Skip to content

Commit 82ed146

Browse files
uwedolinskymartygrant
authored andcommitted
[SYCL][NATIVECPU] UR adapter updates (#10857)
Removes some unneeded UR_ASSERTS Added initial GlobalTimeStamp implementation for `sycl-ls`.
1 parent 382b27d commit 82ed146

File tree

2 files changed

+15
-11
lines changed

2 files changed

+15
-11
lines changed

sycl/plugins/unified_runtime/ur/adapters/native_cpu/context.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,6 @@ urContextCreate(uint32_t DeviceCount, const ur_device_handle_t *phDevices,
2020
const ur_context_properties_t *pProperties,
2121
ur_context_handle_t *phContext) {
2222
std::ignore = pProperties;
23-
UR_ASSERT(phDevices, UR_RESULT_ERROR_INVALID_NULL_POINTER);
24-
UR_ASSERT(phContext, UR_RESULT_ERROR_INVALID_NULL_POINTER);
25-
2623
assert(DeviceCount == 1);
2724

2825
// TODO: Proper error checking.
@@ -46,9 +43,6 @@ urContextRelease(ur_context_handle_t hContext) {
4643
UR_APIEXPORT ur_result_t UR_APICALL
4744
urContextGetInfo(ur_context_handle_t hContext, ur_context_info_t propName,
4845
size_t propSize, void *pPropValue, size_t *pPropSizeRet) {
49-
50-
UR_ASSERT(hContext, UR_RESULT_ERROR_INVALID_NULL_HANDLE);
51-
5246
UrReturnHelper returnValue(propSize, pPropValue, pPropSizeRet);
5347

5448
switch (propName) {

sycl/plugins/unified_runtime/ur/adapters/native_cpu/device.cpp

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -315,11 +315,21 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceCreateWithNativeHandle(
315315
UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetGlobalTimestamps(
316316
ur_device_handle_t hDevice, uint64_t *pDeviceTimestamp,
317317
uint64_t *pHostTimestamp) {
318-
std::ignore = hDevice;
319-
std::ignore = pDeviceTimestamp;
320-
std::ignore = pHostTimestamp;
321-
322-
DIE_NO_IMPLEMENTATION;
318+
std::ignore = hDevice; // todo
319+
if (pHostTimestamp) {
320+
using namespace std::chrono;
321+
*pHostTimestamp =
322+
duration_cast<nanoseconds>(steady_clock::now().time_since_epoch())
323+
.count();
324+
}
325+
if (pDeviceTimestamp) {
326+
// todo: calculate elapsed time properly
327+
using namespace std::chrono;
328+
*pDeviceTimestamp =
329+
duration_cast<nanoseconds>(steady_clock::now().time_since_epoch())
330+
.count();
331+
}
332+
return UR_RESULT_SUCCESS;
323333
}
324334

325335
UR_APIEXPORT ur_result_t UR_APICALL urDeviceSelectBinary(

0 commit comments

Comments
 (0)