Skip to content

Commit

Permalink
Merge pull request oneapi-src#1821 from PietroGhg/pietro/native_cpu_s…
Browse files Browse the repository at this point in the history
…pecconstants

[NATIVECPU] Initial support for spec constants on Native CPU
  • Loading branch information
omarahmed1111 authored Sep 13, 2024
2 parents 92638b2 + 9eb1c74 commit fa9ebe7
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 9 deletions.
4 changes: 2 additions & 2 deletions source/adapters/native_cpu/device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<uint32_t>(hDevice->tp.num_threads()));
case UR_DEVICE_INFO_PARTITION_MAX_SUB_DEVICES:
Expand Down
2 changes: 1 addition & 1 deletion source/adapters/native_cpu/memory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
12 changes: 11 additions & 1 deletion source/adapters/native_cpu/platform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
5 changes: 0 additions & 5 deletions test/conformance/platform/platform_adapter_native_cpu.match
Original file line number Diff line number Diff line change
@@ -1,6 +1 @@
urPlatformCreateWithNativeHandleTest.InvalidNullPointerPlatform
urPlatfromGetBackendOptionTest.InvalidValueFrontendOption
urPlatfromGetBackendOptionTestWithParam.Success/_O0
urPlatfromGetBackendOptionTestWithParam.Success/_O1
urPlatfromGetBackendOptionTestWithParam.Success/_O2
urPlatfromGetBackendOptionTestWithParam.Success/_O3

0 comments on commit fa9ebe7

Please sign in to comment.