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

CUDA sin is broken #924

Closed
wsmoses opened this issue Jul 3, 2023 · 4 comments
Closed

CUDA sin is broken #924

wsmoses opened this issue Jul 3, 2023 · 4 comments

Comments

@wsmoses
Copy link
Member

wsmoses commented Jul 3, 2023

There was some change such (? to CUDA.jl) that nv_sin/etc is not always ebing linked in now, which means we cannot find it to generate the derivative of nv_cos.

@wsmoses
Copy link
Member Author

wsmoses commented Jul 3, 2023

@vchuravy if you have any insights here

@wsmoses
Copy link
Member Author

wsmoses commented Jul 13, 2023

So this was broken by https://github.com/EnzymeAD/Enzyme.jl/pull/915/files aka GPUCompiler 0.20

cc @maleadt if you might have any insights here.

Essentially what used to happen is that for cuda code using device functions Enzyme/GPUCompiler would link in all of libdevice (aka sin, cos, etc). This is necessary since the derivative of nv_sin is nv_cos.

Since ?GPUCompiler 0.20, it appears that by the time Enzyme gets it, the (from the source) unused nv_cos is dropped, leaving Enzyme.jl no implementation to use on CUDA, leading to issues.

@wsmoses
Copy link
Member Author

wsmoses commented Jul 13, 2023

Yes, this PR: JuliaGPU/GPUCompiler.jl#458 specifically broke Enzyme CUDA compilation here, for the reasons above.

@maleadt can we go back to having linking before codegen (otherwise we are unable to do the relevant force preservation and llvm.sin -> __nv_sin) ?

@maleadt
Copy link

maleadt commented Jul 13, 2023

@maleadt can we go back to having linking before codegen (otherwise we are unable to do the relevant force preservation and llvm.sin -> __nv_sin) ?

Not easily, as that was a correctness fix for deferred-mode compilation. Changing it would re-introduce a bug.

You should be able to sufficiently customize the compilation already though. Where were you currently detecting __nv_sin?

@wsmoses wsmoses closed this as completed Jul 30, 2023
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