Skip to content

[NFC][SYCL] Use get_ur_handles in bindless_images.cpp #19250

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 2, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 9 additions & 21 deletions sycl/source/detail/bindless_images.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -811,11 +811,7 @@ __SYCL_EXPORT std::vector<image_memory_handle_type>
get_image_memory_support(const image_descriptor &imageDescriptor,
const sycl::device &syclDevice,
const sycl::context &syclContext) {
std::shared_ptr<sycl::detail::device_impl> DevImpl =
sycl::detail::getSyclObjImpl(syclDevice);
sycl::detail::context_impl &CtxImpl =
*sycl::detail::getSyclObjImpl(syclContext);
const sycl::detail::AdapterPtr &Adapter = CtxImpl.getAdapter();
auto [urDevice, urCtx, Adapter] = get_ur_handles(syclDevice, syclContext);

ur_image_desc_t urDesc;
ur_image_format_t urFormat;
Expand All @@ -825,15 +821,15 @@ get_image_memory_support(const image_descriptor &imageDescriptor,
Adapter->call<sycl::errc::runtime,
sycl::detail::UrApiKind::
urBindlessImagesGetImageMemoryHandleTypeSupportExp>(
CtxImpl.getHandleRef(), DevImpl->getHandleRef(), &urDesc, &urFormat,
urCtx, urDevice, &urDesc, &urFormat,
ur_exp_image_mem_type_t::UR_EXP_IMAGE_MEM_TYPE_USM_POINTER,
&supportsPointerAllocation);

ur_bool_t supportsOpaqueAllocation{0};
Adapter->call<sycl::errc::runtime,
sycl::detail::UrApiKind::
urBindlessImagesGetImageMemoryHandleTypeSupportExp>(
CtxImpl.getHandleRef(), DevImpl->getHandleRef(), &urDesc, &urFormat,
urCtx, urDevice, &urDesc, &urFormat,
ur_exp_image_mem_type_t::UR_EXP_IMAGE_MEM_TYPE_OPAQUE_HANDLE,
&supportsOpaqueAllocation);

Expand Down Expand Up @@ -862,11 +858,7 @@ __SYCL_EXPORT bool is_image_handle_supported<unsampled_image_handle>(
const image_descriptor &imageDescriptor,
image_memory_handle_type imageMemoryHandleType,
const sycl::device &syclDevice, const sycl::context &syclContext) {
std::shared_ptr<sycl::detail::device_impl> DevImpl =
sycl::detail::getSyclObjImpl(syclDevice);
sycl::detail::context_impl &CtxImpl =
*sycl::detail::getSyclObjImpl(syclContext);
const sycl::detail::AdapterPtr &Adapter = CtxImpl.getAdapter();
auto [urDevice, urCtx, Adapter] = get_ur_handles(syclDevice, syclContext);

ur_image_desc_t urDesc;
ur_image_format_t urFormat;
Expand All @@ -881,8 +873,8 @@ __SYCL_EXPORT bool is_image_handle_supported<unsampled_image_handle>(
Adapter->call<sycl::errc::runtime,
sycl::detail::UrApiKind::
urBindlessImagesGetImageUnsampledHandleSupportExp>(
CtxImpl.getHandleRef(), DevImpl->getHandleRef(), &urDesc, &urFormat,
memHandleType, &supportsUnsampledHandle);
urCtx, urDevice, &urDesc, &urFormat, memHandleType,
&supportsUnsampledHandle);

return supportsUnsampledHandle;
}
Expand All @@ -902,11 +894,7 @@ __SYCL_EXPORT bool is_image_handle_supported<sampled_image_handle>(
const image_descriptor &imageDescriptor,
image_memory_handle_type imageMemoryHandleType,
const sycl::device &syclDevice, const sycl::context &syclContext) {
std::shared_ptr<sycl::detail::device_impl> DevImpl =
sycl::detail::getSyclObjImpl(syclDevice);
sycl::detail::context_impl &CtxImpl =
*sycl::detail::getSyclObjImpl(syclContext);
const sycl::detail::AdapterPtr &Adapter = CtxImpl.getAdapter();
auto [urDevice, urCtx, Adapter] = get_ur_handles(syclDevice, syclContext);

ur_image_desc_t urDesc;
ur_image_format_t urFormat;
Expand All @@ -921,8 +909,8 @@ __SYCL_EXPORT bool is_image_handle_supported<sampled_image_handle>(
Adapter->call<
sycl::errc::runtime,
sycl::detail::UrApiKind::urBindlessImagesGetImageSampledHandleSupportExp>(
CtxImpl.getHandleRef(), DevImpl->getHandleRef(), &urDesc, &urFormat,
memHandleType, &supportsSampledHandle);
urCtx, urDevice, &urDesc, &urFormat, memHandleType,
&supportsSampledHandle);

return supportsSampledHandle;
}
Expand Down