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*

An interesting problem on DPCPP

shenuo
Employee
1,125 Views

 

 kernelfunc_1(sycl::queue&Q, int *ptr1,int*ptr2) {

image im3(ptr1, image_channel_order::rgba, image_channel_type::unsigned_int32, range{ M,N,L });

try
{
auto ev3 = Q.submit([&](handler &h) {

auto out = sycl::stream(1024, 1024, h);
accessor<int4, 2, access::mode::write, access::target::image_array> acs3_w(im3, h);
im3.set_final_data(ptr1);
h.parallel_for(nd_range{ range{ M ,N,L}, range{ 1,1,1 } }, [=](nd_item<3> it) {
int idx = it.get_global_linear_id();
if (idx == 0) {
for (int k = 0; k < L; k++) {
out << "layer:" << k << ":" << sycl::endl;
for (int i = 0; i < M; i++) {
for (int j = 0; j < N; j++)
{
if (i == 0 && j == 0 && k == 0) continue;
acs3_w[k].write(int2(i, j), int4(1, 2, 3, 4));
}
out << sycl::endl;
}
}

}

});
}
);
return ev3;
}
catch (const std::exception& e)
{
std::cout << "An exception is caught for vector add.\n" << e.what();
std::terminate();
}
}

 

auto kernelfunc_2(sycl::queue&Q, int *ptr1, int*ptr2) {
Q.wait();
buffer ptr(ptr1, range{ N*M*L*C });
ptr.set_final_data(ptr2);

try
{
auto ev2 = Q.submit([&](handler &h) {
ptr.set_final_data(ptr2);
accessor acs(ptr, h);
auto out = sycl::stream(1024, 1024, h);
h.parallel_for(nd_range{ range{ M ,N,L}, range{ 1,1,1 } }, [=](nd_item<3> it) {

int idx = it.get_global_linear_id();
if (idx == 0) {
for (int k = 0; k < L; k++) {
acs[0] = 999;
}
}
});
}
);
return ev2;
}
catch (const std::exception& e)
{
std::cout << "An exception is caught for vector add.\n" << e.what();
std::terminate();
}
}

 

int main(){

kernelfunc_1(Q, host_array3_2,host_array3_2);      

kernelfunc_2(Q, shared_array3_2, shared_array3_2);

---------------------v1---------------------------------------------

kernelfunc_1(Q, host_array3_2,shared_array3_2);

kernelfunc_2(Q, shared_array3_2, shared_array3_2);

----------------------v2--------------------------------------------

The V1 can produce the correct result. Obviously, there is no relationship between the two functions.

However, the V2 REALLY confuses me a lot, as you can see in the kernelfunc_1, I  didn't use the shared_array3_2, why the v2 will get stuck like this: Screenshot 2021-08-17 121435.png

my programming environment :

VS2017

one API DPC++ Compiler  (2021.3.0)

windows 10.

can anybody tell me why?

 

}

0 Kudos
7 Replies
ShanmukhS_Intel
Moderator
1,093 Views

Hi,


Thanks for reaching out to us.


We have tried executing your code in "Intel oneAPI command prompt for Intel 64 for Visual Studio 2019" and in Visual Studio 2019 (release mode).

We see that the code compiles fine with smooth exit under our system environment.

Our system environment :

VS2019-16.9.0

one API DPC++ Compiler (2021.3.0)

windows 10.

We'd like to request you to provide the Visual Studio version being used.


Best Regards,

Shanmukh.SS


0 Kudos
shenuo
Employee
1,059 Views

Glad to see your reply!

             You remind me that this problem may lay in the hardware environment. So I move my code to another PC(desktop), under the same software environment(VS2017(10.0.17763.0), one API DPC++ Compiler (2021.3.0), windows 10.), it works fine. I can tell you my laptop is core i7-10610U CPU with Graphics UHD620(driver version 27.20.100.9320)(my desktop is  i7-8700 &UHD 630(30.0.100.9684) )

 

0 Kudos
ShanmukhS_Intel
Moderator
1,042 Views

Hi,

 

Thanks for reaching out to us.

 

>>You remind me that this problem may lay in the hardware environment.

Below is the link for oneAPI Base Toolkit System Requirements.

https://software.intel.com/content/www/us/en/develop/articles/intel-oneapi-base-toolkit-system-requirements.html

 

In addition, Below is the link for list of versions of Visual Studio supported for latest oneAPI 2021.3

https://software.intel.com/content/www/us/en/develop/articles/intel-compilers-compatibility-with-microsoft-visual-studio-and-xcode.html

 

Best Regards,

Shanmukh.SS

 

 

0 Kudos
ShanmukhS_Intel
Moderator
977 Views

Hi,


Reminder:


Has the information provided helped? Could you please confirm whether we could close this thread from our end.


Best Regards,

Shanmukh.SS


0 Kudos
shenuo
Employee
963 Views

Yes , It really helps, and thank you, but I don't know how to mark it as acceptable.

0 Kudos
ShanmukhS_Intel
Moderator
951 Views

Hi,


Thank you for the confirmation. To mark it as accepted, You can find "Accept as solution" option under our reply.


Best Regards,

Shanmukh.SS


0 Kudos
ShanmukhS_Intel
Moderator
912 Views

Hi,


Thanks for the confirmation. If you need any additional information, please submit a new question as this thread will no longer be monitored.


Best Regards,

Shanmukh.SS


0 Kudos
Reply