Closed wenju-he closed 8 months ago
There are two options hgow we can describe sampler for Sampled Image:
// Define sampler ze_sampler_desc_t samplerDesc; samplerDesc.addressMode = ZE_SAMPLER_ADDRESS_MODE_CLAMP;
ze_image_bindless_exp_desc_t bindlessExtDesc = {};
bindlessExtDesc.stype = ZE_STRUCTURE_TYPE_BINDLESS_IMAGE_EXP_DESC;
bindlessExtDesc.pNext = &samplerDesc;
// Indicate we allocate bindless SampledImage bindlessExtDesc.flags = ZE_IMAGE_BINDLESS_EXP_FLAG_BINDLESS | ZE_IMAGE_BINDLESS_EXP_FLAG_SAMPLED_IMAGE;
ze_image_desc_t srcImgDesc = {ZE_STRUCTURE_TYPE_IMAGE_DESC,
&bindlessExtDesc,
0,
ZE_IMAGE_TYPE_2D,
{ZE_IMAGE_FORMAT_LAYOUT_8_8_8_8, ZE_IMAGE_FORMAT_TYPE_SINT,
ZE_IMAGE_FORMAT_SWIZZLE_R, ZE_IMAGE_FORMAT_SWIZZLE_G,
ZE_IMAGE_FORMAT_SWIZZLE_B, ZE_IMAGE_FORMAT_SWIZZLE_A},
imageWidth,
static_cast<uint32_t>(imageHeight),
static_cast<uint32_t>(imageDepth),
0,
0};
ze_image_handle_t srcImg = nullptr;
SUCCESS_OR_TERMINATE(zeImageCreate(context, device, &srcImgDesc, &srcImg));
Sampler may be used beofre image is created - passed as kernel argument - so it will need to have bindless slot allocated for Bindless addressing kernels
Then , when bindless sampled image is created - we would need to allocate sampler binldess slot again - rigth after image bindless slot.
I think for Sampled Images - it is better to allocate everything in one call - there is no need of tracking objects lifetimes in the app.
i have posted my proposal here: <redacted>
i have posted my proposal here: <redacted>
thank you. Close this PR.
Add a new descriptor ze_sampler_exp_desc_t that contains a pointer to sampler object. A bindless sampled image could be created by passing the new descriptor via pNext member using zeImageCreate API. Motivation is to support a single 64-bit handle for SYCL bindless sampled image.