Skip to content

Add CoopVec load/store pointer overloads#6822

Merged
fairywreath merged 10 commits intoshader-slang:masterfrom
fairywreath:coop-vec-pointer
May 23, 2025
Merged

Add CoopVec load/store pointer overloads#6822
fairywreath merged 10 commits intoshader-slang:masterfrom
fairywreath:coop-vec-pointer

Conversation

@fairywreath
Copy link
Copy Markdown
Contributor

@fairywreath fairywreath commented Apr 15, 2025

Adds CoopVec load/store function overloads to accept Ptr types. SPIRV accepts the pointers as pointers to an array of scalars/vectors. Hence the user's pointer-to-scalar must be translated to a pointer-to-array, more specifically a runtime/unsized array, where a stride decoration is required.

@fairywreath fairywreath requested a review from a team as a code owner April 15, 2025 21:56
@fairywreath fairywreath marked this pull request as draft April 15, 2025 21:57
int32_t* ptr;
}

//TEST_INPUT:ubuffer(data=[1 2 3 4 5 6 7 8], stride=4),name=buf
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

ptr isn't initialized with anything that is actually valid to read/write to.

TEST_INPUT allows you to assign a ubuffer to a pointer value, can you try that instead and turn this into an executable test?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

e.g.

//TEST_INPUT: set pObj = ubuffer(data=[2 0 0 0], stride=4);
uniform Obj* pObj;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks - is it possible to have these as output?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Should be? I haven’t tried that yet…

@fairywreath fairywreath added the pr: non-breaking PRs without breaking changes label Apr 17, 2025
@fairywreath fairywreath marked this pull request as ready for review May 22, 2025 05:25
@fairywreath fairywreath requested a review from csyonghe May 22, 2025 05:26
@csyonghe
Copy link
Copy Markdown
Collaborator

I think we also need overloads of coopMatMulAdd and friends that takes pointers for the matrix instead of a ByteAddressBuffer + offset.

@fairywreath fairywreath enabled auto-merge (squash) May 23, 2025 05:07
@fairywreath fairywreath merged commit d108bfa into shader-slang:master May 23, 2025
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr: non-breaking PRs without breaking changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants