Skip to content

Commit 1e81dea

Browse files
[NFC][SYCL] Move platform_impl::get_info impl to the header (#18300)
So that we wouldn't need explicit instantiations. Instead, `platform.cpp` would implicitly instantiate all of them when processing explicit ones for `platform::get_info`.
1 parent f102408 commit 1e81dea

File tree

2 files changed

+10
-19
lines changed

2 files changed

+10
-19
lines changed

sycl/source/detail/platform_impl.cpp

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
#include <detail/device_impl.hpp>
1212
#include <detail/global_handler.hpp>
1313
#include <detail/platform_impl.hpp>
14-
#include <detail/split_string.hpp>
1514
#include <detail/ur_info_code.hpp>
1615
#include <sycl/backend_types.hpp>
1716
#include <sycl/detail/iostream_proxy.hpp>
@@ -565,17 +564,6 @@ ur_native_handle_t platform_impl::getNative() const {
565564
return Handle;
566565
}
567566

568-
template <typename Param>
569-
typename Param::return_type platform_impl::get_info() const {
570-
std::string InfoStr = urGetInfoString<UrApiKind::urPlatformGetInfo>(
571-
*this, detail::UrInfoCode<Param>::value);
572-
if constexpr (std::is_same_v<Param, info::platform::extensions>) {
573-
return split_string(InfoStr, ' ');
574-
} else {
575-
return InfoStr;
576-
}
577-
}
578-
579567
#ifndef __INTEL_PREVIEW_BREAKING_CHANGES
580568
template <>
581569
typename info::platform::version::return_type
@@ -645,12 +633,6 @@ device_impl *platform_impl::getDeviceImplHelper(ur_device_handle_t UrDevice) {
645633
return nullptr;
646634
}
647635

648-
#define __SYCL_PARAM_TRAITS_SPEC(DescType, Desc, ReturnT, PiCode) \
649-
template ReturnT platform_impl::get_info<info::platform::Desc>() const;
650-
651-
#include <sycl/info/platform_traits.def>
652-
#undef __SYCL_PARAM_TRAITS_SPEC
653-
654636
} // namespace detail
655637
} // namespace _V1
656638
} // namespace sycl

sycl/source/detail/platform_impl.hpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#pragma once
1010

1111
#include <detail/adapter.hpp>
12+
#include <detail/split_string.hpp>
1213
#include <detail/ur.hpp>
1314
#include <detail/ur_info_code.hpp>
1415
#include <sycl/backend_types.hpp>
@@ -79,7 +80,15 @@ class platform_impl : public std::enable_shared_from_this<platform_impl> {
7980
/// Queries this SYCL platform for info.
8081
///
8182
/// The return type depends on information being queried.
82-
template <typename Param> typename Param::return_type get_info() const;
83+
template <typename Param> typename Param::return_type get_info() const {
84+
std::string InfoStr = urGetInfoString<UrApiKind::urPlatformGetInfo>(
85+
*this, detail::UrInfoCode<Param>::value);
86+
if constexpr (std::is_same_v<Param, info::platform::extensions>) {
87+
return split_string(InfoStr, ' ');
88+
} else {
89+
return InfoStr;
90+
}
91+
}
8392

8493
/// Queries this SYCL platform for SYCL backend-specific information.
8594
///

0 commit comments

Comments
 (0)