From e4cb5f6e59cd2e5a7b2f149ccec763227f1ed782 Mon Sep 17 00:00:00 2001 From: Alexey Bader Date: Tue, 6 Oct 2020 17:18:32 +0300 Subject: [PATCH 1/2] [SYCL] Align image class constructors with the SYCL spec Enable image construction with initialization data and const pitch parameters. --- sycl/include/CL/sycl/image.hpp | 4 ++-- sycl/test/basic_tests/image.cpp | 11 +++++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/sycl/include/CL/sycl/image.hpp b/sycl/include/CL/sycl/image.hpp index cf47c5d093778..91c1fd840a304 100644 --- a/sycl/include/CL/sycl/image.hpp +++ b/sycl/include/CL/sycl/image.hpp @@ -155,7 +155,7 @@ class image { template 1)> image(void *HostPointer, image_channel_order Order, image_channel_type Type, const range &Range, - typename std::enable_if>::type &Pitch, + const typename std::enable_if>::type &Pitch, const property_list &PropList = {}) { impl = std::make_shared>( HostPointer, Order, Type, Range, Pitch, @@ -167,7 +167,7 @@ class image { template 1)> image(void *HostPointer, image_channel_order Order, image_channel_type Type, const range &Range, - typename std::enable_if>::type &Pitch, + const typename std::enable_if>::type &Pitch, AllocatorT Allocator, const property_list &PropList = {}) { impl = std::make_shared>( HostPointer, Order, Type, Range, Pitch, diff --git a/sycl/test/basic_tests/image.cpp b/sycl/test/basic_tests/image.cpp index 8b9b93ac360f3..5c25cb05f0815 100644 --- a/sycl/test/basic_tests/image.cpp +++ b/sycl/test/basic_tests/image.cpp @@ -76,6 +76,17 @@ int main() { }); } + { + const sycl::range<1> ImgPitch(4 * 4 * 4 * 2); + sycl::image<2> Img(Img1HostData.data(), ChanOrder, ChanType, Img1Size, + ImgPitch); + TestQueue Q{sycl::default_selector()}; + Q.submit([&](sycl::handler &CGH) { + auto ImgAcc = Img.get_access(CGH); + CGH.single_task([=]() { ImgAcc.get_range(); }); + }); + } + // image with write accessor to it in kernel { int NX = 32; From 4b2deebfc5d015b5da05bd54a897f98585755862 Mon Sep 17 00:00:00 2001 From: Alexey Bader Date: Thu, 8 Oct 2020 19:51:12 +0300 Subject: [PATCH 2/2] Update sycl/test/basic_tests/image.cpp Co-authored-by: Ronan Keryell --- sycl/test/basic_tests/image.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sycl/test/basic_tests/image.cpp b/sycl/test/basic_tests/image.cpp index 5c25cb05f0815..7497821315d4a 100644 --- a/sycl/test/basic_tests/image.cpp +++ b/sycl/test/basic_tests/image.cpp @@ -83,7 +83,7 @@ int main() { TestQueue Q{sycl::default_selector()}; Q.submit([&](sycl::handler &CGH) { auto ImgAcc = Img.get_access(CGH); - CGH.single_task([=]() { ImgAcc.get_range(); }); + CGH.single_task([=] { ImgAcc.get_range(); }); }); }