Skip to content

[CUDA] Ship CCCL in python distribution #2348

Closed

Description

@zcbenz

The CUDA backed is currently built with a fixed version of CCCL:

# Use fixed version of CCCL.
FetchContent_Declare(
cccl
URL "https://github.com/NVIDIA/cccl/releases/download/v2.8.1/cccl-v2.8.1.zip")
FetchContent_MakeAvailable(cccl)
target_include_directories(mlx BEFORE PRIVATE "${cccl_SOURCE_DIR}/include")

which makes sure the code compiles across different CUDA versions.

However for JIT kernels the code are built with the CCCL shipped by system-installed CUDA toolkit, which could be many years old and result in a few problems:

  • JIT currently does not work with CUDA 11 at all.
  • We have to provide a few wrappers in the case of an old CCCL, for example the atomic ops.
  • We can't use some CCCL features, which leads to complex workarounds like in [CUDA] Implement Scan kernel #2347.

A solution is to ship source code of CCCL as part of MLX's python distribution, and make JIT compiler search headers from it.

The size increased for distribution would not be very large:

$ du -hs build/temp.linux-x86_64-cpython-310/mlx.core/_deps/cccl-src/
17M	build/temp.linux-x86_64-cpython-310/mlx.core/_deps/cccl-src/

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

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions