aprender-gpu 0.51.0

Pure Rust PTX generation for NVIDIA CUDA - no LLVM, no nvcc
Documentation
[package]
name = "aprender-gpu"
version.workspace = true
edition = "2021"
authors = ["Pragmatic AI Labs"]
license = "MIT"
description = "Pure Rust PTX generation for NVIDIA CUDA - no LLVM, no nvcc"
repository = "https://github.com/paiml/trueno"
readme = "README.md"
keywords = ["cuda", "ptx", "gpu", "simd", "nvidia"]
categories = ["algorithms", "mathematics", "science"]

[dependencies]
# NOTE: trueno-gpu does NOT depend on trueno (would create cycle)
# ComputeBrick is available from trueno crate directly
# Users: `use trueno::brick::{ComputeBrick, ComputeBackend};`
thiserror = "2.0"
batuta-common = { workspace = true }
# Dynamic library loading for libcuda.so/nvcuda.dll
# OWN THE STACK: We write our own CUDA FFI in driver/sys.rs (~400 lines)
# Citation: RustBelt [1] proves Rust's type system safely encapsulates unsafe FFI
libloading = { version = "0.8", optional = true }
# WASM support
wasm-bindgen = { version = "0.2", optional = true }
# Sovereign Stack - visual testing (optional to avoid version conflicts)
# NOTE: trueno-viz (=aprender-viz) removed (APR-MONO self-containment): aprender-viz
# depends on trueno, so gpu→viz→trueno closed a compute→gpu→viz→compute cycle. The `viz`
# feature's unused-in-tree GPU visual-testing (gpu_renderer.rs + wasm.rs, 835 LOC) is
# dropped here; re-home as a top-level visual-test crate above both gpu and viz if needed.
# Simular for deterministic RNG and TUI monitoring (Sovereign Stack)
simular = { workspace = true, optional = true }
# NOTE: renacer (=aprender-profile) removed as a normal dep (APR-MONO self-containment):
# aprender-profile depends on trueno, so gpu→renacer→trueno would close a
# compute→gpu→profile→compute cycle. renacer was unused in gpu src; it remains a
# dev-dependency (dev-dep cycles are legal) for stress-test benches only.
# NOTE: presentar-core/-terminal removed (APR-MONO self-containment): the GPU backend
# crate must not depend on the terminal-UI layer (present-core → trueno would close a
# compute→gpu→present-core→compute cycle). No gpu src consumed them — TUI/monitoring
# lives in higher-level tools (apr-cli, cbtop), not the gpu backend.
crossterm = { version = "0.28", optional = true }
# WGPU for cross-platform WebGPU compute (Vulkan/Metal/DX12/WebGPU)
wgpu = { version = "24", optional = true }

# Apple Metal backend via manzana (macOS only)
[target.'cfg(target_os = "macos")'.dependencies]
manzana = { version = "0.2.0", optional = true }

[dev-dependencies]
proptest = "1.9"
criterion = { workspace = true }
simular = { path = "../aprender-simulate", package = "aprender-simulate" }
pollster = "0.4"
bytemuck = { version = "1.21", features = ["derive"] }

# NOTE: renacer (=aprender-profile) dev-dep removed — unused (0 references) and its
# ^0.51.0 version pin closed a crates.io publish cycle
# (aprender-compute → aprender-gpu → aprender-profile → aprender-core → aprender-compute).

[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
# GPU pixel testing with TUI visualization (Sovereign Stack)
jugar-probar = { version = "0.4.0", optional = true }

[features]
default = []
# Enable CUDA driver FFI for actual GPU execution (requires NVIDIA driver)
# Uses our own driver/sys.rs FFI layer, not external bindings
cuda = ["dep:libloading"]
# WASM visual testing
wasm = ["dep:wasm-bindgen"]
# Stress testing with randomized inputs (native only)
stress-test = ["dep:simular"]
# TUI monitoring mode for stress tests
tui-monitor = ["stress-test", "dep:crossterm"]
# GPU pixel testing with probar TUI visualization
gpu-pixels = ["dep:jugar-probar", "dep:crossterm"]
# WGPU backend for cross-platform GPU compute (WebGPU via wgpu crate)
wgpu = ["dep:wgpu"]
# Apple Metal backend via manzana (macOS only)
metal = ["dep:manzana"]

[package.metadata.wasm-pack.profile.release]
wasm-opt = false

# Inherit workspace lints
[lints.rust]
unsafe_code = "allow"


[lib]
name = "trueno_gpu"
path = "src/lib.rs"
crate-type = ["cdylib", "rlib"]

[[bench]]
name = "ptx_gen"
harness = false

# cuBLAS benchmark: cargo test -p trueno-gpu --features cuda --lib -- cublas_bench --no-capture --release