Skip to content

Fix IMAGE1D and IMAGE1D_ARRAY image type deduction in addImage - #484

Merged
bashbaug merged 1 commit into
intel:mainfrom
bigmat18:fix-image1D-type-deduction
Sep 3, 2026
Merged

Fix IMAGE1D and IMAGE1D_ARRAY image type deduction in addImage#484
bashbaug merged 1 commit into
intel:mainfrom
bigmat18:fix-image1D-type-deduction

Conversation

@bigmat18

@bigmat18 bigmat18 commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Fixes: #481

Description of Changes

Instead of guessing the image type from its dimensions, the Intercept Layer should explicitly query the exact memory object type by adding one more API call alongside the existing clGetImageInfo queries.

We can retrieve the type using clGetMemObjectInfo with the CL_MEM_TYPE flag, matching the existing coding style:

cl_mem_object_type imageType;

errorCode |= dispatch().clGetMemObjectInfo(
    image,
    CL_MEM_TYPE,
    sizeof(imageType),
    &imageType,
    NULL );

This guarantees that CL_MEM_OBJECT_IMAGE1D (and its array counterpart) remains exactly what the application requested, immune to driver quirks.

Testing Done

Tested on Windows

@bashbaug bashbaug left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Have you checked that the example you described on the issue generates the correct metadata now?

@bigmat18

bigmat18 commented Sep 3, 2026

Copy link
Copy Markdown
Contributor Author

Yes, I tested with the same example and these are the results:
First allocation (desc1d.image_type = CL_MEM_OBJECT_IMAGE1D)

1024
1
1
16
16384
0
4318
4277
4340 // 0x10F4 that' s correct

Second allocation (desc1da.image_type = CL_MEM_OBJECT_IMAGE1D_ARRAY)

1024
5
5
16
16384
16384
4318
4277
4341 // 10F5 that' s correct

So it works as expected

@bashbaug
bashbaug merged commit 9729a58 into intel:main Sep 3, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

OBJECT_IMAGE1D and IMAGE1D_ARRAY are incorrectly classified as 2D

2 participants