[llvm] [SYCL] Add sycl::device initial implementation (PR #176972)

Kseniya Tikhomirova via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 21 06:36:11 PST 2026


================
@@ -0,0 +1,123 @@
+//===----------------------------------------------------------------------===//
+//
+// 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/device.hpp>
+#include <sycl/__impl/device_selector.hpp>
+
+#include <detail/device_impl.hpp>
+
+#include <algorithm>
+
+_LIBSYCL_BEGIN_NAMESPACE_SYCL
+
+static constexpr int MatchedTypeDefaultScore = 1000;
+static constexpr int GPUDeviceDefaultScore = 500;
+static constexpr int CPUDeviceDefaultScore = 300;
+static constexpr int AccDeviceDefaultScore = 75;
+static constexpr int RejectDeviceScore = -1;
+
+static int getDevicePreference(const device &Device) {
+  int Score = 0;
+  const auto &DeviceImpl = detail::getSyclObjImpl(Device);
+
+  // TODO: increase score for devices with compatible dev images
----------------
KseniyaTikhomirova wrote:

https://github.com/llvm/llvm-project/pull/176972/commits/35ee340bc773cdfced2304ea74fe3a51494d101f

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


More information about the llvm-commits mailing list