[SYCL] reqd_work_group_size attribute is reversed#1234
[SYCL] reqd_work_group_size attribute is reversed#1234romanovvlad merged 17 commits intointel:syclfrom
Conversation
Signed-off-by: Aleksander Fadeev <aleksander.fadeev@intel.com>
Signed-off-by: Aleksander Fadeev <aleksander.fadeev@intel.com>
Signed-off-by: Aleksander Fadeev <aleksander.fadeev@intel.com>
Signed-off-by: Aleksander Fadeev <aleksander.fadeev@intel.com>
Signed-off-by: Aleksander Fadeev <aleksander.fadeev@intel.com>
Signed-off-by: Aleksander Fadeev <aleksander.fadeev@intel.com>
Signed-off-by: Aleksander Fadeev <aleksander.fadeev@intel.com>
Signed-off-by: Aleksander Fadeev <aleksander.fadeev@intel.com>
erichkeane
left a comment
There was a problem hiding this comment.
I can't make the value judgement required here, but the code changes seem innocuous enough. There are a couple of unnecessary formatting changes (see handleWorkGroupSize:2942), but I'll leave it up to @bader to see if its worth reverting that in this patch.
I make automatic formatting and this is that I got. |
| Existing->getYDim() == WGSize[1] && | ||
| Existing->getZDim() == WGSize[2])) | ||
| if (Existing && | ||
| !(Existing->getXDim() == WGSize[0] && Existing->getYDim() == WGSize[1] && |
There was a problem hiding this comment.
This check is not reversed. Does the warning below still work correctly?
There was a problem hiding this comment.
I think it can work. Is there test for it?
There was a problem hiding this comment.
If yes, then it works fine.
There was a problem hiding this comment.
I think it can work. Is there test for it?
That is what I was going to ask.
If I'm reading this code correctly, we compare XDim of an existing attribute with WGSize[0], which is going to be ZDim. Shouldn't we compare existing XDim with WGSize[2] instead?
There was a problem hiding this comment.
Maybe you are right
There was a problem hiding this comment.
I will try to prove it.
There was a problem hiding this comment.
Yes, it need to be reversed.
There was a problem hiding this comment.
I suspect that the diagnostic was not tested. Can you add a test for it?
There was a problem hiding this comment.
A general case was tested, see: reqd-work-group-size.cpp:23 - 31, and these diagnostics are firing anyway.
But with this patch there is a corner case introduced, that was untested, like:
[[cl::reqd_work_group_size(4, 4, 1)]]
[[cl::reqd_work_group_size(1, 4, 4)]]
void foo() { /*...*/ }
There was a problem hiding this comment.
I add one test, that prove rightness of the implementation.
Signed-off-by: Aleksander Fadeev <aleksander.fadeev@intel.com>
Signed-off-by: Aleksander Fadeev <aleksander.fadeev@intel.com>
| class Functor16 { | ||
| public: | ||
| [[cl::reqd_work_group_size(16, 1, 1)]] void operator()() {} | ||
| [[cl::reqd_work_group_size(16, 1, 1)]] [[cl::reqd_work_group_size(16, 1, 1)]] void operator()() {} |
Signed-off-by: Aleksander Fadeev <aleksander.fadeev@intel.com>
Signed-off-by: Aleksander Fadeev <aleksander.fadeev@intel.com>
Signed-off-by: Aleksander Fadeev <aleksander.fadeev@intel.com>
clang/lib/Sema/SemaDeclAttr.cpp
Outdated
|
|
||
| if (const auto *A = D->getAttr<SYCLIntelMaxWorkGroupSizeAttr>()) { | ||
| if (!(WGSize[0] <= A->getXDim() && WGSize[1] <= A->getYDim() && | ||
| if (S.getLangOpts().SYCLIsDevice && |
There was a problem hiding this comment.
There is a lot of code duplication around S.getLangOpts().SYCLIsDevice.
Consider the following improvement:
int XDim = WGSize[0];
int YDim = WGSize[1];
int ZDim = WGSize[2];
if (S.getLangOpts().SYCLIsDevice) {
std::swap(XDim, ZDim); // add a good comment here
}
and then use *Dim variables instead of WGSize.
Signed-off-by: Aleksander Fadeev <aleksander.fadeev@intel.com>
Signed-off-by: Aleksander Fadeev <aleksander.fadeev@intel.com>
5831eb4 to
dc704bf
Compare
Signed-off-by: Aleksander Fadeev <aleksander.fadeev@intel.com>
clang/include/clang/Basic/Attr.td
Outdated
| def SYCLIntelNumSimdWorkItems : InheritableAttr { | ||
| let Spellings = [CXX11<"intelfpga","num_simd_work_items">]; | ||
| let Args = [UnsignedArgument<"Number">]; | ||
| let Args = [IntArgument<"Number">]; |
There was a problem hiding this comment.
I guess this should be removed.
Signed-off-by: Aleksander Fadeev <aleksander.fadeev@intel.com>
…e_api_test * origin/sycl: [SYCL][NFC] Fix static code analysis concerns (intel#1283) [SYCL] Fix the test/basic_tests/buffer/subbuffer.cpp (intel#1277) [SYCL][CUDA] Implement the program kernel names query (intel#1248) [SYCL] Honor the LLVM_LIBDIR_SUFFIX variable at installation time (intel#1261) [SYCL][UX] Diagnostic for undefined device functions (intel#1026) [SYCL] Reverse reqd_work_group_size attribute (intel#1234) [SYCL] Rename project to oneAPI DPC++ Compiler (intel#1249) [SYCL][XPTI] Instrumentation of SYCL runtime with XPTI (intel#1129)
…st_commit * otcshare/sycl: (469 commits) [SYCL] Implement thread-local storage restriction (intel#1281) [Driver][SYCL][FPGA] Adjust the output location for the project report (intel#1278) [SYCL][NFC] Fix static code analysis concerns (intel#1283) [SYCL] Fix the test/basic_tests/buffer/subbuffer.cpp (intel#1277) [SYCL][CUDA] Implement the program kernel names query (intel#1248) [SYCL] Honor the LLVM_LIBDIR_SUFFIX variable at installation time (intel#1261) [SYCL][UX] Diagnostic for undefined device functions (intel#1026) [SYCL] Reverse reqd_work_group_size attribute (intel#1234) [SYCL] Rename project to oneAPI DPC++ Compiler (intel#1249) [SYCL][XPTI] Instrumentation of SYCL runtime with XPTI (intel#1129) [SYCL] Add buffer dimensions restriction (intel#1147) [SYCL][NFC] Update copyright header in handler files (intel#1271) [SYCL][NFC] Format the code with clang-format [SYCL][Test] Fix SYCL library location path for LIT tests (intel#1228) [SYCL][NFC] Fix doxygen warnings (intel#1270) [SYCL][CUDA] Add the CUDA backend to the deploy-sycl-toolchain target (intel#1268) [SYCL][NFC] Fix a misleading comment regarding the SYCL flow (intel#1266) Change capability for SpecId decoration README.md: Mention retrieving llvm archive signatures travis: Restore macOS builds ...
…_accessor_refactor * origin/sycl: (454 commits) [SYCL][NFC] Fix static code analysis concerns (intel#1283) [SYCL] Fix the test/basic_tests/buffer/subbuffer.cpp (intel#1277) [SYCL][CUDA] Implement the program kernel names query (intel#1248) [SYCL] Honor the LLVM_LIBDIR_SUFFIX variable at installation time (intel#1261) [SYCL][UX] Diagnostic for undefined device functions (intel#1026) [SYCL] Reverse reqd_work_group_size attribute (intel#1234) [SYCL] Rename project to oneAPI DPC++ Compiler (intel#1249) [SYCL][XPTI] Instrumentation of SYCL runtime with XPTI (intel#1129) [SYCL] Add buffer dimensions restriction (intel#1147) [SYCL][NFC] Update copyright header in handler files (intel#1271) [SYCL][NFC] Format the code with clang-format [SYCL][Test] Fix SYCL library location path for LIT tests (intel#1228) [SYCL][NFC] Fix doxygen warnings (intel#1270) [SYCL][CUDA] Add the CUDA backend to the deploy-sycl-toolchain target (intel#1268) Change capability for SpecId decoration README.md: Mention retrieving llvm archive signatures travis: Restore macOS builds Fix DebugInfo creation after LLVM change 7a42bab Add more missing mixes Add missing fixes ...
The reqd_work_group_size attribute should follow the SYCL/C++ convention, where the rightmost index maps to the linear dimension.
Signed-off-by: Aleksander Fadeev aleksander.fadeev@intel.com