feat(lsrtm): RWI vp gradient for AcousticLSRTM (c backend, 2-D/3-D, DD) - #108
Merged
Merged
Conversation
impl='c' AcousticLSRTM/3D returned vp.grad = 0. Full and bs now compute terms II+III+IV (Wu & Alkhalifah 2015): a background adjoint driven by the coupling transpose plus the scattered field (u_tt stored in full, reconstructed in bs). Only when vp requires grad: the layout follows it per call, so a fixed-vp LSRTM keeps the old buffers and cost (V100 x1.00; with vp.grad x1.5-1.8 time, x1.4-2.0 memory). vs eager, mp reaching the CPML band: rel 2.4e-4 (2-D) / 6.2e-4 (3-D).
With SWEEP_LSRTM_SPLIT_III=1 the full/bs backward writes the image-point term III to BackwardInput.grad_split_iii_out (new ABI field, generated files regenerated): vp.grad keeps II+IV and last_grad_split_iii() returns III on the model grid, for (II+IV) + beta*III (eq. 18-20). (II+IV) + III equals the unsplit vp.grad to rel <1e-7.
Forward and bs backward run stepped segments and honour the cut mask; the slot tables let ModelParallel rotate and halo-exchange both fields (LSRTM_DD, serial forward). The capture follows each model's requires_grad (mp only: 3 reconstruction grids; re-captured once vp wants its gradient). The NOPML reconstruction guard was abcn-based on every face and skipped cells beside each cut; now per face. Record and gradients bitwise vs one card on 4x V100, with and without vp.
Notebook 32: the paper's Fig. 1 anatomy in 2-D and 3-D, the eq. 15 identity, the beta-III split and the memory modes; gallery card and nav.
This was referenced Oct 5, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
impl='c'AcousticLSRTM / AcousticLSRTM3D returnedvp.grad = 0. This branch adds the RWI tomographic vp gradient (Wu & Alkhalifah, 2015, terms II+III+IV) to the c backward, then domain decomposition and a docs notebook.Commits
ad2babb3vp gradient in full and boundary-saving modes: a background adjoint driven by the coupling transpose, plus the scattered field (u_ttstored in full mode, reconstructed in bs). The coupling also runs inside the CPML band (pml_field); without it vp.grad was 8–10 % off eager once mp reached the edges.3d9ede9eSWEEP_LSRTM_SPLIT_III=1returns term III on its own (last_grad_split_iii()), for (II+IV) + β·III. NewBackwardInputfield; generated files regenerated.dc569060DD for AcousticLSRTM 2-D/3-D: stepped segments, cut mask, slot tables for both fields. The NOPML reconstruction guard is now per face (it skipped the cells beside every cut).ca48c33anotebook 32: Acoustic vs AcousticLSRTM gradient anatomy in 2-D and 3-D, the β-III split, memory modes; gallery card and nav.Cost follows
vp.requires_grad, per callA classic LSRTM (mp only) keeps dev's buffers and kernels. The RWI layout is allocated only when vp asks for its gradient; under DD the capture is redone the first time it does.
Checks
-fmad=false; ≤7e-7 in the default build (FMA contraction).test/on KW60443: 1888 passed; the one failure,test_shipped_core, always fails with an in-place build. Newtest/test_lsrtm_rwi_vp_gate.pypins both layouts.backend_gradient_matrix.py(acoustic_lsrtm2d/3d): 2-D passes; 3-D fails only on the wavelet gradient, as on dev.Not covered: checkpointing modes still return vp.grad = 0 (declared in
test/gradient_cases.py).🤖 Generated with Claude Code