-
Notifications
You must be signed in to change notification settings - Fork 796
[SYCL] Fix ESIMD split detection in module properties computation #15527
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
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| ; RUN: sycl-post-link -properties -split-esimd -S < %s -o %t.table | ||
| ; RUN: FileCheck %s -input-file=%t_esimd_0.prop | ||
|
|
||
| ; Verify we mark a image with an ESIMD kernel with the isEsimdImage property | ||
|
|
||
| ; CHECK: isEsimdImage=1|1 | ||
|
|
||
| target datalayout = "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-n8:16:32:64-G1" | ||
| target triple = "spir64-unknown-unknown" | ||
|
|
||
| %"struct.sycl::_V1::detail::AssertHappened" = type { i32, [257 x i8], [257 x i8], [129 x i8], i32, i64, i64, i64, i64, i64, i64 } | ||
| %"class.sycl::_V1::id" = type { %"class.sycl::_V1::detail::array" } | ||
| %"class.sycl::_V1::detail::array" = type { [1 x i64] } | ||
|
|
||
| @.str = private unnamed_addr addrspace(1) constant [10 x i8] c"Id != 400\00", align 1 | ||
| @.str.1 = private unnamed_addr addrspace(1) constant [8 x i8] c"foo.cpp\00", align 1 | ||
| @__PRETTY_FUNCTION__ = private unnamed_addr addrspace(1) constant [56 x i8] c"auto main()::(anonymous class)::operator()(id<1>) const\00", align 1 | ||
| @SPIR_AssertHappenedMem = linkonce_odr dso_local addrspace(1) global %"struct.sycl::_V1::detail::AssertHappened" zeroinitializer, align 8 | ||
|
|
||
| declare void @llvm.assume(i1 noundef) #2 | ||
|
|
||
| define weak_odr dso_local spir_kernel void @esimd_kernel() local_unnamed_addr #0 !sycl_explicit_simd !0 { | ||
| entry: | ||
| tail call spir_func void @__assert_fail(ptr addrspace(4) noundef addrspacecast (ptr addrspace(1) @.str to ptr addrspace(4)), ptr addrspace(4) noundef addrspacecast (ptr addrspace(1) @.str.1 to ptr addrspace(4)), i32 noundef 13, ptr addrspace(4) noundef addrspacecast (ptr addrspace(1) @__PRETTY_FUNCTION__ to ptr addrspace(4))) #12 | ||
| ret void | ||
| } | ||
|
|
||
| define weak dso_local spir_func void @__assert_fail(ptr addrspace(4) noundef %expr, ptr addrspace(4) noundef %file, i32 noundef %line, ptr addrspace(4) noundef %func) #1 { | ||
| entry: | ||
| tail call spir_func void @__devicelib_assert_fail(ptr addrspace(4) noundef %expr, ptr addrspace(4) noundef %file, i32 noundef %line, ptr addrspace(4) noundef %func) #1 | ||
| ret void | ||
| } | ||
|
|
||
| define weak dso_local spir_func void @__devicelib_assert_fail(ptr addrspace(4) noundef %expr, ptr addrspace(4) noundef %file, i32 noundef %line, ptr addrspace(4) noundef %func) #2 { | ||
| entry: | ||
| ret void | ||
| } | ||
|
|
||
| attributes #0 = { convergent mustprogress norecurse nounwind "frame-pointer"="all" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "sycl-module-id"="foo.cpp" "sycl-optlevel"="2" "uniform-work-group-size"="true" } | ||
| attributes #1 = { convergent mustprogress norecurse nounwind "frame-pointer"="all" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "sycl-module-id"="bar.cpp" "sycl-optlevel"="2" } | ||
| attributes #2 = { convergent nounwind } | ||
|
|
||
| !0 = !{} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -419,6 +419,7 @@ void saveModule(std::vector<std::unique_ptr<util::SimpleTable>> &OutTables, | |
| module_split::ModuleDesc &MD, int I, StringRef IRFilename) { | ||
| IrPropSymFilenameTriple BaseTriple; | ||
| StringRef Suffix = getModuleSuffix(MD); | ||
| MD.saveSplitInformationAsMetadata(); | ||
| if (!IRFilename.empty()) { | ||
| // don't save IR, just record the filename | ||
| BaseTriple.Ir = IRFilename.str(); | ||
|
|
@@ -509,10 +510,6 @@ processSpecConstantsWithDefaultValues(const module_split::ModuleDesc &MD) { | |
| assert(NewModuleDesc->Props.SpecConstsMet && | ||
| "This property should be true since the presence of SpecConsts " | ||
| "has been checked before the run of the pass"); | ||
| // Add metadata to the module so we can identify it as the default value split | ||
| // later. | ||
| NewModuleDesc->getModule().getOrInsertNamedMetadata( | ||
| SpecConstantsPass::SPEC_CONST_DEFAULT_VAL_MODULE_MD_STRING); | ||
| NewModuleDesc->rebuildEntryPoints(); | ||
| return NewModuleDesc; | ||
| } | ||
|
|
@@ -791,7 +788,7 @@ processInputModule(std::unique_ptr<Module> M) { | |
| // to keep the optimizer from wrongfully removing them. llvm.compiler.used | ||
| // symbols are usually removed at backend lowering, but this is handled here | ||
| // for SPIR-V since SYCL compilation uses llvm-spirv, not the SPIR-V backend. | ||
| if (auto Triple = M->getTargetTriple().find("spir") != std::string::npos) | ||
| if (M->getTargetTriple().find("spir") != std::string::npos) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is not related to this change but fixes an unused variable warning. |
||
| Modified |= removeDeviceGlobalFromCompilerUsed(*M.get()); | ||
|
|
||
| // Instrument each image scope device globals if the module has been | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A nit:
If we are planning to add more metadata like this in the future, may be it will help to add a helper function?
Not a blocker though
Thanks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't expect it to grow that much, the things we check in module properties is limited and doesn't grow that often. If it does blow up we can just move each MD to a function, sure, thanks.