Community
cancel
Showing results for 
Search instead for 
Did you mean: 
55 Views

image::write causing exception

I am trying to write data into an image buffer using image::write but it is causing an exception.

Input image img2 is a simple uchar4 rgba image and I just want to copy this image to new buffer (*out). If I comment out image3Ptr.write, I do not get an exception

uint4 *out = (uint4 *)calloc(fWidth * fHeight, sizeof(uint4));

cl::sycl::image<2> img2(second, cl::sycl::image_channel_order::rgba,
	cl::sycl::image_channel_type::unsigned_int8, range<2>(sWidth, sHeight));
cl::sycl::image<2> img3(out, cl::sycl::image_channel_order::rgba,
	cl::sycl::image_channel_type::unsigned_int8, range<2>(sWidth, sHeight));
myQueue.submit([&](handler &cgh)
{
	accessor<uint4, 2, access::mode::read, access::target::image> image2Ptr(img2, cgh);
	accessor<uint4, 2, access::mode::write, access::target::image> image3Ptr(img3, cgh);
	cgh.parallel_for<class nn_search1>(
		nd_range<2>(range<2>(fWidth, fHeight), range<2>(1, 1)),
		[=](nd_item<2> item)
	{
		auto idx = item.get_global_id(0);
		auto idy = item.get_global_id(1);
		uint4 v = image2Ptr.read((int2)(idx, idy));
		image3Ptr.write((int2)(idx, idy), v);
	});
});

Exception details: Exception thrown at 0x00007FFA776BBACF (igc64.dll) in PatchMatch.exe: 0xC0000005: Access violation writing location 0x000000000000001A.

Visual studio takes me to handler.hpp, line 407 

detail::EventImplPtr Event = detail::Scheduler::getInstance().addCG(
        std::move(CommandGroup), std::move(MQueue));

and stack trace shows:

     PatchMatch.exe!cl::sycl::handler::finalize() Line 407    C++
     PatchMatch.exe!cl::sycl::detail::queue_impl::submit_impl<`lambda at ..\\source\\PM_SYCL.cpp:531:21'>(nn_search_sycl1::<unnamed-tag> cgf, std::shared_ptr<cl::sycl::detail::queue_impl> self) Line 212    C++
     PatchMatch.exe!cl::sycl::detail::queue_impl::submit<`lambda at ..\\source\\PM_SYCL.cpp:531:21'>(nn_search_sycl1::<unnamed-tag> cgf, std::shared_ptr<cl::sycl::detail::queue_impl> self) Line 106    C++
     PatchMatch.exe!cl::sycl::queue::submit<`lambda at ..\\source\\PM_SYCL.cpp:531:21'>(nn_search_sycl1::<unnamed-tag> cgf) Line 87    C++

 

0 Kudos
3 Replies
Viet_H_Intel
Moderator
55 Views

What are VS and compiler versions? Can you provide us with a reproducible test case?

55 Views

Viet Hoang (Intel) wrote:

What are VS and compiler versions? Can you provide us with a reproducible test case?

I am using Visual studio with One API offline tool kit installed.

Complete VS2017 project is attached as zip file.

When I select cpu_selector, it copies first element (so even thats not working properly) but in case of gpu_selector, it is straight away throwing exception.

dpcpp version: DPC++ Compiler 2021.1 (2019.8.x.0.1010)
Target: x86_64-pc-windows-msvc
Thread model: posix

 

55 Views

Viet Hoang (Intel) wrote:

What are VS and compiler versions? Can you provide us with a reproducible test case?

I am using Visual studio with One API offline tool kit installed.

Complete VS2017 project is attached as zip file.

When I select cpu_selector, it copies first element (so even thats not working properly) but in case of gpu_selector, it is straight away throwing exception.

dpcpp version: DPC++ Compiler 2021.1 (2019.8.x.0.1010)
Target: x86_64-pc-windows-msvc
Thread model: posix