@@ -145,21 +145,17 @@ struct ExtFuncPtrT {
145145 clDeviceMemAllocINTEL_fn clDeviceMemAllocINTELCache;
146146 clSharedMemAllocINTEL_fn clSharedMemAllocINTELCache;
147147 clGetDeviceFunctionPointer_fn clGetDeviceFunctionPointerCache;
148- clCreateBufferWithPropertiesINTEL_fn
149- clCreateBufferWithPropertiesINTELCache;
148+ clCreateBufferWithPropertiesINTEL_fn clCreateBufferWithPropertiesINTELCache;
150149 clMemBlockingFreeINTEL_fn clMemBlockingFreeINTELCache;
151- clSetKernelArgMemPointerINTEL_fn
152- clSetKernelArgMemPointerINTELCache;
150+ clSetKernelArgMemPointerINTEL_fn clSetKernelArgMemPointerINTELCache;
153151 clEnqueueMemFillINTEL_fn clEnqueueMemFillINTELCache;
154152 clEnqueueMemcpyINTEL_fn clEnqueueMemcpyINTELCache;
155153 clGetMemAllocInfoINTEL_fn clGetMemAllocInfoINTELCache;
156- clEnqueueWriteGlobalVariable_fn
157- clEnqueueWriteGlobalVariableCache;
154+ clEnqueueWriteGlobalVariable_fn clEnqueueWriteGlobalVariableCache;
158155 clEnqueueReadGlobalVariable_fn clEnqueueReadGlobalVariableCache;
159156 clEnqueueReadHostPipeINTEL_fn clEnqueueReadHostPipeINTELCache;
160157 clEnqueueWriteHostPipeINTEL_fn clEnqueueWriteHostPipeINTELCache;
161- clSetProgramSpecializationConstant_fn
162- clSetProgramSpecializationConstantCache;
158+ clSetProgramSpecializationConstant_fn clSetProgramSpecializationConstantCache;
163159 clCreateCommandBufferKHR_fn clCreateCommandBufferKHRCache;
164160 clRetainCommandBufferKHR_fn clRetainCommandBufferKHRCache;
165161 clReleaseCommandBufferKHR_fn clReleaseCommandBufferKHRCache;
@@ -170,36 +166,32 @@ struct ExtFuncPtrT {
170166 clCommandFillBufferKHR_fn clCommandFillBufferKHRCache;
171167 clEnqueueCommandBufferKHR_fn clEnqueueCommandBufferKHRCache;
172168};
173- }
169+ } // namespace cl_adapter
174170
175171struct ur_platform_handle_t_ {
176- using native_type = cl_platform_id;
177- native_type Platform;
178- std::unique_ptr<cl_adapter::ExtFuncPtrT> ExtFuncPtr;
179-
180- ur_platform_handle_t_ (native_type Plat):Platform(Plat) {
181- std::make_unique<cl_adapter::ExtFuncPtrT>();
182- }
183-
184- ~ur_platform_handle_t_ () {
185- ExtFuncPtr.reset ();
186- }
187-
188- ur_result_t getPlatformVersion (oclv::OpenCLVersion &Version);
189-
190- template <typename T>
191- ur_result_t getExtFunc (T CachedExtFunc, const char *FuncName, T *Fptr) {
192- if (!CachedExtFunc) {
193- // TODO: check that the function is available
194- CachedExtFunc = reinterpret_cast <T>(
195- clGetExtensionFunctionAddressForPlatform (Platform, FuncName));
196- if (!CachedExtFunc) {
197- return UR_RESULT_ERROR_INVALID_VALUE;
198- }
199- }
200- *Fptr = CachedExtFunc;
201- return UR_RESULT_SUCCESS;
172+ using native_type = cl_platform_id;
173+ native_type Platform;
174+ std::unique_ptr<cl_adapter::ExtFuncPtrT> ExtFuncPtr;
175+
176+ ur_platform_handle_t_ (native_type Plat) : Platform(Plat) {
177+ std::make_unique<cl_adapter::ExtFuncPtrT>();
178+ }
179+
180+ ~ur_platform_handle_t_ () { ExtFuncPtr.reset (); }
181+
182+ template <typename T>
183+ ur_result_t getExtFunc (T CachedExtFunc, const char *FuncName, T *Fptr) {
184+ if (!CachedExtFunc) {
185+ // TODO: check that the function is available
186+ CachedExtFunc = reinterpret_cast <T>(
187+ clGetExtensionFunctionAddressForPlatform (Platform, FuncName));
188+ if (!CachedExtFunc) {
189+ return UR_RESULT_ERROR_INVALID_VALUE;
190+ }
202191 }
192+ *Fptr = CachedExtFunc;
193+ return UR_RESULT_SUCCESS;
194+ }
203195
204- native_type get () { return Platform; }
196+ native_type get () { return Platform; }
205197};
0 commit comments