55// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
66//
77// ===----------------------------------------------------------------------===//
8-
98#include < detail/allowlist.hpp>
109#include < detail/config.hpp>
1110#include < detail/device_impl.hpp>
11+ #include < detail/device_info.hpp>
1212#include < detail/platform_info.hpp>
13+ #include < sycl/backend.hpp>
1314
1415#include < algorithm>
1516#include < regex>
@@ -335,15 +336,17 @@ bool deviceIsAllowed(const DeviceDescT &DeviceDesc,
335336
336337void applyAllowList (std::vector<RT::PiDevice> &PiDevices,
337338 RT::PiPlatform PiPlatform, const plugin &Plugin) {
339+
338340 AllowListParsedT AllowListParsed =
339341 parseAllowList (SYCLConfig<SYCL_DEVICE_ALLOWLIST>::get ());
340342 if (AllowListParsed.empty ())
341343 return ;
342344
345+ // Get platform's backend and put it to DeviceDesc
343346 DeviceDescT DeviceDesc;
347+ auto PlatformImpl = platform_impl::getOrMakePlatformImpl (PiPlatform, Plugin);
348+ backend Backend = PlatformImpl->getBackend ();
344349
345- // get BackendName value and put it to DeviceDesc
346- sycl::backend Backend = Plugin.getBackend ();
347350 for (const auto &SyclBe : getSyclBeMap ()) {
348351 if (SyclBe.second == Backend) {
349352 DeviceDesc.emplace (BackendNameKeyName, SyclBe.first );
@@ -361,6 +364,7 @@ void applyAllowList(std::vector<RT::PiDevice> &PiDevices,
361364
362365 int InsertIDx = 0 ;
363366 for (RT::PiDevice Device : PiDevices) {
367+ auto DeviceImpl = PlatformImpl->getOrMakeDeviceImpl (Device, PlatformImpl);
364368 // get DeviceType value and put it to DeviceDesc
365369 RT::PiDeviceType PiDevType;
366370 Plugin.call <PiApiKind::piDeviceGetInfo>(Device, PI_DEVICE_INFO_TYPE,
@@ -376,19 +380,18 @@ void applyAllowList(std::vector<RT::PiDevice> &PiDevices,
376380 }
377381 // get DeviceVendorId value and put it to DeviceDesc
378382 uint32_t DeviceVendorIdUInt =
379- sycl::detail::get_device_info<info::device::vendor_id>(Device, Plugin );
383+ sycl::detail::get_device_info<info::device::vendor_id>(DeviceImpl );
380384 std::stringstream DeviceVendorIdHexStringStream;
381385 DeviceVendorIdHexStringStream << " 0x" << std::hex << DeviceVendorIdUInt;
382386 const auto &DeviceVendorIdValue = DeviceVendorIdHexStringStream.str ();
383387 DeviceDesc[DeviceVendorIdKeyName] = DeviceVendorIdValue;
384388 // get DriverVersion value and put it to DeviceDesc
385389 const std::string &DriverVersionValue =
386- sycl::detail::get_device_info<info::device::driver_version>(Device,
387- Plugin);
390+ sycl::detail::get_device_info<info::device::driver_version>(DeviceImpl);
388391 DeviceDesc[DriverVersionKeyName] = DriverVersionValue;
389392 // get DeviceName value and put it to DeviceDesc
390393 const std::string &DeviceNameValue =
391- sycl::detail::get_device_info<info::device::name>(Device, Plugin );
394+ sycl::detail::get_device_info<info::device::name>(DeviceImpl );
392395 DeviceDesc[DeviceNameKeyName] = DeviceNameValue;
393396
394397 // check if we can allow device with such device description DeviceDesc
0 commit comments