-
Notifications
You must be signed in to change notification settings - Fork 787
[SYCL] Add support for image with pitch but without host ptr provided. #723
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,6 +24,9 @@ int main() { | |
const sycl::image_channel_order ChanOrder = sycl::image_channel_order::rgba; | ||
const sycl::image_channel_type ChanType = sycl::image_channel_type::fp32; | ||
|
||
constexpr auto SYCLRead = sycl::access::mode::read; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this constexpr supposed to have a different namespace specification compared to the one on the next line? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, will fix. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed. |
||
constexpr auto SYCLWrite = sycl::access::mode::write; | ||
|
||
const sycl::range<2> Img1Size(4, 4); | ||
const sycl::range<2> Img2Size(4, 4); | ||
|
||
|
@@ -35,8 +38,6 @@ int main() { | |
sycl::image<2> Img2(Img2HostData.data(), ChanOrder, ChanType, Img2Size); | ||
TestQueue Q{sycl::default_selector()}; | ||
Q.submit([&](sycl::handler &CGH) { | ||
constexpr auto SYCLRead = sycl::access::mode::read; | ||
constexpr auto SYCLWrite = cl::sycl::access::mode::write; | ||
|
||
auto Img1Acc = Img1.get_access<sycl::float4, SYCLRead>(CGH); | ||
auto Img2Acc = Img2.get_access<sycl::float4, SYCLWrite>(CGH); | ||
|
@@ -62,6 +63,16 @@ int main() { | |
} | ||
} | ||
|
||
{ | ||
const sycl::range<1> ImgPitch(4 * 4 * 4 * 2); | ||
sycl::image<2> Img(ChanOrder, ChanType, Img1Size, ImgPitch); | ||
TestQueue Q{sycl::default_selector()}; | ||
Q.submit([&](sycl::handler &CGH) { | ||
auto ImgAcc = Img.get_access<sycl::float4, SYCLRead>(CGH); | ||
CGH.single_task<class EmptyKernel>([=]() { ImgAcc.get_size(); }); | ||
}); | ||
} | ||
|
||
std::cout << "Success" << std::endl; | ||
return 0; | ||
} |
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 did not understand this change. How are the fields Desc.image_row_pitch and Desc.image_slice_pitch used? What happens when the user is constructing an image without host_ptr but a valid pitch?
Eg with constructor:
image(image_channel_order order, image_channel_type type, const range &range, const range<dimensions - 1> &pitch, const property_list &propList = {});
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.
There are used as arguments to clCreateImage function.
For OpenCL device image is created without host ptr and with pitch == 0.
For host device image is created without host ptr and with pitches that user specifies.
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.
Read section 5.3.1.2 in OpenCL spec.
Thanks.