Repository navigation
Conversation
Member
Author
|
partially fixes #3793 |
Codecov Report❌ Patch coverage is
Additional details and impacted files
|
Contributor
|
The documentation preview is ready to be viewed at https://preview.awkward-array.org/PR4484/ |
This was referenced Oct 27, 2026
…dexed-simplify # Conflicts: # dev/generate-tests.py # src/awkward/_backends/cupy.py
This was referenced Oct 28, 2026
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.
Migrate IndexedArray simplification from RawKernel to cuda.compute for all nine outer/inner index dtype combinations, preserving the canonical immediate-error and partial-write contract.
Inputs of at most 64 entries use one prepared operation that validates and writes sequentially, stopping before the first invalid read. The large path now fuses validation and first-error selection into a prepared reduction over CountingIterator row numbers, followed by the existing guarded parallel gather and attempted-index packing. It needs no separate validation transform, chunk-results buffer or TransformIterator.
The custom binary operator maps valid rows to the length sentinel and invalid rows to their own position, then selects the minimum. The mapping is idempotent, making the operation associative and commutative on row numbers plus the sentinel. Negative outer indices map to -1; negative inner indices are copied unchanged. The failing row and output suffix stay untouched. One 16-byte status read preserves immediate errors and the original attempted index.
Prepared operations/adapters and workspace sizing are cached by device/context, dtypes and declared lengths. Per-call status and reduction workspace remain independent. Cached proxies hold metadata rather than array owners; rebinding/launch is locked and proxies are cleared afterward. Remove the legacy registration/source and update the spec-driven generation/test adapters. Canonical signatures and reference semantics remain unchanged. No C++ implementation, dependency, awkward-cpp version or root pin changes.
Performance evidence and limits
The original
249aba447passed canonical GPU parity but regressed substantially. Prepared setup and cached workspace sizing reduced that overhead. Della run 16371839, candidate712d13f0bversus historical baseline7c403344b, passed all 24 completed public field-selection cases, but valid large cases remained 13–14% slower and bounds cases 8–9% slower. Both timings include stream completion and error draining; the candidate reports errors during the call while baseline reports them during draining.A benchmark-only fused prototype on Della run 16372118 reduced completed prepared-call latency from approximately 137 µs to 122–123 µs, a 10.4–10.8% reduction, consistently across valid inputs and first/middle/last errors. The prototype checks full output buffers, first error and attempted index. These timings include scratch, rebinding, status transfer and completion, but exclude public/backend dispatch and error-context capture.
Revision
e0eab8138375d3b78bbd30968ba2d99223e978c8also captures CUDA error context using bounded host metadata, avoiding GPU value reads and eager array formatting on successful calls. This is the same context-capture implementation used in #4481; the reduction algorithm is unchanged by this final optimization.Della run 16374446 compared this revision with baseline
7c403344b574980bbb020f98dc2a7b1bd5f80324on an NVIDIA A100. All 24 public-operation cases passed CPU-reference parity. Inputs and CPU reference results were prepared outside timing, JIT warmup was excluded, and completed timings include the public call, result construction, stream completion and deferred-error draining. Error classification and output comparisons were outside timing.Representative completed public-operation medians (baseline → candidate):
Across all 12 valid cases, completed ratios were 0.287–0.424 (2.4–3.5× faster). The large indexed→option and indexed→indexed candidate timings are effectively equal. The paired diagnostics in run 16372993 showed one simplify dispatch and one context capture for each projection, with essentially identical status-read costs; they did not identify additional option-specific kernel dispatch.
The final revision
131b98a18d38f7a0410462dbf5a3e618099cb0afalso reuses the CUDA metadata snapshot when decorating immediate exceptions. Previously the original public error context formatted array values again during unwinding. CPU exceptions without a CUDA snapshot retain value formatting; error type/message and immediate reporting are preserved.Final public-operation results
Della run 16376376, final revision
131b98a18versus the same historical baseline7c403344b, passed all 24 CPU-reference parity cases. The methodology is unchanged: unprofiled medians, JIT warmup excluded, inputs/reference preparation and comparisons outside timing, and stream completion/error draining included.All 12 valid cases improved, with completed ratios 0.293–0.429 (2.3–3.4× faster). All 12 bounds-error cases also improved, with ratios 0.274–0.407 (2.5–3.7× faster). The previous bounds-path slowdown is resolved in this measurement. Candidate bounds errors occur during the call; baseline errors occur during final draining (250/250 samples for each case).
Remaining limitations: these public-operation results do not replace the separate kernel comparison or establish that its review gate passes. GPU CI still needs independent confirmation. Instrumented diagnostic timings are not benchmark latencies or pure GPU times, and a prepared reduction call may launch multiple device kernels. Full run artifacts remain in
results/16376376/public-indexed/on Della; the benchmark harness is in ianna/awkward-matrix. Results here were transcribed from the supplied report; raw JSON/Nsight artifacts have not been uploaded to this PR.Validation
This branch is independent of #4481/#4483. They share the returned-KernelError generated-test adapter: combine the kernel-name sets when integrating. Benchmark tools live in ianna/awkward-matrix on
ianna/cuda-migration-validation.AI assistance was used to implement, review, test and document this contribution.