Skip to content

Commit

Permalink
[SYCL][PI] Add PI_ERROR_UNSUPPORTED_FEATURE error code (intel#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 authored and kbenzie committed Apr 17, 2024
1 parent 40c2781 commit 1985ba5
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 16 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
12 changes: 6 additions & 6 deletions sycl/plugins/unified_runtime/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,12 @@ if(SYCL_PI_UR_USE_FETCH_CONTENT)
include(FetchContent)

set(UNIFIED_RUNTIME_REPO "https://github.com/oneapi-src/unified-runtime.git")
# commit 65af257bb4adeb59c7cdfec9246e6b4fc4312343
# Author: aarongreig <aaron.greig@codeplay.com>
# Date: Fri Apr 5 14:26:59 2024 +0100
# Merge pull request #1486 from nrspruit/fix_memfree_report
# [L0] Fix DeviceInfo global mem free to report unsupported given MemCount==0
set(UNIFIED_RUNTIME_TAG 65af257bb4adeb59c7cdfec9246e6b4fc4312343)
# commit 410c02365eb8505ace69d3cb6b8192dbe0077161
# Author: Kenneth Benzie (Benie) <k.benzie@codeplay.com>
# Date: Thu Apr 4 10:23:33 2024 +0200
# Merge pull request #1448 from steffenlarsen/steffen/make_ext_func_fail_unsupported
# [OpenCL] Make extension function lookup return unusupported error
set(UNIFIED_RUNTIME_TAG 410c02365eb8505ace69d3cb6b8192dbe0077161)

if(SYCL_PI_UR_OVERRIDE_FETCH_CONTENT_REPO)
set(UNIFIED_RUNTIME_REPO "${SYCL_PI_UR_OVERRIDE_FETCH_CONTENT_REPO}")
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 @@ -101,8 +101,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 1985ba5

Please sign in to comment.