-
Notifications
You must be signed in to change notification settings - Fork 787
[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
[SYCL][Test] Add IR checks into atomic tests #2834
Conversation
Check that correct `__spirv_Atomic*` external calls are emitted by the compiler FE, and thus ensure that the headers provide a proper implementation for each function. Signed-off-by: Artem Gindinson <[email protected]>
This is mainly being done in scope of future atomic float extensions' support. A draft example of this is #2765. |
Signed-off-by: Artem Gindinson <[email protected]>
Signed-off-by: Artem Gindinson <[email protected]>
@s-kanaev @intel/llvm-reviewers-runtime Ping |
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.
Looks good. Only got several comments out of curiosity.
@@ -181,12 +195,31 @@ int main() { | |||
} | |||
|
|||
constexpr int N = 32; | |||
// CHECK-LLVM: declare dso_local spir_func i32 | |||
// CHECK-LLVM-SAME: @_Z{{[0-9]+}}__spirv_AtomicIAdd | |||
// CHECK-LLVM-SAME: (i32 addrspace(1)*, i32, i32, i32) | |||
add_test<int>(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).
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 comment
The 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 comment
The 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
external calls are made inside this emulation, but #2765 exemplifies what happens if the emulation is changed by an external call to a unique float-typed function.
Check that correct
__spirv_Atomic*
external calls are emittedby the compiler FE, and thus ensure that the headers provide a
proper implementation for each function.
Signed-off-by: Artem Gindinson [email protected]