Skip to content

Commit fa9ebe7

Browse files
Merge pull request #1821 from PietroGhg/pietro/native_cpu_specconstants
[NATIVECPU] Initial support for spec constants on Native CPU
2 parents 92638b2 + 9eb1c74 commit fa9ebe7

File tree

4 files changed

+14
-9
lines changed

4 files changed

+14
-9
lines changed

source/adapters/native_cpu/device.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,9 +160,9 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(ur_device_handle_t hDevice,
160160
case UR_DEVICE_INFO_VERSION:
161161
return ReturnValue("0.1");
162162
case UR_DEVICE_INFO_COMPILER_AVAILABLE:
163-
return ReturnValue(bool{false});
163+
return ReturnValue(bool{true});
164164
case UR_DEVICE_INFO_LINKER_AVAILABLE:
165-
return ReturnValue(bool{false});
165+
return ReturnValue(bool{true});
166166
case UR_DEVICE_INFO_MAX_COMPUTE_UNITS:
167167
return ReturnValue(static_cast<uint32_t>(hDevice->tp.num_threads()));
168168
case UR_DEVICE_INFO_PARTITION_MAX_SUB_DEVICES:

source/adapters/native_cpu/memory.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urMemBufferCreate(
4646
UR_ASSERT(size != 0, UR_RESULT_ERROR_INVALID_BUFFER_SIZE);
4747

4848
const bool useHostPtr = flags & UR_MEM_FLAG_USE_HOST_POINTER;
49-
const bool copyHostPtr = flags & UR_MEM_FLAG_USE_HOST_POINTER;
49+
const bool copyHostPtr = flags & UR_MEM_FLAG_ALLOC_COPY_HOST_POINTER;
5050

5151
ur_mem_handle_t_ *retMem;
5252

source/adapters/native_cpu/platform.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,17 @@ UR_APIEXPORT ur_result_t UR_APICALL urPlatformGetBackendOption(
9292
std::ignore = pFrontendOption;
9393
std::ignore = ppPlatformOption;
9494

95-
CONTINUE_NO_IMPLEMENTATION;
95+
std::ignore = hPlatform;
96+
using namespace std::literals;
97+
if (pFrontendOption == nullptr)
98+
return UR_RESULT_ERROR_INVALID_NULL_POINTER;
99+
if (pFrontendOption == "-O0"sv || pFrontendOption == "-O1"sv ||
100+
pFrontendOption == "-O2"sv || pFrontendOption == "-O3"sv ||
101+
pFrontendOption == ""sv) {
102+
*ppPlatformOption = "";
103+
return UR_RESULT_SUCCESS;
104+
}
105+
return UR_RESULT_ERROR_INVALID_VALUE;
96106
}
97107

98108
UR_APIEXPORT ur_result_t UR_APICALL urPlatformCreateWithNativeHandle(
Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1 @@
11
urPlatformCreateWithNativeHandleTest.InvalidNullPointerPlatform
2-
urPlatfromGetBackendOptionTest.InvalidValueFrontendOption
3-
urPlatfromGetBackendOptionTestWithParam.Success/_O0
4-
urPlatfromGetBackendOptionTestWithParam.Success/_O1
5-
urPlatfromGetBackendOptionTestWithParam.Success/_O2
6-
urPlatfromGetBackendOptionTestWithParam.Success/_O3

0 commit comments

Comments
 (0)