clover: Fixes building with mingw-x86

Cc: mesa-stable

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19610>
This commit is contained in:
Yonggang Luo 2022-11-08 19:07:35 +08:00 committed by Marge Bot
parent a3b26e2758
commit f25d483e1b
7 changed files with 153 additions and 143 deletions

View file

@ -32,22 +32,22 @@
namespace clover {
extern const cl_icd_dispatch _dispatch;
cl_int
cl_int CL_API_CALL
GetPlatformInfo(cl_platform_id d_platform, cl_platform_info param,
size_t size, void *r_buf, size_t *r_size);
void *
void * CL_API_CALL
GetExtensionFunctionAddress(const char *p_name);
void *
void * CL_API_CALL
GetExtensionFunctionAddressForPlatform(cl_platform_id d_platform,
const char *p_name);
cl_int
cl_int CL_API_CALL
IcdGetPlatformIDsKHR(cl_uint num_entries, cl_platform_id *rd_platforms,
cl_uint *rnum_platforms);
cl_int
cl_int CL_API_CALL
EnqueueSVMFree(cl_command_queue command_queue,
cl_uint num_svm_pointers,
void *svm_pointers[],
@ -60,7 +60,7 @@ namespace clover {
cl_event *event,
cl_int cmd);
cl_int
cl_int CL_API_CALL
EnqueueSVMMemcpy(cl_command_queue command_queue,
cl_bool blocking_copy,
void *dst_ptr,
@ -71,7 +71,7 @@ namespace clover {
cl_event *event,
cl_int cmd);
cl_int
cl_int CL_API_CALL
EnqueueSVMMap(cl_command_queue command_queue,
cl_bool blocking_map,
cl_map_flags map_flags,
@ -82,7 +82,7 @@ namespace clover {
cl_event *event,
cl_int cmd);
cl_int
cl_int CL_API_CALL
EnqueueSVMMemFill(cl_command_queue command_queue,
void *svm_ptr,
const void *pattern,
@ -93,7 +93,7 @@ namespace clover {
cl_event *event,
cl_int cmd);
cl_int
cl_int CL_API_CALL
EnqueueSVMUnmap(cl_command_queue command_queue,
void *svm_ptr,
cl_uint num_events_in_wait_list,
@ -101,7 +101,7 @@ namespace clover {
cl_event *event,
cl_int cmd);
cl_program
cl_program CL_API_CALL
CreateProgramWithILKHR(cl_context d_ctx, const void *il,
size_t length, cl_int *r_errcode);
}

View file

@ -364,7 +364,8 @@ clEnqueueTask(cl_command_queue d_q, cl_kernel d_kern,
}
CLOVER_API cl_int
clEnqueueNativeKernel(cl_command_queue d_q, void (*func)(void *),
clEnqueueNativeKernel(cl_command_queue d_q,
void (CL_CALLBACK * func)(void *),
void *args, size_t args_size,
cl_uint num_mems, const cl_mem *d_mems,
const void **mem_handles, cl_uint num_deps,

View file

@ -44,7 +44,7 @@ namespace {
class build_notifier {
public:
build_notifier(cl_program prog,
void (*notifer)(cl_program, void *), void *data) :
void (CL_CALLBACK * notifer)(cl_program, void *), void *data) :
prog_(prog), notifer(notifer), data_(data) { }
~build_notifier() {
@ -54,14 +54,14 @@ namespace {
private:
cl_program prog_;
void (*notifer)(cl_program, void *);
void (CL_CALLBACK * notifer)(cl_program, void *);
void *data_;
};
void
validate_build_common(const program &prog, cl_uint num_devs,
const cl_device_id *d_devs,
void (*pfn_notify)(cl_program, void *),
void (CL_CALLBACK * pfn_notify)(cl_program, void *),
void *user_data) {
if (!pfn_notify && user_data)
throw error(CL_INVALID_VALUE);
@ -267,7 +267,7 @@ clReleaseProgram(cl_program d_prog) try {
CLOVER_API cl_int
clBuildProgram(cl_program d_prog, cl_uint num_devs,
const cl_device_id *d_devs, const char *p_opts,
void (*pfn_notify)(cl_program, void *),
void (CL_CALLBACK * pfn_notify)(cl_program, void *),
void *user_data) try {
auto &prog = obj(d_prog);
auto devs =
@ -301,7 +301,7 @@ clCompileProgram(cl_program d_prog, cl_uint num_devs,
const cl_device_id *d_devs, const char *p_opts,
cl_uint num_headers, const cl_program *d_header_progs,
const char **header_names,
void (*pfn_notify)(cl_program, void *),
void (CL_CALLBACK * pfn_notify)(cl_program, void *),
void *user_data) try {
auto &prog = obj(d_prog);
auto devs =
@ -426,7 +426,7 @@ namespace {
CLOVER_API cl_program
clLinkProgram(cl_context d_ctx, cl_uint num_devs, const cl_device_id *d_devs,
const char *p_opts, cl_uint num_progs, const cl_program *d_progs,
void (*pfn_notify) (cl_program, void *), void *user_data,
void (CL_CALLBACK * pfn_notify) (cl_program, void *), void *user_data,
cl_int *r_errcode) try {
auto &ctx = obj(d_ctx);
const auto opts = build_options(p_opts, "CLOVER_EXTRA_LINK_OPTIONS");

View file

@ -970,6 +970,16 @@ clEnqueueMigrateMemObjects(cl_command_queue d_q,
return e.get();
}
static void CL_CALLBACK
free_queue(cl_command_queue d_q, cl_uint num_svm_pointers,
void *svm_pointers[], void *) {
clover::context &ctx = obj(d_q).context();
for (void *p : range(svm_pointers, num_svm_pointers)) {
ctx.remove_svm_allocation(p);
free(p);
}
}
cl_int
clover::EnqueueSVMFree(cl_command_queue d_q,
cl_uint num_svm_pointers,
@ -1003,14 +1013,7 @@ clover::EnqueueSVMFree(cl_command_queue d_q,
CLOVER_NOT_SUPPORTED_UNTIL("2.0");
return CL_INVALID_VALUE;
}
pfn_free_func = [](cl_command_queue d_q, cl_uint num_svm_pointers,
void *svm_pointers[], void *) {
clover::context &ctx = obj(d_q).context();
for (void *p : range(svm_pointers, num_svm_pointers)) {
ctx.remove_svm_allocation(p);
free(p);
}
};
pfn_free_func = free_queue;
}
auto hev = create<hard_event>(q, cmd, deps,

View file

@ -1,5 +1,5 @@
EXPORTS
clGetPlatformInfo
clGetExtensionFunctionAddress
clGetExtensionFunctionAddressForPlatform
clIcdGetPlatformIDsKHR
; stdcall calling convention have @number suffix on 32 bits architecture for gcc
clGetPlatformInfo@20
clGetExtensionFunctionAddress@4
clGetExtensionFunctionAddressForPlatform@8
clIcdGetPlatformIDsKHR@12

View file

@ -1,124 +1,124 @@
EXPORTS
clBuildProgram
clCreateBuffer
clCreateCommandQueue
clCreateContext
clCreateContextFromType
; stdcall calling convention have @number suffix on 32 bits architecture for gcc
clBuildProgram@24
clCreateBuffer@24
clCreateCommandQueue@20
clCreateContext@24
clCreateContextFromType@24
; clCreateFromGLBuffer
; clCreateFromGLRenderbuffer
; clCreateFromGLTexture2D
; clCreateFromGLTexture3D
clCreateImage2D
clCreateImage3D
clCreateKernel
clCreateKernelsInProgram
clCreateProgramWithBinary
clCreateProgramWithSource
clCreateSampler
clCreateImage2D@36
clCreateImage3D@44
clCreateKernel@12
clCreateKernelsInProgram@16
clCreateProgramWithBinary@28
clCreateProgramWithSource@20
clCreateSampler@20
; clEnqueueAcquireGLObjects
clEnqueueBarrier
clEnqueueCopyBuffer
clEnqueueCopyBufferToImage
clEnqueueCopyImage
clEnqueueCopyImageToBuffer
clEnqueueMapBuffer
clEnqueueMapImage
clEnqueueMarker
clEnqueueNDRangeKernel
clEnqueueNativeKernel
clEnqueueReadBuffer
clEnqueueReadImage
clEnqueueBarrier@4
clEnqueueCopyBuffer@36
clEnqueueCopyBufferToImage@36
clEnqueueCopyImage@36
clEnqueueCopyImageToBuffer@36
clEnqueueMapBuffer@44
clEnqueueMapImage@52
clEnqueueMarker@8
clEnqueueNDRangeKernel@36
clEnqueueNativeKernel@40
clEnqueueReadBuffer@36
clEnqueueReadImage@44
; clEnqueueReleaseGLObjects
clEnqueueTask
clEnqueueUnmapMemObject
clEnqueueWaitForEvents
clEnqueueWriteBuffer
clEnqueueWriteImage
clFinish
clFlush
clGetCommandQueueInfo
clGetContextInfo
clGetDeviceIDs
clGetDeviceInfo
clGetEventInfo
clGetEventProfilingInfo
clGetExtensionFunctionAddress
clEnqueueTask@20
clEnqueueUnmapMemObject@24
clEnqueueWaitForEvents@12
clEnqueueWriteBuffer@36
clEnqueueWriteImage@44
clFinish@4
clFlush@4
clGetCommandQueueInfo@20
clGetContextInfo@20
clGetDeviceIDs@24
clGetDeviceInfo@20
clGetEventInfo@20
clGetEventProfilingInfo@20
clGetExtensionFunctionAddress@4
; clGetGLObjectInfo
; clGetGLTextureInfo
clGetImageInfo
clGetKernelInfo
clGetKernelWorkGroupInfo
clGetMemObjectInfo
clGetPlatformIDs
clGetPlatformInfo
clGetProgramBuildInfo
clGetProgramInfo
clGetSamplerInfo
clGetSupportedImageFormats
clReleaseCommandQueue
clReleaseContext
clReleaseEvent
clReleaseKernel
clReleaseMemObject
clReleaseProgram
clReleaseSampler
clRetainCommandQueue
clRetainContext
clRetainEvent
clRetainKernel
clRetainMemObject
clRetainProgram
clRetainSampler
clGetImageInfo@20
clGetKernelInfo@20
clGetKernelWorkGroupInfo@24
clGetMemObjectInfo@20
clGetPlatformIDs@12
clGetPlatformInfo@20
clGetProgramBuildInfo@24
clGetProgramInfo@20
clGetSamplerInfo@20
clGetSupportedImageFormats@28
clReleaseCommandQueue@4
clReleaseContext@4
clReleaseEvent@4
clReleaseKernel@4
clReleaseMemObject@4
clReleaseProgram@4
clReleaseSampler@4
clRetainCommandQueue@4
clRetainContext@4
clRetainEvent@4
clRetainKernel@4
clRetainMemObject@4
clRetainProgram@4
clRetainSampler@4
; clSetCommandQueueProperty
clSetKernelArg
clUnloadCompiler
clWaitForEvents
clCreateSubBuffer
clCreateUserEvent
clEnqueueCopyBufferRect
clEnqueueReadBufferRect
clEnqueueWriteBufferRect
clSetEventCallback
clSetMemObjectDestructorCallback
clSetUserEventStatus
clCompileProgram
clSetKernelArg@16
clUnloadCompiler@0
clWaitForEvents@8
clCreateSubBuffer@24
clCreateUserEvent@8
clEnqueueCopyBufferRect@52
clEnqueueReadBufferRect@56
clEnqueueWriteBufferRect@56
clSetEventCallback@16
clSetMemObjectDestructorCallback@12
clSetUserEventStatus@8
clCompileProgram@36
; clCreateFromGLTexture
clCreateImage
clCreateProgramWithBuiltInKernels
clCreateSubDevices
clEnqueueBarrierWithWaitList
clEnqueueFillBuffer
clEnqueueFillImage
clEnqueueMarkerWithWaitList
clEnqueueMigrateMemObjects
clGetExtensionFunctionAddressForPlatform
clGetKernelArgInfo
clLinkProgram
clReleaseDevice
clRetainDevice
clUnloadPlatformCompiler
clCreateCommandQueueWithProperties
clCreatePipe
clCreateImage@28
clCreateProgramWithBuiltInKernels@20
clCreateSubDevices@20
clEnqueueBarrierWithWaitList@16
clEnqueueFillBuffer@36
clEnqueueFillImage@32
clEnqueueMarkerWithWaitList@16
clEnqueueMigrateMemObjects@32
clGetExtensionFunctionAddressForPlatform@8
clGetKernelArgInfo@24
clLinkProgram@36
clReleaseDevice@4
clRetainDevice@4
clUnloadPlatformCompiler@4
clCreateCommandQueueWithProperties@16
clCreatePipe@28
; clCreateSamplerWithProperties
clEnqueueSVMFree
clEnqueueSVMMap
clEnqueueSVMMemcpy
clEnqueueSVMMemFill
clEnqueueSVMUnmap
clGetPipeInfo
clSetKernelArgSVMPointer
clSetKernelExecInfo
clSVMAlloc
clSVMFree
clEnqueueSVMFree@32
clEnqueueSVMMap@36
clEnqueueSVMMemcpy@32
clEnqueueSVMMemFill@32
clEnqueueSVMUnmap@20
clGetPipeInfo@20
clSetKernelArgSVMPointer@12
clSetKernelExecInfo@16
clSVMAlloc@20
clSVMFree@8
; clCloneKernel
clCreateProgramWithIL
clEnqueueSVMMigrateMem
clGetDeviceAndHostTimer
clGetHostTimer
clGetKernelSubGroupInfo
clSetDefaultDeviceCommandQueue
clSetProgramReleaseCallback
clSetProgramSpecializationConstant
clCreateBufferWithProperties
clCreateImageWithProperties
clSetContextDestructorCallback
clCreateProgramWithIL@16
clEnqueueSVMMigrateMem@36
clGetDeviceAndHostTimer@12
clGetHostTimer@8
clGetKernelSubGroupInfo@32
clSetDefaultDeviceCommandQueue@12
clSetProgramReleaseCallback@12
clSetProgramSpecializationConstant@16
clCreateBufferWithProperties@28
clCreateImageWithProperties@32
clSetContextDestructorCallback@12

View file

@ -85,7 +85,13 @@ if not _shared_llvm or not (dep_clang.found() and dep_clang_usable)
endif
endif
ocldef = files(opencl_libname + '.def.in')[0]
ocldef_in = files(opencl_libname + '.def.in')[0]
ocldef = custom_target(
'ocldef.def',
input: ocldef_in,
output : 'ocldef.def',
command : gen_vs_module_defs_normal_command,
)
libopencl = shared_library(
opencl_libname,