-
Notifications
You must be signed in to change notification settings - Fork 29
Add support for raw_kernel_arg extension #2038
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
base: master
Are you sure you want to change the base?
Conversation
DPCTL_API | ||
void DPCTLRawKernelArg_Delete(__dpctl_take DPCTLSyclRawKernelArgRef Ref) | ||
{ | ||
delete unwrap<RawKernelArgData>(Ref); |
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.
auto RawArg = unwrap<RawKernelArgData>(Ref);
delete[] RawArg->bytes;
delete RawArg;
std::memcpy(rawData.get(), bytes, count); | ||
auto RawKernelArg = std::unique_ptr<RawKernelArgData>( | ||
new RawKernelArgData{rawData.release(), count}); | ||
rka = wrap<RawKernelArgData>(RawKernelArg.release()); |
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.
Sorry. I've misled you in my previous comment about unique_ptr
. To make it work it should be something like this:
auto rawData =
std::unique_ptr<unsigned char[]>(new unsigned char[count]);
std::memcpy(rawData.get(), bytes, count);
auto RawKernelArg = std::unique_ptr<RawKernelArgData>(
new RawKernelArgData{rawData.get(), count});
rka = wrap<RawKernelArgData>(RawKernelArg.get());
RawKernelArg.release();
rawData.release();
Otherwise rawData
would leak if new RawKernelArgData{rawData.release(), count}
throws.
@sommerlukas |
Add support for the DPC++ SYCL extension
raw_kernel_arg
that allows to pass a binary blob as kernel arguments.This is for example useful if the kernel uses a
struct
as kernel parameter, but is loaded from SPIR-V and the argument type is unknown forset_arg
.The implementation follows #1984.