Replies: 2 comments
|
Closing in favour of a more detailed report with confirmed measurements and related issue references: #2787. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Hi Enzyme Team,
I am building a simulation engine that works in two distinct calculation stages:
Calculation flow
Stage 1 (Common calculation):$\times$ Times $\times$ Paths).
Generates a 3D "Risk Factor Cube" (Factors
This cube will be re-used from list of individual (entity) calculations afterwards
Stage 2 (Entity - unique):$\times$ Paths). This matrix is then is aggregated into a single scalar result of we which I need to differentiate.
Each individual calculation entity reads from the 3D Cube to generate a 2D "Projection Matrix" of results (Times
Hence, I need to evaluate the derivatives of the "list" of the dependent scalars with respect to the independent variables.
Contraint
Because I have thousands of individual entities to calculate, I cannot store simultaneously all the 2D "Projection Matrices" at once. So I need to stage the results of each individual "entity" one at the time, to keep RAM usage constant.
My Proposed Loop:
Step A (Entity AD: from Stage 2 -> 1):
Run
__enzyme_autodiffon the Entity Simulation result. I capture the gradient of the scalar with respect to the 3D Cube (from Calculation Stage 1) in a temporary shadow buffer (d_Cube_Staging).Step B (Bridge AD: from Stage 1 -> 0):
Run
__enzyme_autodiffon the Common Simulation. I seed it with thed_Cube_Stagingfrom Step A to propagate the sensitivity back to my initial model parameters.Step C (Cleanup the staging 2D matrix):
memset the staging shadow buffer (of staged gradients) to zero and repeat for the next entity.
Questions:
d_Cube_Staging) inside a loop a safe and recommended pattern?All reactions