From 26bd60ab16d573bb2f17cf85430d401b60588a94 Mon Sep 17 00:00:00 2001 From: omarahmed1111 Date: Mon, 11 Dec 2023 14:05:10 +0000 Subject: [PATCH] Formating --- source/adapters/opencl/context.cpp | 23 +++++---- source/adapters/opencl/context.hpp | 22 +++++---- source/adapters/opencl/device.cpp | 12 ++--- source/adapters/opencl/device.hpp | 8 ++-- source/adapters/opencl/enqueue.cpp | 20 ++++---- source/adapters/opencl/kernel.cpp | 4 +- source/adapters/opencl/memory.cpp | 12 ++--- source/adapters/opencl/platform.cpp | 43 +++++++++-------- source/adapters/opencl/platform.hpp | 8 ++-- source/adapters/opencl/program.cpp | 72 +++++++++++++---------------- source/adapters/opencl/program.hpp | 13 +++--- source/adapters/opencl/queue.cpp | 11 ++--- source/adapters/opencl/sampler.cpp | 5 +- source/adapters/opencl/usm.cpp | 15 +++--- 14 files changed, 130 insertions(+), 138 deletions(-) diff --git a/source/adapters/opencl/context.cpp b/source/adapters/opencl/context.cpp index 875fdff201..3f15bb986f 100644 --- a/source/adapters/opencl/context.cpp +++ b/source/adapters/opencl/context.cpp @@ -42,9 +42,9 @@ UR_APIEXPORT ur_result_t UR_APICALL urContextCreate( CLDevices[i] = phDevices[i]->get(); } - cl_context Ctx = clCreateContext(nullptr, cl_adapter::cast(DeviceCount), - CLDevices.data(), - nullptr, nullptr, cl_adapter::cast(&Ret)); + cl_context Ctx = clCreateContext( + nullptr, cl_adapter::cast(DeviceCount), CLDevices.data(), + nullptr, nullptr, cl_adapter::cast(&Ret)); *phContext = new ur_context_handle_t_(Ctx, DeviceCount, phDevices); return mapCLErrorToUR(Ret); @@ -95,9 +95,8 @@ urContextGetInfo(ur_context_handle_t hContext, ur_context_info_t propName, case UR_CONTEXT_INFO_DEVICES: case UR_CONTEXT_INFO_REFERENCE_COUNT: { size_t CheckPropSize = 0; - auto ClResult = - clGetContextInfo(hContext->get(), CLPropName, - propSize, pPropValue, &CheckPropSize); + auto ClResult = clGetContextInfo(hContext->get(), CLPropName, propSize, + pPropValue, &CheckPropSize); if (pPropValue && CheckPropSize != propSize) { return UR_RESULT_ERROR_INVALID_SIZE; } @@ -134,11 +133,11 @@ UR_APIEXPORT ur_result_t UR_APICALL urContextGetNativeHandle( } UR_APIEXPORT ur_result_t UR_APICALL urContextCreateWithNativeHandle( - ur_native_handle_t hNativeContext, uint32_t numDevices, const ur_device_handle_t *phDevices, - const ur_context_native_properties_t *, ur_context_handle_t *phContext) { + ur_native_handle_t hNativeContext, uint32_t numDevices, + const ur_device_handle_t *phDevices, const ur_context_native_properties_t *, + ur_context_handle_t *phContext) { - cl_context NativeHandle = - reinterpret_cast(hNativeContext); + cl_context NativeHandle = reinterpret_cast(hNativeContext); *phContext = new ur_context_handle_t_(NativeHandle, numDevices, phDevices); return UR_RESULT_SUCCESS; } @@ -189,8 +188,8 @@ UR_APIEXPORT ur_result_t UR_APICALL urContextSetExtendedDeleter( auto *C = static_cast(pUserData); C->execute(); }; - CL_RETURN_ON_FAILURE(clSetContextDestructorCallback( - hContext->get(), ClCallback, Callback)); + CL_RETURN_ON_FAILURE( + clSetContextDestructorCallback(hContext->get(), ClCallback, Callback)); return UR_RESULT_SUCCESS; } diff --git a/source/adapters/opencl/context.hpp b/source/adapters/opencl/context.hpp index 7156372a87..46cbd2167f 100644 --- a/source/adapters/opencl/context.hpp +++ b/source/adapters/opencl/context.hpp @@ -21,18 +21,20 @@ getDevicesFromContext(ur_context_handle_t hContext, } struct ur_context_handle_t_ { - using native_type = cl_context; - native_type Context; - std::vector Devices; - uint32_t DeviceCount; + using native_type = cl_context; + native_type Context; + std::vector Devices; + uint32_t DeviceCount; - ur_context_handle_t_(native_type Ctx, uint32_t DevCount, const ur_device_handle_t *phDevices) : Context(Ctx), DeviceCount(DevCount) { - for (uint32_t i = 0; i < DeviceCount; i++) { - Devices.emplace_back(phDevices[i]); - } + ur_context_handle_t_(native_type Ctx, uint32_t DevCount, + const ur_device_handle_t *phDevices) + : Context(Ctx), DeviceCount(DevCount) { + for (uint32_t i = 0; i < DeviceCount; i++) { + Devices.emplace_back(phDevices[i]); } + } - ~ur_context_handle_t_() {} + ~ur_context_handle_t_() {} - native_type get() { return Context; } + native_type get() { return Context; } }; diff --git a/source/adapters/opencl/device.cpp b/source/adapters/opencl/device.cpp index 165358d7ab..629e205b1a 100644 --- a/source/adapters/opencl/device.cpp +++ b/source/adapters/opencl/device.cpp @@ -52,11 +52,10 @@ ur_result_t cl_adapter::checkDeviceExtensions( return UR_RESULT_SUCCESS; } -UR_APIEXPORT ur_result_t UR_APICALL urDeviceGet(ur_platform_handle_t hPlatform, - ur_device_type_t DeviceType, - [[maybe_unused]] uint32_t NumEntries, - ur_device_handle_t *phDevices, - uint32_t *pNumDevices) { +UR_APIEXPORT ur_result_t UR_APICALL +urDeviceGet(ur_platform_handle_t hPlatform, ur_device_type_t DeviceType, + [[maybe_unused]] uint32_t NumEntries, ur_device_handle_t *phDevices, + uint32_t *pNumDevices) { cl_device_type Type; switch (DeviceType) { @@ -1000,7 +999,8 @@ UR_APIEXPORT ur_result_t UR_APICALL urDevicePartition( CLNumDevicesRet, CLSubDevices.data(), nullptr)); for (uint32_t i = 0; i < NumDevices; i++) { - phSubDevices[i] = new ur_device_handle_t_(CLSubDevices[i], hDevice->Platform, hDevice); + phSubDevices[i] = + new ur_device_handle_t_(CLSubDevices[i], hDevice->Platform, hDevice); } } diff --git a/source/adapters/opencl/device.hpp b/source/adapters/opencl/device.hpp index cedff1a82e..dc29a1692e 100644 --- a/source/adapters/opencl/device.hpp +++ b/source/adapters/opencl/device.hpp @@ -24,14 +24,16 @@ struct ur_device_handle_t_ { native_type Device; ur_platform_handle_t Platform; cl_device_type Type = 0; - ur_device_handle_t ParentDevice = nullptr; + ur_device_handle_t ParentDevice = nullptr; - ur_device_handle_t_(native_type Dev, ur_platform_handle_t Plat, ur_device_handle_t Parent) + ur_device_handle_t_(native_type Dev, ur_platform_handle_t Plat, + ur_device_handle_t Parent) : Device(Dev), Platform(Plat), ParentDevice(Parent) { if (Parent) { Type = Parent->Type; } else { - clGetDeviceInfo(Device, CL_DEVICE_TYPE, sizeof(cl_device_type), &Type, nullptr); + clGetDeviceInfo(Device, CL_DEVICE_TYPE, sizeof(cl_device_type), &Type, + nullptr); } } diff --git a/source/adapters/opencl/enqueue.cpp b/source/adapters/opencl/enqueue.cpp index 420a070653..5c56cd2381 100644 --- a/source/adapters/opencl/enqueue.cpp +++ b/source/adapters/opencl/enqueue.cpp @@ -345,9 +345,8 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueDeviceGlobalVariableWrite( if (!F || Res != CL_SUCCESS) return UR_RESULT_ERROR_INVALID_OPERATION; - Res = F(cl_adapter::cast(hQueue), - hProgram->get(), name, blockingWrite, count, - offset, pSrc, numEventsInWaitList, + Res = F(cl_adapter::cast(hQueue), hProgram->get(), name, + blockingWrite, count, offset, pSrc, numEventsInWaitList, cl_adapter::cast(phEventWaitList), cl_adapter::cast(phEvent)); @@ -376,9 +375,8 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueDeviceGlobalVariableRead( if (!F || Res != CL_SUCCESS) return UR_RESULT_ERROR_INVALID_OPERATION; - Res = F(cl_adapter::cast(hQueue), - hProgram->get(), name, blockingRead, count, - offset, pDst, numEventsInWaitList, + Res = F(cl_adapter::cast(hQueue), hProgram->get(), name, + blockingRead, count, offset, pDst, numEventsInWaitList, cl_adapter::cast(phEventWaitList), cl_adapter::cast(phEvent)); @@ -407,9 +405,8 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueReadHostPipe( if (FuncPtr) { RetVal = mapCLErrorToUR( - FuncPtr(cl_adapter::cast(hQueue), - hProgram->get(), pipe_symbol, blocking, - pDst, size, numEventsInWaitList, + FuncPtr(cl_adapter::cast(hQueue), hProgram->get(), + pipe_symbol, blocking, pDst, size, numEventsInWaitList, cl_adapter::cast(phEventWaitList), cl_adapter::cast(phEvent))); } @@ -439,9 +436,8 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueWriteHostPipe( if (FuncPtr) { RetVal = mapCLErrorToUR( - FuncPtr(cl_adapter::cast(hQueue), - hProgram->get(), pipe_symbol, blocking, - pSrc, size, numEventsInWaitList, + FuncPtr(cl_adapter::cast(hQueue), hProgram->get(), + pipe_symbol, blocking, pSrc, size, numEventsInWaitList, cl_adapter::cast(phEventWaitList), cl_adapter::cast(phEvent))); } diff --git a/source/adapters/opencl/kernel.cpp b/source/adapters/opencl/kernel.cpp index 71a728a506..a589ffd70f 100644 --- a/source/adapters/opencl/kernel.cpp +++ b/source/adapters/opencl/kernel.cpp @@ -19,8 +19,8 @@ urKernelCreate(ur_program_handle_t hProgram, const char *pKernelName, ur_kernel_handle_t *phKernel) { cl_int CLResult; - *phKernel = cl_adapter::cast(clCreateKernel( - hProgram->get(), pKernelName, &CLResult)); + *phKernel = cl_adapter::cast( + clCreateKernel(hProgram->get(), pKernelName, &CLResult)); CL_RETURN_ON_FAILURE(CLResult); return UR_RESULT_SUCCESS; } diff --git a/source/adapters/opencl/memory.cpp b/source/adapters/opencl/memory.cpp index 2505be4d2e..1eadd01fd8 100644 --- a/source/adapters/opencl/memory.cpp +++ b/source/adapters/opencl/memory.cpp @@ -270,9 +270,9 @@ UR_APIEXPORT ur_result_t UR_APICALL urMemBufferCreate( } void *HostPtr = pProperties ? pProperties->pHost : nullptr; - *phBuffer = reinterpret_cast(clCreateBuffer( - hContext->get(), static_cast(flags), - size, HostPtr, cl_adapter::cast(&RetErr))); + *phBuffer = reinterpret_cast( + clCreateBuffer(hContext->get(), static_cast(flags), size, + HostPtr, cl_adapter::cast(&RetErr))); CL_RETURN_ON_FAILURE(RetErr); return UR_RESULT_SUCCESS; @@ -289,9 +289,9 @@ UR_APIEXPORT ur_result_t UR_APICALL urMemImageCreate( cl_image_desc ImageDesc = mapURImageDescToCL(pImageDesc); cl_map_flags MapFlags = convertURMemFlagsToCL(flags); - *phMem = reinterpret_cast(clCreateImage( - hContext->get(), MapFlags, &ImageFormat, - &ImageDesc, pHost, cl_adapter::cast(&RetErr))); + *phMem = reinterpret_cast( + clCreateImage(hContext->get(), MapFlags, &ImageFormat, &ImageDesc, pHost, + cl_adapter::cast(&RetErr))); CL_RETURN_ON_FAILURE(RetErr); return UR_RESULT_SUCCESS; diff --git a/source/adapters/opencl/platform.cpp b/source/adapters/opencl/platform.cpp index 86027d5beb..2526c14a51 100644 --- a/source/adapters/opencl/platform.cpp +++ b/source/adapters/opencl/platform.cpp @@ -66,9 +66,9 @@ urPlatformGetInfo(ur_platform_handle_t hPlatform, ur_platform_info_t propName, if (hPlatform) { Plat = hPlatform->get(); } - CL_RETURN_ON_FAILURE(clGetPlatformInfo(Plat, CLPropName, - propSize, pPropValue, pSizeRet)); - + CL_RETURN_ON_FAILURE( + clGetPlatformInfo(Plat, CLPropName, propSize, pPropValue, pSizeRet)); + return UR_RESULT_SUCCESS; } default: @@ -93,26 +93,25 @@ urPlatformGet(ur_adapter_handle_t *, uint32_t, uint32_t NumEntries, cl_int Result = CL_SUCCESS; std::call_once( - InitFlag, - [](cl_int &Result) { - Result = clGetPlatformIDs(0, nullptr, &NumPlatforms); - if (Result != CL_SUCCESS) { - return Result; - } - std::vector CLPlatforms(NumPlatforms); - Result = clGetPlatformIDs(cl_adapter::cast(NumPlatforms), - CLPlatforms.data(), - nullptr); - if (Result != CL_SUCCESS) { + InitFlag, + [](cl_int &Result) { + Result = clGetPlatformIDs(0, nullptr, &NumPlatforms); + if (Result != CL_SUCCESS) { + return Result; + } + std::vector CLPlatforms(NumPlatforms); + Result = clGetPlatformIDs(cl_adapter::cast(NumPlatforms), + CLPlatforms.data(), nullptr); + if (Result != CL_SUCCESS) { + return Result; + } + URPlatforms.resize(NumPlatforms); + for (uint32_t i = 0; i < NumPlatforms; i++) { + URPlatforms[i] = new ur_platform_handle_t_(CLPlatforms[i]); + } return Result; - } - URPlatforms.resize(NumPlatforms); - for (uint32_t i = 0; i < NumPlatforms; i++) { - URPlatforms[i] = new ur_platform_handle_t_(CLPlatforms[i]); - } - return Result; - }, - Result); + }, + Result); /* Absorb the CL_PLATFORM_NOT_FOUND_KHR and just return 0 in num_platforms */ if (Result == CL_PLATFORM_NOT_FOUND_KHR) { diff --git a/source/adapters/opencl/platform.hpp b/source/adapters/opencl/platform.hpp index ebdcf4d134..667b998970 100644 --- a/source/adapters/opencl/platform.hpp +++ b/source/adapters/opencl/platform.hpp @@ -202,14 +202,16 @@ struct ur_platform_handle_t_ { ur_result_t InitDevices() { cl_uint DeviceNum = 0; - CL_RETURN_ON_FAILURE(clGetDeviceIDs(Platform, CL_DEVICE_TYPE_ALL, 0, nullptr, &DeviceNum)); + CL_RETURN_ON_FAILURE( + clGetDeviceIDs(Platform, CL_DEVICE_TYPE_ALL, 0, nullptr, &DeviceNum)); std::vector CLDevices(DeviceNum); - CL_RETURN_ON_FAILURE(clGetDeviceIDs(Platform, CL_DEVICE_TYPE_ALL, DeviceNum, CLDevices.data(), nullptr)); + CL_RETURN_ON_FAILURE(clGetDeviceIDs(Platform, CL_DEVICE_TYPE_ALL, DeviceNum, + CLDevices.data(), nullptr)); Devices = std::vector(DeviceNum); for (size_t i = 0; i < DeviceNum; i++) { - Devices[i] = new ur_device_handle_t_(CLDevices[i], this, nullptr); + Devices[i] = new ur_device_handle_t_(CLDevices[i], this, nullptr); } return UR_RESULT_SUCCESS; diff --git a/source/adapters/opencl/program.cpp b/source/adapters/opencl/program.cpp index 94d13d48a2..33cf125d73 100644 --- a/source/adapters/opencl/program.cpp +++ b/source/adapters/opencl/program.cpp @@ -8,11 +8,11 @@ // //===----------------------------------------------------------------------===// +#include "program.hpp" #include "common.hpp" #include "context.hpp" #include "device.hpp" #include "platform.hpp" -#include "program.hpp" static ur_result_t getDevicesFromProgram( ur_program_handle_t hProgram, @@ -69,7 +69,8 @@ UR_APIEXPORT ur_result_t UR_APICALL urProgramCreateWithIL( } } - cl_program Program = clCreateProgramWithIL(hContext->get(), pIL, length, &Err); + cl_program Program = + clCreateProgramWithIL(hContext->get(), pIL, length, &Err); CL_RETURN_ON_FAILURE(Err); *phProgram = new ur_program_handle_t_(Program, hContext); @@ -117,8 +118,8 @@ UR_APIEXPORT ur_result_t UR_APICALL urProgramCreateWithBinary( cl_int BinaryStatus[1]; cl_int CLResult; cl_program Program = clCreateProgramWithBinary( - hContext->get(), cl_adapter::cast(1u), - Devices, Lengths, &pBinary, BinaryStatus, &CLResult); + hContext->get(), cl_adapter::cast(1u), Devices, Lengths, + &pBinary, BinaryStatus, &CLResult); *phProgram = new ur_program_handle_t_(Program, hContext); CL_RETURN_ON_FAILURE(BinaryStatus[0]); CL_RETURN_ON_FAILURE(CLResult); @@ -133,10 +134,9 @@ urProgramCompile([[maybe_unused]] ur_context_handle_t hContext, std::unique_ptr> DevicesInProgram; CL_RETURN_ON_FAILURE(getDevicesFromProgram(hProgram, DevicesInProgram)); - CL_RETURN_ON_FAILURE(clCompileProgram(hProgram->get(), - DevicesInProgram->size(), - DevicesInProgram->data(), pOptions, 0, - nullptr, nullptr, nullptr, nullptr)); + CL_RETURN_ON_FAILURE(clCompileProgram( + hProgram->get(), DevicesInProgram->size(), DevicesInProgram->data(), + pOptions, 0, nullptr, nullptr, nullptr, nullptr)); return UR_RESULT_SUCCESS; } @@ -171,9 +171,9 @@ UR_APIEXPORT ur_result_t UR_APICALL urProgramGetInfo(ur_program_handle_t hProgram, ur_program_info_t propName, size_t propSize, void *pPropValue, size_t *pPropSizeRet) { size_t CheckPropSize = 0; - auto ClResult = clGetProgramInfo(hProgram->get(), - mapURProgramInfoToCL(propName), propSize, - pPropValue, &CheckPropSize); + auto ClResult = + clGetProgramInfo(hProgram->get(), mapURProgramInfoToCL(propName), + propSize, pPropValue, &CheckPropSize); if (pPropValue && CheckPropSize != propSize) { return UR_RESULT_ERROR_INVALID_SIZE; } @@ -191,9 +191,9 @@ urProgramBuild([[maybe_unused]] ur_context_handle_t hContext, std::unique_ptr> DevicesInProgram; CL_RETURN_ON_FAILURE(getDevicesFromProgram(hProgram, DevicesInProgram)); - CL_RETURN_ON_FAILURE(clBuildProgram( - hProgram->get(), DevicesInProgram->size(), - DevicesInProgram->data(), pOptions, nullptr, nullptr)); + CL_RETURN_ON_FAILURE(clBuildProgram(hProgram->get(), DevicesInProgram->size(), + DevicesInProgram->data(), pOptions, + nullptr, nullptr)); return UR_RESULT_SUCCESS; } @@ -207,11 +207,9 @@ urProgramLink(ur_context_handle_t hContext, uint32_t count, for (uint32_t i = 0; i < count; i++) { CLPrograms[i] = phPrograms[i]->get(); } - cl_program Program = - clLinkProgram(hContext->get(), 0, nullptr, - pOptions, cl_adapter::cast(count), - CLPrograms.data(), nullptr, - nullptr, &CLResult); + cl_program Program = clLinkProgram( + hContext->get(), 0, nullptr, pOptions, cl_adapter::cast(count), + CLPrograms.data(), nullptr, nullptr, &CLResult); *phProgram = new ur_program_handle_t_(Program, hContext); CL_RETURN_ON_FAILURE(CLResult); @@ -278,16 +276,14 @@ urProgramGetBuildInfo(ur_program_handle_t hProgram, ur_device_handle_t hDevice, UrReturnHelper ReturnValue(propSize, pPropValue, pPropSizeRet); cl_program_binary_type BinaryType; CL_RETURN_ON_FAILURE(clGetProgramBuildInfo( - hProgram->get(), hDevice->get(), - mapURProgramBuildInfoToCL(propName), sizeof(cl_program_binary_type), - &BinaryType, nullptr)); + hProgram->get(), hDevice->get(), mapURProgramBuildInfoToCL(propName), + sizeof(cl_program_binary_type), &BinaryType, nullptr)); return ReturnValue(mapCLBinaryTypeToUR(BinaryType)); } size_t CheckPropSize = 0; - cl_int ClErr = - clGetProgramBuildInfo(hProgram->get(), - hDevice->get(), mapURProgramBuildInfoToCL(propName), - propSize, pPropValue, &CheckPropSize); + cl_int ClErr = clGetProgramBuildInfo(hProgram->get(), hDevice->get(), + mapURProgramBuildInfoToCL(propName), + propSize, pPropValue, &CheckPropSize); if (pPropValue && CheckPropSize != propSize) { return UR_RESULT_ERROR_INVALID_SIZE; } @@ -309,8 +305,7 @@ urProgramRetain(ur_program_handle_t hProgram) { UR_APIEXPORT ur_result_t UR_APICALL urProgramRelease(ur_program_handle_t hProgram) { - CL_RETURN_ON_FAILURE( - clReleaseProgram(hProgram->get())); + CL_RETURN_ON_FAILURE(clReleaseProgram(hProgram->get())); return UR_RESULT_SUCCESS; } @@ -325,8 +320,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urProgramCreateWithNativeHandle( ur_native_handle_t hNativeProgram, ur_context_handle_t hContext, const ur_program_native_properties_t *pProperties, ur_program_handle_t *phProgram) { - cl_program NativeHandle = - reinterpret_cast(hNativeProgram); + cl_program NativeHandle = reinterpret_cast(hNativeProgram); *phProgram = new ur_program_handle_t_(NativeHandle, hContext); if (!pProperties || !pProperties->isNativeHandleOwned) { return urProgramRetain(*phProgram); @@ -382,7 +376,8 @@ UR_APIEXPORT ur_result_t UR_APICALL urProgramSetSpecializationConstants( SetProgramSpecializationConstant = nullptr; const ur_result_t URResult = cl_ext::getExtFuncFromContext< decltype(SetProgramSpecializationConstant)>( - Ctx->get(), cl_ext::ExtFuncPtrCache->clSetProgramSpecializationConstantCache, + Ctx->get(), + cl_ext::ExtFuncPtrCache->clSetProgramSpecializationConstantCache, cl_ext::SetProgramSpecializationConstantName, &SetProgramSpecializationConstant); @@ -449,15 +444,14 @@ UR_APIEXPORT ur_result_t UR_APICALL urProgramGetFunctionPointer( // throws exceptions. *ppFunctionPointer = 0; size_t Size; - CL_RETURN_ON_FAILURE(clGetProgramInfo(hProgram->get(), - CL_PROGRAM_KERNEL_NAMES, 0, nullptr, - &Size)); + CL_RETURN_ON_FAILURE(clGetProgramInfo( + hProgram->get(), CL_PROGRAM_KERNEL_NAMES, 0, nullptr, &Size)); std::string KernelNames(Size, ' '); - CL_RETURN_ON_FAILURE(clGetProgramInfo( - hProgram->get(), CL_PROGRAM_KERNEL_NAMES, - KernelNames.size(), &KernelNames[0], nullptr)); + CL_RETURN_ON_FAILURE( + clGetProgramInfo(hProgram->get(), CL_PROGRAM_KERNEL_NAMES, + KernelNames.size(), &KernelNames[0], nullptr)); // Get rid of the null terminator and search for the kernel name. If the // function cannot be found, return an error code to indicate it exists. @@ -467,8 +461,8 @@ UR_APIEXPORT ur_result_t UR_APICALL urProgramGetFunctionPointer( } const cl_int CLResult = - FuncT(hDevice->get(), hProgram->get(), - pFunctionName, reinterpret_cast(ppFunctionPointer)); + FuncT(hDevice->get(), hProgram->get(), pFunctionName, + reinterpret_cast(ppFunctionPointer)); // GPU runtime sometimes returns CL_INVALID_ARG_VALUE if the function address // cannot be found but the kernel exists. As the kernel does exist, return // that the function name is invalid. diff --git a/source/adapters/opencl/program.hpp b/source/adapters/opencl/program.hpp index d8e8197331..84f486b7e8 100644 --- a/source/adapters/opencl/program.hpp +++ b/source/adapters/opencl/program.hpp @@ -14,13 +14,14 @@ #include struct ur_program_handle_t_ { - using native_type = cl_program; - native_type Program; - ur_context_handle_t Context; + using native_type = cl_program; + native_type Program; + ur_context_handle_t Context; - ur_program_handle_t_(native_type Prog, ur_context_handle_t Ctx) : Program(Prog), Context(Ctx) {} + ur_program_handle_t_(native_type Prog, ur_context_handle_t Ctx) + : Program(Prog), Context(Ctx) {} - ~ur_program_handle_t_() {} + ~ur_program_handle_t_() {} - native_type get() { return Program; } + native_type get() { return Program; } }; diff --git a/source/adapters/opencl/queue.cpp b/source/adapters/opencl/queue.cpp index 276c179f95..60218fd01f 100644 --- a/source/adapters/opencl/queue.cpp +++ b/source/adapters/opencl/queue.cpp @@ -7,9 +7,9 @@ //===-----------------------------------------------------------------===// #include "common.hpp" +#include "context.hpp" #include "device.hpp" #include "platform.hpp" -#include "context.hpp" cl_command_queue_info mapURQueueInfoToCL(const ur_queue_info_t PropName) { @@ -94,9 +94,9 @@ UR_APIEXPORT ur_result_t UR_APICALL urQueueCreate( cl_int RetErr = CL_INVALID_OPERATION; if (Version < oclv::V2_0) { - *phQueue = cl_adapter::cast(clCreateCommandQueue( - hContext->get(), hDevice->get(), - CLProperties & SupportByOpenCL, &RetErr)); + *phQueue = cl_adapter::cast( + clCreateCommandQueue(hContext->get(), hDevice->get(), + CLProperties & SupportByOpenCL, &RetErr)); CL_RETURN_ON_FAILURE(RetErr); return UR_RESULT_SUCCESS; } @@ -106,8 +106,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urQueueCreate( CL_QUEUE_PROPERTIES, CLProperties & SupportByOpenCL, 0}; *phQueue = cl_adapter::cast(clCreateCommandQueueWithProperties( - hContext->get(), hDevice->get(), - CreationFlagProperties, &RetErr)); + hContext->get(), hDevice->get(), CreationFlagProperties, &RetErr)); CL_RETURN_ON_FAILURE(RetErr); return UR_RESULT_SUCCESS; } diff --git a/source/adapters/opencl/sampler.cpp b/source/adapters/opencl/sampler.cpp index a066ff70fa..cfec86ed37 100644 --- a/source/adapters/opencl/sampler.cpp +++ b/source/adapters/opencl/sampler.cpp @@ -145,9 +145,8 @@ ur_result_t urSamplerCreate(ur_context_handle_t hContext, // Always call OpenCL 1.0 API *phSampler = cl_adapter::cast(clCreateSampler( - hContext->get(), - static_cast(pDesc->normalizedCoords), AddressingMode, FilterMode, - cl_adapter::cast(&ErrorCode))); + hContext->get(), static_cast(pDesc->normalizedCoords), + AddressingMode, FilterMode, cl_adapter::cast(&ErrorCode))); return mapCLErrorToUR(ErrorCode); } diff --git a/source/adapters/opencl/usm.cpp b/source/adapters/opencl/usm.cpp index 935c099b2c..9a1a5b9d2b 100644 --- a/source/adapters/opencl/usm.cpp +++ b/source/adapters/opencl/usm.cpp @@ -9,8 +9,8 @@ //===----------------------------------------------------------------------===// #include "common.hpp" -#include "device.hpp" #include "context.hpp" +#include "device.hpp" inline cl_mem_alloc_flags_intel hostDescToClFlags(const ur_usm_host_desc_t &desc) { @@ -149,8 +149,8 @@ urUSMDeviceAlloc(ur_context_handle_t hContext, ur_device_handle_t hDevice, if (FuncPtr) { cl_int ClResult = CL_SUCCESS; Ptr = FuncPtr(CLContext, hDevice->get(), - AllocProperties.empty() ? nullptr : AllocProperties.data(), size, - Alignment, &ClResult); + AllocProperties.empty() ? nullptr : AllocProperties.data(), + size, Alignment, &ClResult); if (ClResult == CL_INVALID_BUFFER_SIZE) { return UR_RESULT_ERROR_INVALID_USM_SIZE; } @@ -192,8 +192,8 @@ urUSMSharedAlloc(ur_context_handle_t hContext, ur_device_handle_t hDevice, if (FuncPtr) { cl_int ClResult = CL_SUCCESS; Ptr = FuncPtr(CLContext, hDevice->get(), - AllocProperties.empty() ? nullptr : AllocProperties.data(), size, - Alignment, cl_adapter::cast(&ClResult)); + AllocProperties.empty() ? nullptr : AllocProperties.data(), + size, Alignment, cl_adapter::cast(&ClResult)); if (ClResult == CL_INVALID_BUFFER_SIZE) { return UR_RESULT_ERROR_INVALID_USM_SIZE; } @@ -551,9 +551,8 @@ urUSMGetMemAllocInfo(ur_context_handle_t hContext, const void *pMem, } size_t CheckPropSize = 0; - cl_int ClErr = - GetMemAllocInfo(hContext->get(), pMem, PropNameCL, - propSize, pPropValue, &CheckPropSize); + cl_int ClErr = GetMemAllocInfo(hContext->get(), pMem, PropNameCL, propSize, + pPropValue, &CheckPropSize); if (pPropValue && CheckPropSize != propSize) { return UR_RESULT_ERROR_INVALID_SIZE; }