Skip to content

Add opt-in CuPy fusion for Gaussian xFit fits - #84

Open
tpn wants to merge 5 commits into
mainfrom
codex/xfit-cupy-fusion-publish-20260930
Open

tpn wants to merge 5 commits into
mainfrom
codex/xfit-cupy-fusion-publish-20260930

Conversation

@tpn

@tpn tpn commented Sep 30, 2026 •

Copy link
Copy Markdown
Collaborator

Gaussian CuPy fits launch many small operations to evaluate residuals and analytic derivatives. Add opt-in CuPy kernels that combine those operations while keeping the existing normal-equation contractions, LM solver, and final uncertainty diagnostics.

fit_dipoles(images, model="gaussian", backend="cupy", fusion=True)

The CLI selects the same implementation with --backend cupy --fusion, and device pipeline manifests accept xfit.fusion: true. Float32/float64, masks, variances, difference mode, and split mode are supported. Each fit owns its buffers and uses the current CuPy stream. Explicit rounding preserves the arithmetic boundaries that matter for ill-conditioned fits.

The public Gaussian benchmark now reports the first fit separately from every warmed sample. Run it with and without --fusion to compare complete fits, including input transfer and portable results.

Local validation: all 43 selected GPU cases passed without skips, covering fusion, numerical edge cases, independent streams, repeated calls, and the actual CLI. The integrated source also passed 545 CPU tests (94 expected GPU/optional skips) and repository hooks, including Ruff and mypy.

@tpn
tpn requested a review from melo-gonzo as a code owner September 30, 2026 11:15
@coderabbitai

coderabbitai Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are limited based on label configuration.

🏷️ Required labels (at least one): 1
  • ai-review

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration
  • Configuration used: Repository: NVIDIA/cuPhoton/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Enterprise
  • Run ID: 73835324-bc8e-4506-8077-e8799e4d5691

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@tpn
tpn force-pushed the codex/xpois-lazy-fits-main-20260930 branch from 0f278f7 to bedf42f Compare October 5, 2026 02:43
@tpn
tpn force-pushed the codex/xfit-cupy-fusion-publish-20260930 branch from 4b8f875 to 81526f2 Compare October 5, 2026 02:48
@tpn
tpn force-pushed the codex/xpois-lazy-fits-main-20260930 branch from bedf42f to e91c262 Compare October 9, 2026 19:12
@tpn
tpn changed the base branch from codex/xpois-lazy-fits-main-20260930 to main October 9, 2026 20:44
@tpn
tpn force-pushed the codex/xfit-cupy-fusion-publish-20260930 branch from 81526f2 to 280d818 Compare October 9, 2026 20:44
@tpn
tpn changed the base branch from main to codex/ci-python-ecr-20261009 October 9, 2026 21:08
@tpn
tpn force-pushed the codex/xfit-cupy-fusion-publish-20260930 branch 2 times, most recently from f48b35f to dfdd55b Compare October 15, 2026 18:05
@tpn
tpn changed the base branch from codex/ci-python-ecr-20261009 to main October 15, 2026 18:06
tpn added 5 commits October 16, 2026 11:44
Add opt-in kernels that combine Gaussian evaluation, weighting and
normal-equation accumulation while retaining the existing LM solver.
Expose fusion through the fit API, CLI and device pipeline settings.

Signed-off-by: Trent Nelson <trentn@nvidia.com>
Use explicit rounding at pointwise operation boundaries while retaining
the default library math and CuPy normal-equation contractions. This
preserves sensitive Gaussian fits and covers cancelling derivatives.

Signed-off-by: Trent Nelson <trentn@nvidia.com>
Signed-off-by: Trent Nelson <trentn@nvidia.com>
Signed-off-by: Trent Nelson <trentn@nvidia.com>
Signed-off-by: Trent Nelson <trentn@nvidia.com>
@tpn
tpn force-pushed the codex/xfit-cupy-fusion-publish-20260930 branch from dfdd55b to 7a4a32b Compare October 16, 2026 18:47

This branch has not been deployed

No deployments
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.

1 participant