Skip to content

perf: compact 3D CPML state - #8

Merged
Vcholerae1 merged 2 commits into
mainfrom
exp/compact-cpml-state
Aug 22, 2026
Merged

perf: compact 3D CPML state#8
Vcholerae1 merged 2 commits into
mainfrom
exp/compact-cpml-state

Conversation

@Vcholerae1

@Vcholerae1 Vcholerae1 commented Aug 21, 2026

Copy link
Copy Markdown
Owner

Summary

  • keep compact CPML shape/pack/unpack bookkeeping as an internal grid utility
  • keep the public EM3D state representation full-grid and backend-independent
  • migrate non-Born CUDA propagation and adjoint scratch to axis-compact CPML storage internally
  • scope compact PML indexes to active branches and specialize adjoint raw accessors by compile-time axis/sign
  • preserve full-grid callback views, CPU/reference continuation, Born output compatibility, Debye behavior, and public API
  • leave TM2D full-grid after its multi-shot compact prototype regressed
  • remove stale quality-workflow references to the benchmark script deleted on main

Results

  • internal CPML working-state storage: 52,800 -> 25,600 bytes on the parity workload (-51.52%)
  • Nsight Compute E adjoint kernel: 64.22 -> 46.66 us (-27.3%)
  • Nsight Compute H adjoint kernel: 67.23 -> 49.50 us (-26.4%)
  • 65^3, 1200-step backward CUDA median improved 16.95% versus the pre-specialization compact implementation
  • public returned states remain full-grid; memory claims exclude returned-state packaging and callback expansion

Verification

  • Ruff format/check: pass (83 files)
  • CPU non-numerical: 288 passed, 2 skipped
  • CPU numerical: 38 passed
  • CUDA numerical: 48 passed
  • targeted continuation/Debye/Born/callback/batched-float64 guards: 10 passed

TM2D and Born computational layouts are intentionally unchanged.

@Vcholerae1
Vcholerae1 force-pushed the exp/compact-cpml-state branch 4 times, most recently from 6c5bfc4 to 780683b Compare August 21, 2026 18:19
Define the compact slab contract, map CUDA forward and adjoint CPML state by axis, compact Python allocations and backward scratch, reuse CPML coefficients, scope compact indexes to active PML branches, and specialize adjoint neighbor indexing at compile time.
@Vcholerae1
Vcholerae1 force-pushed the exp/compact-cpml-state branch from 780683b to 9e5305b Compare August 21, 2026 18:21
@Vcholerae1
Vcholerae1 requested a balanced review from Copilot August 22, 2026 11:40

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@Vcholerae1
Vcholerae1 merged commit a72698e into main Aug 22, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants