-
Notifications
You must be signed in to change notification settings - Fork 795
[NFC][SYCL][SYCLLowerIR] Add cl::opt SpecConstantMode for LIT testing #15821
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -29,6 +29,19 @@ | |||||
|
|
||||||
| using namespace llvm; | ||||||
|
|
||||||
| static cl::opt<SpecConstantsPass::HandlingMode> SpecConstantMode( | ||||||
| "spec-constant-mode", cl::Optional, cl::Hidden, | ||||||
| cl::desc("Spec constant handling mode"), | ||||||
|
||||||
| cl::desc("Spec constant handling mode"), | |
| cl::desc("Specialization constant handling mode"), |
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.
done
Outdated
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.
| "spec constant uses are replaced by default values"), | |
| "Specialization constant uses are replaced by default values"), |
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.
done
Outdated
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.
| "spec constant intrinsics are replaced by RT buffers"), | |
| "Specialization constant intrinsics are replaced by run-time buffers"), |
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.
done
Outdated
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.
| "spec constant intrinsics are lowered to spirv intrinsics"))); | |
| "Specialization constant intrinsics are lowered to SPIR-V intrinsics"))); |
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.
done
asudarsa marked this conversation as resolved.
Show resolved
Hide resolved
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,6 @@ | ||
| ; RUN: sycl-post-link -properties -split=auto -spec-const=native -S -o %t.table %s -generate-device-image-default-spec-consts | ||
|
Contributor
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. Is the sycl-post-link test not expected to work anymore? I somehow feel it will be better to add a new test here.
Contributor
Author
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. sycl-post-link test is still expected to work. After reading your comment, I also feel it is better to keep the test to check sycl-post-link is correctly passing parameters to SpecConstantPass. So I added it back in the second commit. |
||
| ; RUN: FileCheck %s -input-file %t_1.ll --implicit-check-not="SpecConst" | ||
| ; RUN: opt -passes=spec-constants -spec-constant-mode=default_values %s -S -o - | FileCheck %s | ||
|
|
||
| ; This test checks that the post link tool is able to correctly transform | ||
| ; This test checks that SpecConstantsPass is able to correctly transform | ||
| ; SYCL alloca intrinsics in SPIR-V devices when using default values. | ||
|
|
||
| %"class.sycl::_V1::specialization_id" = type { i64 } | ||
|
|
@@ -20,9 +19,9 @@ | |
| define spir_kernel void @private_alloca() { | ||
| ; CHECK: alloca double, i32 120, align 8 | ||
| call ptr @llvm.sycl.alloca.p0.p4.p4.p4.f64(ptr addrspace(4) addrspacecast (ptr @size_i32_stable_name to ptr addrspace(4)), ptr addrspace(4) addrspacecast (ptr addrspace(1) @size_i32 to ptr addrspace(4)), ptr addrspace(4) null, double 0.000000e+00, i64 8) | ||
| ; CHECK: alloca float, i64 10, align 8 | ||
| ; CHECK-NEXT: alloca float, i64 10, align 8 | ||
| call ptr @llvm.sycl.alloca.p0.p4.p4.p4.f32(ptr addrspace(4) addrspacecast (ptr @size_i64_stable_name to ptr addrspace(4)), ptr addrspace(4) addrspacecast (ptr addrspace(1) @size_i64 to ptr addrspace(4)), ptr addrspace(4) null, float 0.000000e+00, i64 8) | ||
| ; CHECK: alloca %my_range, i16 1, align 64 | ||
| ; CHECK-NEXT: alloca %my_range, i16 1, align 64 | ||
| call ptr @llvm.sycl.alloca.p0.p4.p4.p4.s_my_range(ptr addrspace(4) addrspacecast (ptr @size_i16_stable_name to ptr addrspace(4)), ptr addrspace(4) addrspacecast (ptr addrspace(1) @size_i16 to ptr addrspace(4)), ptr addrspace(4) null, %my_range zeroinitializer, i64 64) | ||
| ret void | ||
| } | ||
|
|
||
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.
is there a default value that can be set here?
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.
added default value:
cl::init(SpecConstantsPass::HandlingMode::emulation)