-
Notifications
You must be signed in to change notification settings - Fork 745
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: support 0-dim acc in handler::copy(accessor, accessor) #1551
Conversation
@v-klochkov Please apply clang-format to the patch. You can find usefule artifacts in deails of clang-format-check job details. |
c69dac4
to
8b33aaa
Compare
@s-kanaev I gave some honor to clang-format and added few additional/recommended changes. |
@romanovvlad Thank you for the quick initial review. |
8b33aaa
to
8bfe7eb
Compare
typename TSrc, int DimSrc, access::mode ModeSrc, access::target TargetSrc, | ||
typename TDst, int DimDst, access::mode ModeDst, access::target TargetDst, | ||
access::placeholder IsPHSrc, access::placeholder IsPHDst> | ||
detail::enable_if_t<(DimSrc > 0) && (DimDst > 0), bool> |
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.
Should we check here if DimSrc == DimDst
?
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 don't know if it is correct to copy from 1D accessor to 3D. It is probably correct. So, that check is not needed.
In my patch I do not change any constraints.
My patch only separates the existing code to this routine to make it possible to copy to/from 0-dim accessor.
sycl/include/CL/sycl/handler.hpp
Outdated
access::placeholder IsPH> | ||
detail::enable_if_t<Dim == 0 && Mode == access::mode::atomic, T> | ||
readFromFirstAccElement(accessor<T, Dim, Mode, Target, IsPH> Src) const { | ||
auto AtomicSrc = (atomic<T, access::address_space::global_space>)Src; |
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.
Could this conversion be converted to this?
auto AtomicSrc = (atomic<T, access::address_space::global_space>)Src; | |
atomic<T, access::address_space::global_space> AtomicSrc = Src; |
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.
Ok, I changed it that way.
sycl/include/CL/sycl/handler.hpp
Outdated
access::placeholder IsPH> | ||
detail::enable_if_t<Dim == 0 && Mode == access::mode::atomic, void> | ||
writeToFirstAccElement(accessor<T, Dim, Mode, Target, IsPH> Dst, T V) const { | ||
auto AtomicDst = (atomic<T, access::address_space::global_space>)Dst; |
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.
Same thing here
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.
Fixed.
I believe you have to massage the code to make clang-format happy. |
8bfe7eb
to
f82691c
Compare
I already applied clang-format per your request, and ignored format's recommendation in only 4 places in sake of better code readability. Did you read my reasoning above? |
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.
LGTM, but I would like @s-kanaev to approve as well.
I understand readability as a pretty good reason. The justification for my argument is that I'm not really sure that "Merge" button will be available with clang-format job failed. |
access::placeholder IsPH> | ||
detail::enable_if_t<Dim == 0 && Mode == access::mode::atomic, void> | ||
writeToFirstAccElement(accessor<T, Dim, Mode, Target, IsPH> Dst, T V) const { | ||
atomic<T, access::address_space::global_space> AtomicDst = Dst; |
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.
Shouldn't it be a reference to atomic?
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 accessor operator[] and operator() return a value, not a reference.
93 /* Available only when: accessMode == access::mode::atomic && dimensions ==
94 0 /
95 operator atomic<dataT, access::address_space::global_space> () const;
96
97 / Available only when: accessMode == access::mode::atomic && dimensions >
98 0 */
99 atomic<dataT, access::address_space::global_space> operator[](
100 id index) const;
Please clarify if I understood your comment incorrectly.
Did you think about adding & sign right before AtomicDst?
atomic<T, access::address_space::global_space> &AtomicDst = Dst;
If so it would be incorrect code, I think.
clang-format-check is not required so we should be able to merge even if it fails |
The reason to make this change is to make consistent formatting across the project, not to make "merge button available". @v-klochkov, if you think that our project should not accept changes proposed by clang-format, please suggest clang-format configuration file changes. It's much better approach than just break the guidelines followed by the community. |
I understand it pretty much. I have only translated mechanics or sequence of actions into plain English. |
f82691c
to
6faf521
Compare
Signed-off-by: Vyacheslav N Klochkov <vyacheslav.n.klochkov@intel.com>
6faf521
to
bc90862
Compare
Teaching clang-format to recognize the existing laconic/1-line style/format already used in file, 'clang-format' check did not have "Required" status, thus I thought there was some flexibility here. |
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 changes LGTM.
Might need some changes in config of clang-format, though.
…versioning * origin/sycl: [XPTI][Framework] Reference implementation of the Xpti framework to be used with instrumentation in SYCL (intel#1557) [SYCL] Initial ABI checks implementation (intel#1528) [SYCL] Support connection with multiple plugins (intel#1490) [SYCL] Add a new header file with the reduction class definition (intel#1558) [SYCL] Add test for SYCL kernels with accessor and spec constant (intel#1536) [SYCL][CUDA] Move interop tests (intel#1570) [Driver][SYCL] Remove COFF object format designator for Windows device compiles (intel#1574) [SYCL] Fix conflicting visibility attributes (intel#1571) [SYCL][DOC] Update the SYCL Runtime Interface document with design details (intel#680) [SYCL] Improve image accessors support on a host device (intel#1502) [SYCL] Make queue's non-USM event ownership temporary (intel#1561) [SYCL] Added support of rounding modes for non-host devices (intel#1463) [SYCL] SemaSYCL significant refactoring (intel#1517) [SYCL] Support 0-dim accessor in handler::copy(accessor, accessor) (intel#1551)
Accessors with atomic access mode were supported in handler::copy() by mistake in the patch (intel#1551). Signed-off-by: Vyacheslav N Klochkov <vyacheslav.n.klochkov@intel.com>
Accessors with atomic access mode were supported in handler::copy() by mistake in the patch (#1551). Signed-off-by: Vyacheslav N Klochkov <vyacheslav.n.klochkov@intel.com>
Signed-off-by: Vyacheslav N Klochkov vyacheslav.n.klochkov@intel.com