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

Kseniya Tikhomirova via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 4 10:58:43 PST 2025


================
@@ -0,0 +1,68 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+#include <detail/global_objects.hpp>
+#include <detail/platform_impl.hpp>
+
+#ifdef _WIN32
+#  include <windows.h>
+#endif
+
+#include <vector>
+
+_LIBSYCL_BEGIN_NAMESPACE_SYCL
+namespace detail {
+
+std::vector<detail::OffloadTopology> &getOffloadTopologies() {
+  static std::vector<detail::OffloadTopology> Topologies(
+      OL_PLATFORM_BACKEND_LAST);
+  return Topologies;
+}
+
+std::vector<platform_impl> &getPlatformCache() {
+  static std::vector<platform_impl> PlatformCache{};
----------------
KseniyaTikhomirova wrote:

I started device implementation and it reveals the problem with this approach of storing just the object. so this will be changed to vector of unique_ptrs as well.

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


More information about the llvm-commits mailing list