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

Provide built-in that expands to the amount of LDS usage declared (up to the point of built-in usage) #4290

Closed
jeremyong-az opened this issue Feb 22, 2022 · 1 comment
Labels
needs-triage Awaiting triage

Comments

@jeremyong-az
Copy link

jeremyong-az commented Feb 22, 2022

It would be useful to detect or even fail compilation in cases where group shared memory exceeds a user specified amount.

Example:

groupshared float data[N];

#if GroupSharedSize >= SOME_NUMBER
    #error "Group shared usage exceeds some arbitrary size of our choosing"
#endif

There are a few possible uses which may include emitting a compiler error as above, or possibly modifying the shader itself depending. The primary usage (I am guessing) would be to detect situations where a shader's LDS-usage is inadvertently changed to affect occupancy in a meaningful way.

Note that the meaning of GroupSharedSize should probably be the size allocated in shared memory up to the point of usage in order to avoid needing multiple (additional) passes to compile the shader itself. That is:

groupshared float datum1;

// GroupSharedSize == 4

groupshared float datum2[2];

// GroupSharedSize = 12
@llvm-beanz
Copy link
Collaborator

Exposing driver-level constants like this is basically an add-on to specialization constants. I think we would address this as part of the language feature request over in hlsl-specs/16.

@llvm-beanz llvm-beanz closed this as not planned Won't fix, can't repro, duplicate, stale Jul 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-triage Awaiting triage
Projects
Archived in project
Development

No branches or pull requests

2 participants