-
Notifications
You must be signed in to change notification settings - Fork 253
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
Report AD checkpoint contexts #5058
Report AD checkpoint contexts #5058
Conversation
Overall, this looks good! However, we really need tests for this. I would suggest that we use the diagnostic sink to report these diagnostics as 'notes' (use |
We need to test for nested functions calls too. If |
@csyonghe The following is what it looks like for nested calls: tests/autodiff/reverse-nested-calls.slang(19): note: checkpointing context of 4 bytes was generated for function: 'f'
float f(float x)
^
tests/autodiff/reverse-nested-calls.slang(21): note: 4 bytes (float) used to checkpoint the following item:
return 3.0f * g(2.0f * x);
^ |
@@ -425,6 +429,9 @@ IRFunc* DiffUnzipPass::extractPrimalFunc( | |||
inst->getFullType(), | |||
intermediateVar, | |||
structKeyDecor->getStructKey()); | |||
|
|||
val->sourceLoc = user->sourceLoc; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of setting source locs everywhere, consider use IRBuilderSourceLocRAII sourceLocInfo(getBuilder(), loc);
to simplify the code. This is an RAII object that will make all future insts emited by the builder automatically have the loc
as source loc, until the RAII object goes out of scope.
e834429
to
8779f24
Compare
d281cb5
to
a85fba7
Compare
1960e23
Issue: #4997
Display checkpoint context structures for functions with non-empty contexts:
-report-checkpoint-intermediates
sourceLoc
copies so that the source locations can be displayedoutput for
reverse-loop.slang
output for
reverse-loop-checkpoint-test.slang