@@ -873,7 +873,7 @@ ur_program_handle_t ProgramManager::getBuiltURProgram(
873
873
auto Device = createSyclObjFromImpl<device>(
874
874
MustBuildOnSubdevice == true ? DeviceImpl : RootDevImpl);
875
875
const RTDeviceBinaryImage &Img =
876
- getDeviceImage (KernelName, ContextImpl, Device);
876
+ getDeviceImage (KernelName, ContextImpl, getSyclObjImpl ( Device). get () );
877
877
878
878
// Check that device supports all aspects used by the kernel
879
879
if (auto exception = checkDevSupportDeviceRequirements (Device, Img, NDRDesc))
@@ -1470,9 +1470,9 @@ ProgramManager::ProgramManager()
1470
1470
}
1471
1471
}
1472
1472
1473
- const char *getArchName (const device &Device ) {
1473
+ const char *getArchName (const device_impl *DeviceImpl ) {
1474
1474
namespace syclex = sycl::ext::oneapi::experimental;
1475
- auto Arch = getSyclObjImpl (Device) ->getDeviceArch ();
1475
+ auto Arch = DeviceImpl ->getDeviceArch ();
1476
1476
switch (Arch) {
1477
1477
#define __SYCL_ARCHITECTURE (ARCH, VAL ) \
1478
1478
case syclex::architecture::ARCH: \
@@ -1494,7 +1494,7 @@ template <typename StorageKey>
1494
1494
RTDeviceBinaryImage *getBinImageFromMultiMap (
1495
1495
const std::unordered_multimap<StorageKey, RTDeviceBinaryImage *> &ImagesSet,
1496
1496
const StorageKey &Key, const ContextImplPtr &ContextImpl,
1497
- const device &Device ) {
1497
+ const device_impl *DeviceImpl ) {
1498
1498
auto [ItBegin, ItEnd] = ImagesSet.equal_range (Key);
1499
1499
if (ItBegin == ItEnd)
1500
1500
return nullptr ;
@@ -1507,7 +1507,7 @@ RTDeviceBinaryImage *getBinImageFromMultiMap(
1507
1507
std::vector<RTDeviceBinaryImage *> DeviceFilteredImgs;
1508
1508
DeviceFilteredImgs.reserve (std::distance (ItBegin, ItEnd));
1509
1509
for (auto It = ItBegin; It != ItEnd; ++It) {
1510
- if (doesImageTargetMatchDevice (*It->second , Device ))
1510
+ if (doesImageTargetMatchDevice (*It->second , DeviceImpl ))
1511
1511
DeviceFilteredImgs.push_back (It->second );
1512
1512
}
1513
1513
@@ -1525,19 +1525,18 @@ RTDeviceBinaryImage *getBinImageFromMultiMap(
1525
1525
// Ask the native runtime under the given context to choose the device image
1526
1526
// it prefers.
1527
1527
ContextImpl->getAdapter ()->call <UrApiKind::urDeviceSelectBinary>(
1528
- getSyclObjImpl (Device) ->getHandleRef (), UrBinaries.data (),
1529
- UrBinaries. size (), &ImgInd);
1528
+ DeviceImpl ->getHandleRef (), UrBinaries.data (), UrBinaries. size (),
1529
+ &ImgInd);
1530
1530
return DeviceFilteredImgs[ImgInd];
1531
1531
}
1532
1532
1533
1533
RTDeviceBinaryImage &
1534
1534
ProgramManager::getDeviceImage (KernelNameStrRefT KernelName,
1535
1535
const ContextImplPtr &ContextImpl,
1536
- const device &Device ) {
1536
+ const device_impl *DeviceImpl ) {
1537
1537
if constexpr (DbgProgMgr > 0 ) {
1538
1538
std::cerr << " >>> ProgramManager::getDeviceImage(\" " << KernelName << " \" , "
1539
- << ContextImpl.get () << " , " << getSyclObjImpl (Device).get ()
1540
- << " )\n " ;
1539
+ << ContextImpl.get () << " , " << DeviceImpl << " )\n " ;
1541
1540
1542
1541
std::cerr << " available device images:\n " ;
1543
1542
debugPrintBinaryImages ();
@@ -1547,7 +1546,7 @@ ProgramManager::getDeviceImage(KernelNameStrRefT KernelName,
1547
1546
assert (m_SpvFileImage);
1548
1547
return getDeviceImage (
1549
1548
std::unordered_set<RTDeviceBinaryImage *>({m_SpvFileImage.get ()}),
1550
- ContextImpl, Device );
1549
+ ContextImpl, DeviceImpl );
1551
1550
}
1552
1551
1553
1552
RTDeviceBinaryImage *Img = nullptr ;
@@ -1556,10 +1555,10 @@ ProgramManager::getDeviceImage(KernelNameStrRefT KernelName,
1556
1555
if (auto KernelId = m_KernelName2KernelIDs.find (KernelName);
1557
1556
KernelId != m_KernelName2KernelIDs.end ()) {
1558
1557
Img = getBinImageFromMultiMap (m_KernelIDs2BinImage, KernelId->second ,
1559
- ContextImpl, Device );
1558
+ ContextImpl, DeviceImpl );
1560
1559
} else {
1561
1560
Img = getBinImageFromMultiMap (m_ServiceKernels, KernelName, ContextImpl,
1562
- Device );
1561
+ DeviceImpl );
1563
1562
}
1564
1563
}
1565
1564
@@ -1580,13 +1579,12 @@ ProgramManager::getDeviceImage(KernelNameStrRefT KernelName,
1580
1579
1581
1580
RTDeviceBinaryImage &ProgramManager::getDeviceImage (
1582
1581
const std::unordered_set<RTDeviceBinaryImage *> &ImageSet,
1583
- const ContextImplPtr &ContextImpl, const device &Device ) {
1582
+ const ContextImplPtr &ContextImpl, const device_impl *DeviceImpl ) {
1584
1583
assert (ImageSet.size () > 0 );
1585
1584
1586
1585
if constexpr (DbgProgMgr > 0 ) {
1587
1586
std::cerr << " >>> ProgramManager::getDeviceImage(Custom SPV file "
1588
- << ContextImpl.get () << " , " << getSyclObjImpl (Device).get ()
1589
- << " )\n " ;
1587
+ << ContextImpl.get () << " , " << DeviceImpl << " )\n " ;
1590
1588
1591
1589
std::cerr << " available device images:\n " ;
1592
1590
debugPrintBinaryImages ();
@@ -1609,8 +1607,8 @@ RTDeviceBinaryImage &ProgramManager::getDeviceImage(
1609
1607
}
1610
1608
1611
1609
ContextImpl->getAdapter ()->call <UrApiKind::urDeviceSelectBinary>(
1612
- getSyclObjImpl (Device) ->getHandleRef (), UrBinaries.data (),
1613
- UrBinaries. size (), &ImgInd);
1610
+ DeviceImpl ->getHandleRef (), UrBinaries.data (), UrBinaries. size (),
1611
+ &ImgInd);
1614
1612
1615
1613
ImageIterator = ImageSet.begin ();
1616
1614
std::advance (ImageIterator, ImgInd);
@@ -3801,29 +3799,29 @@ checkDevSupportDeviceRequirements(const device &Dev,
3801
3799
}
3802
3800
3803
3801
bool doesImageTargetMatchDevice (const RTDeviceBinaryImage &Img,
3804
- const device &Dev ) {
3802
+ const device_impl *DevImpl ) {
3805
3803
auto PropRange = Img.getDeviceRequirements ();
3806
3804
auto PropIt =
3807
3805
std::find_if (PropRange.begin (), PropRange.end (), [&](const auto &Prop) {
3808
3806
return Prop->Name == std::string_view (" compile_target" );
3809
3807
});
3810
3808
// Device image has no compile_target property, check target.
3811
3809
if (PropIt == PropRange.end ()) {
3812
- sycl::backend BE = Dev. get_backend ();
3810
+ sycl::backend BE = DevImpl-> getBackend ();
3813
3811
const char *Target = Img.getRawData ().DeviceTargetSpec ;
3814
3812
if (strcmp (Target, __SYCL_DEVICE_BINARY_TARGET_SPIRV64) == 0 ) {
3815
3813
return (BE == sycl::backend::opencl ||
3816
3814
BE == sycl::backend::ext_oneapi_level_zero);
3817
3815
}
3818
3816
if (strcmp (Target, __SYCL_DEVICE_BINARY_TARGET_SPIRV64_X86_64) == 0 ) {
3819
- return Dev. is_cpu ();
3817
+ return DevImpl-> is_cpu ();
3820
3818
}
3821
3819
if (strcmp (Target, __SYCL_DEVICE_BINARY_TARGET_SPIRV64_GEN) == 0 ) {
3822
- return Dev. is_gpu () && (BE == sycl::backend::opencl ||
3823
- BE == sycl::backend::ext_oneapi_level_zero);
3820
+ return DevImpl-> is_gpu () && (BE == sycl::backend::opencl ||
3821
+ BE == sycl::backend::ext_oneapi_level_zero);
3824
3822
}
3825
3823
if (strcmp (Target, __SYCL_DEVICE_BINARY_TARGET_SPIRV64_FPGA) == 0 ) {
3826
- return Dev. is_accelerator ();
3824
+ return DevImpl-> is_accelerator ();
3827
3825
}
3828
3826
if (strcmp (Target, __SYCL_DEVICE_BINARY_TARGET_NVPTX64) == 0 ||
3829
3827
strcmp (Target, __SYCL_DEVICE_BINARY_TARGET_LLVM_NVPTX64) == 0 ) {
@@ -3848,7 +3846,7 @@ bool doesImageTargetMatchDevice(const RTDeviceBinaryImage &Img,
3848
3846
std::string_view CompileTarget (
3849
3847
reinterpret_cast <const char *>(&CompileTargetByteArray[0 ]),
3850
3848
CompileTargetByteArray.size ());
3851
- std::string_view ArchName = getArchName (Dev );
3849
+ std::string_view ArchName = getArchName (DevImpl );
3852
3850
// Note: there are no explicit targets for CPUs, so on x86_64,
3853
3851
// intel_cpu_spr, and intel_cpu_gnr, we use a spir64_x86_64
3854
3852
// compile target image.
0 commit comments