Skip to content

Conversation

@farzonl
Copy link
Member

@farzonl farzonl commented Nov 13, 2025

fixes #502
https://godbolt.org/z/xaEE44cbE
Test 3 cases (loads and stores):

  1. single subscript as an l-value swizzle
  2. single subscript where the store/load takes a vector r-value swizzle
  3. single subscript where we store/load the vector as is.

https://godbolt.org/z/xaEE44cbE
Test 3 cases (loads and stores):
1. single subscript as an l-value swizzle
2. single subscript where the store/load takes a vector r-value swizzle
3. single subscript where we store/load the vector as is.
In[15]);

for (int i = 0; i < 4; i++) {
int4 B;

Choose a reason for hiding this comment

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

very minor nit, but a for loop for 4 assignments with two of them be 'special' made me look at this for a moment longer.
4 explicit assignment statements might be cleaner.

Copy link
Member Author

Choose a reason for hiding this comment

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

its going to be much more than 4 explicit asignments because its 16 asignments to fill up Out[i*4 + j].

Copy link

@alsepkow alsepkow left a comment

Choose a reason for hiding this comment

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

LGTM. Minor nit on the first for loop in both tests. Take it or leave it.

Copy link
Contributor

@Icohedron Icohedron left a comment

Choose a reason for hiding this comment

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

LGTM! Just a few formatting/spacing nits

Copy link

@tex3d tex3d left a comment

Choose a reason for hiding this comment

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

Minor comments/suggestions, nothing necessarily requiring changes regarding:

  • dynamic/static subscript indexing and potential optimizations
  • symmetrical swizzles (equivalent when used in source or dest)

for (int i = 0; i < 4; i++) {
int4 B;
if (i % 2 == 0)
B = A[i];
Copy link

Choose a reason for hiding this comment

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

Just a comment, not a request for change:

These subscript accesses look dynamic, but these loops are likely to be unrolled, either before IR (in DXC, Clang, etc.) or after (in a driver compiler). That unrolling would make all accesses static, even eliminating the intermediate local variables to copy values directly from static indices of In to static indices of Out. That's a fine path to test, but this might not test other important dynamic indexing code paths, if desired.

I guess this gets at the fuzzy purpose issue with the offload-test-suite. This seems fine to test this scenario end-to-end, whatever path it may take through optimizations, and maybe that's all that's desired for this test.

Copy link
Member Author

@farzonl farzonl Nov 18, 2025

Choose a reason for hiding this comment

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

I was trying to use uint GI : SV_GroupIndex for the input to main because I thought someone might mention that. But I could not get the persistance I needed to properly fill the out buffer.

In anycase the matrix execution tests are like you said more about confirming a matrix frontend features behave the same as they would on DXC and thus a little bit different than some of the other behaviors being tested in the offload test suite like intrinsic tests. In my case its more about layout and access of data which should be preserved regardless of optimization passes.

@farzonl farzonl merged commit 8167a5b into llvm:main Nov 19, 2025
10 of 12 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.

[Matrix] Implement tests for single subscript that allows vector r and l values aswell as vector swizzle

5 participants