Skip to content

[HLSL] Disallow function recursion #105244

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

Open
pow2clk opened this issue Aug 20, 2024 · 0 comments
Open

[HLSL] Disallow function recursion #105244

pow2clk opened this issue Aug 20, 2024 · 0 comments
Labels
HLSL HLSL Language Support

Comments

@pow2clk
Copy link
Contributor

pow2clk commented Aug 20, 2024

Due to inlining everything, HLSL doesn't allow recursion. We need to detect recursion and produce an error when it is encountered.

My initial investigations suggest this isn't currently detected in clang and existing checks in the inliner rely on inlining itself to detect loops involving multiple functions. There is a norecurse attribute, but it is descriptive rather than prescriptive.

@pow2clk pow2clk added the HLSL HLSL Language Support label Aug 20, 2024
pow2clk added a commit that referenced this issue Aug 29, 2024
Previously, functions named "main" got the NoRecurse attribute
consistent with the behavior of C++, which HLSL largely follows.
However, standard recursion is not allowed in HLSL, so all functions
should really have this attribute. This doesn't prevent recursion, but
rather signals that these functions aren't expected to recurse.

Practically, this was done so that entry point functions named "main"
would have all have the same attributes as otherwise identical entry
points with other names.

This required small changes to the this assignment tests because they no
longer generate so many attribute sets since more of them match.

related to #105244
but done to simplify testing for #89806
@damyanp damyanp moved this to Ready in HLSL Support Oct 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
HLSL HLSL Language Support
Projects
Status: Ready
Development

No branches or pull requests

2 participants