From 8d06e24a9eb6a89525d06f832d9a6c89ba3ec7df Mon Sep 17 00:00:00 2001 From: Adam Fidel Date: Fri, 8 May 2026 12:01:38 -0700 Subject: [PATCH] [SYCL][Graph] Align spec and implementation for native recording mode --- sycl/source/detail/graph/graph_impl.cpp | 18 ++++++------------ .../exception_out_of_order_queue.cpp | 2 +- .../NativeRecording/exception_update.cpp | 16 ++++------------ 3 files changed, 11 insertions(+), 25 deletions(-) diff --git a/sycl/source/detail/graph/graph_impl.cpp b/sycl/source/detail/graph/graph_impl.cpp index 4ea11db8c1d64..ac05dd10f5ede 100644 --- a/sycl/source/detail/graph/graph_impl.cpp +++ b/sycl/source/detail/graph/graph_impl.cpp @@ -823,7 +823,7 @@ void graph_impl::beginRecordingImpl(sycl::detail::queue_impl &Queue, // Native recording limitation: in-order queues only if (MNativeGraphHandle && !Queue.isInOrder()) { - throw sycl::exception(make_error_code(errc::feature_not_supported), + throw sycl::exception(make_error_code(errc::invalid), "Native recording only works with in-order queues"); } @@ -1094,6 +1094,11 @@ exec_graph_impl::exec_graph_impl(sycl::context Context, // Create native UR executable graph if the modifiable graph uses native // recording if (isNativeRecordingEnabledForGraph(*GraphImpl)) { + if (MIsUpdatable) { + throw sycl::exception( + sycl::make_error_code(errc::feature_not_supported), + "Updatable graphs are not supported in native recording mode"); + } context_impl &ContextImpl = *sycl::detail::getSyclObjImpl(MContext); sycl::detail::adapter_impl &Adapter = ContextImpl.getAdapter(); ur_result_t Result = @@ -1649,12 +1654,6 @@ void exec_graph_impl::duplicateNodes() { } void exec_graph_impl::update(std::shared_ptr GraphImpl) { - if (MNativeExecutableGraphHandle) { - throw sycl::exception( - sycl::make_error_code(errc::feature_not_supported), - "Graph update is not supported in native recording mode"); - } - if (MDevice != GraphImpl->getDevice()) { throw sycl::exception( sycl::make_error_code(errc::invalid), @@ -1726,11 +1725,6 @@ void exec_graph_impl::update(node_impl &Node) { } void exec_graph_impl::update(nodes_range Nodes) { - if (MNativeExecutableGraphHandle) { - throw sycl::exception( - sycl::make_error_code(errc::feature_not_supported), - "Graph update is not supported in native recording mode"); - } if (!MIsUpdatable) { throw sycl::exception(sycl::make_error_code(errc::invalid), "update() cannot be called on a executable graph " diff --git a/sycl/test-e2e/Graph/RecordReplay/NativeRecording/exception_out_of_order_queue.cpp b/sycl/test-e2e/Graph/RecordReplay/NativeRecording/exception_out_of_order_queue.cpp index b006446283f48..f547fc4d21c4c 100644 --- a/sycl/test-e2e/Graph/RecordReplay/NativeRecording/exception_out_of_order_queue.cpp +++ b/sycl/test-e2e/Graph/RecordReplay/NativeRecording/exception_out_of_order_queue.cpp @@ -18,7 +18,7 @@ int main() { if (!expectException([&]() { Graph.begin_recording(OutOfOrderQueue); }, "begin_recording with out-of-order queue", - sycl::errc::feature_not_supported)) { + sycl::errc::invalid)) { std::cerr << "Out-of-order queue should throw exception" << std::endl; return 1; } diff --git a/sycl/test-e2e/Graph/RecordReplay/NativeRecording/exception_update.cpp b/sycl/test-e2e/Graph/RecordReplay/NativeRecording/exception_update.cpp index 0b0392c5fc8e1..3b26a32220bd0 100644 --- a/sycl/test-e2e/Graph/RecordReplay/NativeRecording/exception_update.cpp +++ b/sycl/test-e2e/Graph/RecordReplay/NativeRecording/exception_update.cpp @@ -5,7 +5,8 @@ // Extra run to check for leaks in Level Zero using UR_L0_LEAKS_DEBUG // RUN: %if level_zero %{%{l0_leak_check} %{run} %t.out 2>&1 | FileCheck %s --implicit-check-not=LEAK %} -// Test that update() throws when called on a graph in native recording mode +// Test that finalize() throws when both enable_native_recording and updatable +// properties are set on the same graph. #include "../../graph_common.hpp" @@ -28,18 +29,9 @@ int main() { }); Graph.end_recording(); - auto ExecGraph = Graph.finalize({exp_ext::property::graph::updatable{}}); - - if (!expectException([&]() { ExecGraph.update(Graph); }, - "update(graph) with native recording enabled", - sycl::errc::feature_not_supported)) { - free(Data, Queue); - return 1; - } - if (!expectException( - [&]() { ExecGraph.update(std::vector{}); }, - "update(nodes) with native recording enabled", + [&]() { Graph.finalize({exp_ext::property::graph::updatable{}}); }, + "finalize() with enable_native_recording and updatable", sycl::errc::feature_not_supported)) { free(Data, Queue); return 1;