From cfdcc53967acaed10a1cc4fd140a82ee530cad2e Mon Sep 17 00:00:00 2001 From: PietroGhg Date: Mon, 3 Jun 2024 12:49:36 +0100 Subject: [PATCH 1/2] Initial support spec constants on Native CPU --- source/adapters/native_cpu/device.cpp | 4 ++-- source/adapters/native_cpu/memory.cpp | 2 +- source/adapters/native_cpu/platform.cpp | 12 +++++++++++- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/source/adapters/native_cpu/device.cpp b/source/adapters/native_cpu/device.cpp index c5652398e3..a35b69923f 100644 --- a/source/adapters/native_cpu/device.cpp +++ b/source/adapters/native_cpu/device.cpp @@ -160,9 +160,9 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(ur_device_handle_t hDevice, case UR_DEVICE_INFO_VERSION: return ReturnValue("0.1"); case UR_DEVICE_INFO_COMPILER_AVAILABLE: - return ReturnValue(bool{false}); + return ReturnValue(bool{true}); case UR_DEVICE_INFO_LINKER_AVAILABLE: - return ReturnValue(bool{false}); + return ReturnValue(bool{true}); case UR_DEVICE_INFO_MAX_COMPUTE_UNITS: return ReturnValue(static_cast(hDevice->tp.num_threads())); case UR_DEVICE_INFO_PARTITION_MAX_SUB_DEVICES: diff --git a/source/adapters/native_cpu/memory.cpp b/source/adapters/native_cpu/memory.cpp index 1f8a927c67..ddf93e44bc 100644 --- a/source/adapters/native_cpu/memory.cpp +++ b/source/adapters/native_cpu/memory.cpp @@ -46,7 +46,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urMemBufferCreate( UR_ASSERT(size != 0, UR_RESULT_ERROR_INVALID_BUFFER_SIZE); const bool useHostPtr = flags & UR_MEM_FLAG_USE_HOST_POINTER; - const bool copyHostPtr = flags & UR_MEM_FLAG_USE_HOST_POINTER; + const bool copyHostPtr = flags & UR_MEM_FLAG_ALLOC_COPY_HOST_POINTER; ur_mem_handle_t_ *retMem; diff --git a/source/adapters/native_cpu/platform.cpp b/source/adapters/native_cpu/platform.cpp index 8d650764c1..840f18f8b3 100644 --- a/source/adapters/native_cpu/platform.cpp +++ b/source/adapters/native_cpu/platform.cpp @@ -92,7 +92,17 @@ UR_APIEXPORT ur_result_t UR_APICALL urPlatformGetBackendOption( std::ignore = pFrontendOption; std::ignore = ppPlatformOption; - CONTINUE_NO_IMPLEMENTATION; + std::ignore = hPlatform; + using namespace std::literals; + if (pFrontendOption == nullptr) + return UR_RESULT_ERROR_INVALID_NULL_POINTER; + if (pFrontendOption == "-O0"sv || pFrontendOption == "-O1"sv || + pFrontendOption == "-O2"sv || pFrontendOption == "-O3"sv || + pFrontendOption == ""sv) { + *ppPlatformOption = ""; + return UR_RESULT_SUCCESS; + } + return UR_RESULT_ERROR_INVALID_VALUE; } UR_APIEXPORT ur_result_t UR_APICALL urPlatformCreateWithNativeHandle( From 9eb1c74f72118fad72302944ede824d5106016a0 Mon Sep 17 00:00:00 2001 From: PietroGhg Date: Wed, 17 Jul 2024 13:05:17 +0100 Subject: [PATCH 2/2] Update match file --- test/conformance/platform/platform_adapter_native_cpu.match | 5 ----- 1 file changed, 5 deletions(-) diff --git a/test/conformance/platform/platform_adapter_native_cpu.match b/test/conformance/platform/platform_adapter_native_cpu.match index 257822d30b..b459b89bbe 100644 --- a/test/conformance/platform/platform_adapter_native_cpu.match +++ b/test/conformance/platform/platform_adapter_native_cpu.match @@ -1,6 +1 @@ urPlatformCreateWithNativeHandleTest.InvalidNullPointerPlatform -urPlatfromGetBackendOptionTest.InvalidValueFrontendOption -urPlatfromGetBackendOptionTestWithParam.Success/_O0 -urPlatfromGetBackendOptionTestWithParam.Success/_O1 -urPlatfromGetBackendOptionTestWithParam.Success/_O2 -urPlatfromGetBackendOptionTestWithParam.Success/_O3