Skip to content

Commit

Permalink
[SYCL][PI] Add PI_ERROR_UNSUPPORTED_FEATURE error code (#13036)
Browse files Browse the repository at this point in the history
This commit adds a new error code to PI as a mapping from
UR_RESULT_ERROR_FEATURE_UNSUPPORTED.

This relates to oneapi-src/unified-runtime#1448.

Signed-off-by: Larsen, Steffen <steffen.larsen@intel.com>
  • Loading branch information
steffenlarsen committed Mar 20, 2024
1 parent d704d3c commit 183832b
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 10 deletions.
3 changes: 2 additions & 1 deletion sycl/include/sycl/detail/pi.h
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,10 @@
// 15.45 Added piextKernelSuggestMaxCooperativeGroupCount and
// piextEnqueueCooperativeKernelLaunch.
// 15.46 Add piextGetGlobalVariablePointer
// 15.47 Added PI_ERROR_FEATURE_UNSUPPORTED.

#define _PI_H_VERSION_MAJOR 15
#define _PI_H_VERSION_MINOR 46
#define _PI_H_VERSION_MINOR 47

#define _PI_STRING_HELPER(a) #a
#define _PI_CONCAT(a, b) _PI_STRING_HELPER(a.b)
Expand Down
3 changes: 3 additions & 0 deletions sycl/include/sycl/detail/pi_error.def
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,9 @@ _PI_ERRC(PI_ERROR_VA_API_MEDIA_SURFACE_NOT_ACQUIRED_INTEL, -1101)
_PI_ERRC(PI_ERROR_UNINITIALIZED, -1102)

// PI specific error codes
// PI_ERROR_UNSUPPORTED_FEATURE indicates that the backend or the corresponding
// device does not support the feature.
_PI_ERRC_WITH_MSG(PI_ERROR_UNSUPPORTED_FEATURE, -995, "The plugin or device does not support the called function")
// PI_ERROR_PLUGIN_SPECIFIC_ERROR indicates that an backend spcific error or
// warning has been emitted by the plugin.
_PI_ERRC_WITH_MSG(PI_ERROR_PLUGIN_SPECIFIC_ERROR, -996, "The plugin has emitted a backend specific error")
Expand Down
4 changes: 2 additions & 2 deletions sycl/plugins/native_cpu/pi_native_cpu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1266,13 +1266,13 @@ pi_result piextEnqueueCooperativeKernelLaunch(
const size_t *, const size_t *,
const size_t *, pi_uint32 ,
const pi_event *, pi_event *) {
return PI_ERROR_INVALID_OPERATION;
return PI_ERROR_UNSUPPORTED_FEATURE;
}

pi_result piextKernelSuggestMaxCooperativeGroupCount(
pi_kernel , size_t , size_t ,
pi_uint32 *) {
return PI_ERROR_INVALID_OPERATION;
return PI_ERROR_UNSUPPORTED_FEATURE;
}

// Initialize function table with stubs.
Expand Down
3 changes: 2 additions & 1 deletion sycl/plugins/unified_runtime/pi2ur.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,9 @@ static pi_result ur2piResult(ur_result_t urResult) {
case UR_RESULT_ERROR_PROGRAM_LINK_FAILURE:
return PI_ERROR_LINK_PROGRAM_FAILURE;
case UR_RESULT_ERROR_UNSUPPORTED_VERSION:
case UR_RESULT_ERROR_UNSUPPORTED_FEATURE:
return PI_ERROR_INVALID_OPERATION;
case UR_RESULT_ERROR_UNSUPPORTED_FEATURE:
return PI_ERROR_UNSUPPORTED_FEATURE;
case UR_RESULT_ERROR_INVALID_ARGUMENT:
case UR_RESULT_ERROR_INVALID_NULL_HANDLE:
case UR_RESULT_ERROR_HANDLE_OBJECT_IN_USE:
Expand Down
10 changes: 5 additions & 5 deletions sycl/source/detail/memory_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1533,7 +1533,7 @@ void MemoryManager::ext_oneapi_copyD2H_cmd_buffer(
SrcXOffBytes, SrcAccessRangeWidthBytes, DstMem + DstXOffBytes,
Deps.size(), Deps.data(), OutSyncPoint);

if (Result == PI_ERROR_INVALID_OPERATION) {
if (Result == PI_ERROR_UNSUPPORTED_FEATURE) {
throw sycl::exception(
sycl::make_error_code(sycl::errc::feature_not_supported),
"Device-to-host buffer copy command not supported by graph backend");
Expand Down Expand Up @@ -1563,7 +1563,7 @@ void MemoryManager::ext_oneapi_copyD2H_cmd_buffer(
&BufferOffset, &HostOffset, &RectRegion, BufferRowPitch,
BufferSlicePitch, HostRowPitch, HostSlicePitch, DstMem, Deps.size(),
Deps.data(), OutSyncPoint);
if (Result == PI_ERROR_INVALID_OPERATION) {
if (Result == PI_ERROR_UNSUPPORTED_FEATURE) {
throw sycl::exception(
sycl::make_error_code(sycl::errc::feature_not_supported),
"Device-to-host buffer copy command not supported by graph backend");
Expand Down Expand Up @@ -1610,7 +1610,7 @@ void MemoryManager::ext_oneapi_copyH2D_cmd_buffer(
DstXOffBytes, DstAccessRangeWidthBytes, SrcMem + SrcXOffBytes,
Deps.size(), Deps.data(), OutSyncPoint);

if (Result == PI_ERROR_INVALID_OPERATION) {
if (Result == PI_ERROR_UNSUPPORTED_FEATURE) {
throw sycl::exception(
sycl::make_error_code(sycl::errc::feature_not_supported),
"Host-to-device buffer copy command not supported by graph backend");
Expand Down Expand Up @@ -1641,7 +1641,7 @@ void MemoryManager::ext_oneapi_copyH2D_cmd_buffer(
BufferSlicePitch, HostRowPitch, HostSlicePitch, SrcMem, Deps.size(),
Deps.data(), OutSyncPoint);

if (Result == PI_ERROR_INVALID_OPERATION) {
if (Result == PI_ERROR_UNSUPPORTED_FEATURE) {
throw sycl::exception(
sycl::make_error_code(sycl::errc::feature_not_supported),
"Host-to-device buffer copy command not supported by graph backend");
Expand All @@ -1665,7 +1665,7 @@ void MemoryManager::ext_oneapi_copy_usm_cmd_buffer(
Plugin->call_nocheck<PiApiKind::piextCommandBufferMemcpyUSM>(
CommandBuffer, DstMem, SrcMem, Len, Deps.size(), Deps.data(),
OutSyncPoint);
if (Result == PI_ERROR_INVALID_OPERATION) {
if (Result == PI_ERROR_UNSUPPORTED_FEATURE) {
throw sycl::exception(
sycl::make_error_code(sycl::errc::feature_not_supported),
"USM copy command not supported by graph backend");
Expand Down
2 changes: 1 addition & 1 deletion sycl/source/detail/sampler_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ sampler_impl::getOrCreateSampler(const context &Context) {
errcode_ret = Plugin->call_nocheck<PiApiKind::piSamplerCreate>(
getSyclObjImpl(Context)->getHandleRef(), sprops, &resultSampler);

if (errcode_ret == PI_ERROR_INVALID_OPERATION)
if (errcode_ret == PI_ERROR_UNSUPPORTED_FEATURE)
throw sycl::exception(sycl::errc::feature_not_supported,
"Images are not supported by this device.");

Expand Down

0 comments on commit 183832b

Please sign in to comment.