Skip to content

proposal: CubeCL-IR to #[kernel] bridge for a Burn integration (builds on #312) #313

Closed

Description

@alejandro-soto-franco

Context

Follow-up to #96 and PR #312 (the in-process library-mode compiler), as flagged in my comment on #96.

#312 gives cuda-oxide a library mode: a normal Rust app dlopens a cdylib and compiles a Rust #[kernel] crate to PTX with no cargo/rustc subprocess, byte-identical to cargo oxide build, about 2.8x faster, with recoverable compile errors, which is the delivery mechanism a runtime-JIT framework needs.

The remaining piece for a real framework integration is a front-end: something that turns a framework's kernel IR into the Rust #[kernel] (or cuda-oxide dialect) that the library-mode compiler consumes.

Proposal

Build a bridge from CubeCL IR to cuda-oxide, so that Burn (which JITs kernels at runtime via CubeCL) can compile through cuda-oxide's LLVM NVPTX pipeline instead of, or alongside, its CUDA C plus nvrtc path. End to end, this gives a pure-Rust GPU JIT. Woo!

Two candidate layers:

  1. CubeCL IR to Rust #[kernel] source, then library-mode compile to PTX. Simpler first step, reuses feat(compiler): in-process library-mode compiler (Rust kernel to PTX) #312 unchanged.
  2. CubeCL IR to cuda-oxide's Pliron dialect-mir directly, skipping the Rust source round-trip. Tighter long term.

First milestone

One elementwise op end to end: CubeCL IR to cuda-oxide to PTX, loaded and run, compared against CubeCL's stock nvrtc path on numerical parity and end-to-end JIT latency. Library mode already shows about 2.8x against cargo oxide build; the open question is the delta against nvrtc.

Notes

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