Repository navigation
feat(qp): pure-qP VTI/TTI on impl='c' + Born pair; acoustic-family fixes - #125
Merged
Merged
Conversation
- qp_vti2d / qp_tti2d CUDA kernels: forward, full and boundary-saving backward (gpu/cpu/disk; fp32/fp16/bf16, int8 refused), orders 2-8 and runtime order. - The adjoint reads the forward state in the absorbing layer: full mode keeps five fields per step, boundary saving stores the whole CPML frame. - s_gradient='adjoint' (new default), 'frozen' or 'exact'. - PropTorch warns once when dt breaks the stability limit (Liang et al. 2023, eq. B-9; a safe-side bound for TTI). - AcousticVTILSRTM / AcousticTTILSRTM (Born pair, eager and c); the compiled backward returns mp's gradient and refuses the rest (c_refuse_grads hook). - Tests: test_qp_aniso_cuda.py, test_qp_stability.py, diagnostics test/qp_*.py; docs qp_born.md and the LSRTM example notebook 34 (isotropic / VTI / TTI on a tilted bed).
Acoustic, Acoustic3D, VRZ 2-D/3-D, LSRTM 2-D/3-D, ViscoAcoustic on impl='c': - the forward runs the CPML update on the db leak cell, the adjoints match it; - the LSRTM adjoint transposes the CPML band (dot test 0.11 -> 1e-6); - checkpoint replays double-buffer psi (in place they raced); - ViscoAcoustic keeps the ring update in its history (= Acoustic with Q off). Records and gradients change: vs eager twins 5e-7..2e-5 / 2e-6..2e-5, DD bitwise to one card, V100 time -5..+2 %. Affected notebooks re-run; 07 and 19 read the eager ring from ReconState.rows (broken since 5fb947d).
- LSRTM 2-D/3-D and VRZ 2-D/3-D on impl='c': a wavelet that requires grad, and LSRTM's vp under Ckpt, raise NotImplementedError before anything runs (they came back zero, wrong or None). - ModelParallel refuses a wavelet that requires grad, for every equation. - Gradient matrix: KNOWN_REFUSED_GRADIENTS; a test per refusal.
The stepped LSRTM backward built its own copy stream per call; under DD (one call per step) the next step's prefetch stayed on a stream nothing waited on and could overwrite a refilled ring slot (3-D: up to 12 % of the gradient peak, run to run). Both LSRTM backwards now use the DD BoundarySession; a stepped call without one drains its stream. cpu staging is bitwise equal to gpu and to itself (dd_offload_check EQ=lsrtm, lsrtm_staging_check.py); storage='disk' is refused at construction.
The compact 3-D restore wrote a multi-band cell once per band; int8/fp16 quantize each face with its own scales, so the last writer won and gradients changed run to run (int8 since 0.1.0, fp16 since 0.2.0). boundary_kernel3d_compact_owned restores such a cell from the band the scan kernel writes last: equal to SWEEP_BOUNDARY_NO_COMPACT=1 bit for bit, other kernels' SASS unchanged. dd_offload_check is now bitwise in every dtype; gate: the 3-D int8 noise floors (8 passes, Ada and V100, bit-stable) nulled.
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.
Five self-contained commits; reviewing them one by one is easiest. Rebased on
dev(#124). The CHANGELOG has the full entries.Commits
impl='c',s_gradientmodes, qP Born pairs_gradient='adjoint'(new default),'frozen','exact'. The exact derivative of the S_n step is ill-conditioned (eager fp32 and fp64 differ by 2-3 % on the canonical gradient test).AcousticVTILSRTM/AcousticTTILSRTM: the Born pair, eager and c. The compiled backward returns thempgradient and refuses the rest.PropTorchwarns once whendtbreaks the scheme's stability limit (the paper's eq. B-9 for VTI; a safe-side bound for TTI).user-guide/qp_born.md(forward, adjoint and Born derivation), example notebook 34 (RTM / LSRTM of a tilted bed with the isotropic, VTI and TTI operators).Acoustic,Acoustic3D,AcousticVRZ,AcousticVRZ3D,AcousticLSRTM,AcousticLSRTM3D,ViscoAcousticonimpl='c').dbis nonzero, and the adjoints' interior bounds stopped one cell short.ReconState.rows.Ckpt: the RWI vp gradient.ModelParallelrefuses a wavelet that requires grad.ModelParallelBoundarySession. cpu staging is bit-identical to gpu-direct.storage='disk'is refused for the pair.gate/noise_floors.jsonare now null (bit-stable).Behaviour changes
AcousticVTI/AcousticTTI(s_gradient='adjoint'; it was'exact').impl='c'(commit 2).Ckptvp gradient onimpl='c'; a wavelet that requires grad underModelParallel; LSRTM with disk storage underModelParallel.Rebase on dev
visco_acoustic2d/kernels.cuh,backward.cu,visco_acoustic.py).merge(old tip, dev)exactly. Core rebuilt.Tests
test_forward_scratch_from_pool.pystill expected four forward scratch grids forViscoAcoustic; commit 2 adds a fifth (the step's update), so the count is updated in that commit.test_qp_aniso_cuda.py,test_qp_stability.py,test_equation_registry_public_api.py,test_aniso_free_surface_guard.py— 138 passed.🤖 Generated with Claude Code