diff --git a/sycl/include/sycl/device.hpp b/sycl/include/sycl/device.hpp index 7b26b5911e3b1..d49a1f1d1ff9a 100644 --- a/sycl/include/sycl/device.hpp +++ b/sycl/include/sycl/device.hpp @@ -336,7 +336,10 @@ class __SYCL_EXPORT device : public detail::OwnerLessBase { /// query `CL_DEVICE_PROFILE`, as defined in section 4.2 "Querying Devices" of /// the OpenCL specification. If the device does not support kernel bundles /// written in `source_language::opencl`, returns the empty string. - std::string ext_oneapi_cl_profile() const; + std::string ext_oneapi_cl_profile() const { + detail::string profile = ext_oneapi_cl_profile_impl(); + return profile.c_str(); + } // TODO: Remove this diagnostics when __SYCL_WARN_IMAGE_ASPECT is removed. #if defined(__clang__) @@ -370,6 +373,7 @@ class __SYCL_EXPORT device : public detail::OwnerLessBase { bool ext_oneapi_supports_cl_extension( detail::string_view name, ext::oneapi::experimental::cl_version *version = nullptr) const; + detail::string ext_oneapi_cl_profile_impl() const; }; } // namespace _V1 diff --git a/sycl/source/device.cpp b/sycl/source/device.cpp index 9207189c7ea03..67b7b5096cc5e 100644 --- a/sycl/source/device.cpp +++ b/sycl/source/device.cpp @@ -314,7 +314,7 @@ bool device::ext_oneapi_supports_cl_extension( Name.data(), VersionPtr, ipVersion); } -std::string device::ext_oneapi_cl_profile() const { +detail::string device::ext_oneapi_cl_profile_impl() const { ur_device_handle_t Device = impl->getHandleRef(); auto Plugin = impl->getPlugin(); uint32_t ipVersion = 0; @@ -322,9 +322,11 @@ std::string device::ext_oneapi_cl_profile() const { Plugin->call_nocheck(urDeviceGetInfo, Device, UR_DEVICE_INFO_IP_VERSION, sizeof(uint32_t), &ipVersion, nullptr); if (res != UR_RESULT_SUCCESS) - return ""; + return detail::string{""}; - return ext::oneapi::experimental::detail::OpenCLC_Profile(ipVersion); + std::string profile = + ext::oneapi::experimental::detail::OpenCLC_Profile(ipVersion); + return detail::string{profile}; } } // namespace _V1 diff --git a/sycl/test/abi/sycl_abi_neutrality_test.cpp b/sycl/test/abi/sycl_abi_neutrality_test.cpp index 3b3cb9d48177d..2f257f1736afd 100644 --- a/sycl/test/abi/sycl_abi_neutrality_test.cpp +++ b/sycl/test/abi/sycl_abi_neutrality_test.cpp @@ -23,4 +23,3 @@ // CHECK:_ZN4sycl3_V16opencl13has_extensionERKNS0_6deviceERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE // CHECK:_ZN4sycl3_V16opencl13has_extensionERKNS0_8platformERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE // CHECK:_ZNK4sycl3_V13ext6oneapi12experimental6detail24modifiable_command_graph11print_graphENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEb -// CHECK:_ZNK4sycl3_V16device21ext_oneapi_cl_profileB5cxx11Ev diff --git a/sycl/test/abi/sycl_symbols_linux.dump b/sycl/test/abi/sycl_symbols_linux.dump index 091fc56494f1d..2ae8f9ee693e8 100644 --- a/sycl/test/abi/sycl_symbols_linux.dump +++ b/sycl/test/abi/sycl_symbols_linux.dump @@ -3890,7 +3890,7 @@ _ZNK4sycl3_V16device18create_sub_devicesILNS0_4info18partition_propertyE4230EEES _ZNK4sycl3_V16device18create_sub_devicesILNS0_4info18partition_propertyE4231EEESt6vectorIS1_SaIS1_EERKS5_ImSaImEE _ZNK4sycl3_V16device18create_sub_devicesILNS0_4info18partition_propertyE4232EEESt6vectorIS1_SaIS1_EENS3_25partition_affinity_domainE _ZNK4sycl3_V16device18create_sub_devicesILNS0_4info18partition_propertyE4233EEESt6vectorIS1_SaIS1_EEv -_ZNK4sycl3_V16device21ext_oneapi_cl_profileB5cxx11Ev +_ZNK4sycl3_V16device26ext_oneapi_cl_profile_implEv _ZNK4sycl3_V16device32ext_oneapi_supports_cl_c_versionERKNS0_3ext6oneapi12experimental10cl_versionE _ZNK4sycl3_V16device32ext_oneapi_supports_cl_extensionENS0_6detail11string_viewEPNS0_3ext6oneapi12experimental10cl_versionE _ZNK4sycl3_V16device3getEv diff --git a/sycl/test/abi/sycl_symbols_windows.dump b/sycl/test/abi/sycl_symbols_windows.dump index 72fe0ebad1ed8..b8e0b9390ee80 100644 --- a/sycl/test/abi/sycl_symbols_windows.dump +++ b/sycl/test/abi/sycl_symbols_windows.dump @@ -3770,6 +3770,7 @@ ?ext_oneapi_can_access_peer@device@_V1@sycl@@QEAA_NAEBV123@W4peer_access@oneapi@ext@23@@Z ?ext_oneapi_can_compile@device@_V1@sycl@@QEAA_NW4source_language@experimental@oneapi@ext@23@@Z ?ext_oneapi_cl_profile@device@_V1@sycl@@QEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@XZ +?ext_oneapi_cl_profile_impl@device@_V1@sycl@@AEBA?AVstring@detail@23@XZ ?ext_oneapi_copy@handler@_V1@sycl@@QEAAXPEBXPEAXAEBUimage_descriptor@experimental@oneapi@ext@23@_K@Z ?ext_oneapi_copy@handler@_V1@sycl@@QEAAXPEBXUimage_mem_handle@experimental@oneapi@ext@23@AEBUimage_descriptor@56723@@Z ?ext_oneapi_copy@handler@_V1@sycl@@QEAAXPEBXV?$range@$02@23@1Uimage_mem_handle@experimental@oneapi@ext@23@1AEBUimage_descriptor@67823@1@Z