CL_MEM_READ_ONLY problem

CL_MEM_READ_ONLY problem

Ritratto di TY

Let

float y[n]={1,2,...,n}

I have a buffer declared as CL_MEM_READ_ONLY:

buffery = clCreateBuffer(context, CL_MEM_READ_ONLY| CL_MEM_COPY_HOST_PTR, sizeof(float)*n,y,&err);

I have a kernel declared as follows:

__kernel void work(__global const float* x,__global float* y){

int i = get_global_id(0);
y[i]=x[i]+y[i];

}

and

clSetKernelArg(workkernel, 1, sizeof(cl_mem), &buffery);

The code executes with no problem, but it shouldn't be, because buffery is declared as read only, am I correct?

Ty

2 post / 0 new
Ultimo contenuto
Per informazioni complete sulle ottimizzazioni del compilatore, consultare l'Avviso sull'ottimizzazione
Ritratto di TY

Update: the spec has not defined the behavior in this scenario.

Accedere per lasciare un commento.