-
Notifications
You must be signed in to change notification settings - Fork 108
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
Enzyme failed to support atomicAdd, atomicCAS, and assert for cuda code #2053
Comments
Hi @wsmoses Thank you for your assistance. With the latest build, the assert issue has been resolved. However, CUDA does not provide an atomicMax function out of the box, so we need to use atomicCAS to achieve that functionality. Unfortunately, it seems that atomicCAS is not supported by Enzyme. Additionally, atomicAdd does not support double precision before SM_60, which also necessitates the use of atomicCAS. Even for float precision, I have been unable to compile atomicAdd with Enzyme. Any tips or workarounds for these issues would be greatly appreciated. |
I tried to use custom gradient to bypass this issues. However the CPU code did not work
it crashed with with compile options |
The gpu version of the custom gradient does not even visit the registered custom gradient
with compile option
|
Hi @wsmoses, do you have any suggestions about the custom gradients as shown above? Is there anything wrong with my code? Thanks in advance for your help! |
@wsmoses Thanks for your suggestion. Now the custom gradient for the CPU works fine https://fwd.gymni.ch/eqgSVV. However, the GPU version did not give the expected gradient https://fwd.gymni.ch/vpgh8Y. It seems the customer gradient is not used at all due to it is not on the device code. However If I have then it will complains
Can you provide any suggestions? Thanks! |
I am using enzyme for gpu code. Here is the some information
in
square_impl
if I useAtomicMax
, it failed to compile with error msg:in
square_impl
if I useAtomicAdd
, it fails to compile with the error msg:in
square_impl
if I useassert(x_out[0] == 0.0);
, it fails to compile with the error msg:The forward codes comply and run fine with the __enzyme_autodiff function commented out.
The text was updated successfully, but these errors were encountered: