From f3d5e16ea6371a975f496f8b1b56b6004953b19a Mon Sep 17 00:00:00 2001 From: "aidan.belton" Date: Mon, 20 Sep 2021 12:47:43 +0100 Subject: [PATCH 1/4] prevent preprocessor being passed to hip and cuda --- sycl/include/CL/sycl/queue.hpp | 35 +++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/sycl/include/CL/sycl/queue.hpp b/sycl/include/CL/sycl/queue.hpp index 2bbeffdfb151c..ec66a9e7e4d48 100644 --- a/sycl/include/CL/sycl/queue.hpp +++ b/sycl/include/CL/sycl/queue.hpp @@ -248,7 +248,8 @@ class __SYCL_EXPORT queue { event Event; #if __SYCL_USE_FALLBACK_ASSERT - if (!is_host()) { + if (!is_host() && get_backend() != backend::cuda && + get_backend() != backend::hip) { auto PostProcess = [this, &CodeLoc](bool IsKernel, bool KernelUsesAssert, event &E) { if (IsKernel && !device_has(aspect::ext_oneapi_native_assert) && @@ -289,22 +290,26 @@ class __SYCL_EXPORT queue { event Event; #if __SYCL_USE_FALLBACK_ASSERT - auto PostProcess = [this, &SecondaryQueue, &CodeLoc]( - bool IsKernel, bool KernelUsesAssert, event &E) { - if (IsKernel && !device_has(aspect::ext_oneapi_native_assert) && - KernelUsesAssert) { - // __devicelib_assert_fail isn't supported by Device-side Runtime - // Linking against fallback impl of __devicelib_assert_fail is performed - // by program manager class - submitAssertCapture(*this, E, /* SecondaryQueue = */ nullptr, CodeLoc); - } - }; + if (get_backend() != backend::cuda && get_backend() != backend::hip) { + auto PostProcess = [this, &SecondaryQueue, &CodeLoc]( + bool IsKernel, bool KernelUsesAssert, event &E) { + if (IsKernel && !device_has(aspect::ext_oneapi_native_assert) && + KernelUsesAssert) { + // __devicelib_assert_fail isn't supported by Device-side Runtime + // Linking against fallback impl of __devicelib_assert_fail is + // performed by program manager class + submitAssertCapture(*this, E, /* SecondaryQueue = */ nullptr, + CodeLoc); + } + }; - Event = - submit_impl_and_postprocess(CGF, SecondaryQueue, CodeLoc, PostProcess); -#else - Event = submit_impl(CGF, SecondaryQueue, CodeLoc); + Event = submit_impl_and_postprocess(CGF, SecondaryQueue, CodeLoc, + PostProcess); + } else #endif // __SYCL_USE_FALLBACK_ASSERT + { + Event = submit_impl(CGF, SecondaryQueue, CodeLoc); + } return Event; } From 2fcc0da311934ef15884d92fd7fccce8dc9fa295 Mon Sep 17 00:00:00 2001 From: "aidan.belton" Date: Tue, 21 Sep 2021 10:09:38 +0100 Subject: [PATCH 2/4] Add comment to check --- sycl/include/CL/sycl/queue.hpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sycl/include/CL/sycl/queue.hpp b/sycl/include/CL/sycl/queue.hpp index ec66a9e7e4d48..5f7ee2ffdbda7 100644 --- a/sycl/include/CL/sycl/queue.hpp +++ b/sycl/include/CL/sycl/queue.hpp @@ -248,6 +248,7 @@ class __SYCL_EXPORT queue { event Event; #if __SYCL_USE_FALLBACK_ASSERT + // TODO: Remove check on CUDA and HIP when they support fallback asserts if (!is_host() && get_backend() != backend::cuda && get_backend() != backend::hip) { auto PostProcess = [this, &CodeLoc](bool IsKernel, bool KernelUsesAssert, @@ -290,6 +291,7 @@ class __SYCL_EXPORT queue { event Event; #if __SYCL_USE_FALLBACK_ASSERT + // TODO: Remove check on CUDA and HIP when they support fallback asserts if (get_backend() != backend::cuda && get_backend() != backend::hip) { auto PostProcess = [this, &SecondaryQueue, &CodeLoc]( bool IsKernel, bool KernelUsesAssert, event &E) { From 3238b1275105cae1fe28b2125126ec603b76337e Mon Sep 17 00:00:00 2001 From: "aidan.belton" Date: Mon, 27 Sep 2021 16:42:08 +0100 Subject: [PATCH 3/4] revert changes to queue.hpp and PI_DEVICE_INFO_EXTENSION_DEVICELIB_ASSERT to hip --- sycl/include/CL/sycl/queue.hpp | 37 ++++++++++++++-------------------- sycl/plugins/hip/pi_hip.cpp | 10 ++++++++- 2 files changed, 24 insertions(+), 23 deletions(-) diff --git a/sycl/include/CL/sycl/queue.hpp b/sycl/include/CL/sycl/queue.hpp index 5f7ee2ffdbda7..2bbeffdfb151c 100644 --- a/sycl/include/CL/sycl/queue.hpp +++ b/sycl/include/CL/sycl/queue.hpp @@ -248,9 +248,7 @@ class __SYCL_EXPORT queue { event Event; #if __SYCL_USE_FALLBACK_ASSERT - // TODO: Remove check on CUDA and HIP when they support fallback asserts - if (!is_host() && get_backend() != backend::cuda && - get_backend() != backend::hip) { + if (!is_host()) { auto PostProcess = [this, &CodeLoc](bool IsKernel, bool KernelUsesAssert, event &E) { if (IsKernel && !device_has(aspect::ext_oneapi_native_assert) && @@ -291,27 +289,22 @@ class __SYCL_EXPORT queue { event Event; #if __SYCL_USE_FALLBACK_ASSERT - // TODO: Remove check on CUDA and HIP when they support fallback asserts - if (get_backend() != backend::cuda && get_backend() != backend::hip) { - auto PostProcess = [this, &SecondaryQueue, &CodeLoc]( - bool IsKernel, bool KernelUsesAssert, event &E) { - if (IsKernel && !device_has(aspect::ext_oneapi_native_assert) && - KernelUsesAssert) { - // __devicelib_assert_fail isn't supported by Device-side Runtime - // Linking against fallback impl of __devicelib_assert_fail is - // performed by program manager class - submitAssertCapture(*this, E, /* SecondaryQueue = */ nullptr, - CodeLoc); - } - }; + auto PostProcess = [this, &SecondaryQueue, &CodeLoc]( + bool IsKernel, bool KernelUsesAssert, event &E) { + if (IsKernel && !device_has(aspect::ext_oneapi_native_assert) && + KernelUsesAssert) { + // __devicelib_assert_fail isn't supported by Device-side Runtime + // Linking against fallback impl of __devicelib_assert_fail is performed + // by program manager class + submitAssertCapture(*this, E, /* SecondaryQueue = */ nullptr, CodeLoc); + } + }; - Event = submit_impl_and_postprocess(CGF, SecondaryQueue, CodeLoc, - PostProcess); - } else + Event = + submit_impl_and_postprocess(CGF, SecondaryQueue, CodeLoc, PostProcess); +#else + Event = submit_impl(CGF, SecondaryQueue, CodeLoc); #endif // __SYCL_USE_FALLBACK_ASSERT - { - Event = submit_impl(CGF, SecondaryQueue, CodeLoc); - } return Event; } diff --git a/sycl/plugins/hip/pi_hip.cpp b/sycl/plugins/hip/pi_hip.cpp index 0a234339384bc..b0173da8d1f28 100644 --- a/sycl/plugins/hip/pi_hip.cpp +++ b/sycl/plugins/hip/pi_hip.cpp @@ -1415,7 +1415,15 @@ pi_result hip_piDeviceGetInfo(pi_device device, pi_device_info param_name, return getInfo(param_value_size, param_value, param_value_size_ret, ""); } case PI_DEVICE_INFO_EXTENSIONS: { - return getInfo(param_value_size, param_value, param_value_size_ret, ""); + // TODO:Remove when HIP support native asserts. + // DEVICELIB_ASSERT extension is set so fallback assert + // postprocessing is NOP + std::string SupportedExtensions = ""; + SupportedExtensions += PI_DEVICE_INFO_EXTENSION_DEVICELIB_ASSERT; + SupportedExtensions += " "; + + return getInfo(param_value_size, param_value, param_value_size_ret, + SupportedExtensions.c_str()); } case PI_DEVICE_INFO_PRINTF_BUFFER_SIZE: { // The minimum value for the FULL profile is 1 MB. From 54476f641ab1e4ea10d64d17b974a03267afacd7 Mon Sep 17 00:00:00 2001 From: "aidan.belton" Date: Mon, 27 Sep 2021 17:10:24 +0100 Subject: [PATCH 4/4] clarify comment --- sycl/plugins/hip/pi_hip.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sycl/plugins/hip/pi_hip.cpp b/sycl/plugins/hip/pi_hip.cpp index b0173da8d1f28..d525c24dff4c4 100644 --- a/sycl/plugins/hip/pi_hip.cpp +++ b/sycl/plugins/hip/pi_hip.cpp @@ -1415,9 +1415,10 @@ pi_result hip_piDeviceGetInfo(pi_device device, pi_device_info param_name, return getInfo(param_value_size, param_value, param_value_size_ret, ""); } case PI_DEVICE_INFO_EXTENSIONS: { - // TODO:Remove when HIP support native asserts. + // TODO: Remove comment when HIP support native asserts. // DEVICELIB_ASSERT extension is set so fallback assert - // postprocessing is NOP + // postprocessing is NOP. HIP 4.3 docs indicate support for + // native asserts are in progress std::string SupportedExtensions = ""; SupportedExtensions += PI_DEVICE_INFO_EXTENSION_DEVICELIB_ASSERT; SupportedExtensions += " ";