-
Notifications
You must be signed in to change notification settings - Fork 804
[SYCL] Don't run SYCLOptimizeBarriersPass with O0 #20037
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
Conversation
Signed-off-by: Sidorov, Dmitry <dmitry.sidorov@intel.com>
Not entirely sure, how to add a test for this change - with O0 SYCL code won't be having memory semantic constants be propagated in the first place. |
Maybe with some kind of log to make sure the barrier does not run? |
Why do we disable it then? |
Because of the OpenMP compiler, that inserts barriers implicitly (with the constants) and OpenMP offloading reuses SYCL offloading model, making this pass running. |
Can we use an OpenMP test? |
AFAIK OpenMP solution is a part of our downstream, so adding a test here won't help much :) The only other solution I see is to add an LLVM IR test with opt -O0 passes as a RUN command, but not sure if it's 'LLVM way' of creating unit tests. |
Actually, I have an idea for SYCL'ish test, let me try it. |
sycl/test/check_device_code/narrow-barrier-explicit-spirv-call.cpp
Outdated
Show resolved
Hide resolved
Signed-off-by: Sidorov, Dmitry <dmitry.sidorov@intel.com>
38937e9
to
68a84f0
Compare
@intel/llvm-gatekeepers please consider merging |
df7e2a8
to
71bdb3f
Compare
} | ||
|
||
void bar() { | ||
kernel<class MyKernel>([=]() {}); |
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.
Apparently non-empty source code is required to make the pass run. @Fznamznon please comment if you are okay with this change or if I should separate the barrier case from this test.
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 think it is fine in this file, I don't really get why it happens.
Same failures are observed in #20082 |
template <typename name, typename Func> | ||
void kernel(const Func &f) __attribute__((sycl_kernel)) { | ||
f(); | ||
} | ||
|
||
void bar() { | ||
kernel<class MyKernel>([=]() {}); | ||
} |
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 find it really weird that the pass manager doesn't report this pass if the source is empty, however I'm not an expert in this. Can we simplify the code and explain why it is required, it is dummy anyway
template <typename name, typename Func> | |
void kernel(const Func &f) __attribute__((sycl_kernel)) { | |
f(); | |
} | |
void bar() { | |
kernel<class MyKernel>([=]() {}); | |
} | |
// Some passes don't run on empty code | |
__attribute__((sycl_device)) void bar() { | |
} |
If a kernel is required please use https://github.com/intel/llvm/blob/sycl/sycl/doc/developer/ContributeToDPCPP.md#dpc-clang-fe-tests .
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.
Applied. So passes registered via registerOptimizerLastEPCallback
are not being run fir the empty test. Passes registered like this are being run at the end of a normal pipeline via invokeOptimizerLastEPCallbacks
and ... I haven't yet finished with the debugging, but it seems like it's module-size sensitive.
} | ||
|
||
void bar() { | ||
kernel<class MyKernel>([=]() {}); |
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 think it is fine in this file, I don't really get why it happens.
5f683c1
to
3496abb
Compare
@intel/llvm-gatekeepers please help with merge |
No description provided.