-
Notifications
You must be signed in to change notification settings - Fork 248
Turn on SPIR-V builtin generation for OpenCL CPP sources #2466
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 2 commits
8a9d600
82285ac
9900e9c
5c74ba9
3962949
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 |
|---|---|---|
|
|
@@ -168,9 +168,10 @@ bool OCLToSPIRVBase::runOCLToSPIRV(Module &Module) { | |
| auto Src = getSPIRVSource(&Module); | ||
| // This is a pre-processing pass, which transform LLVM IR module to a more | ||
| // suitable form for the SPIR-V translation: it is specifically designed to | ||
| // handle OpenCL C built-in functions and shouldn't be launched for other | ||
| // handle OpenCL C/CPP built-in functions and shouldn't be launched for other | ||
| // source languages | ||
| if (std::get<0>(Src) != spv::SourceLanguageOpenCL_C) | ||
| if (std::get<0>(Src) != spv::SourceLanguageOpenCL_C && | ||
| std::get<0>(Src) != spv::SourceLanguageOpenCL_CPP) | ||
|
||
| return false; | ||
|
|
||
| CLVer = std::get<1>(Src); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -541,7 +541,7 @@ attributes #5 = { nounwind } | |
|
|
||
| !0 = !{i32 1, !"wchar_size", i32 4} | ||
| !1 = !{i32 1, i32 2} | ||
| !2 = !{i32 4, i32 100000} | ||
| !2 = !{i32 7, i32 100000} | ||
|
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. This test case was actually derived from SYCL source. |
||
| !3 = !{!"clang version 11.0.0"} | ||
| !4 = !{} | ||
| !5 = !{!6, !6, i64 0} | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| ; RUN: llvm-as %s -o %t.bc | ||
|
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. Consider adding a comment describing purpose of this test. I think that looking at the filename or file history is not as clear or convenient.
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. Done. Thanks |
||
| ; RUN: llvm-spirv %t.bc -o %t.spv | ||
| ; RUN: llvm-spirv %t.bc -spirv-text -o %t.txt | ||
| ; RUN: FileCheck < %t.txt %s --check-prefix=CHECK-SPIRV | ||
| ; RUN: spirv-val %t.spv | ||
|
|
||
| target datalayout = "e-p:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024" | ||
| target triple = "spir-unknown-unknown" | ||
|
|
||
| %opencl.event_t = type opaque | ||
|
|
||
| ; CHECK-SPIRV: {{[0-9]+}} Name {{[0-9]+}} "__spirv_BuiltInWorkgroupId" | ||
| ; Function Attrs: nounwind | ||
| define spir_kernel void @test_fn(i32 %a) { | ||
| entry: | ||
| %call15 = call spir_func i32 @_Z12get_group_idj(i32 0) | ||
| ret void | ||
| } | ||
|
|
||
| declare spir_func i32 @_Z12get_group_idj(i32) | ||
|
|
||
| !spirv.Source = !{!0} | ||
|
|
||
| !0 = !{i32 4, i32 100000} | ||
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.
Out of curiosity, what is the reason for only running this transform for these types of sources?
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.
These are the only OpenCL related sources and this particular module deals with OpenCL sources.