cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

FrodoTheGiant
Journeyman III

Memory access violation

What happens if there is a memory access violation inside a kernel?

Example: Let's assume param is an array of size 32.

__kernel void myKernel ( __constant float *param) {

...

     temp = param[37];

...

}

0 Likes
6 Replies

The result of the load is undefined.
0 Likes

Originally posted by: MicahVillmow The result of the load is undefined.


A question... are you testing ptr outbounds/buffer underrun in the CPU implementation? That will be good to debug.

0 Likes

Thanks for reply, Micah.

 

What happens if I use pinned memory (CL_MEM_COPY_HOST_PTR). Do I get a memory violation in the host code?

E.g. param is an array of size 32.

__kernel void myKernel ( __global float *param) {

...

  param[37] = 23;

...

}

0 Likes

It's a HD6970.

 

What would happen with the pinned memory example on a HD6970 ?

0 Likes

That all depends on the device you are executing the code on. Since the GPU doesn't have page faults/exceptions to the OS, it won't have the same behavior as the CPU.
0 Likes

Writes get dropped and reads return zero, or some other standard value. However, that also depends on how the memory is allocated on the device, not allocated in the program.
0 Likes