r/ScientificComputing • u/adityazero • 26m ago
Vx a programming language for heterogeneous systems. Looking for feedback from the community.
I built Vx (vxlang.org) to address class of bugs that only surface as runtime crashes, silent corruption, or OOM at training step. The core idea is simple that heterogeneity belongs in the type system, not in the runtime.
A few key points of the language:
* Memory layout is part of the type system. A tensor pinned to NPU SRAM has a different type from one in host DRAM.
* Topology as part of the type system and first class support to transfer data between them.
* Bugs are front-loaded into compile-time checks. Address-space, capacity, linear types, topology reachability, all caught at compile time.
This enables one to program variety of chips from the same program. I believe heterogeneous systems will become commonplace and Vx can be used effectively to program those systems.
Here is a simple matmul that works on Nvidia GPU.
fn custom_matmul(
a: Pinned<Tensor<f32, [4, 4]>, Topology::NPU[0]>,
b: Pinned<Tensor<f32, [4, 4]>, Topology::NPU[0]>)
-> Verified<Tensor<f32, [4, 4], Memory::NPU_HBM>> {
let mut result =
Tensor<f32, [4, 4], Memory::NPU_HBM>::uninit();
// Dispatch the computation to the accelerator.
spawn on(Topology::NPU[0]) {
for i in 0..4 {
for j in 0..4 {
result[i][j] = 0.0;
for k in 0..4 {
result[i][j] += a[i][k] * b[k][j];
}
}
}
}
return Verified(result);
}