From 86acba4eb67738ce7cc5edd99f0206ef68c5d02e Mon Sep 17 00:00:00 2001 From: Ewan Crawford Date: Mon, 28 Aug 2023 09:08:42 +0100 Subject: [PATCH] [SYCL][Graph] Remove assume_data_outlives_buffer property Implements spec feedback to remove this property, goes with spec PR https://github.com/reble/llvm/pull/311 --- .../sycl/ext/oneapi/experimental/graph.hpp | 13 --- sycl/source/detail/graph_impl.cpp | 7 -- sycl/source/detail/graph_impl.hpp | 8 -- .../assume_data_outlives_buffer_property.cpp | 11 --- .../assume_data_outlives_buffer_property.cpp | 84 ------------------- sycl/test-e2e/Graph/Inputs/basic_buffer.cpp | 3 +- sycl/test-e2e/Graph/Inputs/buffer_copy.cpp | 3 +- sycl/test-e2e/Graph/Inputs/buffer_copy_2d.cpp | 3 +- .../Graph/Inputs/buffer_copy_host2target.cpp | 3 +- .../Inputs/buffer_copy_host2target_2d.cpp | 3 +- .../Inputs/buffer_copy_host2target_offset.cpp | 3 +- .../Graph/Inputs/buffer_copy_offsets.cpp | 3 +- .../Graph/Inputs/buffer_copy_target2host.cpp | 3 +- .../Inputs/buffer_copy_target2host_2d.cpp | 3 +- .../Inputs/buffer_copy_target2host_offset.cpp | 3 +- .../Graph/Inputs/dotp_buffer_reduction.cpp | 3 +- .../Graph/Inputs/dotp_usm_reduction.cpp | 6 +- .../Graph/Inputs/event_status_querying.cpp | 3 +- .../Graph/Inputs/sub_graph_reduction.cpp | 12 +-- .../Graph/Inputs/temp_buffer_reinterpret.cpp | 3 +- .../assume_data_outlives_buffer_property.cpp | 11 --- 21 files changed, 16 insertions(+), 175 deletions(-) delete mode 100644 sycl/test-e2e/Graph/Explicit/assume_data_outlives_buffer_property.cpp delete mode 100644 sycl/test-e2e/Graph/Inputs/assume_data_outlives_buffer_property.cpp delete mode 100644 sycl/test-e2e/Graph/RecordReplay/assume_data_outlives_buffer_property.cpp diff --git a/sycl/include/sycl/ext/oneapi/experimental/graph.hpp b/sycl/include/sycl/ext/oneapi/experimental/graph.hpp index 51266a551fc4d..94ce494337d8c 100644 --- a/sycl/include/sycl/ext/oneapi/experimental/graph.hpp +++ b/sycl/include/sycl/ext/oneapi/experimental/graph.hpp @@ -117,19 +117,6 @@ class assume_buffer_outlives_graph public: assume_buffer_outlives_graph() = default; }; - -/// Property passed to command_graph constructor to allow buffers created with -/// host pointers. Passing this property represents a promise from the user that -/// the host data will outlive the buffer and by extension any graph that it is -/// used in. -/// -class assume_data_outlives_buffer - : public ::sycl::detail::DataLessProperty< - ::sycl::detail::GraphAssumeDataOutlivesBuffer> { -public: - assume_data_outlives_buffer() = default; -}; - } // namespace graph namespace node { diff --git a/sycl/source/detail/graph_impl.cpp b/sycl/source/detail/graph_impl.cpp index 29c057ee22d12..443db6de1aec4 100644 --- a/sycl/source/detail/graph_impl.cpp +++ b/sycl/source/detail/graph_impl.cpp @@ -271,13 +271,6 @@ graph_impl::add(sycl::detail::CG::CGTYPE CGType, for (auto &Req : Requirements) { // Track and mark the memory objects being used by the graph. auto MemObj = static_cast(Req->MSYCLMemObj); - if (MemObj->getUserPtr() && !MAllowBuffersHostPointers) { - throw sycl::exception( - make_error_code(errc::invalid), - "Cannot use a buffer which was created with a host pointer in a " - "graph without passing the assume_data_outlives_buffer property on " - "Graph construction."); - } bool WasInserted = MMemObjs.insert(MemObj).second; if (WasInserted) { MemObj->markBeingUsedInGraph(); diff --git a/sycl/source/detail/graph_impl.hpp b/sycl/source/detail/graph_impl.hpp index 522f69afc2748..030c1eb8bd886 100644 --- a/sycl/source/detail/graph_impl.hpp +++ b/sycl/source/detail/graph_impl.hpp @@ -305,9 +305,6 @@ class graph_impl { if (PropList.has_property()) { MSkipCycleChecks = true; } - if (PropList.has_property()) { - MAllowBuffersHostPointers = true; - } if (PropList .has_property()) { MAllowBuffers = true; @@ -615,11 +612,6 @@ class graph_impl { /// Unique set of SYCL Memory Objects which are currently in use in the graph. std::set MMemObjs; - /// Controls whether we allow buffers that are created with host pointers to - /// be used in the graph. Set by the presence of the - /// assume_data_outlives_buffer property. - bool MAllowBuffersHostPointers = false; - /// Controls whether we allow buffers to be used in the graph. Set by the /// presence of the assume_buffer_outlives_graph property. bool MAllowBuffers = false; diff --git a/sycl/test-e2e/Graph/Explicit/assume_data_outlives_buffer_property.cpp b/sycl/test-e2e/Graph/Explicit/assume_data_outlives_buffer_property.cpp deleted file mode 100644 index 00c13cf87834f..0000000000000 --- a/sycl/test-e2e/Graph/Explicit/assume_data_outlives_buffer_property.cpp +++ /dev/null @@ -1,11 +0,0 @@ -// REQUIRES: level_zero, gpu -// RUN: %{build} -o %t.out -// RUN: %{run} %t.out -// Extra run to check for leaks in Level Zero using ZE_DEBUG -// RUN: %if ext_oneapi_level_zero %{env ZE_DEBUG=4 %{run} %t.out 2>&1 | FileCheck %s %} -// -// CHECK-NOT: LEAK - -#define GRAPH_E2E_EXPLICIT - -#include "../Inputs/assume_data_outlives_buffer_property.cpp" diff --git a/sycl/test-e2e/Graph/Inputs/assume_data_outlives_buffer_property.cpp b/sycl/test-e2e/Graph/Inputs/assume_data_outlives_buffer_property.cpp deleted file mode 100644 index b16b595127590..0000000000000 --- a/sycl/test-e2e/Graph/Inputs/assume_data_outlives_buffer_property.cpp +++ /dev/null @@ -1,84 +0,0 @@ -// Tests that using a buffer which is created with a host pointer in a graph -// will throw, unless the assume_data_outlives_buffer property is passed on -// graph creation. - -#include "../graph_common.hpp" - -int main() { - queue Queue; - - using T = unsigned short; - - T Data = 0; - - buffer BufferHost{&Data, range<1>{1}}; - BufferHost.set_write_back(false); - buffer BufferNoHost{range<1>{1}}; - BufferNoHost.set_write_back(false); - - // Test with the property - { - exp_ext::command_graph Graph{ - Queue.get_context(), - Queue.get_device(), - {exp_ext::property::graph::assume_buffer_outlives_graph{}, - exp_ext::property::graph::assume_data_outlives_buffer{}}}; - - std::error_code ErrorCode = make_error_code(sycl::errc::success); - // This should not throw because we have passed the property - try { - add_node(Graph, Queue, [&](handler &CGH) { - auto acc = BufferHost.get_access(CGH); - CGH.single_task([=]() {}); - }); - } catch (const sycl::exception &e) { - ErrorCode = e.code(); - } - assert(ErrorCode == sycl::errc::success); - - // This should not throw regardless of property use - try { - add_node(Graph, Queue, [&](handler &CGH) { - auto acc = BufferNoHost.get_access(CGH); - CGH.single_task([=]() {}); - }); - } catch (const sycl::exception &e) { - ErrorCode = e.code(); - } - assert(ErrorCode == sycl::errc::success); - } - - // Test without the property - { - exp_ext::command_graph Graph{ - Queue.get_context(), - Queue.get_device(), - {exp_ext::property::graph::assume_buffer_outlives_graph{}}}; - - std::error_code ErrorCode = make_error_code(sycl::errc::success); - // This should throw because we haven't used the property - try { - add_node(Graph, Queue, [&](handler &CGH) { - auto acc = BufferHost.get_access(CGH); - CGH.single_task([=]() {}); - }); - } catch (const sycl::exception &e) { - ErrorCode = e.code(); - } - assert(ErrorCode == sycl::errc::invalid); - - ErrorCode = sycl::errc::success; - // This should not throw regardless of property use - try { - add_node(Graph, Queue, [&](handler &CGH) { - auto acc = BufferNoHost.get_access(CGH); - CGH.single_task([=]() {}); - }); - } catch (const sycl::exception &e) { - ErrorCode = e.code(); - } - assert(ErrorCode == sycl::errc::success); - } - - return 0; -} diff --git a/sycl/test-e2e/Graph/Inputs/basic_buffer.cpp b/sycl/test-e2e/Graph/Inputs/basic_buffer.cpp index 5a2c553faa55b..e8c6cf8dcb760 100644 --- a/sycl/test-e2e/Graph/Inputs/basic_buffer.cpp +++ b/sycl/test-e2e/Graph/Inputs/basic_buffer.cpp @@ -28,8 +28,7 @@ int main() { exp_ext::command_graph Graph{ Queue.get_context(), Queue.get_device(), - {exp_ext::property::graph::assume_buffer_outlives_graph{}, - exp_ext::property::graph::assume_data_outlives_buffer{}}}; + {exp_ext::property::graph::assume_buffer_outlives_graph{}}}; // Add commands to graph add_nodes(Graph, Queue, Size, BufferA, BufferB, BufferC); diff --git a/sycl/test-e2e/Graph/Inputs/buffer_copy.cpp b/sycl/test-e2e/Graph/Inputs/buffer_copy.cpp index 539d6fb49dd9b..9f092fa44b07a 100644 --- a/sycl/test-e2e/Graph/Inputs/buffer_copy.cpp +++ b/sycl/test-e2e/Graph/Inputs/buffer_copy.cpp @@ -37,8 +37,7 @@ int main() { exp_ext::command_graph Graph{ Queue.get_context(), Queue.get_device(), - {exp_ext::property::graph::assume_buffer_outlives_graph{}, - exp_ext::property::graph::assume_data_outlives_buffer{}}}; + {exp_ext::property::graph::assume_buffer_outlives_graph{}}}; // Copy from B to A auto NodeA = add_node(Graph, Queue, [&](handler &CGH) { diff --git a/sycl/test-e2e/Graph/Inputs/buffer_copy_2d.cpp b/sycl/test-e2e/Graph/Inputs/buffer_copy_2d.cpp index 179d624254fd9..08e1018826273 100644 --- a/sycl/test-e2e/Graph/Inputs/buffer_copy_2d.cpp +++ b/sycl/test-e2e/Graph/Inputs/buffer_copy_2d.cpp @@ -38,8 +38,7 @@ int main() { exp_ext::command_graph Graph{ Queue.get_context(), Queue.get_device(), - {exp_ext::property::graph::assume_buffer_outlives_graph{}, - exp_ext::property::graph::assume_data_outlives_buffer{}}}; + {exp_ext::property::graph::assume_buffer_outlives_graph{}}}; // Copy from B to A auto NodeA = add_node(Graph, Queue, [&](handler &CGH) { diff --git a/sycl/test-e2e/Graph/Inputs/buffer_copy_host2target.cpp b/sycl/test-e2e/Graph/Inputs/buffer_copy_host2target.cpp index efff98d1fb045..08488009dede4 100644 --- a/sycl/test-e2e/Graph/Inputs/buffer_copy_host2target.cpp +++ b/sycl/test-e2e/Graph/Inputs/buffer_copy_host2target.cpp @@ -24,8 +24,7 @@ int main() { exp_ext::command_graph Graph{ Queue.get_context(), Queue.get_device(), - {exp_ext::property::graph::assume_buffer_outlives_graph{}, - exp_ext::property::graph::assume_data_outlives_buffer{}}}; + {exp_ext::property::graph::assume_buffer_outlives_graph{}}}; auto NodeA = add_node(Graph, Queue, [&](handler &CGH) { auto AccA = BufferA.get_access(CGH); diff --git a/sycl/test-e2e/Graph/Inputs/buffer_copy_host2target_2d.cpp b/sycl/test-e2e/Graph/Inputs/buffer_copy_host2target_2d.cpp index d81e5f7928fe0..3ce06926f5c7d 100644 --- a/sycl/test-e2e/Graph/Inputs/buffer_copy_host2target_2d.cpp +++ b/sycl/test-e2e/Graph/Inputs/buffer_copy_host2target_2d.cpp @@ -25,8 +25,7 @@ int main() { exp_ext::command_graph Graph{ Queue.get_context(), Queue.get_device(), - {exp_ext::property::graph::assume_buffer_outlives_graph{}, - exp_ext::property::graph::assume_data_outlives_buffer{}}}; + {exp_ext::property::graph::assume_buffer_outlives_graph{}}}; auto NodeA = add_node(Graph, Queue, [&](handler &CGH) { auto AccA = BufferA.get_access(CGH); diff --git a/sycl/test-e2e/Graph/Inputs/buffer_copy_host2target_offset.cpp b/sycl/test-e2e/Graph/Inputs/buffer_copy_host2target_offset.cpp index e109a7bdad80f..f8fd346c142ff 100644 --- a/sycl/test-e2e/Graph/Inputs/buffer_copy_host2target_offset.cpp +++ b/sycl/test-e2e/Graph/Inputs/buffer_copy_host2target_offset.cpp @@ -27,8 +27,7 @@ int main() { exp_ext::command_graph Graph{ Queue.get_context(), Queue.get_device(), - {exp_ext::property::graph::assume_buffer_outlives_graph{}, - exp_ext::property::graph::assume_data_outlives_buffer{}}}; + {exp_ext::property::graph::assume_buffer_outlives_graph{}}}; auto NodeA = add_node(Graph, Queue, [&](handler &CGH) { auto AccA = BufferA.get_access(CGH, range<1>(Size), diff --git a/sycl/test-e2e/Graph/Inputs/buffer_copy_offsets.cpp b/sycl/test-e2e/Graph/Inputs/buffer_copy_offsets.cpp index 8626b3acc09cd..f6323efc1f7e7 100644 --- a/sycl/test-e2e/Graph/Inputs/buffer_copy_offsets.cpp +++ b/sycl/test-e2e/Graph/Inputs/buffer_copy_offsets.cpp @@ -34,8 +34,7 @@ int main() { exp_ext::command_graph Graph{ Queue.get_context(), Queue.get_device(), - {exp_ext::property::graph::assume_buffer_outlives_graph{}, - exp_ext::property::graph::assume_data_outlives_buffer{}}}; + {exp_ext::property::graph::assume_buffer_outlives_graph{}}}; // Copy from A to B auto NodeA = add_node(Graph, Queue, [&](handler &CGH) { diff --git a/sycl/test-e2e/Graph/Inputs/buffer_copy_target2host.cpp b/sycl/test-e2e/Graph/Inputs/buffer_copy_target2host.cpp index 916d54bb8825c..18b4dafe66862 100644 --- a/sycl/test-e2e/Graph/Inputs/buffer_copy_target2host.cpp +++ b/sycl/test-e2e/Graph/Inputs/buffer_copy_target2host.cpp @@ -25,8 +25,7 @@ int main() { exp_ext::command_graph Graph{ Queue.get_context(), Queue.get_device(), - {exp_ext::property::graph::assume_buffer_outlives_graph{}, - exp_ext::property::graph::assume_data_outlives_buffer{}}}; + {exp_ext::property::graph::assume_buffer_outlives_graph{}}}; auto NodeA = add_node(Graph, Queue, [&](handler &CGH) { auto AccA = BufferA.get_access(CGH); diff --git a/sycl/test-e2e/Graph/Inputs/buffer_copy_target2host_2d.cpp b/sycl/test-e2e/Graph/Inputs/buffer_copy_target2host_2d.cpp index ccf0fa62770c6..42af3d0a47f43 100644 --- a/sycl/test-e2e/Graph/Inputs/buffer_copy_target2host_2d.cpp +++ b/sycl/test-e2e/Graph/Inputs/buffer_copy_target2host_2d.cpp @@ -26,8 +26,7 @@ int main() { exp_ext::command_graph Graph{ Queue.get_context(), Queue.get_device(), - {exp_ext::property::graph::assume_buffer_outlives_graph{}, - exp_ext::property::graph::assume_data_outlives_buffer{}}}; + {exp_ext::property::graph::assume_buffer_outlives_graph{}}}; auto NodeA = add_node(Graph, Queue, [&](handler &CGH) { auto AccA = BufferA.get_access(CGH); diff --git a/sycl/test-e2e/Graph/Inputs/buffer_copy_target2host_offset.cpp b/sycl/test-e2e/Graph/Inputs/buffer_copy_target2host_offset.cpp index de6e44f44a7fa..bd9e28ac30964 100644 --- a/sycl/test-e2e/Graph/Inputs/buffer_copy_target2host_offset.cpp +++ b/sycl/test-e2e/Graph/Inputs/buffer_copy_target2host_offset.cpp @@ -28,8 +28,7 @@ int main() { exp_ext::command_graph Graph{ Queue.get_context(), Queue.get_device(), - {exp_ext::property::graph::assume_buffer_outlives_graph{}, - exp_ext::property::graph::assume_data_outlives_buffer{}}}; + {exp_ext::property::graph::assume_buffer_outlives_graph{}}}; auto NodeA = add_node(Graph, Queue, [&](handler &CGH) { auto AccA = BufferA.get_access( diff --git a/sycl/test-e2e/Graph/Inputs/dotp_buffer_reduction.cpp b/sycl/test-e2e/Graph/Inputs/dotp_buffer_reduction.cpp index 832b61129f23a..eac37ec354376 100644 --- a/sycl/test-e2e/Graph/Inputs/dotp_buffer_reduction.cpp +++ b/sycl/test-e2e/Graph/Inputs/dotp_buffer_reduction.cpp @@ -26,8 +26,7 @@ int main() { exp_ext::command_graph Graph{ Queue.get_context(), Queue.get_device(), - {exp_ext::property::graph::assume_buffer_outlives_graph{}, - exp_ext::property::graph::assume_data_outlives_buffer{}}}; + {exp_ext::property::graph::assume_buffer_outlives_graph{}}}; auto NodeI = add_node(Graph, Queue, [&](handler &CGH) { auto X = XBuf.get_access(CGH); diff --git a/sycl/test-e2e/Graph/Inputs/dotp_usm_reduction.cpp b/sycl/test-e2e/Graph/Inputs/dotp_usm_reduction.cpp index 4618ae5da2b2a..50918b0fe9e8f 100644 --- a/sycl/test-e2e/Graph/Inputs/dotp_usm_reduction.cpp +++ b/sycl/test-e2e/Graph/Inputs/dotp_usm_reduction.cpp @@ -6,11 +6,7 @@ int main() { queue Queue; - exp_ext::command_graph Graph{ - Queue.get_context(), - Queue.get_device(), - {exp_ext::property::graph::assume_buffer_outlives_graph{}, - exp_ext::property::graph::assume_data_outlives_buffer{}}}; + exp_ext::command_graph Graph{Queue.get_context(), Queue.get_device()}; float *Dotp = malloc_device(1, Queue); diff --git a/sycl/test-e2e/Graph/Inputs/event_status_querying.cpp b/sycl/test-e2e/Graph/Inputs/event_status_querying.cpp index 0f5819ee361cf..962f68c24488b 100644 --- a/sycl/test-e2e/Graph/Inputs/event_status_querying.cpp +++ b/sycl/test-e2e/Graph/Inputs/event_status_querying.cpp @@ -66,8 +66,7 @@ int main() { exp_ext::command_graph Graph{ Queue.get_context(), Queue.get_device(), - {exp_ext::property::graph::assume_buffer_outlives_graph{}, - exp_ext::property::graph::assume_data_outlives_buffer{}}}; + {exp_ext::property::graph::assume_buffer_outlives_graph{}}}; // Copy from B to A auto Init = add_node(Graph, Queue, [&](handler &CGH) { diff --git a/sycl/test-e2e/Graph/Inputs/sub_graph_reduction.cpp b/sycl/test-e2e/Graph/Inputs/sub_graph_reduction.cpp index 5ea3b6fd78a03..ccb168e28f805 100644 --- a/sycl/test-e2e/Graph/Inputs/sub_graph_reduction.cpp +++ b/sycl/test-e2e/Graph/Inputs/sub_graph_reduction.cpp @@ -6,16 +6,8 @@ int main() { queue Queue; - exp_ext::command_graph Graph{ - Queue.get_context(), - Queue.get_device(), - {exp_ext::property::graph::assume_buffer_outlives_graph{}, - exp_ext::property::graph::assume_data_outlives_buffer{}}}; - exp_ext::command_graph SubGraph{ - Queue.get_context(), - Queue.get_device(), - {exp_ext::property::graph::assume_buffer_outlives_graph{}, - exp_ext::property::graph::assume_data_outlives_buffer{}}}; + exp_ext::command_graph Graph{Queue.get_context(), Queue.get_device()}; + exp_ext::command_graph SubGraph{Queue.get_context(), Queue.get_device()}; float *Dotp = malloc_device(1, Queue); diff --git a/sycl/test-e2e/Graph/Inputs/temp_buffer_reinterpret.cpp b/sycl/test-e2e/Graph/Inputs/temp_buffer_reinterpret.cpp index bbed84e3df709..a47165c38f104 100644 --- a/sycl/test-e2e/Graph/Inputs/temp_buffer_reinterpret.cpp +++ b/sycl/test-e2e/Graph/Inputs/temp_buffer_reinterpret.cpp @@ -30,8 +30,7 @@ int main() { exp_ext::command_graph Graph{ Queue.get_context(), Queue.get_device(), - {exp_ext::property::graph::assume_buffer_outlives_graph{}, - exp_ext::property::graph::assume_data_outlives_buffer{}}}; + {exp_ext::property::graph::assume_buffer_outlives_graph{}}}; { // Create some temporary buffers only for adding nodes diff --git a/sycl/test-e2e/Graph/RecordReplay/assume_data_outlives_buffer_property.cpp b/sycl/test-e2e/Graph/RecordReplay/assume_data_outlives_buffer_property.cpp deleted file mode 100644 index cd517364665b0..0000000000000 --- a/sycl/test-e2e/Graph/RecordReplay/assume_data_outlives_buffer_property.cpp +++ /dev/null @@ -1,11 +0,0 @@ -// REQUIRES: level_zero, gpu -// RUN: %{build} -o %t.out -// RUN: %{run} %t.out -// Extra run to check for leaks in Level Zero using ZE_DEBUG -// RUN: %if ext_oneapi_level_zero %{env ZE_DEBUG=4 %{run} %t.out 2>&1 | FileCheck %s %} -// -// CHECK-NOT: LEAK - -#define GRAPH_E2E_RECORD_REPLAY - -#include "../Inputs/assume_data_outlives_buffer_property.cpp"