Skip to content

[SYCL] Option to disable alloca address space for sret arguments #17976

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 16 commits into from
Apr 22, 2025

Conversation

Fznamznon
Copy link
Contributor

@Fznamznon Fznamznon commented Apr 11, 2025

Recent community change llvm/llvm-project#114062 enabled the use of
alloca address space for sret arguments. This causes several issues for sycl, particularly for the SPIR
target where this leads to invalid address-space-casts from the local address space.

The new option -foffload-use-alloca-addrspace-for-srets is TRUE by default (and produces the current
community behavior) and is set to FALSE in sycl device compilation modes (where the prior behavior is
retained). The commit also reverts some test changes made to reflect the current community behavior.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
@Fznamznon Fznamznon requested review from a team as code owners April 11, 2025 13:23
@Fznamznon Fznamznon marked this pull request as draft April 11, 2025 13:23
@premanandrao premanandrao marked this pull request as ready for review April 21, 2025 14:15
@premanandrao premanandrao requested review from a team as code owners April 21, 2025 14:15
@premanandrao premanandrao changed the title [TESTING] Test option to disable alloca address space for sret arguments [SYCL] Option to disable alloca address space for sret arguments Apr 21, 2025
Copy link
Contributor

@aelovikov-intel aelovikov-intel left a comment

Choose a reason for hiding this comment

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

SYCL RT LGTM, but this PR needs a better description.

Copy link
Contributor Author

@Fznamznon Fznamznon left a comment

Choose a reason for hiding this comment

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

Thank you for picking this up!
See also #17976 (comment)

@@ -13,63 +13,63 @@ using namespace sycl::ext::oneapi::experimental;

namespace static_as_cast {
// CHECK-LABEL: define dso_local spir_func void @_ZN14static_as_cast19to_global_decoratedEN4sycl3_V19multi_ptrIiLNS1_6access13address_spaceE6ELNS3_9decoratedE1EEE(
// CHECK-SAME: ptr dead_on_unwind noalias writable writeonly sret(%"class.sycl::_V1::multi_ptr") align 8 captures(none) [[AGG_RESULT:%.*]], ptr noundef readonly byval(%"class.sycl::_V1::multi_ptr.0") align 8 captures(none) [[P:%.*]]) local_unnamed_addr #[[ATTR0:[0-9]+]] {{.*}}{
// CHECK-SAME: ptr addrspace(4) dead_on_unwind noalias writable writeonly sret(%"class.sycl::_V1::multi_ptr") align 8 captures(none) initializes((0, 8)) [[AGG_RESULT:%.*]], ptr noundef readonly byval(%"class.sycl::_V1::multi_ptr.0") align 8 captures(none) [[P:%.*]]) local_unnamed_addr #[[ATTR0:[0-9]+]] {{.*}}{
Copy link
Contributor Author

Choose a reason for hiding this comment

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

It would be great if we could check both modes.

@dm-vodopyanov
Copy link
Contributor

Should this file be also updated? (these lines should be removed)

# CMPLRLLVM-66370
hierarchical

@Fznamznon
Copy link
Contributor Author

Should this file be also updated? (these lines should be removed)

# CMPLRLLVM-66370
hierarchical

Yes, I would expect this problem to be fixed/hidden by the option until we figure out how to deal with alloca for srets properly.

// Disable this option for SPIR targets.
// TODO: This needs to be re-enabled once we have a real fix.
CmdArgs.push_back("-fno-offload-use-alloca-addrspace-for-srets");
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Updated change LGTM

@premanandrao premanandrao requested a review from a team as a code owner April 22, 2025 18:30
Copy link
Contributor

@aelovikov-intel aelovikov-intel left a comment

Choose a reason for hiding this comment

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

@premanandrao
Copy link
Contributor

@intel/llvm-gatekeepers, can this please be merged?

@tahonermann reviewed and approved this for CFE. (Since I am running this PR, I don't want to self-approve this.)
@Fznamznon has reviewed it, and her review comments have been addressed.

@premanandrao
Copy link
Contributor

The code-formatting error is about a test case, not source code. Not sure why it is being flagged.

@aelovikov-intel
Copy link
Contributor

aelovikov-intel commented Apr 22, 2025

The code-formatting error is about a test case, not source code. Not sure why it is being flagged.

Tests should be properly formatted too... Also note

CommentPragmas: "RUN|FAIL|REQUIRES|UNSUPPORTED|CHECK|expected-|update_cc_test_checks.py"

Maybe renaming the FileCheck's label to contain CHECK would silence the clang-format.

@premanandrao
Copy link
Contributor

Tests should be properly formatted too...

Sure, but the changes it is suggesting didn't make sense to me.

Maybe renaming the FileCheck's label to contain CHECK would silence the clang-format.

This may be it. Thanks, let me try.

@premanandrao
Copy link
Contributor

Thank you @aelovikov-intel, that was it.

@aelovikov-intel aelovikov-intel merged commit 7175536 into intel:sycl Apr 22, 2025
50 of 54 checks passed
@premanandrao
Copy link
Contributor

Thank you @aelovikov-intel

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.

None yet

7 participants