Intel® oneAPI DPC++/C++ Compiler
Talk to fellow users of Intel® oneAPI DPC++/C++ Compiler and companion tools like Intel® oneAPI DPC++ Library, Intel® DPC++ Compatibility Tool, and Intel® Distribution for GDB*

image::write causing exception

Shukla__Gagandeep
1,695 Views

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
8 Replies
GouthamK_Intel
Moderator
1,695 Views

Hi,

Thanks for reaching out to us.

We are working on it and will get back to you.

 

Goutham

0 Kudos
SriVardham_A_Intel
1,695 Views

Hi

We've observed that your 'img3' size of '(sWidth, sHeight)', doesn't match that of the 'out' size of '(fWidth, fHeight)', along with kernel size of '(fWidth, fHeight)'. Try running your code after appropriate changes.

Hope this resolves your issue. If not, please provide us with the entire source code and steps to reproduce, so that we can investigate further into the issue

 

Thanks

Teja Alaghari

0 Kudos
Shukla__Gagandeep
1,695 Views

Alaghari, Sri Vardhamana Maha Teja (Intel) wrote:

Hi

We've observed that your 'img3' size of '(sWidth, sHeight)', doesn't match that of the 'out' size of '(fWidth, fHeight)', along with kernel size of '(fWidth, fHeight)'. Try running your code after appropriate changes.

Hope this resolves your issue. If not, please provide us with the entire source code and steps to reproduce, so that we can investigate further into the issue

 

Thanks

 

Teja Alaghari

Actually those both values are same. Anyways here is complete DPC++ VS2017 project that shows the error.

gauss.cpp ->gaussFilterSycl() function causes the error. 

It goes to handler.hpp: line 407

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

 

See if you can help me.
 

Regards,

Gagan

0 Kudos
GouthamK_Intel
Moderator
1,695 Views

Hi Gagan,

Thanks for providing the source code, we tried running your code in our environment ("Ubuntu 18.04.3 LTS") and it's working fine. 

We assume that the problem is with the environment, So kindly provide us more details of your visual studio environment like oneAPI toolkit version you are using.

 

Thanks 

Goutham

0 Kudos
Shukla__Gagandeep
1,695 Views

Kuncham, Goutham Kalikrishna Reddy (Intel) wrote:

Hi Gagan,

Thanks for providing the source code, we tried running your code in our environment ("Ubuntu 18.04.3 LTS") and it's working fine. 

We assume that the problem is with the environment, So kindly provide us more details of your visual studio environment like oneAPI toolkit version you are using.

 

Thanks 

Goutham

Hi Goutham,

I am using Visual Studio 2017 with offline OnAPI kit installed with following version:

DPC++ Compiler 2021.1 (2019.8.x.0.1010)
Target: x86_64-pc-windows-msvc
Thread model: posix
InstalledDir: C:\PROGRA~2\INTELO~1\compiler\2021~1.1-B\windows\bin

 

Regards,

Gagan

 

0 Kudos
GouthamK_Intel
Moderator
1,695 Views

Hi Gagan,

We tried running your code in VS2019 with basekit 2021.1 beta03, and it's working fine. Can you please verify whether oneAPI toolkit is integrated properly in your VS or not. and please check whether you are able to run any other codes other than this gauss.cpp.

 

Thanks

Goutham

0 Kudos
Shukla__Gagandeep
1,695 Views

Kuncham, Goutham Kalikrishna Reddy (Intel) wrote:

Hi Gagan,

We tried running your code in VS2019 with basekit 2021.1 beta03, and it's working fine. Can you please verify whether oneAPI toolkit is integrated properly in your VS or not. and please check whether you are able to run any other codes other than this gauss.cpp.

 

Thanks

Goutham

0 Kudos
GouthamK_Intel
Moderator
1,695 Views

Hi Gagan,

Please, let us know if your issue got resolved or not, and confirm whether we can close this thread.

You are always welcome to raise a new thread for any other issues. 

 

Thanks

Goutham

0 Kudos
Reply