5
5
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
6
//
7
7
// ===----------------------------------------------------------------------===//
8
-
9
8
#include < detail/allowlist.hpp>
10
9
#include < detail/config.hpp>
11
10
#include < detail/device_impl.hpp>
11
+ #include < detail/device_info.hpp>
12
12
#include < detail/platform_info.hpp>
13
+ #include < sycl/backend.hpp>
13
14
14
15
#include < algorithm>
15
16
#include < regex>
@@ -335,15 +336,17 @@ bool deviceIsAllowed(const DeviceDescT &DeviceDesc,
335
336
336
337
void applyAllowList (std::vector<RT::PiDevice> &PiDevices,
337
338
RT::PiPlatform PiPlatform, const plugin &Plugin) {
339
+
338
340
AllowListParsedT AllowListParsed =
339
341
parseAllowList (SYCLConfig<SYCL_DEVICE_ALLOWLIST>::get ());
340
342
if (AllowListParsed.empty ())
341
343
return ;
342
344
345
+ // Get platform's backend and put it to DeviceDesc
343
346
DeviceDescT DeviceDesc;
347
+ auto PlatformImpl = platform_impl::getOrMakePlatformImpl (PiPlatform, Plugin);
348
+ backend Backend = PlatformImpl->getBackend ();
344
349
345
- // get BackendName value and put it to DeviceDesc
346
- sycl::backend Backend = Plugin.getBackend ();
347
350
for (const auto &SyclBe : getSyclBeMap ()) {
348
351
if (SyclBe.second == Backend) {
349
352
DeviceDesc.emplace (BackendNameKeyName, SyclBe.first );
@@ -361,6 +364,7 @@ void applyAllowList(std::vector<RT::PiDevice> &PiDevices,
361
364
362
365
int InsertIDx = 0 ;
363
366
for (RT::PiDevice Device : PiDevices) {
367
+ auto DeviceImpl = PlatformImpl->getOrMakeDeviceImpl (Device, PlatformImpl);
364
368
// get DeviceType value and put it to DeviceDesc
365
369
RT::PiDeviceType PiDevType;
366
370
Plugin.call <PiApiKind::piDeviceGetInfo>(Device, PI_DEVICE_INFO_TYPE,
@@ -376,19 +380,18 @@ void applyAllowList(std::vector<RT::PiDevice> &PiDevices,
376
380
}
377
381
// get DeviceVendorId value and put it to DeviceDesc
378
382
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 );
380
384
std::stringstream DeviceVendorIdHexStringStream;
381
385
DeviceVendorIdHexStringStream << " 0x" << std::hex << DeviceVendorIdUInt;
382
386
const auto &DeviceVendorIdValue = DeviceVendorIdHexStringStream.str ();
383
387
DeviceDesc[DeviceVendorIdKeyName] = DeviceVendorIdValue;
384
388
// get DriverVersion value and put it to DeviceDesc
385
389
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);
388
391
DeviceDesc[DriverVersionKeyName] = DriverVersionValue;
389
392
// get DeviceName value and put it to DeviceDesc
390
393
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 );
392
395
DeviceDesc[DeviceNameKeyName] = DeviceNameValue;
393
396
394
397
// check if we can allow device with such device description DeviceDesc
0 commit comments