You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Feature Request] Warn on use of eval intrinsics (EvaluateAttribute*, GetAttributeAtVertex) outside entry function #6478
Is your feature request related to a problem? Please describe.
Using an attribute evaluation intrinsic (EvaluateAttribute* and GetAttributeAtVertex) outside an entry point is not well-defined in the HLSL language. Sometimes it works for DXIL because of the way we optimize code before lowering to a DXIL operation, and many times it doesn't work. However, it can't be reliably defined or implemented in the current language due to our current calling convention that uses copy-in semantics.
Describe the solution you'd like
I suggest we introduce a warning when using these intrinsics outside of the entry function, since that's where the language does not have a well-defined way to support this.
The wording of the warning should indicate that calls to these intrinsics are unsupported outside the entry function, even though they may work in some cases on certain targets.
Defaulting this warning to error would be useful, but might be too disruptive in the short term, so we may need to limit the scope for that, perhaps to SPIR-V and HLSL 202x.
The warning should have a unique group to allow user override.
Describe alternatives you've considered
A change to require nointerpolation on intermediate function arguments used for GetAttributeAtVertex has been submitted in PR #6453. However, while this may be used to catch some invalid use cases, it will also block legal use cases, won't help catch a variety of other problematic cases, and won't help with the EvaluateAttribute* intrinsics at all, which have the same problem. It will only be enabled on SPIR-V, so it may be acceptable as a helpful mitigation in SPIR-V for now, but I do not believe it points towards a solution to the general problem.
Let's have a think about this when we get closer to deciding what's in HLSL 202x. It's not obvious at the moment if we need to do something about the current status quo, and whether or not a warning like this adds enough value to make it worth the investment.
Activity
damyanp commentedon Apr 1, 2024
Let's have a think about this when we get closer to deciding what's in HLSL 202x. It's not obvious at the moment if we need to do something about the current status quo, and whether or not a warning like this adds enough value to make it worth the investment.