Skip to content

Commit cd51f76

Browse files
authored
[SYCL][Bindless] Fix get_image_num_channels failing with mipmap images (#15036)
This patch fixes a crash due to get_image_num_channels expecting a CUarray instead of a CUmipmappedArray. Expands test coverage to test this.
1 parent 894f40a commit cd51f76

File tree

2 files changed

+31
-6
lines changed

2 files changed

+31
-6
lines changed

sycl/cmake/modules/FetchUnifiedRuntime.cmake

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -117,13 +117,13 @@ if(SYCL_UR_USE_FETCH_CONTENT)
117117
endfunction()
118118

119119
set(UNIFIED_RUNTIME_REPO "https://github.com/oneapi-src/unified-runtime.git")
120-
# commit b4195cbb694b6e7c6216bf42a757ed700a325855
121-
# Merge: 5482621c ab77d020
120+
# commit 76361a88a0af6502fe655144655b381260ea9706
121+
# Merge: b4195cb 0db57da
122122
# Author: Omar Ahmed <[email protected]>
123-
# Date: Mon Aug 26 14:00:04 2024 +0100
124-
# Merge pull request #2006 from zhaomaosu/devsan-fix-cxxlib-mismatch
125-
# [DeviceSanitizer] Fix libstdc++ and libc++ mismatch problem
126-
set(UNIFIED_RUNTIME_TAG b4195cbb694b6e7c6216bf42a757ed700a325855)
123+
# Date: Wed, 31 Jul 2024 14:26:38 +0100
124+
# Merge pull request #1961 from DBDuncan/duncan/num-channels-mipmap-fix
125+
# [Bindless][Exp] Fix urBindlessImagesImageGetInfoExp failing with mipmap images
126+
set(UNIFIED_RUNTIME_TAG 76361a88a0af6502fe655144655b381260ea9706)
127127

128128
set(UMF_BUILD_EXAMPLES OFF CACHE INTERNAL "EXAMPLES")
129129
# Due to the use of dependentloadflag and no installer for UMF and hwloc we need

sycl/test-e2e/bindless_images/image_get_info.cpp

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,31 @@ int main() {
229229
validated = false;
230230
}
231231

232+
// Extension: image descriptor -- number of levels
233+
sycl::ext::oneapi::experimental::image_descriptor mipDesc(
234+
{width, height}, 4, sycl::image_channel_type::signed_int32,
235+
sycl::ext::oneapi::experimental::image_type::mipmap, 3);
236+
237+
// Extension: allocate mipmap memory on device
238+
sycl::ext::oneapi::experimental::image_mem mipMem(mipDesc, q);
239+
240+
auto numChannelsMipMem = mipMem.get_num_channels();
241+
auto numChannelsMip =
242+
sycl::ext::oneapi::experimental::get_image_num_channels(
243+
mipMem.get_handle(), dev, ctxt);
244+
245+
if (numChannelsMipMem != numChannelsMip) {
246+
printString(
247+
"mipmap handle and mem object disagree on number of channels!\n");
248+
validated = false;
249+
}
250+
if (numChannelsMip == 4) {
251+
printString("mipmap num channels is correct!\n");
252+
} else {
253+
printString("mipmap num channels is NOT correct!\n");
254+
validated = false;
255+
}
256+
232257
} catch (sycl::exception e) {
233258
std::cerr << "SYCL exception caught! : " << e.what() << "\n";
234259
return 1;

0 commit comments

Comments
 (0)