Repository navigation
perf(assign): fuse unchanged dense CUDA assignment - #29
Open
JESUSROYETH wants to merge 1 commit into
Open
JESUSROYETH wants to merge 1 commit into
JESUSROYETH wants to merge 1 commit into
Conversation
WP: 200b Provenance: R40, R44 Assumptions: none Gate: focused assignment, loss replay, CLI and compiler tests; pre-commit Signed-off-by: Jesús Royeth <JESUSROYETH@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The fit-test assertion rejects valid native-fallback environments because it treats Triton availability as full backend eligibility.
1 open issue
What changed in this PR
Adds opt-in CUDA fusion to the existing target-assignment pipeline, aiming to reduce training time without changing assignment results. The reported 10.94% complete-fit improvement applies to the measured nano OBB workload.
Changes:
- Adds four CUDA passes with native fallbacks for unsupported execution.
- Threads
fused_assignmentthrough training, both loss branches and graph-recording checks. - Adds parity, fallback, replay and CLI tests, plus installation and benchmark documentation.
Validation remains provisional: full make gate, aggregate coverage, accelerator goldens and long-run accuracy are unverified. No runtime checks were performed in this review.
| File | Description |
|---|---|
tests/ptl/test_loss_capture.py |
Exercises fused assignment during loss replay and training. |
tests/ptl/test_compile.py |
Checks compiler tracing with fusion requested. |
tests/ptl/test_cli.py |
Verifies CLI forwarding to both assigners. |
tests/assign/test_cuda_assignment.py |
Adds parity, eligibility, boundary and replay coverage. |
src/lucid_yolo/ptl/module.py |
Exposes the default-off training option. |
src/lucid_yolo/ptl/loss_capture.py |
Includes fusion settings and helpers in recording checks. |
src/lucid_yolo/losses/dual_loss.py |
Forwards fusion requests to both branches. |
src/lucid_yolo/assign/tal.py |
Integrates optional CUDA passes into assignment. |
src/lucid_yolo/assign/stal.py |
Forwards the small-target assigner's option. |
src/lucid_yolo/assign/one_to_one.py |
Forwards the unique assigner's option. |
src/lucid_yolo/assign/_cuda.py |
Handles eligibility, launches, readiness and fallback. |
src/lucid_yolo/assign/_cuda_kernels.py |
Implements the four device passes. |
pyproject.toml |
Adds optional CUDA-assignment dependencies. |
docs/work_packages/wp-200b.md |
Records implementation, measurements and limitations. |
docs/work_packages/wp-200.md |
Links the dependent work package. |
docs/work_packages/wp-199.md |
Adds the dependency backlink. |
docs/work_packages/wp-198.md |
Adds the dependency backlink. |
docs/TRAINING.md |
Documents installation, eligibility and usage. |
docs/ROADMAP.md |
Tracks WP-200b and outstanding validation. |
docs/PROVENANCE.md |
Records implementation sources and runtime constraints. |
docs/engineering/phase-17-pose-objective-parity.md |
Includes the new work-package report. |
Review effort: Balanced
Comment on lines
+678
to
+679
| if fused_assignment and _cuda._AVAILABLE: | ||
| assert {kind for kind, _ in _cuda._STATE.verified} == {"metric", "conflicts"} |
This branch has not been deployed
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.

This reduces complete nano OBB training time by 10.94% on an L4 at batch 16/1024/BF16, with the merged replay and input options enabled.
The new
fused_assignmentoption schedules dense IoU, class gather/masking, rotated containment and conflict resolution in four CUDA passes. It defaults to false, native PyTorch still computes powers, trigonometry, ranking and target normalization. Unsupported inputs keep the native path.I ran five alternating 50-epoch pairs, seconds as median (range):
8276de7All 350 loss values per run, model/optimiser/EMA/scheduler states and validation metrics match byte for byte. Focused CPU/CUDA checks and pre-commit pass. This measurement is for this recipe only. That said, full
make gate, aggregate coverage, goldens and long-run accuracy remain unverified. Workload and startup limits are in WP-200b.WP: 200b
Provenance: R40, R44
Assumptions: none
Gate: tests/assign/test_cuda_assignment.py; tests/ptl/test_loss_capture.py; tests/ptl/test_cli.py; tests/ptl/test_compile.py::TestDetectObjectiveTracesAsOneGraph