Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
107 Views

Value blowup when read and printed from the kernel (no other operation done)

Jump to solution

Hello

In the attached code which is reduced from a larger code, the middle-value of my vector of arrays specifically blows up when enqueued and just printed from the kernel (no operation is done, only read and print).  But, if an operation is done and printed I get expected value. I request your advice on this behavior from the kernel.

Please note this behavior is happening only on GPU and works as expected on the CPU.
I have made suitable comments in the code to identify the value that blows up inside the kernel and printing the expected values before the kernel for comparison.

System spec: Ubuntu 18.04.4 LTS, Intel® Core™ i7-7700HQ CPU @ 2.80GHz, Intel® HD Graphics 630 (Kaby Lake GT2)
oneAPI version beta 07, running on default L0 BE

0 Kudos

Accepted Solutions
Highlighted
Moderator
84 Views

Hi Suraj,

 

Thank you for reporting this problem. Actually, at some point sycl::stream is showing such behavior and if you see closely you will find that the stream buffer is copying the previous content for long results. Please see the below snippet of the output (with some changes in code)

o/p

    kernel 4 0 0.5878

    kernel 4 1 -0.000000087422771453857421875

    kernel 4 2 421875000087422771453857421875

    kernel 5 0 421875000087422771453857421875

    kernel 5 1 -0.5878

 

And if you will check the result after the kernel you will get the correct values inside your buffer, you can also try to print just value of readafter[i][j] with i==5 and j==0 you will get the correct result.

 

And if there is a need to print all of these values inside the kernel and can use experimental printf this will give you the correct result with your given code. Please refer below the code snippet to use experimental printf.

 

 

#ifdef __SYCL_DEVICE_ONLY__
  #define CONSTANT __attribute__((opencl_constant))
#else
  #define CONSTANT
#endif

//below lines inside kernel
static const CONSTANT char FMT[] = "n: %d\n";
sycl::intel::experimental::printf(FMT, 7);

 

 

We will also report this behavior with sycl::stream to the concerned team meanwhile you can continue debugging your use-case with experimental printf. Also, please check the attached updated code.

 

 

Warm Regards,

Abhishek

View solution in original post

0 Kudos
3 Replies
Highlighted
Moderator
85 Views

Hi Suraj,

 

Thank you for reporting this problem. Actually, at some point sycl::stream is showing such behavior and if you see closely you will find that the stream buffer is copying the previous content for long results. Please see the below snippet of the output (with some changes in code)

o/p

    kernel 4 0 0.5878

    kernel 4 1 -0.000000087422771453857421875

    kernel 4 2 421875000087422771453857421875

    kernel 5 0 421875000087422771453857421875

    kernel 5 1 -0.5878

 

And if you will check the result after the kernel you will get the correct values inside your buffer, you can also try to print just value of readafter[i][j] with i==5 and j==0 you will get the correct result.

 

And if there is a need to print all of these values inside the kernel and can use experimental printf this will give you the correct result with your given code. Please refer below the code snippet to use experimental printf.

 

 

#ifdef __SYCL_DEVICE_ONLY__
  #define CONSTANT __attribute__((opencl_constant))
#else
  #define CONSTANT
#endif

//below lines inside kernel
static const CONSTANT char FMT[] = "n: %d\n";
sycl::intel::experimental::printf(FMT, 7);

 

 

We will also report this behavior with sycl::stream to the concerned team meanwhile you can continue debugging your use-case with experimental printf. Also, please check the attached updated code.

 

 

Warm Regards,

Abhishek

View solution in original post

0 Kudos
Highlighted
Beginner
65 Views

Thank you, Abhishek for the code snippet. "experimental printf"  works well. The issue is resolved for me.

0 Kudos
Highlighted
Moderator
54 Views

Hi Suraj,


Thank you for the confirmation. Please post a new thread if you have any other issues.



Warm Regards,

Abhishek


0 Kudos