[SYCL][Bindless][UR] Add support for sRGB image formats#22257
Open
juanchuletas wants to merge 2 commits into
Open
[SYCL][Bindless][UR] Add support for sRGB image formats#22257juanchuletas wants to merge 2 commits into
juanchuletas wants to merge 2 commits into
Conversation
8e6a729 to
15fc9ae
Compare
Author
Update,I tested the changes using: and I got: Device: Intel(R) Arc(TM) Graphics
Input raw pixel value: 186 (0xba)
Input normalized (unorm_int8): 0.729412
Expected linear : 0.491021
RGBA result (no decode): R=0.729412 G=0.729412 B=0.729412 A=1
sRGBA result (hardware decoded): R=0.490745 G=0.490745 B=0.490745 A=1
Difference in R channel: 0.238666
PASS: RGBA returns raw unorm, sRGBA returns decoded linear
|
kswiecicki
approved these changes
Jun 9, 2026
kswiecicki
left a comment
Contributor
There was a problem hiding this comment.
L0 adapter side LGTM, 2 nitpicks.
Contributor
There was a problem hiding this comment.
nit: You can stack this case with UR_IMAGE_CHANNEL_ORDER_RGBA as they look identical.
Contributor
There was a problem hiding this comment.
nit: else if (pImageFormat->channelOrder == UR_IMAGE_CHANNEL_ORDER_SRGBA) {
0x12CC
requested changes
Jun 9, 2026
0x12CC
left a comment
Contributor
There was a problem hiding this comment.
Thanks, @juanchuletas. Please add relevant tests.
Contributor
There was a problem hiding this comment.
These changes need corresponding changes in sycl/doc/extensions/experimental/sycl_ext_oneapi_bindless_images.asciidoc to ensure the implementation and specification remain consistent.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds native sRGB decode support for bindless images through the full DPC++ stack: SYCL API, Unified Runtime, and the Level Zero adapter.
Description
The hardware sampler on Intel Arc GPUs supports native sRGB decode via ze_srgb_ext_desc_t, confirmed by direct Level Zero testing against driver 26.18.38308.1. The driver correctly applies the IEC 61966-2-1 piecewise formula on fetch, returning linear values to the kernel. This capability was not exposed anywhere in the DPC++ or UR stack.
The SYCL bindless image API had no way to request sRGB color space decoding. The
image_descriptoronly accepted num_channels and channel_type, with the channel order always derived internally. This made it impossible to distinguish between a linear RGBA texture and an sRGB-encoded RGBA texture, forcing applications to manually decode sRGB values on the CPU before upload at a significant memory cost.Proposed Changes
sycl/include/sycl/ext/oneapi/bindless_images_descriptor.hppAdded an
std::optional<image_channel_order>channel order field toimage_descriptor. This defaults tostd::nulloptto preserve full backward compatibility. Added a validation check inverify()to ensure that whenchannel_orderis set toext_oneapi_srgba, the configuration must use 4 channels and theunorm_int8type, as these are the only values accepted by the Level Zero driver for sRGB images.sycl/source/detail/bindless_images.cppModified
populate_ur_structsto use the provided channel order viachannel_order.value_or(get_image_default_channel_order(num_channels)). When the channel order is not set, the behavior remains identical to previous versions. When set, the explicit value is passed to the Unified Runtime.unified-runtime/source/adapters/level_zero/image_common.cppUpdated
ur2zeImageDescto mapUR_IMAGE_CHANNEL_ORDER_SRGBAto theZE_IMAGE_FORMAT_LAYOUT_8_8_8_8memory layout. Configured the hardware channel assignment forSRGBAto maintain a 1-to-1 mapping, identical to the standardRGBAconfiguration.Modified
urBindlessImagesImageAllocateExpto appendze_srgb_ext_desc_t(withsRGB = true) to theZeImageBindlessDesc.pNextchain whenUR_IMAGE_CHANNEL_ORDER_SRGBAis specified. This forces the hardware to enable the sRGB-to-Linear conversion path during image fetches.Modified
bindlessImagesCreateImplto chainze_srgb_ext_desc_tcorrectly for both sampled and unsampled image paths, ensuring the existingpNextchain order is respected:ZeImageDesc->BindlessDesc->ZeSrgbDesc->ZeSamplerDesc.Proposed Usage