-
Notifications
You must be signed in to change notification settings - Fork 373
Implement GetElementCount for TypeCastIntVal #8950
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
base: master
Are you sure you want to change the base?
Conversation
kaizhangNV
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
|
The recursive call to I have added a check for specialization constants in |
| // emission, then evaluated to concrete bytes at pipeline-creation time | ||
| // | ||
| // This differs from generic parameters, which are resolved at Slang compile-time | ||
| return LayoutSize::infinite(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is unnecessarily true, if downstream doesn't provide the value via pipeline, it will just use the default value. So I don't think this change is correct.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need to differentiate it from generic parameter?
Both of them cannot be determined at front-end, so I don't know why there is difference.
Fixes #8894
Adds handling of
TypeCastIntValinGetElementCount, recursively callingGetElementCounton its baseIntVal, allowing aSpecializationConstantto be used as an array size.Also adds a check for specialization constants in
GetElementCountso that if aDeclRefIntValhas aVarDeclBasewith theSpecializationConstantAttribute,GetElementCountwill returnLayoutSize::infinite()to ensure that the array gets a binding but does not get a size at compile-time. In this case theDeclRefIntValis the baseIntValof theTypeCastIntValthat we recursively check.