From 12efeae9b1e2eb9d80a11c891c0859320bf9ed9f Mon Sep 17 00:00:00 2001 From: aelovikov-intel Date: Tue, 3 Dec 2024 09:05:17 -0800 Subject: [PATCH] =?UTF-8?q?Revert=20"[SYCL]=20Support=20`online=5Fcompiler?= =?UTF-8?q?::compile`=20compiled=20with=20pre-C++11=20ABI=E2=80=A6"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 40e2e66344e7a916b8a7961beb786b7cb58f240c. --- sycl/include/sycl/detail/string_view.hpp | 13 ++-- .../intel/experimental/online_compiler.hpp | 42 ++----------- .../online_compiler/online_compiler.cpp | 59 +++++++++---------- sycl/test/abi/sycl_symbols_linux.dump | 2 - sycl/test/abi/sycl_symbols_windows.dump | 2 - 5 files changed, 38 insertions(+), 80 deletions(-) diff --git a/sycl/include/sycl/detail/string_view.hpp b/sycl/include/sycl/detail/string_view.hpp index d36301efbfdac..7815ecc4ce676 100644 --- a/sycl/include/sycl/detail/string_view.hpp +++ b/sycl/include/sycl/detail/string_view.hpp @@ -37,19 +37,14 @@ class string_view { const char *data() const noexcept { return str; } - friend bool operator==(string_view lhs, std::string_view rhs) noexcept { + friend bool operator==(const string_view &lhs, + std::string_view rhs) noexcept { return rhs == lhs.data(); } - friend bool operator==(std::string_view lhs, string_view rhs) noexcept { + friend bool operator==(std::string_view lhs, + const string_view &rhs) noexcept { return lhs == rhs.data(); } - - friend bool operator!=(string_view lhs, std::string_view rhs) noexcept { - return rhs != lhs.data(); - } - friend bool operator!=(std::string_view lhs, string_view rhs) noexcept { - return lhs != rhs.data(); - } }; } // namespace detail diff --git a/sycl/include/sycl/ext/intel/experimental/online_compiler.hpp b/sycl/include/sycl/ext/intel/experimental/online_compiler.hpp index feeaa30d9e2ba..769dbe45050fc 100644 --- a/sycl/include/sycl/ext/intel/experimental/online_compiler.hpp +++ b/sycl/include/sycl/ext/intel/experimental/online_compiler.hpp @@ -81,21 +81,6 @@ class __SYCL2020_DEPRECATED( "experimental online_compiler is being deprecated. See " "'sycl_ext_oneapi_kernel_compiler.asciidoc' instead for new kernel " "compiler extension to kernel_bundle implementation.") online_compiler { - __SYCL_EXPORT std::vector - compile_impl(sycl::detail::string_view Src, - sycl::detail::string_view DeviceStepping, - const std::vector &Options); - - std::vector compile_impl(const std::string &Source, - const std::vector &UserArgs) { - std::vector Args; - for (auto &&Arg : UserArgs) - Args.emplace_back(Arg); - - return compile_impl(std::string_view{Source}, - std::string_view{DeviceStepping}, Args); - } - public: /// Constructs online compiler which can target any device and produces /// given compiled code format. Produces 64-bit device code. @@ -211,17 +196,9 @@ class __SYCL2020_DEPRECATED( /// OpenCL JIT compiler options must be supported. template <> template <> -#if !defined(__SYCL_ONLINE_COMPILER_CPP) || \ - defined(__INTEL_PREVIEW_BREAKING_CHANGES) -inline -#else -__SYCL_EXPORT -#endif - std::vector - online_compiler::compile( - const std::string &src, const std::vector &options) { - return compile_impl(src, options); -} +__SYCL_EXPORT std::vector +online_compiler::compile( + const std::string &src, const std::vector &options); /// Compiles the given OpenCL source. May throw \c online_compile_error. /// @param src - contents of the source. @@ -237,17 +214,8 @@ online_compiler::compile(const std::string &src) { /// @param options - compilation options (implementation defined). template <> template <> -#if !defined(__SYCL_ONLINE_COMPILER_CPP) || \ - defined(__INTEL_PREVIEW_BREAKING_CHANGES) -inline -#else -__SYCL_EXPORT -#endif - std::vector - online_compiler::compile( - const std::string &src, const std::vector &options) { - return compile_impl(src, options); -} +__SYCL_EXPORT std::vector online_compiler::compile( + const std::string &src, const std::vector &options); /// Compiles the given CM source \p src. template <> diff --git a/sycl/source/detail/online_compiler/online_compiler.cpp b/sycl/source/detail/online_compiler/online_compiler.cpp index 344d32cd61ff5..5d3c3a381607b 100644 --- a/sycl/source/detail/online_compiler/online_compiler.cpp +++ b/sycl/source/detail/online_compiler/online_compiler.cpp @@ -6,8 +6,6 @@ // //===----------------------------------------------------------------------===// -#define __SYCL_ONLINE_COMPILER_CPP - #include #include #include @@ -21,11 +19,9 @@ inline namespace _V1 { namespace ext::intel::experimental { namespace detail { -using namespace sycl::detail; - static std::vector prepareOclocArgs(sycl::info::device_type DeviceType, device_arch DeviceArch, - bool Is64Bit, string_view DeviceStepping, + bool Is64Bit, const std::string &DeviceStepping, const std::string &UserArgs) { std::vector Args = {"ocloc", "-q", "-spv_only", "-device"}; @@ -58,7 +54,7 @@ prepareOclocArgs(sycl::info::device_type DeviceType, device_arch DeviceArch, if (DeviceStepping != "") { Args.push_back("-revision_id"); - Args.push_back(DeviceStepping.data()); + Args.push_back(DeviceStepping.c_str()); } Args.push_back(Is64Bit ? "-64" : "-32"); @@ -86,11 +82,11 @@ prepareOclocArgs(sycl::info::device_type DeviceType, device_arch DeviceArch, /// allocated during the compilation. /// @param UserArgs - User's options to ocloc compiler. static std::vector -compileToSPIRV(string_view Src, sycl::info::device_type DeviceType, - device_arch DeviceArch, bool Is64Bit, string_view DeviceStepping, - void *&CompileToSPIRVHandle, void *&FreeSPIRVOutputsHandle, +compileToSPIRV(const std::string &Source, sycl::info::device_type DeviceType, + device_arch DeviceArch, bool Is64Bit, + const std::string &DeviceStepping, void *&CompileToSPIRVHandle, + void *&FreeSPIRVOutputsHandle, const std::vector &UserArgs) { - std::string Source{Src.data()}; if (!CompileToSPIRVHandle) { #ifdef __SYCL_RT_OS_WINDOWS @@ -202,10 +198,11 @@ compileToSPIRV(string_view Src, sycl::info::device_type DeviceType, } } // namespace detail -template -__SYCL_EXPORT std::vector online_compiler::compile_impl( - detail::string_view Src, detail::string_view DeviceStepping, - const std::vector &Options) { +template <> +template <> +__SYCL_EXPORT std::vector +online_compiler::compile( + const std::string &Source, const std::vector &UserArgs) { if (OutputFormatVersion != std::pair{0, 0}) { std::string Version = std::to_string(OutputFormatVersion.first) + ", " + @@ -214,27 +211,29 @@ __SYCL_EXPORT std::vector online_compiler::compile_impl( Version + ") is not supported yet"); } - std::vector UserArgs; - for (auto &&Opt : Options) - UserArgs.emplace_back(Opt.data()); - - if constexpr (Lang == source_language::cm) - UserArgs.push_back("-cmc"); - - return detail::compileToSPIRV(Src, DeviceType, DeviceArch, Is64Bit, + return detail::compileToSPIRV(Source, DeviceType, DeviceArch, Is64Bit, DeviceStepping, CompileToSPIRVHandle, FreeSPIRVOutputsHandle, UserArgs); } -template __SYCL_EXPORT std::vector -online_compiler::compile_impl( - detail::string_view Src, detail::string_view DeviceStepping, - const std::vector &Options); +template <> +template <> +__SYCL_EXPORT std::vector online_compiler::compile( + const std::string &Source, const std::vector &UserArgs) { -template __SYCL_EXPORT std::vector -online_compiler::compile_impl( - detail::string_view Src, detail::string_view DeviceStepping, - const std::vector &Options); + if (OutputFormatVersion != std::pair{0, 0}) { + std::string Version = std::to_string(OutputFormatVersion.first) + ", " + + std::to_string(OutputFormatVersion.second); + throw online_compile_error(std::string("The output format version (") + + Version + ") is not supported yet"); + } + + std::vector CMUserArgs = UserArgs; + CMUserArgs.push_back("-cmc"); + return detail::compileToSPIRV(Source, DeviceType, DeviceArch, Is64Bit, + DeviceStepping, CompileToSPIRVHandle, + FreeSPIRVOutputsHandle, CMUserArgs); +} } // namespace ext::intel::experimental namespace ext { diff --git a/sycl/test/abi/sycl_symbols_linux.dump b/sycl/test/abi/sycl_symbols_linux.dump index 3e7673d95b236..fdb3b934fccc7 100644 --- a/sycl/test/abi/sycl_symbols_linux.dump +++ b/sycl/test/abi/sycl_symbols_linux.dump @@ -2985,9 +2985,7 @@ _ZN4sycl3_V121__isgreaterequal_implEdd _ZN4sycl3_V121__isgreaterequal_implEff _ZN4sycl3_V122accelerator_selector_vERKNS0_6deviceE _ZN4sycl3_V128verifyUSMAllocatorPropertiesERKNS0_13property_listE -_ZN4sycl3_V13ext5intel12experimental15online_compilerILNS3_15source_languageE0EE12compile_implENS0_6detail11string_viewES8_RKSt6vectorIS8_SaIS8_EE _ZN4sycl3_V13ext5intel12experimental15online_compilerILNS3_15source_languageE0EE7compileIJSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaISE_EEEEES8_IhSaIhEERKSE_DpRKT_ -_ZN4sycl3_V13ext5intel12experimental15online_compilerILNS3_15source_languageE1EE12compile_implENS0_6detail11string_viewES8_RKSt6vectorIS8_SaIS8_EE _ZN4sycl3_V13ext5intel12experimental15online_compilerILNS3_15source_languageE1EE7compileIJSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaISE_EEEEES8_IhSaIhEERKSE_DpRKT_ _ZN4sycl3_V13ext5intel12experimental9pipe_base13get_pipe_nameB5cxx11EPKv _ZN4sycl3_V13ext5intel12experimental9pipe_base17wait_non_blockingERKNS0_5eventE diff --git a/sycl/test/abi/sycl_symbols_windows.dump b/sycl/test/abi/sycl_symbols_windows.dump index a84e393e5b006..e93fd8be978e8 100644 --- a/sycl/test/abi/sycl_symbols_windows.dump +++ b/sycl/test/abi/sycl_symbols_windows.dump @@ -3743,8 +3743,6 @@ ?category@exception@_V1@sycl@@QEBAAEBVerror_category@std@@XZ ?clearArgs@handler@_V1@sycl@@AEAAXXZ ?code@exception@_V1@sycl@@QEBAAEBVerror_code@std@@XZ -?compile_impl@?$online_compiler@$00@experimental@intel@ext@_V1@sycl@@AEAA?AV?$vector@EV?$allocator@E@std@@@std@@Vstring_view@detail@56@0AEBV?$vector@Vstring_view@detail@_V1@sycl@@V?$allocator@Vstring_view@detail@_V1@sycl@@@std@@@8@@Z -?compile_impl@?$online_compiler@$0A@@experimental@intel@ext@_V1@sycl@@AEAA?AV?$vector@EV?$allocator@E@std@@@std@@Vstring_view@detail@56@0AEBV?$vector@Vstring_view@detail@_V1@sycl@@V?$allocator@Vstring_view@detail@_V1@sycl@@@std@@@8@@Z ?compile_impl@detail@_V1@sycl@@YA?AV?$shared_ptr@Vkernel_bundle_impl@detail@_V1@sycl@@@std@@AEBV?$kernel_bundle@$0A@@23@AEBV?$vector@Vdevice@_V1@sycl@@V?$allocator@Vdevice@_V1@sycl@@@std@@@5@AEBVproperty_list@23@@Z ?complete_fusion@fusion_wrapper@experimental@codeplay@ext@_V1@sycl@@QEAA?AVevent@56@AEBVproperty_list@56@@Z ?computeFallbackKernelBounds@handler@_V1@sycl@@AEAA?AV?$id@$01@23@_K0@Z