Skip to content

Comments

[HLSL][QC] Modify stride on arrays-16bit.test#754

Closed
joaosaffran wants to merge 11 commits intollvm:mainfrom
joaosaffran:bugfix/qc-arrays-16bit
Closed

[HLSL][QC] Modify stride on arrays-16bit.test#754
joaosaffran wants to merge 11 commits intollvm:mainfrom
joaosaffran:bugfix/qc-arrays-16bit

Conversation

@joaosaffran
Copy link
Contributor

@joaosaffran joaosaffran commented Feb 18, 2026

This patch is modifying the stride for the arrays-16bit.test, in order to fix the vulkan validation errors raised by validation layer.

@joaosaffran joaosaffran added the test-all When applied to a PR this will opt-in to additional pre-merge test configurations.. label Feb 18, 2026
@joaosaffran joaosaffran reopened this Feb 19, 2026
@joaosaffran joaosaffran force-pushed the bugfix/qc-arrays-16bit branch from d797d08 to 8234eb5 Compare February 19, 2026 19:18
@joaosaffran joaosaffran marked this pull request as ready for review February 19, 2026 19:22
uint16_t c1[2][2];
float16_t c2[1];
uint16_t4 c3[2];
uint16_t c4[1];
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is doing more than modifying the stride?

Is this working around some cbuffer layout issue?

# add a small amount of buffer at the end here.
Stride: 28
FillSize: 28
FillSize: 64
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why isn't the fillsize still 28?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

When running the Vulkan validation layer, it is outputting the following error:

Validation Error: [ VUID-VkMappedMemoryRange-size-01389 ] | MessageID = 0xee4872d
vkFlushMappedMemoryRanges(): pMemoryRanges[0].size is VK_WHOLE_SIZE and the mapping end (28 = 0 + 28) not a multiple of VkPhysicalDeviceLimits::nonCoherentAtomSize (64) and not equal to the end of the memory object (32).
The Vulkan spec states: If size is equal to VK_WHOLE_SIZE, the end of the current mapping of memory must either be a multiple of VkPhysicalDeviceLimits::nonCoherentAtomSize bytes from the beginning of the memory object, or be equal to the end of the memory object (https://docs.vulkan.org/spec/latest/chapters/memory.html#VUID-VkMappedMemoryRange-size-01389)
Objects: 1
    [0] VkDeviceMemory 0x80000000008

To fix that, I need to modify the fill size to match 32 or 64. That causes the extra padding in the output below.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think that maybe rules like this should be enforced in the C++ code. For example, something like this is done already for D3D in constant buffers -

return (Sz + 255u) & 0xFFFFFFFFFFFFFF00;

0x0005, 0x0006, 0x0007, 0x0008,
0x0,
0x0009,
0x0000, 0x0000, 0x0000, 0x0000,
Copy link
Collaborator

Choose a reason for hiding this comment

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

why is there all this extra padding now? because of the larger fill size?

@spall
Copy link
Collaborator

spall commented Feb 19, 2026

this also didn't run any of the tests...

0x3c00, 0x5A5A, 0x5A5A, 0x5A5A, 0x5A5A, 0x5A5A, 0x5A5A, 0x5A5A,
0x0001, 0x0002, 0x0003, 0x0004, 0x5A5A, 0x5A5A, 0x5A5A, 0x5A5A,
0x0005, 0x0006, 0x0007, 0x0008, 0x5A5A, 0x5A5A, 0x5A5A, 0x5A5A,
0x0009, 0x5A5A, 0x5A5A, 0x5A5A, 0x5A5A, 0x5A5A, 0x5A5A, 0x5A5A,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should this last line be here? This is beyond the end of the data covered by CBArrays, isn't it?

If we need to pad this buffer to be a multiple of something then we should make the whole thing be 0x5A5As to be consistent with the values used for the other padding in this test.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I'd like to understand why we need to add the extra padding here. It looks like this is to round it up to an 8-byte boundary?

@joaosaffran joaosaffran requested review from damyanp and spall February 19, 2026 22:45
# add a small amount of buffer at the end here.
Stride: 28
FillSize: 28
FillSize: 32
Copy link
Collaborator

Choose a reason for hiding this comment

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

it sounds like @damyanp suggestion of fixing this issue in the C++ would be preferable because other tests might have this problem and it isn't clear what the padding is for.

@joaosaffran
Copy link
Contributor Author

I will close this issue, since this is a offloader bug

@spall
Copy link
Collaborator

spall commented Feb 20, 2026

I will close this issue, since this is a offloader bug

By issue you mean PR? the stride still needs to be fixed right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

test-all When applied to a PR this will opt-in to additional pre-merge test configurations..

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants