[STF] Use out parameter for partition mappers#9117
Conversation
|
/ok to test 5f33c27 |
📝 WalkthroughSummary by CodeRabbitRelease Notes
WalkthroughPartitioner and executor function signatures are refactored from return-by-value to out-parameter convention. Type definitions are updated in CudaX and C wrapper headers, partition implementations are converted, call sites are adapted, test mappers are adjusted, and documentation is synchronized across the refactoring. ChangesPartitioner ABI migration
Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
cudax/include/cuda/experimental/__places/partitions/blocked_partition.cuh (1)
105-123:⚠️ Potential issue | 🔴 Critical | ⚡ Quick wincritical:
blocked_partition_custom::get_executorcan divide by zero on Line 123 when the selected dimension extent is zero (part_sizebecomes 0). Add an early guard forgrid_dims.x == 0/part_size == 0before computingc / part_size.
🧹 Nitpick comments (2)
cudax/include/cuda/experimental/__places/localized_array.cuh (1)
362-364: ⚡ Quick winsuggestion: initialize
eplace_coordsbefore passing it tomapper(e.g.,pos4 eplace_coords(0);) so partially-written mapper outputs cannot leak uninitialized coordinates into placement decisions.cudax/include/cuda/experimental/__places/data_place_interface.cuh (1)
55-58: ⚡ Quick winsuggestion: Add explicit unstable API warning to the documentation comment. While the
cuda::experimentalnamespace indicates experimental status, the coding guidelines require that "All CUDA Experimental APIs must be documented as unstable and subject to change without notice." Consider adding a Doxygen@warningor note tag.//! Function type for computing executor placement from data coordinates. //! Uses an out-pointer convention so the signature is trivially representable //! in FFI frameworks (ctypes, cffi, Rust) that cannot return C structs. +//! `@warning` This API is experimental and subject to change without notice. using partition_fn_t = void (*)(pos4* result, pos4 data_coords, dim4 data_dims, dim4 grid_dims);As per coding guidelines: "All CUDA Experimental APIs must be documented as unstable and subject to change without notice".
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: 59d940a9-5232-4609-8a45-9d12e8f769af
📒 Files selected for processing (9)
c/experimental/stf/include/cccl/c/experimental/stf/stf.hc/experimental/stf/src/stf.cuc/experimental/stf/test/test_places.cppcudax/include/cuda/experimental/__places/data_place_interface.cuhcudax/include/cuda/experimental/__places/localized_array.cuhcudax/include/cuda/experimental/__places/partitions/blocked_partition.cuhcudax/include/cuda/experimental/__places/partitions/cyclic_shape.cuhcudax/include/cuda/experimental/__places/partitions/tiled_partition.cuhdocs/cudax/places.rst
😬 CI Workflow Results🟥 Finished in 1h 31m: Pass: 98%/59 | Total: 1d 15h | Max: 1h 31m | Hits: 5%/318213See results here. |
Summary
partition_fn_t/stf_get_executor_fnto write mapper results through an out parameter instead of returningpos4by value.stf_c_apibranch work.Test plan
pre-commit run --files c/experimental/stf/include/cccl/c/experimental/stf/stf.h c/experimental/stf/src/stf.cu c/experimental/stf/test/test_places.cpp cudax/include/cuda/experimental/__places/data_place_interface.cuh cudax/include/cuda/experimental/__places/localized_array.cuh cudax/include/cuda/experimental/__places/partitions/blocked_partition.cuh cudax/include/cuda/experimental/__places/partitions/cyclic_shape.cuh cudax/include/cuda/experimental/__places/partitions/tiled_partition.cuh docs/cudax/places.rstgit diff --check