perf: use SIMD-accelerated tcog_window_fast in refined centroiding path - #81
Merged
Conversation
purvanshjoshi
commented
Jul 8, 2026
Contributor
- rippa_compute_centroids_refined was using scalar minmax + tcog_window
- Replace with tcog_window_fast() which dispatches to AVX2 at runtime
- Main TCoG loop already AVX2-vectorized via PR perf: add AVX2-accelerated TCoG centroiding with runtime dispatch (#49) #76
- This completes TCoG SIMD coverage: both fast and refined paths now use SIMD
Closes #22 - Uncomment test_cuda in CMakeLists.txt (mark .c source as CUDA language so nvcc compiles it). The test requires a GPU to actually run but compiles on any runner with the CUDA toolkit installed. - test_cuda.c: gracefully skip if no GPU available (rippra_cuda_centroid_init fails), prints SKIP and returns 0 instead of erroring. - Add synthetic data generation and ctest run to CUDA CI job with continue-on-error: true — compiles on every push, runs only on GPU runners. - CUDA README badge already exists.
changed to ../cuda/rippra_cuda.h
nvcc treats .c files as C++ where goto cannot bypass variable initialization. Moved all declarations to the top of main() and removed the skip: label in favor of a skip flag.
- nvcc treats .c files as C++: goto cannot bypass variable initialization - GPU section wrapped in a block so cleanup: label is within the same scope - Skip path (no GPU) does early return instead of goto, avoiding crossing GPU allocs - max_diff_W/max_diff_c moved to common scope within the GPU block
- nvcc (C++ mode) rejects goto bypassing for-loop variable declarations - Split cleanup into 'cleanup' (non-GPU) and 'gpu_cleanup' (GPU) - GPU skip path does direct return (no goto over GPU allocs) - All loop variables declared at function scope, not in for-loop init - gpu_cleanup label placed before any for-loop blocks
- rippra_cuda.h was missing declarations for dm_init, dm_free, and full_pipeline - nvcc linker error when compiling test_cuda.c
- centroid_kernels.cu, dm_kernels.cu, matrix_kernels.cu were not part of any library target - test_cuda (and any CUDA code) got linker errors because these .cu implementations were missing - Also removed unused 'ok' variable from test_cuda.c to silence nvcc warning
… ci/cuda-build-test-22
- rippa_compute_centroids_refined was using scalar minmax + tcog_window - Replace with tcog_window_fast() which dispatches to AVX2 at runtime - Already-vectorized main centroiding path (PR #76) plus refined path complete the TCoG SIMD coverage
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.