Skip to content

Add an optional Numba-CUDA-MLIR Gaussian xFit backend - #85

Open
tpn wants to merge 4 commits into
mainfrom
codex/numba-xfit-main-20260930
Open

tpn wants to merge 4 commits into
mainfrom
codex/numba-xfit-main-20260930

Conversation

@tpn

@tpn tpn commented Sep 30, 2026 •

Copy link
Copy Markdown
Collaborator

Gaussian fits repeatedly evaluate the model and analytic derivatives through CuPy expressions. Add an optional Numba-CUDA-MLIR backend that combines this work into separate residual and weighted-Jacobian CUDA kernels, with per-thread kernel reuse and explicit stream/buffer lifetimes. CuPy normal-equation contractions, the LM solver and final diagnostics are preserved.

Install cuphoton[numba-cuda-mlir] on Linux with CUDA 13 and select --backend numba-cuda-mlir. The selection also flows through device-pipeline configuration and bulk execution. Gaussian difference/split modes support float32/float64, masks and variance weights; sampled models and finite differences fail explicitly. Existing backend defaults and fallbacks are preserved.

Public synthetic tests cover scientific parity, solver edge cases, concurrent fits, delayed producer streams and actual CLI selection. The xScan-to-xFit inference test compares both backends through the CLI. GPU CI requires these tests to run without skips, and the existing Gaussian benchmark accepts the new backend for warmed comparisons. Builds on #82.

Validation on the integrated source (Python 3.12, CUDA 13):

  • 707 CPU tests passed, covering xFit, shared execution, FITS controls, and pipeline contracts.
  • Seven GPU CLI and end-to-end pipeline checks passed without skips, including difference/split fits and comparison with CuPy.
  • All-file hooks passed with the optional GPU and Numba dependencies installed, including mypy and lock validation.

@tpn
tpn requested a review from melo-gonzo as a code owner September 30, 2026 13:36
@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: f4d7291d-6a12-4d90-911c-aa0434b1ac69

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/numba-xfit-main-20260930 branch from 08a39e6 to cd776e0 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:46
@tpn
tpn force-pushed the codex/numba-xfit-main-20260930 branch from cd776e0 to bed540e Compare October 9, 2026 20:46
@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/numba-xfit-main-20260930 branch 2 times, most recently from 0bd3868 to 9aa4b56 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 4 commits October 16, 2026 11:44
Fuse Gaussian model and analytic Jacobian evaluation while preserving
the reference weighted normal contractions and solver behavior.
Keep CuPy as the default and expose the optional backend through xFit
and the device pipeline, with real CLI and scientific coverage.

Signed-off-by: Trent Nelson <trentn@nvidia.com>
Include the Numba-CUDA-MLIR installation extra and device-fit backend
argument in the existing public contract assertions.

Signed-off-by: Trent Nelson <trentn@nvidia.com>
Keep the device signature and shared pipeline diagnostics consistent
when native and Numba-CUDA-MLIR execution are both available.

Signed-off-by: Trent Nelson <trentn@nvidia.com>
Allow dynamic CUDA array and stream exports in GPU-enabled type checks.

Signed-off-by: Trent Nelson <trentn@nvidia.com>
@tpn
tpn force-pushed the codex/numba-xfit-main-20260930 branch from 9aa4b56 to d940e53 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