cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

sky3551211
Journeyman III

clSetKernelArgSVMPointer() does not support a constant?

Jump to solution

main.cpp:

cl_uchar4* svmbuffer=(cl_uchar4*)clSVMAlloc(....)

cl_uchar4* svmoutbuffer=(cl_uchar4*)clSVMAlloc(....)

int n=2;

...............

status = clSetKernelArgSVMPointer(kernel2D,0,svmbuffer);

status = clSetKernelArgSVMPointer( kernel2D,1,svmoutbuffer);

status = clSetKernelArgSVMPointer( kernel2D,1,&n);

kernel.cl:

__kernel void image1dCopy(global uchar4* svmbuffer,global uchar4* svmoutbuffer, global int *n)

{

******

}

But an error is located at  "status = clSetKernelArgSVMPointer( kernel2D,1,&n);",

and the error code is CL_INVALID_ARG_VALUE.

When I change the "global int *n" to "global int n", it show me error: parameter may not be qualified with an address space.

So, clSetKernelArgSVMPointer() does not support a constant?

Tags (2)
0 Likes
1 Solution

Accepted Solutions
dipak
Staff
Staff

Re: clSetKernelArgSVMPointer() does not support a constant?

Jump to solution

As per the spec, clSetKernelArgSVMPointer API expects a svm pointer as the argument value for argument specified by arg_index. So, you can not pass "&n" in this way as it is not a svm pointer.

When I change the "global int *n" to "global int n", it show me error: parameter may not be qualified with an address space.

If you want to pass the value of "n" , declare the corresponding kernel argument as "int n" [no "global" qualifier is required, as it is not a pointer] and use clSetKernelArg instead of clSetKernelArgSVMPointer.


For example:

__kernel void image1dCopy(global uchar4* svmbuffer,global uchar4* svmoutbuffer, int n)


status = clSetKernelArg( kernel2D, 2, sizeof(cl_int), &n);


Regards,


View solution in original post

0 Likes
2 Replies
dipak
Staff
Staff

Re: clSetKernelArgSVMPointer() does not support a constant?

Jump to solution

As per the spec, clSetKernelArgSVMPointer API expects a svm pointer as the argument value for argument specified by arg_index. So, you can not pass "&n" in this way as it is not a svm pointer.

When I change the "global int *n" to "global int n", it show me error: parameter may not be qualified with an address space.

If you want to pass the value of "n" , declare the corresponding kernel argument as "int n" [no "global" qualifier is required, as it is not a pointer] and use clSetKernelArg instead of clSetKernelArgSVMPointer.


For example:

__kernel void image1dCopy(global uchar4* svmbuffer,global uchar4* svmoutbuffer, int n)


status = clSetKernelArg( kernel2D, 2, sizeof(cl_int), &n);


Regards,


View solution in original post

0 Likes
sky3551211
Journeyman III

Re: clSetKernelArgSVMPointer() does not support a constant?

Jump to solution

Thanks, dipak.

0 Likes