Skip to content

[CubeCL][P1.1] Implement runtime, device, buffer, transfer, and constructor foundation #41

Description

@code-tc

Objective

Implement the reusable CubeCL runtime foundation beneath Array: runtime/device discovery, typed buffers, allocation ownership, host↔device transfer, constructors, and typed unsupported-device/resource errors.

Scope

  • CubeCL runtime/client ownership and deterministic backend selection.
  • Buffer shape/dtype/layout metadata and allocation lifetime.
  • Host upload/download and zero/one/range-style constructors currently supported by the public API.
  • Explicit memory accounting hooks and safe cleanup.
  • Shared conformance fixtures against host behavior.

Acceptance criteria

  • CPU runtime passes constructors and host round-trip fixtures for all supported dtypes/shapes.
  • A designated accelerator passes the same fixtures without changing public Array semantics.
  • Zero-size, overflow, allocation failure, device unavailable/lost, transfer failure and drop cleanup are typed and tested.
  • Device selection never silently claims acceleration after falling back.
  • Allocation/transfer evidence exposes bytes, device identity and cleanup without leaking raw data.
  • No OpenCL code is removed.

Parent: #35

Tembo execution contract

automation:
  eligible: true
  executor_profile: tembo
  readiness: blocked
  primary_repository: TinyChain-Inc/ha-ndarray
  base_branch: main
  writable_scope:
    - src/cubecl/runtime/**
    - src/cubecl/buffer/**
    - src/cubecl/constructors/**
    - src/platform.rs
    - src/buffer.rs
    - tests/conformance/**
  prerequisites:
    - "#50 designated accelerator validation lane"
    - "#34 accepted HAL/runtime contract"
  concurrency_group: cubecl-runtime-buffer
  required_commands:
    - "cargo fmt --all -- --check"
    - "cargo test --no-default-features --features cubecl"
    - "cargo test --all-features"
  evidence:
    cpu_conformance: required
    accelerator_conformance: required-on-designated-runner
    actual_browser: not-required
    benchmark_report: not-required
    exact_hardware_and_driver_identity: required
  external_actions: none
  draft_pr_only: true
  completion_authority: human
  budget:
    size: large
    max_revisions: 3
    max_wall_minutes: 180

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