[llvm] [SYCL] Add platform enumeration and info query using liboffload (PR #166927)

Kseniya Tikhomirova via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 19 05:41:58 PST 2025


================
@@ -0,0 +1,54 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+///
+/// \file
+/// This file contains the declaration of SYCL 2020 platform info types.
+///
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBSYCL___IMPL_INFO_PLATFORM_HPP
+#define _LIBSYCL___IMPL_INFO_PLATFORM_HPP
+
+#include <sycl/__impl/detail/config.hpp>
+
+#include <string>
+
+_LIBSYCL_BEGIN_NAMESPACE_SYCL
+
+// A.1. Platform information descriptors
+namespace info {
+namespace platform {
+#define __SYCL_PARAM_TRAITS_SPEC(DescType, Desc, ReturnT, OffloadCode)         \
+  struct Desc {                                                                \
+    using return_type = ReturnT;                                               \
+  };
+
+// 4.6.2.4. Information descriptors
+#include <sycl/__impl/info/platform.def>
+
+#undef __SYCL_PARAM_TRAITS_SPEC
+} // namespace platform
+} // namespace info
+
+namespace detail {
+template <typename T> struct is_platform_info_desc : std::false_type {};
+
+#define __SYCL_PARAM_TRAITS_SPEC(DescType, Desc, ReturnT, OffloadCode)         \
+  template <>                                                                  \
+  struct is_##DescType##_info_desc<info::DescType::Desc> : std::true_type {    \
+    using return_type = info::DescType::Desc::return_type;                     \
+  };
----------------
KseniyaTikhomirova wrote:

1) At first glance I think we don't need those static_asserts at all. In the way we declare info - application that requests incorrect info shouldn't be able to compile. 
2) "Can't we use "platfrom" directly?" this macro will be placed in some common file once I add another SYCL class with info.

https://github.com/llvm/llvm-project/pull/166927


More information about the llvm-commits mailing list