Skip to content

chore(examples): port nine legacy cuda_launch\! examples to #[cuda_module] - #170

Merged
nihalpasham merged 1 commit into
mainfrom
chore/port-cuda-launch-examples
Jun 11, 2026
Merged

nihalpasham merged 1 commit into
mainfrom
chore/port-cuda-launch-examples

Conversation

@nihalpasham

Copy link
Copy Markdown
Collaborator

What

Nine examples move from the legacy untyped cuda_launch\! macro to the typed #[cuda_module] path: hashmap, hashmap_v2, hashmap_v3 (both bins each), f16_stress, fmaxmin_smoke, fp_special_literal_smoke, device_global, index2d_const, math_atan.

Kernel bodies, host checks, and printed success markers are byte-identical; only the launch plumbing changes. The tenth candidate, host_closure, turned out to already use the typed path as its primary mechanism.

No typed-path gaps surfaced: every parameter shape in these examples (read-only slices, DisjointSlice with and without Index2D, scalars, raw pointers on an unsafe kernel, f16 buffers) marshals identically.

This narrows the remaining cuda_launch\! surface to: the two deliberate low-level API regression examples (manual_launch_generic, manual_launch_libdevice), the fuzzer harness, host_closure's secondary variant, and coop_groups_demo's non-cooperative calls — the prelude to demoting the macro to an explicitly unsafe niche API for runtime-loaded kernels.

Evidence

  • All nine ported examples executed on sm_120 with their original success markers.
  • Review mechanically diffed old vs new (behavior-identical), confirmed no example was force-ported around a typed-path gap.
  • fmt (edition-aware per example)/compile-only smoketest green.

…dule]

Move the kernels of hashmap, hashmap_v2, hashmap_v3, f16_stress,
fmaxmin_smoke, fp_special_literal_smoke, device_global, index2d_const,
and math_atan into #[cuda_module] modules and replace every
cuda_launch! invocation with the generated typed launch methods
(kernels::from_module(...) followed by module.<kernel>(stream, cfg,
args...)).

Kernels, checks, and printed success markers are unchanged; only the
launch plumbing differs. The hashmap_v2/v3 host drivers now take
&kernels::LoadedModule instead of &Arc<CudaModule>, and both bench
bins are ported alongside their default bins.

host_closure is intentionally left as is: it already drives the typed
path, and its remaining cuda_launch!/cuda_launch_async! calls are a
deliberate four-way launch-path parity matrix.
@nihalpasham nihalpasham added host-apis Host-side runtime APIs (cuda-host, cuda-core, cuda-async) QoL-improvement Quality-of-life improvement; not a correctness fix labels Jun 11, 2026
@nihalpasham
nihalpasham merged commit 9c6da1c into main Jun 11, 2026
24 checks passed
@nihalpasham
nihalpasham deleted the chore/port-cuda-launch-examples branch June 12, 2026 10:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

host-apis Host-side runtime APIs (cuda-host, cuda-core, cuda-async) QoL-improvement Quality-of-life improvement; not a correctness fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant