clover: add stubs for SVM

although most of those are 2.0 core functions, there is
cl_arm_shared_virtual_memory to expose those in a 1.2 context. But we
should be able to expose this extension with 1.1 as well as there is no
technicaly reason why this shouldn't work.

v2: move svm functions into existing files
v3: rename func args to match convention

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Reviewed-by: Pierre Moreau <dev@pmoreau.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/2076>
This commit is contained in:
Karol Herbst 2019-05-22 13:46:40 +02:00 committed by Marge Bot
parent e738967d6e
commit c170c0cfe4
4 changed files with 117 additions and 10 deletions

View file

@ -150,20 +150,20 @@ namespace clover {
clCreateCommandQueueWithProperties,
NULL, // clCreatePipe
NULL, // clGetPipeInfo
NULL, // clSVMAlloc
NULL, // clSVMFree
NULL, // clEnqueueSVMFree
NULL, // clEnqueueSVMMemcpy
NULL, // clEnqueueSVMMemFill
NULL, // clEnqueueSVMMap
NULL, // clEnqueueSVMUnmap
clSVMAlloc,
clSVMFree,
clEnqueueSVMFree,
clEnqueueSVMMemcpy,
clEnqueueSVMMemFill,
clEnqueueSVMMap,
clEnqueueSVMUnmap,
NULL, // clCreateSamplerWithProperties
NULL, // clSetKernelArgSVMPointer
NULL, // clSetKernelExecInfo
clSetKernelArgSVMPointer,
clSetKernelExecInfo,
NULL, // clGetKernelSubGroupInfoKHR
NULL, // clCloneKernel
NULL, // clCreateProgramWithIL
NULL, // clEnqueueSVMMigrateMem
clEnqueueSVMMigrateMem,
NULL, // clGetDeviceAndHostTimer
NULL, // clGetHostTimer
NULL, // clGetKernelSubGroupInfo

View file

@ -333,3 +333,20 @@ clEnqueueNativeKernel(cl_command_queue d_q, void (*func)(void *),
const cl_event *d_deps, cl_event *rd_ev) {
return CL_INVALID_OPERATION;
}
CLOVER_API cl_int
clSetKernelArgSVMPointer(cl_kernel d_kern,
cl_uint arg_index,
const void *arg_value) {
CLOVER_NOT_SUPPORTED_UNTIL("2.0");
return CL_INVALID_VALUE;
}
CLOVER_API cl_int
clSetKernelExecInfo(cl_kernel d_kern,
cl_kernel_exec_info param_name,
size_t param_value_size,
const void *param_value) {
CLOVER_NOT_SUPPORTED_UNTIL("2.0");
return CL_INVALID_VALUE;
}

View file

@ -426,3 +426,18 @@ clEnqueueFillImage(cl_command_queue command_queue, cl_mem image,
CLOVER_NOT_SUPPORTED_UNTIL("1.2");
return CL_INVALID_VALUE;
}
CLOVER_API void *
clSVMAlloc(cl_context d_ctx,
cl_svm_mem_flags flags,
size_t size,
unsigned int alignment) {
CLOVER_NOT_SUPPORTED_UNTIL("2.0");
return nullptr;
}
CLOVER_API void
clSVMFree(cl_context d_ctx,
void *svm_pointer) {
CLOVER_NOT_SUPPORTED_UNTIL("2.0");
}

View file

@ -764,3 +764,78 @@ clEnqueueMigrateMemObjects(cl_command_queue command_queue,
CLOVER_NOT_SUPPORTED_UNTIL("1.2");
return CL_INVALID_VALUE;
}
CLOVER_API cl_int
clEnqueueSVMFree(cl_command_queue d_q,
cl_uint num_svm_pointers,
void *svm_pointers[],
void (CL_CALLBACK *pfn_free_func) (cl_command_queue queue, cl_uint num_svm_pointers, void *svm_pointers[], void *user_data),
void *user_data,
cl_uint num_events_in_wait_list,
const cl_event *event_wait_list,
cl_event *event) {
CLOVER_NOT_SUPPORTED_UNTIL("2.0");
return CL_INVALID_VALUE;
}
CLOVER_API cl_int
clEnqueueSVMMemcpy(cl_command_queue d_q,
cl_bool blocking_copy,
void *dst_ptr,
const void *src_ptr,
size_t size,
cl_uint num_events_in_wait_list,
const cl_event *event_wait_list,
cl_event *event) {
CLOVER_NOT_SUPPORTED_UNTIL("2.0");
return CL_INVALID_VALUE;
}
CLOVER_API cl_int
clEnqueueSVMMemFill(cl_command_queue d_q,
void *svm_ptr,
const void *pattern,
size_t pattern_size,
size_t size,
cl_uint num_events_in_wait_list,
const cl_event *event_wait_list,
cl_event *event) {
CLOVER_NOT_SUPPORTED_UNTIL("2.0");
return CL_INVALID_VALUE;
}
CLOVER_API cl_int
clEnqueueSVMMap(cl_command_queue d_q,
cl_bool blocking_map,
cl_map_flags map_flags,
void *svm_ptr,
size_t size,
cl_uint num_events_in_wait_list,
const cl_event *event_wait_list,
cl_event *event) {
CLOVER_NOT_SUPPORTED_UNTIL("2.0");
return CL_INVALID_VALUE;
}
CLOVER_API cl_int
clEnqueueSVMUnmap(cl_command_queue d_q,
void *svm_ptr,
cl_uint num_events_in_wait_list,
const cl_event *event_wait_list,
cl_event *event) {
CLOVER_NOT_SUPPORTED_UNTIL("2.0");
return CL_INVALID_VALUE;
}
CLOVER_API cl_int
clEnqueueSVMMigrateMem(cl_command_queue d_q,
cl_uint num_svm_pointers,
const void **svm_pointers,
const size_t *sizes,
const cl_mem_migration_flags flags,
cl_uint num_events_in_wait_list,
const cl_event *event_wait_list,
cl_event *event) {
CLOVER_NOT_SUPPORTED_UNTIL("2.1");
return CL_INVALID_VALUE;
}