Skip to content

[NFCI][SYCL] Refactor selection of FP builtin calls #16966

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

Merged
merged 3 commits into from
Feb 11, 2025

Conversation

MrSidims
Copy link
Contributor

@MrSidims MrSidims commented Feb 11, 2025

This is an upstream from a closed source repository.

Co-author: Stasenko, Alexander P alexander.p.stasenko@intel.com

This is an upstream from a closed source repository.

Signed-off-by: Sidorov, Dmitry <dmitry.sidorov@intel.com>
@MrSidims MrSidims requested a review from a team as a code owner February 11, 2025 13:28
@asudarsa
Copy link
Contributor

This is an upstream from a closed source repository.

Co-author: Stasenko, Alexander P alexander.p.stasenko@intel.com

Can we please add some details about this change in the PR description?

Thanks

@asudarsa
Copy link
Contributor

Can you please comment on why we do not have any tests added here?

Thanks

};

FPBuiltinReplacement(Kind K, const StringRef &ImplName = StringRef())
: RepKind(K), AltMathFunctionImplName(ImplName) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we want to assign to AltMathFunctionImplName even if K is not set to ReplaceWithAltMathFunction?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think not. In this case we should to either error out or attempt to lower to standard to LLVM instructions/intrinsics or target specific intrinsics if applicable (like nvvm approx math intrinsics).

@MrSidims
Copy link
Contributor Author

Thanks @asudarsa , going one by one for your questions

Can we please add some details about this change in the PR description?

No as details exposes internal code, that we don't plan to upstream.

Can you please comment on why we do not have any tests added here?

Because it's a refactoring (aka NFC change). The original patch contained tests, but they are exposing other customizations that we don't plan to upstream.

return FPBuiltinReplacement(FPBuiltinReplacement::ReplaceWithLLVMIR);
return FPBuiltinReplacement(FPBuiltinReplacement::Unexpected0dot5);
}
// AltMathLibrary don't have implementation for CUDA approximate precision
Copy link
Contributor

Choose a reason for hiding this comment

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

Just curious: Does 'Accuracy > 0.5' map to 'approximate precision'?

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.

'Accuracy > 0.5' maps on 'not-precise'. Regarding if it maps on nvvm approx intrinsics/nvptx approx instruction - it depends on the operation and what ptx spec mandates.

More details is in the discussion with Joshua in #16714 .

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.

Overall looks good. Please address questions/comments as convenient.

Thanks

Signed-off-by: Sidorov, Dmitry <dmitry.sidorov@intel.com>
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
Copy link
Contributor Author

@intel/llvm-gatekeepers please help with the merge

@MrSidims MrSidims requested a review from a team February 11, 2025 21:29
@uditagarwal97 uditagarwal97 merged commit 38e2103 into intel:sycl Feb 11, 2025
17 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.

3 participants