clover: add stubs for SVM
authorKarol Herbst <kherbst@redhat.com>
Wed, 22 May 2019 11:46:40 +0000 (13:46 +0200)
committerMarge Bot <eric+marge@anholt.net>
Wed, 15 Apr 2020 11:08:13 +0000 (11:08 +0000)
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>

src/gallium/state_trackers/clover/api/dispatch.cpp
src/gallium/state_trackers/clover/api/kernel.cpp
src/gallium/state_trackers/clover/api/memory.cpp
src/gallium/state_trackers/clover/api/transfer.cpp

index a2d270ea05b239cf33cc1019067129464944bae7..6e1b0351afab711c568ecf02d34d4427a3f43ba6 100644 (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
index b665773d9ecd24c808fca13ad3da51cc2f2c2805..35b2f5450f7b262f61bbe9edac1a4927a1b56598 100644 (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;
+}
index df4b9baa1d99565f41c46be901e0cba8da042c33..6a0717680cfaffd6391c640551c6e09308e6470e 100644 (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");
+}
index 34559042aec34eebcf712bc136dc17ccda3162a0..879b8a9d762e8c02875e90a2c03f88e7fe51c130 100644 (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;
+}