Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SM6.9] Support long vector declaration, casting, and assignment #7117

Open
Tracked by #7067
pow2clk opened this issue Feb 4, 2025 · 0 comments · May be fixed by #7143
Open
Tracked by #7067

[SM6.9] Support long vector declaration, casting, and assignment #7117

pow2clk opened this issue Feb 4, 2025 · 0 comments · May be fixed by #7143
Assignees
Labels
enhancement Feature suggestion sm6.9 Shader Model 6.9

Comments

@pow2clk
Copy link
Member

pow2clk commented Feb 4, 2025

Long vectors should be supported in

  • Elements of arrays, structs, StructuredBuffers, and ByteAddressBuffers.
  • Parameters and return types of non-entry functions.
  • Stored in groupshared memory.
  • Static global variables.
  • Local function scoped variables.

This task is to allow declaring vectors of size greater than 4 using the template declaration in all of the above. In addition, they should be assignable, initializable, and castable in ways consistent with existing vectors using splatted scalars, initializer lists, constructors, and casted arrays. The best way to test this is probably a library shader since that allows exporting non-entry functions which allows parameters to be used to verify the assignment operations.

Some example assignments:

vector<uint, 5> InitList = {1, 2, 3, 4, 5};
vector<uint, 6> Construct = vector<uint, 6>(6, 7, 8, 9, 0, 0);
uint4 initval = {0, 0, 0, 0};
vector<uint, 8> VecVec = {uint2(coord.xy), vecB};
vector<uint, 6> Assigned = vecB;
float arr[5];
vector<float, 5> CastArr = (vector<float, 5>)arr;
vector<float, 6> ArrScal = {arr, 7.9};
vector<float, 10> ArrArr = {arr, arr};
vector<float, 15> Scal = 4.2;
@pow2clk pow2clk changed the title declaring long vectors in the various contexts it is supported Support long vectors in the contexts it is supported Feb 4, 2025
@pow2clk pow2clk changed the title Support long vectors in the contexts it is supported Support long vector declaration in supported contexts Feb 4, 2025
@pow2clk pow2clk changed the title Support long vector declaration in supported contexts Support long vector declaration and assignment Feb 4, 2025
@pow2clk pow2clk changed the title Support long vector declaration and assignment Support long vector declaration, casting, and assignment Feb 4, 2025
@pow2clk pow2clk changed the title Support long vector declaration, casting, and assignment [SM6.9] Support long vector declaration, casting, and assignment Feb 4, 2025
@pow2clk pow2clk added enhancement Feature suggestion sm6.9 Shader Model 6.9 labels Feb 4, 2025
@pow2clk pow2clk self-assigned this Feb 4, 2025
@pow2clk pow2clk moved this to Active in HLSL Support Feb 4, 2025
@pow2clk pow2clk moved this from Active to Planning in HLSL Support Feb 4, 2025
@damyanp damyanp moved this from Planning to Active in HLSL Support Feb 10, 2025
pow2clk added a commit to pow2clk/DirectXShaderCompiler that referenced this issue Feb 18, 2025
Remove errors in Sema diagnostics for vectors longer than 4 in 6.9.
Test for failures using long vectors in unspported contexts and for correct codegen in
supported contexts. Verify errors persist in pre-6.9 shader models

The type buffer cache expects a max vector size of 4. By just skipping the cache for longer vectors, we don't overrun and store float7 vectors in the double3 slot or retrieve the double3 in place of float7.

Testing is for acceptance, mangling and basic copying that takes place
at the high level to ensure they are being accepted and recognized
correctly. The intent is not to tully test the passing of data as that
requires enabling vector operations to do properly. This test is used to
verify that these same constructs are disallowed in 6.8 and earlier.

A separate test verifies that disallowed contexts produce the
appropriate errors

Fixes microsoft#7117
@pow2clk pow2clk linked a pull request Feb 18, 2025 that will close this issue
@damyanp damyanp moved this from Active to Needs Review in HLSL Support Feb 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Feature suggestion sm6.9 Shader Model 6.9
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant