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

Andrei Elovikov via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 7 10:10:57 PST 2025


================
@@ -0,0 +1,65 @@
+//===----------------------------------------------------------------------===//
+//
+// 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 <sycl/__impl/detail/config.hpp>
+#include <sycl/__impl/detail/obj_base.hpp>
+
+#include <detail/global_objects.hpp>
+#include <detail/platform_impl.hpp>
+
+_LIBSYCL_BEGIN_NAMESPACE_SYCL
+
+namespace detail {
+
+platform_impl *
+platform_impl::getOrMakePlatformImpl(ol_platform_handle_t Platform,
+                                     size_t PlatformIndex) {
+  const std::lock_guard<std::mutex> Guard(getPlatformMapMutex());
----------------
aelovikov-intel wrote:

I think just a simple singleton without any mutexes or `getOrMakePlatformImpl` would suffice for the platforms and that this particular interface is just some legacy from our downstream implementation. We should be able to create full platform/device hierarchy that wouldn't change later, or is it (immutability) not the case with liboffload?

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


More information about the llvm-commits mailing list