From 8d34950abba82a25ce3df91cded8a65ce0435d6d Mon Sep 17 00:00:00 2001 From: foreman Date: Fri, 9 Oct 2015 16:58:53 -0400 Subject: [PATCH] P4 to Git Change 1198583 by lmoriche@lmoriche_opencl_dev on 2015/10/09 16:38:12 SWDEV-78467 - Add the LiquidFlash extension entrypoints Affected files ... ... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/cl_context.cpp#45 edit ... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/cl_lqdflash_amd.cpp#1 add ... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/cl_lqdflash_amd.h#1 add ... //depot/stg/opencl/drivers/opencl/api/opencl/khronos/headers/opencl2.0/CL/cl_ext.h#18 edit --- opencl/api/opencl/amdocl/cl_context.cpp | 11 ++++ opencl/api/opencl/amdocl/cl_lqdflash_amd.cpp | 57 +++++++++++++++++++ opencl/api/opencl/amdocl/cl_lqdflash_amd.h | 42 ++++++++++++++ .../khronos/headers/opencl2.0/CL/cl_ext.h | 39 +++++++++++++ 4 files changed, 149 insertions(+) create mode 100644 opencl/api/opencl/amdocl/cl_lqdflash_amd.cpp create mode 100644 opencl/api/opencl/amdocl/cl_lqdflash_amd.h diff --git a/opencl/api/opencl/amdocl/cl_context.cpp b/opencl/api/opencl/amdocl/cl_context.cpp index 3f8859886e..1abf6ae045 100644 --- a/opencl/api/opencl/amdocl/cl_context.cpp +++ b/opencl/api/opencl/amdocl/cl_context.cpp @@ -22,6 +22,7 @@ #include "cl_sdi_amd.h" #include "cl_thread_trace_amd.h" #include "cl_debugger_amd.h" +#include "cl_lqdflash_amd.h" #include #include @@ -512,6 +513,9 @@ clGetExtensionFunctionAddress(const char* func_name) #if cl_khr_il_program CL_EXTENSION_ENTRYPOINT_CHECK(clCreateProgramWithILKHR); #endif // cl_khr_il_program +#if cl_amd_liquid_flash + CL_EXTENSION_ENTRYPOINT_CHECK(clCreateFileObjectAMD); +#endif // cl_amd_liquid_flash break; case 'D': break; @@ -531,6 +535,9 @@ clGetExtensionFunctionAddress(const char* func_name) CL_EXTENSION_ENTRYPOINT_CHECK(clEnqueueWaitSignalAMD); CL_EXTENSION_ENTRYPOINT_CHECK(clEnqueueWriteSignalAMD); CL_EXTENSION_ENTRYPOINT_CHECK(clEnqueueMakeBuffersResidentAMD); +#if cl_amd_liquid_flash + CL_EXTENSION_ENTRYPOINT_CHECK(clEnqueueWriteBufferFromFileAMD); +#endif // cl_amd_liquid_flash break; case 'G': CL_EXTENSION_ENTRYPOINT_CHECK(clGetKernelInfoAMD); @@ -590,6 +597,10 @@ clGetExtensionFunctionAddress(const char* func_name) CL_EXTENSION_ENTRYPOINT_CHECK(clRetainDeviceEXT); CL_EXTENSION_ENTRYPOINT_CHECK(clReleaseDeviceEXT); #endif // cl_ext_device_fission +#if cl_amd_liquid_flash + CL_EXTENSION_ENTRYPOINT_CHECK(clRetainFileObjectAMD); + CL_EXTENSION_ENTRYPOINT_CHECK(clReleaseFileObjectAMD); +#endif // cl_amd_liquid_flash break; case 'S': CL_EXTENSION_ENTRYPOINT_CHECK(clSetThreadTraceParamAMD); diff --git a/opencl/api/opencl/amdocl/cl_lqdflash_amd.cpp b/opencl/api/opencl/amdocl/cl_lqdflash_amd.cpp new file mode 100644 index 0000000000..acd3bd88f2 --- /dev/null +++ b/opencl/api/opencl/amdocl/cl_lqdflash_amd.cpp @@ -0,0 +1,57 @@ +// +// Copyright (c) 2015 Advanced Micro Devices, Inc. All rights reserved. +// + +#include "cl_common.hpp" + +#include "cl_lqdflash_amd.h" + +/*! \addtogroup API + * @{ + * + * \addtogroup AMD_Extensions + * @{ + * + */ + +RUNTIME_ENTRY_RET(cl_file_amd, clCreateFileObjectAMD, ( + cl_context context, + cl_file_flags_amd, + cl_char * file_name, + cl_int *errcode_ret)) +{ + *not_null(errcode_ret) = CL_INVALID_CONTEXT; + return (cl_file_amd) 0; +} +RUNTIME_EXIT + +RUNTIME_ENTRY(cl_int, clRetainFileObjectAMD, ( + cl_file_amd file)) +{ + return CL_INVALID_FILE_OBJECT_AMD; +} +RUNTIME_EXIT + +RUNTIME_ENTRY(cl_int, clReleaseFileObjectAMD, ( + cl_file_amd file)) +{ + return CL_INVALID_FILE_OBJECT_AMD; +} +RUNTIME_EXIT + +RUNTIME_ENTRY(cl_int, clEnqueueWriteBufferFromFileAMD, ( + cl_command_queue command_queue, + cl_mem buffer, + cl_bool blocking_write, + size_t buffer_offset, + size_t cb, + cl_file_amd file, + size_t file_offset, + cl_uint num_events_in_wait_list, + const cl_event *event_wait_list, + cl_event *event)) +{ + return CL_INVALID_FILE_OBJECT_AMD; +} +RUNTIME_EXIT + diff --git a/opencl/api/opencl/amdocl/cl_lqdflash_amd.h b/opencl/api/opencl/amdocl/cl_lqdflash_amd.h new file mode 100644 index 0000000000..8de90f4107 --- /dev/null +++ b/opencl/api/opencl/amdocl/cl_lqdflash_amd.h @@ -0,0 +1,42 @@ +#ifndef __CL_LQDFLASH_AMD_H +#define __CL_LQDFLASH_AMD_H + +#include "CL/cl_ext.h" + +#ifdef __cplusplus +extern "C" { +#endif /*__cplusplus*/ + +extern CL_API_ENTRY cl_file_amd CL_API_CALL +clCreateFileObjectAMD( + cl_context context, + cl_file_flags_amd flags, + cl_char * file_name, + cl_int * errcode_ret) CL_EXT_SUFFIX__VERSION_1_2; + +extern CL_API_ENTRY cl_int CL_API_CALL +clRetainFileObjectAMD( + cl_file_amd file) CL_EXT_SUFFIX__VERSION_1_2; + +extern CL_API_ENTRY cl_int CL_API_CALL +clReleaseFileObjectAMD( + cl_file_amd file) CL_EXT_SUFFIX__VERSION_1_2; + +extern CL_API_ENTRY cl_int CL_API_CALL +clEnqueueWriteBufferFromFileAMD( + cl_command_queue command_queue, + cl_mem buffer, + cl_bool blocking_write, + size_t buffer_offset, + size_t cb, + cl_file_amd file, + size_t file_offset, + cl_uint num_events_in_wait_list, + const cl_event * event_wait_list, + cl_event * event) CL_EXT_SUFFIX__VERSION_1_2; + +#ifdef __cplusplus +} /*extern "C"*/ +#endif /*__cplusplus*/ + +#endif diff --git a/opencl/api/opencl/khronos/headers/opencl2.0/CL/cl_ext.h b/opencl/api/opencl/khronos/headers/opencl2.0/CL/cl_ext.h index fbe756c8d6..f9dbf0c528 100644 --- a/opencl/api/opencl/khronos/headers/opencl2.0/CL/cl_ext.h +++ b/opencl/api/opencl/khronos/headers/opencl2.0/CL/cl_ext.h @@ -450,6 +450,45 @@ typedef CL_API_ENTRY cl_int cl_event * /*event*/) CL_EXT_SUFFIX__VERSION_1_2; #endif /* CL_VERSION_1_2 */ +#ifdef CL_VERSION_1_2 +/********************** +* cl_amd_liquid_flash * +***********************/ +#define cl_amd_liquid_flash 1 + +#define CL_INVALID_FILE_OBJECT_AMD 0x404D + +typedef struct _cl_file_amd * cl_file_amd; + +typedef cl_uint cl_file_flags_amd; + +typedef CL_API_ENTRY cl_file_amd +(CL_API_CALL * clCreateFileObjectAMD_fn)( cl_context /*context*/, + cl_file_flags_amd /*flags*/, + cl_char * /*file_name*/, + cl_int * /*errcode_ret*/) CL_EXT_SUFFIX__VERSION_1_2; + +typedef CL_API_ENTRY cl_int +(CL_API_CALL * clRetainFileObjectAMD_fn)( cl_file_amd /*file*/) CL_EXT_SUFFIX__VERSION_1_2; + +typedef CL_API_ENTRY cl_int +(CL_API_CALL * clReleaseFileObjectAMD_fn)( cl_file_amd /*file*/) CL_EXT_SUFFIX__VERSION_1_2; + +typedef CL_API_ENTRY cl_int +(CL_API_CALL * clEnqueueWriteBufferFromFileAMD_fn)( cl_command_queue /*command_queue*/, + cl_mem /*buffer*/, + cl_bool /*blocking_write*/, + size_t /*buffer_offset*/, + size_t /*cb*/, + cl_file_amd /*file*/, + size_t /*file_offset*/, + cl_uint /*num_events_in_wait_list*/, + const cl_event * /*event_wait_list*/, + cl_event * /*event*/) CL_EXT_SUFFIX__VERSION_1_2; + +#endif /* CL_VERSION_1_2 */ + + #ifdef CL_VERSION_2_0 /********************************* * cl_khr_sub_groups extension