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

Use gensym-ed variable in @compile and @jit #274

Merged
merged 3 commits into from
Nov 14, 2024

Conversation

jumerckx
Copy link
Contributor

This should fix #237.

@mofeing
Copy link
Collaborator

mofeing commented Nov 14, 2024

thanks @jumerckx! would you mind adding a test for this? like try compile a function called f or so. the function can do nothing like:

f(x) = x
x = rand(2,2)
y = Reactant.to_rarray(x)
z = @jit f(y)

@jumerckx
Copy link
Contributor Author

thanks @jumerckx! would you mind adding a test for this? like try compile a function called f or so. the function can do nothing like:

f(x) = x
x = rand(2,2)
y = Reactant.to_rarray(x)
z = @jit f(y)

That example actually doesn't trigger the bug because then it's just shadowing f. It's only when f is used within the function that is compiled that there is a problem.
I checked that the test I added failed before this pr.

f(x) = x
g(x) = f(x)
x = rand(2,2)
y = Reactant.to_rarray(x)
@test (@jit g(y); true)

Copy link
Collaborator

@mofeing mofeing left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great! thanks!

@wsmoses wsmoses merged commit 2946722 into EnzymeAD:main Nov 14, 2024
19 of 33 checks passed
@jumerckx jumerckx deleted the gensym_vars branch November 14, 2024 19:00
@jumerckx jumerckx mentioned this pull request Nov 15, 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

Successfully merging this pull request may close these issues.

Name clash when calling Reactant.@compile over a function that is named f
3 participants