Skip to content

Implement a kernel dispatcher raft::launch_kernel - #3104

Merged
rapids-bot[bot] merged 7 commits into
NVIDIA:mainfrom
achirkin:fea-kernel-launch
Aug 13, 2026
Merged

Implement a kernel dispatcher raft::launch_kernel#3104
rapids-bot[bot] merged 7 commits into
NVIDIA:mainfrom
achirkin:fea-kernel-launch

Conversation

@achirkin

@achirkin achirkin commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Implement an extendable kernel dispatcher:

// run in the default stream from raft::resources handle
raft::launch_kernel(res, grid, block, my_kernel, arg0, arg1);
// same but specify non-zero dynamic shared memory
raft::launch_kernel({res, smem}, grid, block, my_kernel, arg0, arg1);
// pass the stream directly in exceptional cases when raft::resources handle is not available
raft::launch_kernel({stream, smem}, grid, block, my_kernel, arg0, arg1);

The first argument in this function is a raft::launch_on structure that is implicitly cast from raft::resources handle or rmm::cuda_stream_view or cudaStream_t. It injects std::source_location::current() to provide precise error reporting without CPP macros. Under the hood, it always dispatches the kernels using the most generic cudaLaunchKernelExC.

By modifying raft::launch_on and the dispatch logic, in future we can modify the behavior of the dispatcher without touching the call sites:

  • Dry run: guard a kernel from launching in dry run mode
  • Synchronized behavior: add one more resource to force cudaStreamSynchronize e.g. as a form of debugging without recompiling the program.
  • Pass arbitrary CUDA kernel attributes to run persistent / JIT kernels and so on.

@achirkin
achirkin requested a review from divyegala August 6, 2026 15:35
@achirkin achirkin self-assigned this Aug 6, 2026
@achirkin
achirkin requested review from a team as code owners August 6, 2026 15:35
@achirkin achirkin added the enhancement New feature or request label Aug 6, 2026
@achirkin achirkin added the non-breaking Non-breaking change label Aug 6, 2026
@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Summary by CodeRabbit

  • New Features
    • Added a unified CUDA kernel-launch utility supporting resource- and stream-based execution, shared memory, and type-checked arguments.
  • Improvements
    • Standardized GPU kernel execution across major workflows while preserving existing behavior.
    • CUDA launch failures now provide clearer source-location and error details.
  • Documentation
    • Added C++ API documentation for the kernel-launch utility.
  • Tests
    • Added coverage for streams, synchronization, shared memory, invalid configurations, and call-site reporting.
  • Chores
    • Updated copyright notices across affected components.

Walkthrough

The pull request adds a typed RAFT CUDA kernel-launch utility with source-location error reporting. It migrates production and test CUDA launches to the utility, adds launcher tests, wires the test target, and documents the API.

Changes

Kernel launch migration

Layer / File(s) Summary
Kernel launcher implementation
cpp/include/raft/util/kernel_launch.hpp, cpp/tests/util/kernel_launch.cu, cpp/tests/CMakeLists.txt, docs/source/cpp_api/utils.rst
Adds launch_on and typed raft::launch_kernel overloads. The utility supports resources, RMM streams, raw CUDA streams, shared memory, argument conversion, source-location diagnostics, and CUDA error reporting. Tests and API documentation cover the new interface.
Production kernel launch migration
cpp/include/raft/**
Replaces direct CUDA kernel launches and local launch-error checks with raft::launch_kernel across common, core, label, linear algebra, matrix, random, solver, sparse, spectral, statistics, and utility headers.
Kernel launcher tests and test migration
cpp/tests/**
Updates CUDA test kernels to use raft::launch_kernel while preserving launch dimensions, streams, arguments, synchronization, and validation paths.

Estimated code review effort: 4 (Complex) | ~60 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 1.89% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly and concisely identifies the main change: implementing the raft::launch_kernel kernel dispatcher.
Description check ✅ Passed The description explains the new dispatcher, its usage, implementation, error reporting, and planned extensibility, matching the changeset.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 9

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@cpp/include/raft/common/detail/scatter.cuh`:
- Around line 40-41: Guard every listed zero-size launch before calling
raft::launch_kernel to prevent invalid CUDA configurations: scatter.cuh
dispatch, sparse/convert/detail/dense.cuh when nrows == 0, sparse/detail/csr.cuh
when N == 0 and for batch_size == 0, both sparse/linalg/detail/add.cuh launches
when m == 0, all three sparse/linalg/detail/degree.cuh launches when nnz == 0,
svds_sign_correction.cuh when k == 0, matrix_wrappers.hpp when n == 0, and both
contingencyMatrix.cuh launches when nSamples == 0. Preserve any required
empty-output initialization and reject or otherwise explicitly handle zero batch
sizes.

In `@cpp/include/raft/sparse/solver/detail/lanczos.cuh`:
- Around line 162-165: Update the kernel launch for kernel_triangular_populate
so raft::launch_kernel receives numBlocks as the grid argument and blockSize as
the block-size argument. Preserve the existing kernel arguments and launch
configuration otherwise.

In `@cpp/include/raft/stats/detail/mutual_info_score.cuh`:
- Around line 154-161: Make synchronization an explicit opt-in in
kernel_launcher::dispatch while keeping its default asynchronous. Update the
launches in cpp/include/raft/stats/detail/mutual_info_score.cuh:154-161,
neighborhood_recall.cuh:103-110, rand_index.cuh:143-149, scores.cuh:167-172, and
silhouette_score.cuh:250-257 to retain asynchronous submission; likewise
preserve asynchronous submission for both batch kernels in
trustworthiness_score.cuh:184-197. Ensure the scores launch remains asynchronous
before queued copies.

In `@cpp/include/raft/util/cache.cuh`:
- Around line 257-266: Add an early return for n == 0 in the function containing
the get_cache_idx launch, before calling raft::launch_kernel. Match the existing
empty-input behavior in AssignCacheIdx, while preserving the current launch path
for positive n.

In `@cpp/include/raft/util/kernel_launch.hpp`:
- Around line 186-204: Add Doxygen comments for both public launch_kernel
overloads, distinguishing the resources and rmm::cuda_stream_view parameters.
Document stream ordering, the shared_mem_bytes dynamic shared-memory argument,
kernel-launch error behavior, and automatic source-location capture without
changing implementation behavior.
- Around line 151-154: Update dispatch in the kernel-launch path to validate
grid and block dimensions before calling cudaLaunchKernel, rejecting zero
blocks/threads and other invalid launch dimensions. At callers where empty input
is valid, especially the map flow producing blocks == 0, return before invoking
dispatch; preserve normal launches for positive valid dimensions.

In `@cpp/tests/core/interruptible.cu`:
- Around line 112-120: Update kernel_launcher::dispatch so debug builds perform
only nonblocking launch-error checking instead of calling cudaStreamSynchronize,
preserving asynchronous stream ordering. Keep the explicit
interruptible::synchronize calls in the test and retain synchronization behavior
only at call sites that require GPU completion.

In `@cpp/tests/linalg/gemm_layout.cu`:
- Around line 87-96: Replace default-stream launches with resource-owned
streams: in cpp/tests/linalg/gemm_layout.cu:87-96, pass handle to
raft::launch_kernel; in cpp/tests/linalg/sqrt.cu:31, pass the setup resource
stream into naiveSqrtElem and launch on it; in cpp/tests/core/span.cu:77-90,
create or pass raft::resources and use its configured stream; and in
cpp/tests/core/span.cu:189, launch TestModifyKernel on that same resource-owned
stream. Preserve asynchronous ordering and avoid raw default-stream usage.

In `@cpp/tests/util/kernel_launch.cu`:
- Around line 38-39: Update kernel_launcher::dispatch so successful launches
remain asynchronous in debug builds by replacing post-launch stream
synchronization with cudaPeekAtLastError() for launch validation. Preserve
explicit completion synchronization at call sites such as
resource::sync_stream(res), and avoid default-stream launches.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: f759c166-44b2-4491-b30d-550046691f4b

📥 Commits

Reviewing files that changed from the base of the PR and between 07652ba and ee94b00.

📒 Files selected for processing (106)
  • cpp/include/raft/common/detail/scatter.cuh
  • cpp/include/raft/core/bitset.cuh
  • cpp/include/raft/core/detail/copy.hpp
  • cpp/include/raft/label/detail/classlabels.cuh
  • cpp/include/raft/label/detail/merge_labels.cuh
  • cpp/include/raft/linalg/detail/add.cuh
  • cpp/include/raft/linalg/detail/coalesced_reduction-inl.cuh
  • cpp/include/raft/linalg/detail/map.cuh
  • cpp/include/raft/linalg/detail/map_then_reduce.cuh
  • cpp/include/raft/linalg/detail/normalize.cuh
  • cpp/include/raft/linalg/detail/reduce_cols_by_key.cuh
  • cpp/include/raft/linalg/detail/reduce_rows_by_key.cuh
  • cpp/include/raft/linalg/detail/strided_reduction.cuh
  • cpp/include/raft/linalg/detail/subtract.cuh
  • cpp/include/raft/linalg/detail/transpose.cuh
  • cpp/include/raft/matrix/detail/columnWiseSort.cuh
  • cpp/include/raft/matrix/detail/gather.cuh
  • cpp/include/raft/matrix/detail/linewise_op.cuh
  • cpp/include/raft/matrix/detail/math.cuh
  • cpp/include/raft/matrix/detail/matrix.cuh
  • cpp/include/raft/matrix/detail/select_radix.cuh
  • cpp/include/raft/matrix/detail/select_warpsort.cuh
  • cpp/include/raft/matrix/detail/shift.cuh
  • cpp/include/raft/random/detail/make_blobs.cuh
  • cpp/include/raft/random/detail/make_regression.cuh
  • cpp/include/raft/random/detail/multi_variable_gaussian.cuh
  • cpp/include/raft/random/detail/permute.cuh
  • cpp/include/raft/random/detail/rmat_rectangular_generator.cuh
  • cpp/include/raft/random/detail/rng_impl.cuh
  • cpp/include/raft/random/detail/rng_impl_deprecated.cuh
  • cpp/include/raft/solver/detail/lap_functions.cuh
  • cpp/include/raft/sparse/convert/detail/adj_to_csr.cuh
  • cpp/include/raft/sparse/convert/detail/bitmap_to_csr.cuh
  • cpp/include/raft/sparse/convert/detail/bitset_to_csr.cuh
  • cpp/include/raft/sparse/convert/detail/coo.cuh
  • cpp/include/raft/sparse/convert/detail/dense.cuh
  • cpp/include/raft/sparse/detail/csr.cuh
  • cpp/include/raft/sparse/detail/utils.h
  • cpp/include/raft/sparse/linalg/detail/add.cuh
  • cpp/include/raft/sparse/linalg/detail/degree.cuh
  • cpp/include/raft/sparse/linalg/detail/laplacian.cuh
  • cpp/include/raft/sparse/linalg/detail/norm.cuh
  • cpp/include/raft/sparse/linalg/detail/symmetrize.cuh
  • cpp/include/raft/sparse/linalg/detail/utils.cuh
  • cpp/include/raft/sparse/op/detail/filter.cuh
  • cpp/include/raft/sparse/op/detail/reduce.cuh
  • cpp/include/raft/sparse/op/detail/row_op.cuh
  • cpp/include/raft/sparse/solver/detail/lanczos.cuh
  • cpp/include/raft/sparse/solver/detail/mst_solver_inl.cuh
  • cpp/include/raft/sparse/solver/detail/svds_sign_correction.cuh
  • cpp/include/raft/spectral/detail/matrix_wrappers.hpp
  • cpp/include/raft/stats/detail/batched/silhouette_score.cuh
  • cpp/include/raft/stats/detail/contingencyMatrix.cuh
  • cpp/include/raft/stats/detail/dispersion.cuh
  • cpp/include/raft/stats/detail/histogram.cuh
  • cpp/include/raft/stats/detail/meanvar.cuh
  • cpp/include/raft/stats/detail/minmax.cuh
  • cpp/include/raft/stats/detail/mutual_info_score.cuh
  • cpp/include/raft/stats/detail/neighborhood_recall.cuh
  • cpp/include/raft/stats/detail/rand_index.cuh
  • cpp/include/raft/stats/detail/scores.cuh
  • cpp/include/raft/stats/detail/silhouette_score.cuh
  • cpp/include/raft/stats/detail/trustworthiness_score.cuh
  • cpp/include/raft/util/cache.cuh
  • cpp/include/raft/util/detail/scatter.cuh
  • cpp/include/raft/util/kernel_launch.hpp
  • cpp/tests/CMakeLists.txt
  • cpp/tests/core/interruptible.cu
  • cpp/tests/core/math_device.cu
  • cpp/tests/core/operators_device.cu
  • cpp/tests/core/span.cu
  • cpp/tests/linalg/add.cuh
  • cpp/tests/linalg/axpy.cu
  • cpp/tests/linalg/binary_op.cuh
  • cpp/tests/linalg/divide.cu
  • cpp/tests/linalg/dot.cu
  • cpp/tests/linalg/eltwise.cu
  • cpp/tests/linalg/gemm_layout.cu
  • cpp/tests/linalg/gemv.cu
  • cpp/tests/linalg/map_then_reduce.cu
  • cpp/tests/linalg/matrix_vector_op.cuh
  • cpp/tests/linalg/mean_squared_error.cu
  • cpp/tests/linalg/norm.cu
  • cpp/tests/linalg/power.cu
  • cpp/tests/linalg/reduce.cuh
  • cpp/tests/linalg/reduce_rows_by_key.cu
  • cpp/tests/linalg/sqrt.cu
  • cpp/tests/linalg/subtract.cu
  • cpp/tests/linalg/unary_op.cuh
  • cpp/tests/matrix/math.cu
  • cpp/tests/random/make_blobs.cu
  • cpp/tests/random/multi_variable_gaussian.cu
  • cpp/tests/random/rmat_rectangular_generator.cu
  • cpp/tests/random/rng.cu
  • cpp/tests/random/rng_int.cu
  • cpp/tests/random/rng_pcg_host_api.cu
  • cpp/tests/sparse/convert_csr.cu
  • cpp/tests/sparse/spmm.cu
  • cpp/tests/sparse/symmetrize.cu
  • cpp/tests/stats/histogram.cu
  • cpp/tests/stats/minmax.cu
  • cpp/tests/util/bitonic_sort.cu
  • cpp/tests/util/device_atomics.cu
  • cpp/tests/util/integer_utils.cu
  • cpp/tests/util/kernel_launch.cu
  • cpp/tests/util/reduction.cu

Comment thread cpp/include/raft/common/detail/scatter.cuh Outdated
Comment thread cpp/include/raft/sparse/solver/detail/lanczos.cuh Outdated
Comment thread cpp/include/raft/stats/detail/mutual_info_score.cuh Outdated
Comment thread cpp/include/raft/util/cache.cuh Outdated
Comment thread cpp/include/raft/util/kernel_launch.hpp Outdated
Comment thread cpp/include/raft/util/kernel_launch.hpp Outdated
Comment thread cpp/tests/core/interruptible.cu Outdated
Comment thread cpp/tests/linalg/gemm_layout.cu Outdated
Comment thread cpp/tests/util/kernel_launch.cu Outdated
@achirkin achirkin added feature request New feature or request and removed enhancement New feature or request labels Aug 7, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/source/cpp_api/utils.rst`:
- Around line 23-26: Add the repository-standard RAPIDS copyright header at the
beginning of the documentation file before the “Kernel Launch” section,
preserving the existing content and formatting after the header.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: d2e3ffe6-db05-4354-9998-98cfe21f86e4

📥 Commits

Reviewing files that changed from the base of the PR and between ee94b00 and ee2e96c.

📒 Files selected for processing (2)
  • cpp/include/raft/util/kernel_launch.hpp
  • docs/source/cpp_api/utils.rst
🚧 Files skipped from review as they are similar to previous changes (1)
  • cpp/include/raft/util/kernel_launch.hpp

Comment thread docs/source/cpp_api/utils.rst
@coderabbitai coderabbitai Bot mentioned this pull request Aug 10, 2026
Comment thread cpp/include/raft/util/kernel_launch.hpp Outdated
* @param[in] location call site to blame for launch errors; leave at its default
* @return a launcher to invoke with the kernel and its arguments
*/
inline kernel_launcher launch_kernel(

@divyegala divyegala Aug 12, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While I like the idea of using a temporary to enforce that we can uniquely identify the launch of each kernel source, I am a bit unconvinced by the UX/syntax of raft::launch_kernel(config)(kernel, args).

I get what you were going for and replicating the triple chevron launcher as close as possible, it's just the dual brackets that are tripping me up.

How would you instead feel about separating config from the launch itself and emulate the cuda runtime API?

raft::kernel_config config{...};
raft::kernel_launcher(config, kernel, args);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, I have the same feeling about the current syntax. But no, replicating the triple chevron is rather accidental :)

The main goal I am trying to achieve here is to pass std::source_location location = std::source_location::current() as close as possible to the kernel call site, so that the generated file, function, and line numbers point to the correct place in the error message.
An obvious solution of passing this along the kernel parameters is not possible, because both the default argument and the parameter pack must appear at the end of the argument list. Hence we resort to various ways to pass the location via struct constructors nearby.

In the current code, I create such a struct kernel_launcher and force its operator to work on rvalue ref types only. So you cannot construct kernel_launcher in one place and then use it to run the kernel somewhere else. I could also slightly modify it to allow something like this raft::launch_kernel{...config...}(kernel, args) (curly braces instead of parens). But I opted out of it, because there's no way to enforce the users to consistently use the braces syntax over the parens syntax (so it would lead to even more confusion).

In your code snippet, the problem is that the std::source_location refers to the line where the config is declared rather than where the kernel is called. However, we can restrict that too, and also enhance it further relying on implicit conversion. I'll update the code in the next commit, so we can compare the two approaches

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this approach a lot!

rapids-bot Bot pushed a commit that referenced this pull request Aug 12, 2026
Fix accidentally swapped block size and grid size arguments.

#3104 (comment)

Authors:
  - Artem M. Chirkin (https://github.com/achirkin)

Approvers:
  - Divye Gala (https://github.com/divyegala)
  - Anupam (https://github.com/aamijar)

URL: #3109

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@cpp/tests/util/kernel_launch.cu`:
- Around line 55-66: Extend the launchability tests near launchable_as_named
with a kernel accepting const int* and invoke it using an int* argument through
the converting launch path. Validate the kernel’s output so the test covers both
kernel-argument conversion and successful execution, using the existing launch
and assertion utilities.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: fc044910-642e-4b29-9d9a-49ade9ad84dc

📥 Commits

Reviewing files that changed from the base of the PR and between c982ae9 and 811adad.

📒 Files selected for processing (105)
  • cpp/include/raft/common/detail/scatter.cuh
  • cpp/include/raft/core/bitset.cuh
  • cpp/include/raft/core/detail/copy.hpp
  • cpp/include/raft/label/detail/classlabels.cuh
  • cpp/include/raft/label/detail/merge_labels.cuh
  • cpp/include/raft/linalg/detail/add.cuh
  • cpp/include/raft/linalg/detail/coalesced_reduction-inl.cuh
  • cpp/include/raft/linalg/detail/map.cuh
  • cpp/include/raft/linalg/detail/map_then_reduce.cuh
  • cpp/include/raft/linalg/detail/normalize.cuh
  • cpp/include/raft/linalg/detail/reduce_cols_by_key.cuh
  • cpp/include/raft/linalg/detail/reduce_rows_by_key.cuh
  • cpp/include/raft/linalg/detail/strided_reduction.cuh
  • cpp/include/raft/linalg/detail/subtract.cuh
  • cpp/include/raft/linalg/detail/transpose.cuh
  • cpp/include/raft/matrix/detail/columnWiseSort.cuh
  • cpp/include/raft/matrix/detail/gather.cuh
  • cpp/include/raft/matrix/detail/linewise_op.cuh
  • cpp/include/raft/matrix/detail/math.cuh
  • cpp/include/raft/matrix/detail/matrix.cuh
  • cpp/include/raft/matrix/detail/select_radix.cuh
  • cpp/include/raft/matrix/detail/select_warpsort.cuh
  • cpp/include/raft/matrix/detail/shift.cuh
  • cpp/include/raft/random/detail/make_blobs.cuh
  • cpp/include/raft/random/detail/make_regression.cuh
  • cpp/include/raft/random/detail/multi_variable_gaussian.cuh
  • cpp/include/raft/random/detail/permute.cuh
  • cpp/include/raft/random/detail/rmat_rectangular_generator.cuh
  • cpp/include/raft/random/detail/rng_impl.cuh
  • cpp/include/raft/random/detail/rng_impl_deprecated.cuh
  • cpp/include/raft/solver/detail/lap_functions.cuh
  • cpp/include/raft/sparse/convert/detail/adj_to_csr.cuh
  • cpp/include/raft/sparse/convert/detail/bitmap_to_csr.cuh
  • cpp/include/raft/sparse/convert/detail/bitset_to_csr.cuh
  • cpp/include/raft/sparse/convert/detail/coo.cuh
  • cpp/include/raft/sparse/convert/detail/dense.cuh
  • cpp/include/raft/sparse/detail/csr.cuh
  • cpp/include/raft/sparse/detail/utils.h
  • cpp/include/raft/sparse/linalg/detail/add.cuh
  • cpp/include/raft/sparse/linalg/detail/degree.cuh
  • cpp/include/raft/sparse/linalg/detail/laplacian.cuh
  • cpp/include/raft/sparse/linalg/detail/norm.cuh
  • cpp/include/raft/sparse/linalg/detail/symmetrize.cuh
  • cpp/include/raft/sparse/linalg/detail/utils.cuh
  • cpp/include/raft/sparse/op/detail/filter.cuh
  • cpp/include/raft/sparse/op/detail/reduce.cuh
  • cpp/include/raft/sparse/op/detail/row_op.cuh
  • cpp/include/raft/sparse/solver/detail/lanczos.cuh
  • cpp/include/raft/sparse/solver/detail/mst_solver_inl.cuh
  • cpp/include/raft/sparse/solver/detail/svds_sign_correction.cuh
  • cpp/include/raft/spectral/detail/matrix_wrappers.hpp
  • cpp/include/raft/stats/detail/batched/silhouette_score.cuh
  • cpp/include/raft/stats/detail/contingencyMatrix.cuh
  • cpp/include/raft/stats/detail/dispersion.cuh
  • cpp/include/raft/stats/detail/histogram.cuh
  • cpp/include/raft/stats/detail/meanvar.cuh
  • cpp/include/raft/stats/detail/minmax.cuh
  • cpp/include/raft/stats/detail/mutual_info_score.cuh
  • cpp/include/raft/stats/detail/neighborhood_recall.cuh
  • cpp/include/raft/stats/detail/rand_index.cuh
  • cpp/include/raft/stats/detail/scores.cuh
  • cpp/include/raft/stats/detail/silhouette_score.cuh
  • cpp/include/raft/stats/detail/trustworthiness_score.cuh
  • cpp/include/raft/util/cache.cuh
  • cpp/include/raft/util/detail/scatter.cuh
  • cpp/include/raft/util/kernel_launch.hpp
  • cpp/tests/core/interruptible.cu
  • cpp/tests/core/math_device.cu
  • cpp/tests/core/operators_device.cu
  • cpp/tests/core/span.cu
  • cpp/tests/linalg/add.cuh
  • cpp/tests/linalg/axpy.cu
  • cpp/tests/linalg/binary_op.cuh
  • cpp/tests/linalg/divide.cu
  • cpp/tests/linalg/dot.cu
  • cpp/tests/linalg/eltwise.cu
  • cpp/tests/linalg/gemm_layout.cu
  • cpp/tests/linalg/gemv.cu
  • cpp/tests/linalg/map_then_reduce.cu
  • cpp/tests/linalg/matrix_vector_op.cuh
  • cpp/tests/linalg/mean_squared_error.cu
  • cpp/tests/linalg/norm.cu
  • cpp/tests/linalg/power.cu
  • cpp/tests/linalg/reduce.cuh
  • cpp/tests/linalg/reduce_rows_by_key.cu
  • cpp/tests/linalg/sqrt.cu
  • cpp/tests/linalg/subtract.cu
  • cpp/tests/linalg/unary_op.cuh
  • cpp/tests/matrix/math.cu
  • cpp/tests/random/make_blobs.cu
  • cpp/tests/random/multi_variable_gaussian.cu
  • cpp/tests/random/rmat_rectangular_generator.cu
  • cpp/tests/random/rng.cu
  • cpp/tests/random/rng_int.cu
  • cpp/tests/random/rng_pcg_host_api.cu
  • cpp/tests/sparse/convert_csr.cu
  • cpp/tests/sparse/spmm.cu
  • cpp/tests/sparse/symmetrize.cu
  • cpp/tests/stats/histogram.cu
  • cpp/tests/stats/minmax.cu
  • cpp/tests/util/bitonic_sort.cu
  • cpp/tests/util/device_atomics.cu
  • cpp/tests/util/integer_utils.cu
  • cpp/tests/util/kernel_launch.cu
  • cpp/tests/util/reduction.cu
🚧 Files skipped from review as they are similar to previous changes (102)
  • cpp/tests/linalg/norm.cu
  • cpp/include/raft/stats/detail/silhouette_score.cuh
  • cpp/include/raft/stats/detail/rand_index.cuh
  • cpp/tests/core/operators_device.cu
  • cpp/include/raft/stats/detail/neighborhood_recall.cuh
  • cpp/include/raft/stats/detail/mutual_info_score.cuh
  • cpp/tests/core/math_device.cu
  • cpp/include/raft/sparse/detail/utils.h
  • cpp/tests/linalg/mean_squared_error.cu
  • cpp/tests/linalg/unary_op.cuh
  • cpp/include/raft/sparse/convert/detail/coo.cuh
  • cpp/tests/util/reduction.cu
  • cpp/tests/core/interruptible.cu
  • cpp/include/raft/label/detail/classlabels.cuh
  • cpp/include/raft/random/detail/rng_impl_deprecated.cuh
  • cpp/include/raft/linalg/detail/map_then_reduce.cuh
  • cpp/tests/sparse/convert_csr.cu
  • cpp/include/raft/util/detail/scatter.cuh
  • cpp/tests/linalg/map_then_reduce.cu
  • cpp/include/raft/linalg/detail/strided_reduction.cuh
  • cpp/include/raft/sparse/convert/detail/bitset_to_csr.cuh
  • cpp/include/raft/linalg/detail/transpose.cuh
  • cpp/include/raft/matrix/detail/gather.cuh
  • cpp/tests/util/integer_utils.cu
  • cpp/tests/linalg/subtract.cu
  • cpp/include/raft/linalg/detail/normalize.cuh
  • cpp/tests/linalg/gemm_layout.cu
  • cpp/tests/util/bitonic_sort.cu
  • cpp/include/raft/random/detail/rng_impl.cuh
  • cpp/tests/linalg/axpy.cu
  • cpp/include/raft/core/detail/copy.hpp
  • cpp/include/raft/random/detail/rmat_rectangular_generator.cuh
  • cpp/include/raft/stats/detail/trustworthiness_score.cuh
  • cpp/include/raft/matrix/detail/select_radix.cuh
  • cpp/include/raft/linalg/detail/reduce_cols_by_key.cuh
  • cpp/include/raft/spectral/detail/matrix_wrappers.hpp
  • cpp/tests/random/multi_variable_gaussian.cu
  • cpp/include/raft/random/detail/make_blobs.cuh
  • cpp/tests/linalg/matrix_vector_op.cuh
  • cpp/include/raft/matrix/detail/matrix.cuh
  • cpp/include/raft/stats/detail/contingencyMatrix.cuh
  • cpp/tests/random/rng.cu
  • cpp/tests/random/make_blobs.cu
  • cpp/include/raft/common/detail/scatter.cuh
  • cpp/tests/sparse/spmm.cu
  • cpp/include/raft/linalg/detail/coalesced_reduction-inl.cuh
  • cpp/tests/core/span.cu
  • cpp/tests/linalg/binary_op.cuh
  • cpp/include/raft/sparse/linalg/detail/add.cuh
  • cpp/include/raft/linalg/detail/map.cuh
  • cpp/include/raft/sparse/convert/detail/bitmap_to_csr.cuh
  • cpp/include/raft/linalg/detail/add.cuh
  • cpp/include/raft/stats/detail/batched/silhouette_score.cuh
  • cpp/tests/stats/minmax.cu
  • cpp/include/raft/matrix/detail/math.cuh
  • cpp/include/raft/sparse/linalg/detail/norm.cuh
  • cpp/tests/linalg/dot.cu
  • cpp/tests/sparse/symmetrize.cu
  • cpp/tests/linalg/add.cuh
  • cpp/include/raft/stats/detail/histogram.cuh
  • cpp/tests/stats/histogram.cu
  • cpp/include/raft/random/detail/multi_variable_gaussian.cuh
  • cpp/include/raft/sparse/op/detail/reduce.cuh
  • cpp/include/raft/linalg/detail/subtract.cuh
  • cpp/include/raft/sparse/solver/detail/lanczos.cuh
  • cpp/tests/linalg/power.cu
  • cpp/tests/linalg/gemv.cu
  • cpp/tests/linalg/divide.cu
  • cpp/include/raft/sparse/solver/detail/mst_solver_inl.cuh
  • cpp/tests/random/rng_pcg_host_api.cu
  • cpp/include/raft/linalg/detail/reduce_rows_by_key.cuh
  • cpp/include/raft/sparse/linalg/detail/laplacian.cuh
  • cpp/include/raft/random/detail/permute.cuh
  • cpp/include/raft/sparse/convert/detail/dense.cuh
  • cpp/include/raft/matrix/detail/shift.cuh
  • cpp/include/raft/matrix/detail/linewise_op.cuh
  • cpp/include/raft/core/bitset.cuh
  • cpp/include/raft/sparse/solver/detail/svds_sign_correction.cuh
  • cpp/tests/linalg/eltwise.cu
  • cpp/include/raft/label/detail/merge_labels.cuh
  • cpp/tests/util/device_atomics.cu
  • cpp/include/raft/sparse/linalg/detail/utils.cuh
  • cpp/include/raft/random/detail/make_regression.cuh
  • cpp/tests/random/rng_int.cu
  • cpp/include/raft/sparse/op/detail/filter.cuh
  • cpp/tests/linalg/reduce.cuh
  • cpp/tests/linalg/reduce_rows_by_key.cu
  • cpp/include/raft/sparse/linalg/detail/degree.cuh
  • cpp/include/raft/sparse/detail/csr.cuh
  • cpp/tests/random/rmat_rectangular_generator.cu
  • cpp/include/raft/stats/detail/minmax.cuh
  • cpp/include/raft/sparse/linalg/detail/symmetrize.cuh
  • cpp/include/raft/stats/detail/dispersion.cuh
  • cpp/include/raft/sparse/convert/detail/adj_to_csr.cuh
  • cpp/tests/matrix/math.cu
  • cpp/include/raft/stats/detail/scores.cuh
  • cpp/include/raft/util/cache.cuh
  • cpp/include/raft/stats/detail/meanvar.cuh
  • cpp/include/raft/solver/detail/lap_functions.cuh
  • cpp/include/raft/sparse/op/detail/row_op.cuh
  • cpp/tests/linalg/sqrt.cu
  • cpp/include/raft/matrix/detail/columnWiseSort.cuh

Comment on lines +55 to +66
// Only a prvalue built inside the launch expression may be launched, so that the reported location
// is always the one of the launch. Everything else must fail to compile.
static_assert(launchable_as_named<raft::resources&>,
"resources must convert to a launch_on prvalue");
static_assert(launchable_as_named<rmm::cuda_stream_view>,
"a stream view must convert to a launch_on prvalue");
static_assert(launchable_as_named<cudaStream_t>,
"a raw stream handle must convert to a launch_on prvalue");
static_assert(!launchable_as_named<raft::launch_on>, "a stored launch_on must not be launchable");
static_assert(!launchable_as_named<raft::launch_on&>, "an lvalue launch_on must not be launchable");
static_assert(!launchable_when_moved<raft::launch_on>,
"a moved-from launch_on must not be launchable");

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Add kernel-argument conversion coverage.

The tests cover conversion to launch_on, but they do not cover conversion from a launch argument to a kernel parameter. Add a kernel that accepts const int*, launch it with int*, and validate its output. This exercises the converting overload.

As per path instructions, “tests should validate launchability/type conversion.”

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@cpp/tests/util/kernel_launch.cu` around lines 55 - 66, Extend the
launchability tests near launchable_as_named with a kernel accepting const int*
and invoke it using an int* argument through the converting launch path.
Validate the kernel’s output so the test covers both kernel-argument conversion
and successful execution, using the existing launch and assertion utilities.

Source: Path instructions

@divyegala divyegala left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, PR looks great!

@achirkin

Copy link
Copy Markdown
Contributor Author

/merge

@rapids-bot
rapids-bot Bot merged commit f633a16 into NVIDIA:main Aug 13, 2026
81 checks passed
alexfallin added a commit to alexfallin/raft_mst_imp that referenced this pull request Aug 15, 2026
Upstream refactored the previous MST solver's kernel launches in
mst_solver_inl.cuh; that file is rewritten on this branch, so the
branch version is kept. SPDX headers updated to the new style.
alexfallin added a commit to alexfallin/raft_mst_imp that referenced this pull request Aug 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature request New feature or request non-breaking Non-breaking change

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

3 participants