-
Notifications
You must be signed in to change notification settings - Fork 769
[SYCL][NFC] Fix warnings coming out of SYCL headers. #3978
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][NFC] Fix warnings coming out of SYCL headers. #3978
Conversation
The problem was discovered in /intel#3777. Fixed by wrapping `x` `_SYCL_SPAN_ASSERT` argument into parentheses. Example of the warning/error: ``` sycl/CL/sycl/sycl_span.hpp:515:82: error: '&&' within '||' [-Werror,-Wlogical-op-parentheses] (static_cast <bool> ((_Count == dynamic_extent || _Count <= size() - _Offset && "Offset + count out of range in span::subspan()"))· ? void (0) : __assert_fail ("(_Count == dynamic_extent || _Count <= size() - _Offset && \"Offset + count out of range in span::subspan( )\")", "/sycl/CL/sycl/sycl_span.hpp", 516, __extension__ __PRETTY_FUNCTION__)); sycl/CL/sycl/sycl_span.hpp:515:82: note: place parentheses around the '&&' expression· to silence this warning ```
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.
@AlexeySachkov, @dm-vodopyanov, I'm okay to merge this PR as soon as pre-commit tests pass, but ideally, the test case triggering the issue should be added to this PR. |
The test which triggered the issue is existing |
You could write a stand-alone reproducer calling |
I'm not exactly sure that this is a reliable thing, because I would expect Problem with |
I assume it's because SYCL headers are handled as system/compiler headers... |
Did you try to build the test in non-SYCL mode (i.e. w/o |
Not yet, but it seems that I was able to reproduce the original problem by explicitly instantiating some SYCL classes in the test |
Jenkins/Precommit is still running, but I see failed tests already. |
|
@bader, I've tried this and it doesn't catch errors which are visible with manual preprocessing + compilation of preprocessed file steps |
I think the problem with reproducing the issue might be that the problem is in the template which is not instantiated. When the code is compiled, the both proposed ways should work (i.e. |
Still can't reproduce them with the following commands:
|
Interesting... can you dump the driver actions and compare with the actions from your reproducer? |
sycl/test/warnings/warnings.cpp
Outdated
@@ -1,17 +1,42 @@ | |||
// RUN: %clangxx -fsycl --no-system-header-prefix=CL/sycl -fsyntax-only -Wall -Wextra -Wno-ignored-attributes -Wno-deprecated-declarations -Wpessimizing-move -Wunused-variable -Wmismatched-tags -Wunneeded-internal-declaration -Werror -Wno-unknown-cuda-version -Wno-unused-parameter %s -o %t.out | |||
|
|||
// RUN: %clangxx -fsycl -E --no-system-header-prefix=CL/sycl %s -o %t.ii | |||
// RUN: %clangxx -fsycl -fsyntax-only -Wall -Wextra -Wno-ignored-attributes -Wno-deprecated-declarations -Wpessimizing-move -Wunused-variable -Wmismatched-tags -Wunneeded-internal-declaration -Werror -Wno-unknown-cuda-version -Wno-unused-parameter %t.ii -o %t.out |
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.
BTW, I don't know why -Wno-unused-parameter
was added here, but we can pass this test just fine without disabling that diagnostic
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.
Outlined this into #3980
From what I see, both |
* upstream/sycl: (489 commits) [SYCL][NFC] Lower overhead of making plugin calls (intel#3982) [SYCL][NFC] Use default macro initialization where applicable (intel#3979) [SYCL] Enable SPV_INTEL_fpga_invocation_pipelining_attributes extension (intel#3864) [SYCL] Disable reassociate pass to reduce register pressure (intel#3615) [Driver][SYCL][FPGA] Restrict -O0 for FPGA with hardware (intel#3966) [SYCL][NFC] Fix warnings coming out of SYCL headers. (intel#3978) [SYCL] Fix bugs with recursion in SYCL kernel (intel#3958) [SYCL][LevelZero] Add support to detect host->device and device->host transfers for USM (intel#3975) [SYCL] Enable native FP atomics by default (intel#3869) [sycl-post-link] Avoid copying from nullptr (intel#3963) [SYCL-PTX] Add warp-reduce path in sub-group reduce (intel#3949) [BuildBot] Uplift CPU/FPGAEMU RT version for CI Process (intel#3946) Fix handling of complex constant expressions Handle OpSpecConstantOp with CompositeExtract and CompositeInsert Handle OpSpecConstantOp with VectorShuffle [FuncSpec] Don't specialise functions with NoDuplicate instructions. [mlir][linalg] Support low padding in subtensor(pad_tensor) lowering [gn build] Port 208332d [AMDGPU] Add Optimize VGPR LiveRange Pass. [mlir][Linalg] NFC - Drop unused variable definition. ...
The problem was discovered in #3777. Fixed by wrapping
x
_SYCL_SPAN_ASSERT
argument into parentheses.Example of the warning/error: