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
error/crash when differentiating member function #1388
Comments
copying from slack. So that error you pasted above, no longer happens (yay). Instead the remaining issue is a type analysis problem. in that minimal case, ironically the problem is that its so small it doesn't have information that the input type is a double
since Enzyme cannot prove the type from the lack of info, it throws an error rather than risking incorrectness. you can tell enzyme to make its best guess, or even tell it the type explicitly |
Looks like the TBAA emitted was kind of worthless (See below), which we could've used to deduce otherwise on the memcpy.
|
The memcpy tbaa coming right out of clang looks worthless already:
My guess is that the clang sret memcpy lowering doesn't use the full type info in its !tbaa.struct !10 that it should. cc @jdoerfert if you know where that is offhand for fixing in upstream LLVM |
Thanks for the update! The original compiler explorer example was too simple, here's a more representative one: |
@wsmoses explained to me that the underlying cause here is related to a function object with no member variables being passed to mat3 output = __enzyme_fwddiff<mat3>((void*)wrapper<Material, mat3, vec3>,
enzyme_const, mat, // mat has no member variables
enzyme_const, &du_dX,
enzyme_dup, &k, &dk); the argument mat3 output = __enzyme_fwddiff<mat3>((void*)wrapper<Material, mat3, vec3>,
enzyme_const, // nothing here any more
enzyme_const, &du_dX,
enzyme_dup, &k, &dk); which is a syntax error, because the first mat3 output = __enzyme_fwddiff<mat3>((void*)wrapper<Material, mat3, vec3>,
// enzyme_const, mat
enzyme_const, &du_dX,
enzyme_dup, &k, &dk); That way, there won't accidentally be two enzyme annotations back-to-back. See: https://fwd.gymni.ch/lFgkQd |
see: https://fwd.gymni.ch/L6n0Wk
the presence or absence of a member variable in the struct "Material" emits a cryptic error message and dumps a stacktrace. I also can't seem to figure out how to call enzyme_fwddiff on the operator() without getting an error message like:
The text was updated successfully, but these errors were encountered: