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

Allow return or return nothing in kernels #443

Open
eschnett opened this issue Dec 13, 2023 · 2 comments
Open

Allow return or return nothing in kernels #443

eschnett opened this issue Dec 13, 2023 · 2 comments

Comments

@eschnett
Copy link
Contributor

I use JuliaFormatter to format my source code. This adds explicit return statements. This leads to

ERROR: LoadError: Return statement not permitted in a kernel function sum2_kernel!

even if the return statement is just return nothing.

At the same time, ending a kernel with an expression (which is equivalent to a return statement) is allowed.

Could this check be changed to allow only empty return or return nothing statements?

@vchuravy
Copy link
Member

At the same time, ending a kernel with an expression (which is equivalent to a return statement) is allowed.

KernelAbstractions will politly ignore those and insert a return nothing for you.
But yes we could explicitly allow return or return nothing

@pxl-th
Copy link
Collaborator

pxl-th commented Jan 9, 2024

Closed by #446.

@pxl-th pxl-th closed this as completed Jan 9, 2024
@vchuravy vchuravy reopened this Feb 26, 2024
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

3 participants