OpenCL* for CPU
Ask questions and share information on Intel® SDK for OpenCL™ Applications and OpenCL™ implementations for Intel® CPU
Announcements
This forum covers OpenCL* for CPU only. OpenCL* for GPU questions can be asked in the GPU Compute Software forum. Intel® FPGA SDK for OpenCL™ questions can be ask in the FPGA Intel® High Level Design forum.

CL_MEM_READ_ONLY problem

TY
Beginner
135 Views

Let

float y={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=x+y;

}

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

0 Kudos
1 Reply
TY
Beginner
135 Views
Update: the spec has not defined the behavior in this scenario.
Reply