From 07d4f515d521069c360c1c16bf5f7fb8b095cf19 Mon Sep 17 00:00:00 2001 From: Krzysztof Filipek Date: Fri, 17 Jul 2026 13:17:00 +0200 Subject: [PATCH 1/2] [UR] Add descriptive error codes for graphs API --- unified-runtime/scripts/core/common.yml | 13 +++++++++++++ .../source/adapters/level_zero/common.cpp | 14 ++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/unified-runtime/scripts/core/common.yml b/unified-runtime/scripts/core/common.yml index c370015741e3e..c2605c95ee684 100644 --- a/unified-runtime/scripts/core/common.yml +++ b/unified-runtime/scripts/core/common.yml @@ -285,6 +285,19 @@ etors: desc: "A specialization constant identifier is not valid." - name: ERROR_INVALID_GRAPH desc: "A graph object is not valid." + - name: ERROR_GRAPH_CAPTURE_UNSUPPORTED + desc: "An operation is not supported during graph capture." + - name: ERROR_GRAPH_CAPTURE_INVALIDATED + desc: "An operation failed and invalidated the graph capture session." + - name: ERROR_GRAPH_CAPTURE_MERGE_ATTEMPT + desc: "An operation failed because it would merge two graph capture sessions." + - name: ERROR_COMMAND_LIST_NOT_CAPTURING + desc: "The command list is not in graph capture mode." + - name: ERROR_GRAPH_UNJOINED_FORKS + desc: "The graph contains unjoined forks." + - name: ERROR_GRAPH_INTERNAL_EVENT + desc: "An operation failed because it uses a graph-internal counter-based + event outside of the graph." - name: ERROR_UNKNOWN value: "0x7ffffffe" desc: "Unknown or internal error" diff --git a/unified-runtime/source/adapters/level_zero/common.cpp b/unified-runtime/source/adapters/level_zero/common.cpp index 0bb8e19c23df5..e298a9f2eab1b 100644 --- a/unified-runtime/source/adapters/level_zero/common.cpp +++ b/unified-runtime/source/adapters/level_zero/common.cpp @@ -62,6 +62,20 @@ ur_result_t ze2urResult(ze_result_t ZeResult) { return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; case ZE_RESULT_ERROR_MODULE_LINK_FAILURE: return UR_RESULT_ERROR_PROGRAM_LINK_FAILURE; + case ZE_RESULT_ERROR_INVALID_GRAPH: + return UR_RESULT_ERROR_INVALID_GRAPH; + case ZE_RESULT_ERROR_GRAPH_CAPTURE_UNSUPPORTED: + return UR_RESULT_ERROR_GRAPH_CAPTURE_UNSUPPORTED; + case ZE_RESULT_ERROR_GRAPH_CAPTURE_INVALIDATED: + return UR_RESULT_ERROR_GRAPH_CAPTURE_INVALIDATED; + case ZE_RESULT_ERROR_GRAPH_CAPTURE_MERGE_ATTEMPT: + return UR_RESULT_ERROR_GRAPH_CAPTURE_MERGE_ATTEMPT; + case ZE_RESULT_ERROR_COMMAND_LIST_NOT_CAPTURING: + return UR_RESULT_ERROR_COMMAND_LIST_NOT_CAPTURING; + case ZE_RESULT_ERROR_GRAPH_UNJOINED_FORKS: + return UR_RESULT_ERROR_GRAPH_UNJOINED_FORKS; + case ZE_RESULT_ERROR_GRAPH_INTERNAL_EVENT: + return UR_RESULT_ERROR_GRAPH_INTERNAL_EVENT; default: return UR_RESULT_ERROR_UNKNOWN; } From 16ca5decbe7185e8b74a386c8dd7bcafc15d9892 Mon Sep 17 00:00:00 2001 From: Krzysztof Filipek Date: Fri, 17 Jul 2026 13:55:34 +0200 Subject: [PATCH 2/2] Add generated files --- .../include/unified-runtime/ur_api.h | 13 +++++++++++++ .../include/unified-runtime/ur_print.hpp | 18 ++++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/unified-runtime/include/unified-runtime/ur_api.h b/unified-runtime/include/unified-runtime/ur_api.h index fac4fcbc64e75..4624a5c9acb0d 100644 --- a/unified-runtime/include/unified-runtime/ur_api.h +++ b/unified-runtime/include/unified-runtime/ur_api.h @@ -961,6 +961,19 @@ typedef enum ur_result_t { UR_RESULT_ERROR_INVALID_SPEC_ID = 70, /// A graph object is not valid. UR_RESULT_ERROR_INVALID_GRAPH = 71, + /// An operation is not supported during graph capture. + UR_RESULT_ERROR_GRAPH_CAPTURE_UNSUPPORTED = 72, + /// An operation failed and invalidated the graph capture session. + UR_RESULT_ERROR_GRAPH_CAPTURE_INVALIDATED = 73, + /// An operation failed because it would merge two graph capture sessions. + UR_RESULT_ERROR_GRAPH_CAPTURE_MERGE_ATTEMPT = 74, + /// The command list is not in graph capture mode. + UR_RESULT_ERROR_COMMAND_LIST_NOT_CAPTURING = 75, + /// The graph contains unjoined forks. + UR_RESULT_ERROR_GRAPH_UNJOINED_FORKS = 76, + /// An operation failed because it uses a graph-internal counter-based + /// event outside of the graph. + UR_RESULT_ERROR_GRAPH_INTERNAL_EVENT = 77, /// Invalid Command-Buffer UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_EXP = 0x1000, /// Sync point is not valid for the command-buffer diff --git a/unified-runtime/include/unified-runtime/ur_print.hpp b/unified-runtime/include/unified-runtime/ur_print.hpp index 10c01a2952e13..5570ed1d7b0be 100644 --- a/unified-runtime/include/unified-runtime/ur_print.hpp +++ b/unified-runtime/include/unified-runtime/ur_print.hpp @@ -2206,6 +2206,24 @@ inline std::ostream &operator<<(std::ostream &os, enum ur_result_t value) { case UR_RESULT_ERROR_INVALID_GRAPH: os << "UR_RESULT_ERROR_INVALID_GRAPH"; break; + case UR_RESULT_ERROR_GRAPH_CAPTURE_UNSUPPORTED: + os << "UR_RESULT_ERROR_GRAPH_CAPTURE_UNSUPPORTED"; + break; + case UR_RESULT_ERROR_GRAPH_CAPTURE_INVALIDATED: + os << "UR_RESULT_ERROR_GRAPH_CAPTURE_INVALIDATED"; + break; + case UR_RESULT_ERROR_GRAPH_CAPTURE_MERGE_ATTEMPT: + os << "UR_RESULT_ERROR_GRAPH_CAPTURE_MERGE_ATTEMPT"; + break; + case UR_RESULT_ERROR_COMMAND_LIST_NOT_CAPTURING: + os << "UR_RESULT_ERROR_COMMAND_LIST_NOT_CAPTURING"; + break; + case UR_RESULT_ERROR_GRAPH_UNJOINED_FORKS: + os << "UR_RESULT_ERROR_GRAPH_UNJOINED_FORKS"; + break; + case UR_RESULT_ERROR_GRAPH_INTERNAL_EVENT: + os << "UR_RESULT_ERROR_GRAPH_INTERNAL_EVENT"; + break; case UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_EXP: os << "UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_EXP"; break;