Skip to content

[SYCL] Pass foffload-fp32-prec-[div/sqrt] options to device's BE #16107

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 10 commits into from
Feb 6, 2025

Conversation

MrSidims
Copy link
Contributor

@MrSidims MrSidims commented Nov 18, 2024

No description provided.

// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
// Remove llvm.fpbuiltin.[sqrt/fdiv] intrinsics to ensure compatibility with the
Copy link
Contributor Author

@MrSidims MrSidims Nov 18, 2024

Choose a reason for hiding this comment

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

@gmlueck without the deep dive into the pass, may I ask you to check if the logic of the pass described in the comment makes sense to you? Note, I'm not adding annotation of the kernels with some optional kernel feature metadata, that could help discarding 'precise' options from the list of the BE options.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Reason is: currently we either have the intrinsics in the module or don't have them at all. And when we have the - non-precise option was already passed, so there is nothing to rewrite for BE options.

@bader
Copy link
Contributor

bader commented Nov 25, 2024

This patch also adds a pass that removes llvm.fpbuiltin.[sqrt/fdiv] intrinsics
to ensure compatibility with the old drivers (that don't support SPV_INTEL_fp_max_error extension).

This sounds SPIR-V specific problem, so I think the right place to run the pass is SPIR-V generator (i.e. SPIR-V translator or SPIR-V backend).

@MrSidims
Copy link
Contributor Author

MrSidims commented Feb 3, 2025

This patch also adds a pass that removes llvm.fpbuiltin.[sqrt/fdiv] intrinsics
to ensure compatibility with the old drivers (that don't support SPV_INTEL_fp_max_error extension).

This sounds SPIR-V specific problem, so I think the right place to run the pass is SPIR-V generator (i.e. SPIR-V translator or SPIR-V backend).

On the other hand it's SYCL/OpenMP specific problem, how it would benefit https://github.com/KhronosGroup/SPIRV-LLVM-Translator community? Also it's still might be beneficial here for non-SPIR-V targets.

UPD: actually, I'm still leaning towards removing this pass. So let me try to land this patch without it and then restore it if needed.

@MrSidims MrSidims marked this pull request as ready for review February 5, 2025 14:03
@MrSidims MrSidims requested review from a team as code owners February 5, 2025 14:03
This patch also adds a pass the removes llvm.fpbuiltin.[sqrt/fdiv]
intrinsic functions from the module to ensure compatibility with the old drivers
(that don't support SPV_INTEL_fp_max_error extension) in case if they are used
with standart for OpenCL max-error (e.g [3.0/2.5] ULP) and there are no other
llvm.fpbuiltin.* intrinsic functions, fdiv instructions or @sqrt
builtins/intrinsics in the module.

Signed-off-by: Sidorov, Dmitry <[email protected]>
Signed-off-by: Sidorov, Dmitry <[email protected]>
Signed-off-by: Sidorov, Dmitry <[email protected]>
Signed-off-by: Sidorov, Dmitry <[email protected]>
Signed-off-by: Sidorov, Dmitry <[email protected]>
Signed-off-by: Sidorov, Dmitry <[email protected]>
Signed-off-by: Sidorov, Dmitry <[email protected]>
This reverts commit 9bef8ff.
Signed-off-by: Sidorov, Dmitry <[email protected]>
Signed-off-by: Sidorov, Dmitry <[email protected]>
@MrSidims
Copy link
Contributor Author

MrSidims commented Feb 6, 2025

@steffenlarsen please have another look at the PR, thanks

Copy link
Contributor

@steffenlarsen steffenlarsen left a comment

Choose a reason for hiding this comment

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

LGTM!

@MrSidims MrSidims requested a review from a team February 6, 2025 13:51
@MrSidims
Copy link
Contributor Author

MrSidims commented Feb 6, 2025

@intel/llvm-gatekeepers please help with the merge

@dm-vodopyanov dm-vodopyanov merged commit 0106136 into intel:sycl Feb 6, 2025
15 checks passed
uditagarwal97 pushed a commit that referenced this pull request Feb 12, 2025
Since a pass that cleans up unnecessary llvm.fpbuiltin intrinsics was
removed from
#16107 we need to enable the extension
by default to
successfully translate them.

Signed-off-by: Sidorov, Dmitry <[email protected]>
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