@@ -1905,6 +1905,7 @@ impl<'source, 'temp> Lowerer<'source, 'temp> {
19051905 stmt. span ,
19061906 function,
19071907 arguments,
1908+ None ,
19081909 & mut ctx. as_expression ( block, & mut emitter) ,
19091910 true ,
19101911 ) ?;
@@ -2227,9 +2228,10 @@ impl<'source, 'temp> Lowerer<'source, 'temp> {
22272228 ast:: Expression :: Call {
22282229 ref function,
22292230 ref arguments,
2231+ result_ty,
22302232 } => {
22312233 let handle = self
2232- . call ( span, function, arguments, ctx, false ) ?
2234+ . call ( span, function, arguments, result_ty , ctx, false ) ?
22332235 . ok_or ( Error :: FunctionReturnsVoid ( function. span ) ) ?;
22342236 return Ok ( Typed :: Plain ( handle) ) ;
22352237 }
@@ -2424,6 +2426,7 @@ impl<'source, 'temp> Lowerer<'source, 'temp> {
24242426 span : Span ,
24252427 function : & ast:: Ident < ' source > ,
24262428 arguments : & [ Handle < ast:: Expression < ' source > > ] ,
2429+ result_ty : Option < ( Handle < ast:: Type < ' source > > , Span ) > ,
24272430 ctx : & mut ExpressionContext < ' source , ' _ , ' _ > ,
24282431 is_statement : bool ,
24292432 ) -> Result < ' source , Option < Handle < ir:: Expression > > > {
@@ -3145,9 +3148,20 @@ impl<'source, 'temp> Lowerer<'source, 'temp> {
31453148 let row_major = function. name . ends_with ( "T" ) ;
31463149 let mut args = ctx. prepare_args ( arguments, 1 , span) ;
31473150 let pointer = self . expression ( args. next ( ) ?, ctx) ?;
3148- //TODO: read from generic argument
3149- let columns = crate :: CooperativeSize :: Eight ;
3150- let rows = crate :: CooperativeSize :: Eight ;
3151+ let ( matrix_ty, matrix_span) = result_ty. expect ( "generic argument" ) ;
3152+ let ( columns, rows, role) = match ctx. types [ matrix_ty] {
3153+ ast:: Type :: CooperativeMatrix {
3154+ columns,
3155+ rows,
3156+ role,
3157+ ..
3158+ } => ( columns, rows, role) ,
3159+ _ => {
3160+ return Err ( Box :: new ( Error :: InvalidCooperativeLoadType (
3161+ matrix_span,
3162+ ) ) )
3163+ }
3164+ } ;
31513165 let stride = if args. total_args > 1 {
31523166 self . expression ( args. next ( ) ?, ctx) ?
31533167 } else {
@@ -3167,7 +3181,7 @@ impl<'source, 'temp> Lowerer<'source, 'temp> {
31673181 crate :: Expression :: CooperativeLoad {
31683182 columns,
31693183 rows,
3170- role : crate :: CooperativeRole :: C , //TODO
3184+ role,
31713185 data : crate :: CooperativeData {
31723186 pointer,
31733187 stride,
0 commit comments