Skip to content

Fix error handling in device_impl::getCurrentDeviceTime() #18863

Open
@againull

Description

@againull

Describe the bug

Currently there is some workaround:

    auto Result =
        getAdapter()->call_nocheck<UrApiKind::urDeviceGetGlobalTimestamps>(
            Device, DeviceTime, HostTime);
    if (Result == UR_RESULT_ERROR_INVALID_OPERATION) {
      // NOTE(UR port): Removed the call to GetLastError because  we shouldn't
      // be calling it after ERROR_INVALID_OPERATION: there is no
      // adapter-specific error.
      throw detail::set_ur_error(
          sycl::exception(
              make_error_code(errc::feature_not_supported),
              "Device and/or backend does not support querying timestamp."),
          UR_RESULT_ERROR_INVALID_OPERATION);
    } else {
      getAdapter()->checkUrResult<errc::feature_not_supported>(Result);
    }
  };

Backend which doesn't support the API is supposed to return UR_RESULT_ERROR_UNSUPPORTED_FEATURE, see #18735 (comment)

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions