Skip to content

Conversation

MrSidims
Copy link
Contributor

No description provided.

Signed-off-by: Sidorov, Dmitry <dmitry.sidorov@intel.com>
@MrSidims MrSidims requested review from a team as code owners September 10, 2025 11:41
@MrSidims
Copy link
Contributor Author

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.

Signed-off-by: Sidorov, Dmitry <dmitry.sidorov@intel.com>
@maarquitos14
Copy link
Contributor

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?

@Fznamznon
Copy link
Contributor

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.

Why do we disable it then?

@MrSidims
Copy link
Contributor Author

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.

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.

@Fznamznon
Copy link
Contributor

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.

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?

@MrSidims
Copy link
Contributor Author

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.

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.

@MrSidims
Copy link
Contributor Author

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.

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.

Signed-off-by: Sidorov, Dmitry <dmitry.sidorov@intel.com>
Copy link
Contributor

@intel/llvm-gatekeepers please consider merging

}

void bar() {
kernel<class MyKernel>([=]() {});
Copy link
Contributor Author

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.

Copy link
Contributor

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.

@MrSidims
Copy link
Contributor Author

Same failures are observed in #20082

Comment on lines 32 to 39
template <typename name, typename Func>
void kernel(const Func &f) __attribute__((sycl_kernel)) {
f();
}

void bar() {
kernel<class MyKernel>([=]() {});
}
Copy link
Contributor

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

Suggested change
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 .

Copy link
Contributor Author

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>([=]() {});
Copy link
Contributor

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.

@MrSidims MrSidims requested a review from a team September 16, 2025 18:05
@MrSidims
Copy link
Contributor Author

@intel/llvm-gatekeepers please help with merge

@sarnex sarnex merged commit 9375f35 into intel:sycl Sep 16, 2025
27 of 28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants