Page MenuHomePhabricator

[mlir][llvmir] Support FastmathFlags for LLVM intrinsic operations.

Authored by vzakhari on Oct 18 2022, 9:02 PM.



This is required for D126305 code to propagate fastmath attributes
for Arith operations that are converted to LLVM IR intrinsics

LLVM IR intrinsic operations are using custom assembly format now
to avoid printing {fastmathFlags = #llvm.fastmath<none>}, which
is too verbose.

Diff Detail

Event Timeline

vzakhari created this revision.Oct 18 2022, 9:02 PM
Herald added a reviewer: aartbik. · View Herald Transcript
Herald added a project: Restricted Project. · View Herald Transcript
vzakhari requested review of this revision.Oct 18 2022, 9:02 PM

Friendly ping.

vzakhari updated this revision to Diff 470935.Oct 26 2022, 2:22 PM
vzakhari edited the summary of this revision. (Show Details)


vzakhari added inline comments.Oct 26 2022, 2:26 PM

I think it may be better to move custom assemblyFormat to LLVM_IntrOpBase, but this is going to have broader effect on the LIT tests. Please let me know if it makes sense to you, and I will do this in a separate commit.

vzakhari added a subscriber: gysit.Oct 26 2022, 2:36 PM
vzakhari added inline comments.

I believe we lost Pure trait and overloadedOperands [0,1] in D136360. I had to fix it to avoid assertion for powi addition in mlir/test/Target/LLVMIR/llvmir.mlir below.

@gysit, can you please confirm that the change for powi was unintentional?

gysit added inline comments.Oct 26 2022, 11:07 PM

Yes that was not intentional. Sorry for the glitch!

Flang test changes look good to me, great to see fastmath flags coming in for intrinsics !

rriddle accepted this revision.Nov 1 2022, 10:46 PM
This revision is now accepted and ready to land.Nov 1 2022, 10:46 PM
Herald added a project: Restricted Project. · View Herald TranscriptNov 2 2022, 12:45 PM

Thank you for the review, Jean and River!