Add sparse COO weight upload for GPU CTRNN/IZNN eval#294
Open
pax7 wants to merge 1 commit into
Open
Conversation
NEAT nets are sparse, so the dense W [N,M,M] tensor uploaded per generation is mostly zeros. Add an opt-in sparse path (sparse_upload=False by default) that transfers a COO edge list (genome_idx, dst, src, weight) instead and scatters it into a device-side dense W via a RawKernel, isolating the transfer win from the existing matmul integration loop. - _padding.py: packers emit edge_index [E,3]/edge_weight [E] with W=None when sparse_upload=True; add num_genomes so backends no longer read W.shape. - _cupy_backend.py: scatter_edges kernel + _upload_W() (dense copy or zero-alloc + GPU scatter, 64-bit W offset for large N*M*M). - evaluator.py: both evaluators accept and forward sparse_upload. - tests: sparse packing scatters to the exact dense W; GPU sparse trajectories and fitness are bit-identical to dense (CTRNN, IZNN, evaluator). - benchmark: report W H2D bytes + dense/sparse timing; add 32-hidden CTRNN run. Transfer cut tracks density: ~1x at M=6, 3.2x at M=35. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
There was a problem hiding this comment.
Your trial has ended. Reactivate Greptile to resume code reviews.
|
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.



NEAT nets are sparse, so the dense W [N,M,M] tensor uploaded per generation is mostly zeros. Add an opt-in sparse path (sparse_upload=False by default) that transfers a COO edge list (genome_idx, dst, src, weight) instead and scatters it into a device-side dense W via a RawKernel, isolating the transfer win from the existing matmul integration loop.
Transfer cut tracks density: ~1x at M=6, 3.2x at M=35.