From 2303e07243b001c783ed680872127d0cc0acf0e3 Mon Sep 17 00:00:00 2001 From: Kseniya Tikhomirova Date: Wed, 3 Jul 2024 20:45:01 +0200 Subject: [PATCH] [SYCL] Fix deferred buf destruction regression caused by host device removal (#14396) Signed-off-by: Tikhomirova, Kseniya --- sycl/source/detail/sycl_mem_obj_t.cpp | 9 ++++++--- sycl/test-e2e/BFloat16/bfloat16_vec.cpp | 3 --- sycl/test-e2e/Basic/stream/blocking_pipes_and_stream.cpp | 2 +- sycl/test-e2e/Basic/stream/stream.cpp | 3 --- sycl/test-e2e/Complex/sycl_complex_stream_test.cpp | 3 --- 5 files changed, 7 insertions(+), 13 deletions(-) diff --git a/sycl/source/detail/sycl_mem_obj_t.cpp b/sycl/source/detail/sycl_mem_obj_t.cpp index 009f910be440..374f6f124709 100644 --- a/sycl/source/detail/sycl_mem_obj_t.cpp +++ b/sycl/source/detail/sycl_mem_obj_t.cpp @@ -205,13 +205,16 @@ void SYCLMemObjT::detachMemoryObject( // For L0 context could be created with two ownership strategies - keep and // transfer. If user keeps ownership - we could not enable deferred buffer // release due to resource release conflict. + // MRecord->MCurContext == nullptr means that last submission to buffer is on + // host (host task), this execution doesn't depend on device context and fully + // controlled by RT. In this case deferred buffer destruction is allowed. bool InteropObjectsUsed = !MOwnNativeHandle || (MInteropContext && !MInteropContext->isOwnedByRuntime()); - if (MRecord && MRecord->MCurContext && - MRecord->MCurContext->isOwnedByRuntime() && !InteropObjectsUsed && - (!MHostPtrProvided || MIsInternal)) { + if (MRecord && + (!MRecord->MCurContext || MRecord->MCurContext->isOwnedByRuntime()) && + !InteropObjectsUsed && (!MHostPtrProvided || MIsInternal)) { bool okToDefer = GlobalHandler::instance().isOkToDefer(); if (okToDefer) Scheduler::getInstance().deferMemObjRelease(Self); diff --git a/sycl/test-e2e/BFloat16/bfloat16_vec.cpp b/sycl/test-e2e/BFloat16/bfloat16_vec.cpp index bca68c2e6d29..549dc13ed76c 100644 --- a/sycl/test-e2e/BFloat16/bfloat16_vec.cpp +++ b/sycl/test-e2e/BFloat16/bfloat16_vec.cpp @@ -10,9 +10,6 @@ // TODO enable opaque pointers support on CPU. // UNSUPPORTED: cpu || accelerator -// https://github.com/intel/llvm/issues/14397 -// UNSUPPORTED: windows && gpu-intel-gen12 - // RUN: %{build} -o %t.out // RUN: %{run} %t.out // RUN: %if preview-breaking-changes-supported %{ %{build} -fpreview-breaking-changes -o %t2.out %} diff --git a/sycl/test-e2e/Basic/stream/blocking_pipes_and_stream.cpp b/sycl/test-e2e/Basic/stream/blocking_pipes_and_stream.cpp index 12e2c062999d..d61f1f69234a 100644 --- a/sycl/test-e2e/Basic/stream/blocking_pipes_and_stream.cpp +++ b/sycl/test-e2e/Basic/stream/blocking_pipes_and_stream.cpp @@ -1,4 +1,4 @@ -// REQUIRES: accelerator, TEMPORARY_DISABLED +// REQUIRES: accelerator // RUN: %{build} -o %t.out // RUN: %{run} %t.out | FileCheck %s diff --git a/sycl/test-e2e/Basic/stream/stream.cpp b/sycl/test-e2e/Basic/stream/stream.cpp index 04680d969841..fe3429cffad2 100644 --- a/sycl/test-e2e/Basic/stream/stream.cpp +++ b/sycl/test-e2e/Basic/stream/stream.cpp @@ -9,9 +9,6 @@ // //===----------------------------------------------------------------------===// -// https://github.com/intel/llvm/issues/14397 -// UNSUPPORTED: windows && gpu-intel-gen12 - #include #include diff --git a/sycl/test-e2e/Complex/sycl_complex_stream_test.cpp b/sycl/test-e2e/Complex/sycl_complex_stream_test.cpp index 1140ef603d33..d8d645f6ac7d 100644 --- a/sycl/test-e2e/Complex/sycl_complex_stream_test.cpp +++ b/sycl/test-e2e/Complex/sycl_complex_stream_test.cpp @@ -1,8 +1,5 @@ // DEFINE: %{mathflags} = %if cl_options %{/clang:-fno-finite-math-only%} %else %{-fno-finite-math-only%} -// https://github.com/intel/llvm/issues/14397 -// UNSUPPORTED: windows && gpu-intel-gen12 - // RUN: %{build} -fsycl-device-code-split=per_kernel %{mathflags} -o %t.out // RUN: %{run} %t.out