Skip to content

Commit a9db584

Browse files
authored
[SYCL][BINDLESS] Fix mem_image_free for gather array (#18109)
The case of `image_type::gather` would lead to an exception being thrown in `free_image_mem`/ `std::terminate` in `~image_mem_impl`. I missed this in #17322. This fixes that. Note that this doesn't fully address #16331 since the call to UR could still throw in theory. However, in order to avoid such a UR call in a destructor the implementation would have to be completely changed. As it is, if for some unusual circumstance the image free did fail in UR, I think there is at least an argument it be better that this does lead to `std::terminate`. So I'm leaving this for discussion. Signed-off-by: JackAKirk <jack.kirk@codeplay.com>
1 parent c800fbb commit a9db584

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

sycl/source/detail/bindless_images.cpp

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -234,16 +234,10 @@ __SYCL_EXPORT void free_image_mem(image_mem_handle memHandle,
234234
Adapter->call<sycl::errc::memory_allocation,
235235
sycl::detail::UrApiKind::urBindlessImagesMipmapFreeExp>(
236236
C, Device, memHandle.raw_handle);
237-
} else if (imageType == image_type::standard ||
238-
imageType == image_type::array ||
239-
imageType == image_type::cubemap ||
240-
imageType == image_type::gather) {
237+
} else {
241238
Adapter->call<sycl::errc::memory_allocation,
242239
sycl::detail::UrApiKind::urBindlessImagesImageFreeExp>(
243240
C, Device, memHandle.raw_handle);
244-
} else {
245-
throw sycl::exception(sycl::make_error_code(sycl::errc::invalid),
246-
"Invalid image type to free");
247241
}
248242
}
249243
}

0 commit comments

Comments
 (0)