@@ -583,8 +583,7 @@ static const char *getUrDeviceTarget(const char *URDeviceTarget) {
583583}
584584
585585static bool compatibleWithDevice (RTDeviceBinaryImage *BinImage,
586- const device &Dev) {
587- detail::device_impl &DeviceImpl = *detail::getSyclObjImpl (Dev);
586+ const device_impl &DeviceImpl) {
588587 auto &Adapter = DeviceImpl.getAdapter ();
589588
590589 const ur_device_handle_t &URDeviceHandle = DeviceImpl.getHandleRef ();
@@ -621,7 +620,7 @@ bool ProgramManager::isSpecialDeviceImage(RTDeviceBinaryImage *BinImage) {
621620}
622621
623622bool ProgramManager::isSpecialDeviceImageShouldBeUsed (
624- RTDeviceBinaryImage *BinImage, const device &Dev ) {
623+ RTDeviceBinaryImage *BinImage, const device_impl &DeviceImpl ) {
625624 // Decide whether a devicelib image should be used.
626625 int Bfloat16DeviceLibVersion = -1 ;
627626 if (m_Bfloat16DeviceLibImages[0 ].get () == BinImage)
@@ -640,7 +639,6 @@ bool ProgramManager::isSpecialDeviceImageShouldBeUsed(
640639 // more devicelib images in this way.
641640 enum { DEVICELIB_FALLBACK = 0 , DEVICELIB_NATIVE };
642641 ur_bool_t NativeBF16Supported = false ;
643- detail::device_impl &DeviceImpl = *detail::getSyclObjImpl (Dev);
644642 ur_result_t CallSuccessful =
645643 DeviceImpl.getAdapter ()->call_nocheck <UrApiKind::urDeviceGetInfo>(
646644 DeviceImpl.getHandleRef (),
@@ -658,15 +656,15 @@ bool ProgramManager::isSpecialDeviceImageShouldBeUsed(
658656 return false ;
659657}
660658
661- static bool checkLinkingSupport (const device &Dev ,
659+ static bool checkLinkingSupport (const device_impl &DeviceImpl ,
662660 const RTDeviceBinaryImage &Img) {
663661 const char *Target = Img.getRawData ().DeviceTargetSpec ;
664662 // TODO replace with extension checks once implemented in UR.
665663 if (strcmp (Target, __SYCL_DEVICE_BINARY_TARGET_SPIRV64) == 0 ) {
666664 return true ;
667665 }
668666 if (strcmp (Target, __SYCL_DEVICE_BINARY_TARGET_SPIRV64_GEN) == 0 ) {
669- return Dev .is_gpu () && Dev. get_backend () == backend::opencl;
667+ return DeviceImpl .is_gpu () && DeviceImpl. getBackend () == backend::opencl;
670668 }
671669 return false ;
672670}
@@ -701,7 +699,8 @@ ProgramManager::collectDeviceImageDepsForImportedSymbols(
701699 HandledSymbols.insert (ISProp->Name );
702700 }
703701 ur::DeviceBinaryType Format = MainImg.getFormat ();
704- if (!WorkList.empty () && !checkLinkingSupport (Dev, MainImg))
702+ if (!WorkList.empty () &&
703+ !checkLinkingSupport (*getSyclObjImpl (Dev).get (), MainImg))
705704 throw exception (make_error_code (errc::feature_not_supported),
706705 " Cannot resolve external symbols, linking is unsupported "
707706 " for the backend" );
@@ -715,10 +714,10 @@ ProgramManager::collectDeviceImageDepsForImportedSymbols(
715714 RTDeviceBinaryImage *Img = It->second ;
716715 if (Img->getFormat () != Format ||
717716 !doesDevSupportDeviceRequirements (Dev, *Img) ||
718- !compatibleWithDevice (Img, Dev))
717+ !compatibleWithDevice (Img, * getSyclObjImpl ( Dev). get () ))
719718 continue ;
720719 if (isSpecialDeviceImage (Img) &&
721- !isSpecialDeviceImageShouldBeUsed (Img, Dev))
720+ !isSpecialDeviceImageShouldBeUsed (Img, * getSyclObjImpl ( Dev). get () ))
722721 continue ;
723722 DeviceImagesToLink.insert (Img);
724723 Found = true ;
@@ -2415,14 +2414,14 @@ kernel_id ProgramManager::getSYCLKernelID(KernelNameStrRefT KernelName) {
24152414 " No kernel found with the specified name" );
24162415}
24172416
2418- bool ProgramManager::hasCompatibleImage (const device &Dev ) {
2417+ bool ProgramManager::hasCompatibleImage (const device_impl &DeviceImpl ) {
24192418 std::lock_guard<std::mutex> Guard (m_KernelIDsMutex);
24202419
24212420 return std::any_of (
24222421 m_BinImg2KernelIDs.cbegin (), m_BinImg2KernelIDs.cend (),
24232422 [&](std::pair<RTDeviceBinaryImage *,
24242423 std::shared_ptr<std::vector<kernel_id>>>
2425- Elem) { return compatibleWithDevice (Elem.first , Dev ); });
2424+ Elem) { return compatibleWithDevice (Elem.first , DeviceImpl ); });
24262425}
24272426
24282427std::vector<kernel_id> ProgramManager::getAllSYCLKernelIDs () {
@@ -2555,7 +2554,7 @@ device_image_plain ProgramManager::getDeviceImageFromBinaryImage(
25552554 RTDeviceBinaryImage *BinImage, const context &Ctx, const device &Dev) {
25562555 const bundle_state ImgState = getBinImageState (BinImage);
25572556
2558- assert (compatibleWithDevice (BinImage, Dev));
2557+ assert (compatibleWithDevice (BinImage, * getSyclObjImpl ( Dev). get () ));
25592558
25602559 std::shared_ptr<std::vector<sycl::kernel_id>> KernelIDs;
25612560 // Collect kernel names for the image.
@@ -2640,7 +2639,7 @@ ProgramManager::getSYCLDeviceImagesWithCompatibleState(
26402639 KernelImageMap.insert ({KernelID, {}});
26412640
26422641 for (RTDeviceBinaryImage *BinImage : BinImages) {
2643- if (!compatibleWithDevice (BinImage, Dev) ||
2642+ if (!compatibleWithDevice (BinImage, * getSyclObjImpl ( Dev). get () ) ||
26442643 !doesDevSupportDeviceRequirements (Dev, *BinImage))
26452644 continue ;
26462645
0 commit comments