-
Notifications
You must be signed in to change notification settings - Fork 802
[SYCL][ABI-Break] Improve Queue fill #13788
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
Thanks for this tip! I didn't know this before. The thing is, this depends on the already existing member of the edit: diff --git a/sycl/source/handler.cpp b/sycl/source/handler.cpp
index 872e31d9b440..51564336ef31 100644
--- a/sycl/source/handler.cpp
+++ b/sycl/source/handler.cpp
@@ -364,10 +364,13 @@ event handler::finalize() {
CommandGroup.reset(new detail::CGCopyUSM(MSrcPtr, MDstPtr, MLength,
std::move(CGData), MCodeLoc));
break;
- case detail::CG::FillUSM:
+ case detail::CG::FillUSM: {
+ std::vector<unsigned char> MPatternU(MPattern.size());
+ std::memcpy(MPatternU.data(), MPattern.data(), MPattern.size());
CommandGroup.reset(new detail::CGFillUSM(
- std::move(MPattern), MDstPtr, MLength, std::move(CGData), MCodeLoc));
+ std::move(MPatternU), MDstPtr, MLength, std::move(CGData), MCodeLoc));
break;
+ } |
|
From https://en.cppreference.com/w/cpp/language/types:
I don't see how |
315b265 to
ca2f561
Compare
|
To make this change from |
PietroGhg
left a comment
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.
Native CPU LGTM, thank you
This wasn't actually that complicated. This is done now @ldrumm. |
|
@intel/llvm-gatekeepers this is now ready to be merged |
Changed the
queue.fill()implementation to make use of the native functions for a specific backend. Also, unified the implementation with the one for memset, since it is just an 8-bit subset operation of fill.In the CUDA case, both memset and fill are currently calling
urEnqueueUSMFillwhich depending on the size of the filling pattern calls eithercuMemsetD8Async,cuMemsetD16Async,cuMemsetD32AsyncorcommonMemSetLargePattern. Before this patch memset was using the same thing, just beforehand setting patternSize always to 1 byte which resulted in callingcuMemsetD8Async. In other backends, the behaviour is analogous.The fill method was just invoking a
parallel_forto fill the memory with the pattern which was making this operation quite slow.