Skip to content

Conversation

MrSidims
Copy link
Contributor

@MrSidims MrSidims commented Mar 11, 2025

FPBuiltinFnSelection pass is modified to create fpmath metadata during replacement of
llvm.fpbuiltin.* intrinsics with native LLVM instructions or LLVM std intrinsics.

Signed-off-by: Sidorov, Dmitry <dmitry.sidorov@intel.com>
@MrSidims MrSidims requested a review from a team as a code owner March 11, 2025 12:08
@MrSidims MrSidims changed the title [SYCL] Preserve max-error information in fpmath metadata [SYCL] Preserve fpbuiltin-max-error information in fpmath metadata Mar 11, 2025
if (auto *ReplacementI = dyn_cast<Instruction>(Replacement))
if (auto *ReplacementI = dyn_cast<Instruction>(Replacement)) {
ReplacementI->copyFastMathFlags(&BuiltinCall);
// Copy accuracy from fp-max-error attribute to fpmath metadata just in case
Copy link
Contributor

Choose a reason for hiding this comment

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

Can this not be done when the BuiltinCall is generated by CodeGen? Is there a reason to wait till SYCLLowerIR stage?

This is mostly a nit/curiosity question. Not a blocker.

Thanks

Copy link
Contributor Author

Choose a reason for hiding this comment

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

AFAIU only entering CodeGen we know, what AltMath library can offer us in terms of FPBuiltin implementations. So at this stage it makes sense to start modifying LLVM IR as we will go over fpbuiltin calls anyway.

Copy link
Contributor

@asudarsa asudarsa 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

@MrSidims MrSidims requested a review from a team March 12, 2025 00:04
@MrSidims
Copy link
Contributor Author

@intel/llvm-gatekeepers please help with merge

@uditagarwal97 uditagarwal97 merged commit 7ad1203 into intel:sycl Mar 12, 2025
23 checks passed
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.

5 participants