-
Notifications
You must be signed in to change notification settings - Fork 790
[SYCL][Test] Add IR checks into atomic tests #2834
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 all commits
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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
// RUN: %clangxx -fsycl -fsycl-unnamed-lambda -fsycl-device-only -S %s -o - \ | ||
// RUN: | FileCheck %s --check-prefix=CHECK-LLVM | ||
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out | ||
// RUN: %RUN_ON_HOST %t.out | ||
|
||
|
@@ -60,12 +62,33 @@ int main() { | |
} | ||
|
||
constexpr int N = 32; | ||
// CHECK-LLVM: declare dso_local spir_func i32 | ||
// CHECK-LLVM-SAME: @_Z{{[0-9]+}}__spirv_AtomicCompareExchange | ||
// CHECK-LLVM-SAME: (i32 addrspace(1)*, i32, i32, i32, i32, i32) | ||
compare_exchange_test<int>(q, N); | ||
// CHECK-LLVM: declare dso_local spir_func i32 | ||
// CHECK-LLVM-SAME: @_Z{{[0-9]+}}__spirv_AtomicCompareExchange | ||
// CHECK-LLVM-SAME: (i32 addrspace(1)*, i32, i32, i32, i32, i32) | ||
compare_exchange_test<unsigned int>(q, N); | ||
// CHECK-LLVM: declare dso_local spir_func i[[long:(32)|(64)]] | ||
// CHECK-LLVM-SAME: @_Z{{[0-9]+}}__spirv_AtomicCompareExchange | ||
// CHECK-LLVM-SAME: (i[[long]] addrspace(1)*, i32, i32, i32, | ||
// CHECK-LLVM-SAME: i[[long]], i[[long]]) | ||
compare_exchange_test<long>(q, N); | ||
// CHECK-LLVM: declare dso_local spir_func i[[long]] | ||
// CHECK-LLVM-SAME: @_Z{{[0-9]+}}__spirv_AtomicCompareExchange | ||
// CHECK-LLVM-SAME: (i[[long]] addrspace(1)*, i32, i32, i32, | ||
// CHECK-LLVM-SAME: i[[long]], i[[long]]) | ||
compare_exchange_test<unsigned long>(q, N); | ||
// CHECK-LLVM: declare dso_local spir_func i64 | ||
// CHECK-LLVM-SAME: @_Z{{[0-9]+}}__spirv_AtomicCompareExchange | ||
// CHECK-LLVM-SAME: (i64 addrspace(1)*, i32, i32, i32, i64, i64) | ||
compare_exchange_test<long long>(q, N); | ||
// CHECK-LLVM: declare dso_local spir_func i64 | ||
// CHECK-LLVM-SAME: @_Z{{[0-9]+}}__spirv_AtomicCompareExchange | ||
// CHECK-LLVM-SAME: (i64 addrspace(1)*, i32, i32, i32, i64, i64) | ||
compare_exchange_test<unsigned long long>(q, N); | ||
// The remaining functions use the already-declared ones on the IR level | ||
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. Do they? It was integers and now we have floats and doubles... 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. The reason for this is that float/pointer-typed functions are emulated instead of being mapped onto particular SPIR-V operands. I do not know the details of why integer |
||
compare_exchange_test<float>(q, N); | ||
compare_exchange_test<double>(q, N); | ||
compare_exchange_test<char *>(q, N); | ||
|
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'm curious what if the function isn't inlined? Is its inlining forced somehow?
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 believe that inlining can't take place as such. These
__spirv_Atomic*
functions are generated due to being included from here, however no definition is provided. These external calls get lowered at later stages (e.g. mapped onto corresponding SPIR-V operands during translation from LLVM IR - see #2765 as a fresh example).