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

Compiler hangs on recursive functions when targeting Metal #5684

Open
dbartussek opened this issue Nov 26, 2024 · 2 comments
Open

Compiler hangs on recursive functions when targeting Metal #5684

dbartussek opened this issue Nov 26, 2024 · 2 comments

Comments

@dbartussek
Copy link

Attempting to compile the following code targeting Metal results in the compiler hanging:

[shader("compute")]
func m() {
    r();
}

func r() {
    r();
}

I stumbled on this while messing around in the playground: https://shader-slang.com/slang-playground/?target=METAL&code=eJyLLs5ITEkt0lBKzs8tKC1JVdKM5UorzUtWyNXQVKjmUgCCIg1Na65aLohwEZowAHEsEU0

@jkwak-work
Copy link
Collaborator

Currently the recursive function call is supported only for CPU targets.
Slang-playground is pretty new and it may not be able to handle error message well yet.

When you compile the given shader with slangc.exe, you can see the error message,

test.slang(7): error 55201: recursion detected in call to 'r', but the current code generation target does not allow recursion.
    r();
     ^

@dbartussek
Copy link
Author

Did you use the Metal target on slangc? I could also trigger the hang with the current release of slangc, but only when targeting Metal.

You are correct that all other targets show the error message, even on the playground. I also haven't been able to test it with the current head version because I couldn't get slangc to compile, so the issue may already have been fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants