Skip to content

CUDA stream: widen intintptr_t across layers and forward it in the distance launchers #4

Description

@balbasty

Confirmed by the fable review; GPU-only, so tracked rather than fixed in the correctness pass (it's a pervasive cross-layer signature change that needs a full CPU+CUDA recompile to verify, and can't be runtime-checked without a GPU).

(a) Width. Every public stream parameter is int across fastfields-lib, fastfields-cpu-lib, fastfields-cuda-lib, fastfields-cuda-impl and fastfields-bind-py/src/ext.cpp, but a cudaStream_t is a pointer (64-bit). A real stream handle passed through int truncates. Widen to intptr_t/int64_t consistently through all layers (CPU ignores it, so no CPU impact) before any GPU wheel ships.

(b) Forwarding. In fastfields-cuda-impl/distance_euclidean.h, distance_l1.h, distance_mesh.h the kernels launch with <<<..., 0>>> and use synchronous cudaMemcpy; cuda-lib/distance.cpp marks its stream param unused and the impl dt() signatures have no stream parameter at all. Thread the stream through dt() and launch on (cudaStream_t)stream with cudaMemcpyAsync, matching the posdef/resize/restrict/splinc launchers which already forward it. (Do (a) and (b) together.)

Workstream: claude-jitfields-to-fastfields

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions