summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2020-11-06 16:25:21 +1000
committerDave Airlie <airlied@redhat.com>2020-11-17 05:15:08 +1000
commita144dd69172b0c4a5858f3025d1b82c9281661fe (patch)
treef34150f4a08b521ef84feb68a7d4e5d9605ddc1a
parente42a7fa03786603b5069afb762006623d71ae7e7 (diff)
clover: add all CL 3.0 API with invalid functions
These CL 2.x APIs are all part of CL3.0 but have to return specific values to show they aren't supported. Reviewed-by: Karol Herbst <kherbst@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7642>
-rw-r--r--src/gallium/frontends/clover/api/dispatch.cpp18
-rw-r--r--src/gallium/frontends/clover/api/invalid.cpp109
-rw-r--r--src/gallium/frontends/clover/meson.build1
3 files changed, 119 insertions, 9 deletions
diff --git a/src/gallium/frontends/clover/api/dispatch.cpp b/src/gallium/frontends/clover/api/dispatch.cpp
index 41583ff3b59..94c60d62dac 100644
--- a/src/gallium/frontends/clover/api/dispatch.cpp
+++ b/src/gallium/frontends/clover/api/dispatch.cpp
@@ -148,8 +148,8 @@ namespace clover {
NULL, // clEnqueueReleaseEGLObjectsKHR
NULL, // clCreateEventFromEGLSyncKHR
clCreateCommandQueueWithProperties,
- NULL, // clCreatePipe
- NULL, // clGetPipeInfo
+ clCreatePipe,
+ clGetPipeInfo,
clSVMAlloc,
clSVMFree,
clEnqueueSVMFree,
@@ -162,14 +162,14 @@ namespace clover {
clSetKernelExecInfo,
NULL, // clGetKernelSubGroupInfoKHR
NULL, // clCloneKernel
- NULL, // clCreateProgramWithIL
+ clCreateProgramWithIL,
clEnqueueSVMMigrateMem,
- NULL, // clGetDeviceAndHostTimer
- NULL, // clGetHostTimer
- NULL, // clGetKernelSubGroupInfo
- NULL, // clSetDefaultDeviceCommandQueue
- NULL, // clSetProgramReleaseCallback
- NULL, // clSetProgramSpecializationConstant
+ clGetDeviceAndHostTimer,
+ clGetHostTimer,
+ clGetKernelSubGroupInfo,
+ clSetDefaultDeviceCommandQueue,
+ clSetProgramReleaseCallback,
+ clSetProgramSpecializationConstant,
clCreateBufferWithProperties,
clCreateImageWithProperties,
clSetContextDestructorCallback
diff --git a/src/gallium/frontends/clover/api/invalid.cpp b/src/gallium/frontends/clover/api/invalid.cpp
new file mode 100644
index 00000000000..cecf1a095a5
--- /dev/null
+++ b/src/gallium/frontends/clover/api/invalid.cpp
@@ -0,0 +1,109 @@
+//
+// Copyright 2020 Red Hat
+//
+// Permission is hereby granted, free of charge, to any person obtaining a
+// copy of this software and associated documentation files (the "Software"),
+// to deal in the Software without restriction, including without limitation
+// the rights to use, copy, modify, merge, publish, distribute, sublicense,
+// and/or sell copies of the Software, and to permit persons to whom the
+// Software is furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+// OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+// OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#include "api/util.hpp"
+#include "core/context.hpp"
+#include "core/platform.hpp"
+
+using namespace clover;
+
+// This contains all the CL 2.x API entrypoints that return INVALID_OPERATON
+// on CL 3.0. If these are implemented they should be moved out of this file.
+
+CLOVER_API cl_mem
+clCreatePipe(cl_context d_ctx,
+ cl_mem_flags flags,
+ cl_uint pipe_packet_size,
+ cl_uint pipe_max_packets,
+ const cl_pipe_properties *properties,
+ cl_int *r_errorcode) {
+ *r_errorcode = CL_INVALID_OPERATION;
+ return nullptr;
+}
+
+
+CLOVER_API cl_int
+clGetPipeInfo(cl_mem pipe,
+ cl_pipe_info param_name,
+ size_t param_value_size,
+ void *param_value,
+ size_t *param_value_size_ret) {
+ return CL_INVALID_MEM_OBJECT;
+}
+
+CLOVER_API cl_int
+clGetDeviceAndHostTimer(cl_device_id device,
+ cl_ulong *device_timestamp,
+ cl_ulong *host_timestamp) {
+ return CL_INVALID_OPERATION;
+}
+
+CLOVER_API cl_int
+clGetHostTimer(cl_device_id device,
+ cl_ulong *host_timestamp) {
+ return CL_INVALID_OPERATION;
+}
+
+
+CLOVER_API cl_int
+clGetKernelSubGroupInfo(cl_kernel d_kern,
+ cl_device_id device,
+ cl_kernel_sub_group_info param_name,
+ size_t input_value_size,
+ const void *input_value,
+ size_t param_size_value,
+ void *param_value,
+ size_t *param_value_size_ret) {
+ return CL_INVALID_OPERATION;
+}
+
+
+CLOVER_API cl_int
+clSetDefaultDeviceCommandQueue(cl_context context,
+ cl_device_id device,
+ cl_command_queue command_queue) {
+ return CL_INVALID_OPERATION;
+}
+
+CLOVER_API cl_int
+clSetProgramReleaseCallback(cl_program d_prog,
+ void (CL_CALLBACK *pfn_notify)(cl_program program, void *user_data),
+ void *user_data) {
+ return CL_INVALID_OPERATION;
+}
+
+CLOVER_API cl_program
+clCreateProgramWithIL(cl_context context,
+ const void *il,
+ size_t length,
+ cl_int *r_errorcode) {
+ *r_errorcode = CL_INVALID_OPERATION;
+ return nullptr;
+}
+
+CLOVER_API cl_int
+clSetProgramSpecializationConstant(cl_program program,
+ cl_uint spec_id,
+ size_t spec_size,
+ const void* spec_value) {
+ return CL_INVALID_OPERATION;
+}
diff --git a/src/gallium/frontends/clover/meson.build b/src/gallium/frontends/clover/meson.build
index c64b217500b..4f26db64d07 100644
--- a/src/gallium/frontends/clover/meson.build
+++ b/src/gallium/frontends/clover/meson.build
@@ -100,6 +100,7 @@ clover_files = files(
'api/dispatch.hpp',
'api/event.cpp',
'api/interop.cpp',
+ 'api/invalid.cpp',
'api/kernel.cpp',
'api/memory.cpp',
'api/platform.cpp',