Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lowering for the Matmul Intrinsic #931

Merged
merged 2 commits into from
Jul 29, 2021
Merged

Lowering for the Matmul Intrinsic #931

merged 2 commits into from
Jul 29, 2021

Conversation

kiranchandramohan
Copy link
Collaborator

@kiranchandramohan kiranchandramohan commented Jul 20, 2021

No description provided.

// Create mutable fir.box to be passed to the runtime for the result.
// TODO: The result can also be of rank 1 if one of the input matrices
// is of rank 1. Will this info be available at compile time or should
// code be generated to compute the rank?
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can compute this using matrixTmpA.rank() which will give you the argument ranks at compile time.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

auto args =
Fortran::lower::createArguments(builder, loc, fTy, resultBox, matrixABox,
matrixBBox, sourceFile, sourceLine);
return builder.create<fir::CallOp>(loc, func, args).getResult(0);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't genMatmul return void ? Matmul runtime functions does not return anything.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah. :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Initial implementation with assumption that rank will be always 2
-> Handle case where rank of one the matrices is 1.
-> Add test for the above case with logical type.
-> Remove return value from the matmul call.
Copy link
Collaborator

@jeanPerier jeanPerier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks Kiran

@kiranchandramohan
Copy link
Collaborator Author

ping @mleair @schweitzpgi

Copy link
Collaborator

@mleair mleair left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link

@schweitzpgi schweitzpgi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, Kiran.

@schweitzpgi schweitzpgi merged commit cea71dc into flang-compiler:fir-dev Jul 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants