TinyChain-Inc / TinyChain-Inc/ha-ndarray
Introduce backend abstraction and minimal CubeCL backend
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 3
- Forks
- 2
- PR merge metrics
- No merged PRs in 30d
Description
Objective
Add a backend-neutral execution boundary and an opt-in cubecl feature, proving one representative elementwise operation on CPU and a supported accelerator without changing the public Array API or removing OpenCL.
Scope
- Define backend/device/buffer/dispatch/error traits owned by
ha-ndarray. - Add CubeCL dependency and feature selection with a documented compatibility pin.
- Implement allocation, host upload/download, device selection, and one unary and one binary elementwise kernel.
- Preserve the host and OpenCL paths during migration.
- Add capability discovery; unsupported targets must fail with a typed error, never silently change semantics.
Acceptance criteria
-
--no-default-features --features cubeclbuilds and tests on a documented CPU runtime. - A supported GPU/WebGPU target passes the same representative operation fixtures.
- Existing host/OpenCL tests remain green.
- Shape, dtype, broadcasting, and error behavior match the current API.
- Backend selection and fallback rules are documented and covered by tests.
- The PR records the CubeCL version and current supported runtime matrix.
Non-goals
Full operator parity, fusion, browser packaging, OpenCL removal, and replacement of Rayon.
Parent: #33
Tembo validation additions
Before implementation, the PR must add an architecture decision record identifying the exact CubeCL version/revision, enabled runtimes/features, supported Rust version, public HAL traits, backend-selection/fallback rules, typed capability errors, and compatibility/update policy. CubeCL is the kernel/runtime substrate; ha-ndarray owns its public HAL, execution IR, fusion legality, and observable semantics.
The validation report must distinguish CPU-runtime proof from actual accelerator proof and record CubeCL, Rust, OS, device, driver and runtime identities. The agent may not claim accelerator support based only on compilation or CPU emulation. A documented accelerator smoke run is sufficient for this architectural vertical slice; #50 subsequently makes that validation reproducible and is not a reverse prerequisite for #34.
automation:
eligible: true
executor_profile: tembo
readiness: ready
primary_repository: TinyChain-Inc/ha-ndarray
base_branch: main
writable_scope: [Cargo.toml, Cargo.lock, src/platform.rs, src/buffer.rs, src/cubecl/**, tests/**, docs/**]
prerequisites: []
concurrency_group: cubecl-hal-foundation
required_commands:
- "cargo fmt --all -- --check"
- "cargo test --no-default-features --features cubecl"
- "cargo test --all-features"
evidence:
architecture_decision: required
cpu_conformance: required
designated_accelerator_conformance: provisional-smoke-required
reproducible_accelerator_lane: "follow-up #50"
exact_environment_identity: required
external_actions: none
draft_pr_only: true
completion_authority: human-architecture-review
budget: {size: large, max_revisions: 3, max_wall_minutes: 180}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the architecture requirements and inspect Cargo.toml, Cargo.lock, src/platform.rs, src/buffer.rs, src/cubecl/, tests/, and docs/**. Run the specified fmt and feature-gated test commands to establish the baseline. Done requires the documented CubeCL decision, public HAL behavior, CPU and designated accelerator evidence, preserved host/OpenCL tests, and typed capability and fallback behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- backend-api-design, build-system, testing
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100