Skip to content

Conversation

@JoeCitizen
Copy link

Add a new HLSL attribute for Compute, Amp and Mesh shaders: GroupSharedLimit.

This is used to limit the amount of group shared memory a shader is allowed to statically declare, and validation will fail if the limit is exceeded.

There is no upper limit on this attribute, and it is expected that shader writers set the limit as the lowest common denominator for their target hardware and software use case (typically 48k or 64k for modern GPUs).

If no attribute is declared the existing 32k limit is used to be compatible with existing shaders.

Extends the PSV structures to include the selected limit so that runtime validation can reject the shader if it exceeds the device support.

@github-actions
Copy link
Contributor

github-actions bot commented Nov 4, 2025

✅ With the latest revision this PR passed the C/C++ code formatter.

Copy link
Member

@damyanp damyanp left a comment

Choose a reason for hiding this comment

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

Some superficial things that'll need to be addressed at some point, I'm afraid I can't really comment on the actual details of how this works.

I suspect that the whole thing needs to be run through clang-format as well.

}
}

void hlsl::SetShaderProps(PSVRuntimeInfo4 *pInfo4, const DxilModule &DM) {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
void hlsl::SetShaderProps(PSVRuntimeInfo4 *pInfo4, const DxilModule &DM) {
void hlsl::SetShaderProps(PSVRuntimeInfo4 *Info4, const DxilModule &DM) {

For new code we generally follow the LLVM Coding Standards. This includes no-p-prefix.

PSVRuntimeInfo1 *pInfo1, PSVRuntimeInfo2 *pInfo2,
PSVRuntimeInfo3 *pInfo3, uint8_t ShaderKind,
const char *EntryName, const char *Comment) {
PSVRuntimeInfo3 *pInfo3, PSVRuntimeInfo4 *pInfo4,
Copy link
Member

Choose a reason for hiding this comment

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

IMO in this case following the pInfoN pattern is appropriate.

Comment on lines 3930 to 3932
if (SpecifiedTGSMSize > 0) {
MaxSize = SpecifiedTGSMSize;
}
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
if (SpecifiedTGSMSize > 0) {
MaxSize = SpecifiedTGSMSize;
}
if (SpecifiedTGSMSize > 0)
MaxSize = SpecifiedTGSMSize;

LLVM coding standards say to omit braces here.

Something's also up with the formatting. Did the format-checker spot it? Anyway, clang-format should fix this for you.

@JoeCitizen JoeCitizen marked this pull request as ready for review December 1, 2025 19:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: New

Development

Successfully merging this pull request may close these issues.

2 participants