llvm icon indicating copy to clipboard operation
llvm copied to clipboard

Fix error handling in `device_impl::getCurrentDeviceTime()`

Open againull opened this issue 4 months ago • 1 comments

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 https://github.com/intel/llvm/pull/18735#discussion_r2135212515

againull avatar Jun 09 '25 15:06 againull