
- Generic Parameters
Tensor<B, D, K> :
B
: Backend - execution backend (composable)D
: usize - dimensionality (compile-time constant)
rustc
that compiles native rust code
(albeit a sub-set of it) to spir-v
Stuff that happens at each stage in the front-end
Rust is a relatively young, but increasingly popular, systems programming language that emphasizes safety, performance, and concurrency. Developed by Mozilla, its stable version 1.0 was released in 2015.
Here's why Rust is gaining traction, especially in areas like AI:
#mlir #llvm #compiler
Plan for Building a Backend in Cranelift
/cranelift/codegen/src/isa
, where each backend resides.TargetIsa
: Specifies the target architecture’s interface.LowerBackend
: Manages instruction lowering for the architecture.KernelDefinition { inputs: [Binding { location: Storage, visibility: Read, item: Item { elem: Float(F32), vectorization: Some(1) | |
}, size: None | |
} | |
], outputs: [Binding { location: Storage, visibility: ReadWrite, item: Item { elem: Float(F32), vectorization: Some(1) | |
}, size: None | |
} | |
], named: [("info", Binding { location: Storage, visibility: Read, item: Item { elem: UInt, vectorization: None | |
}, size: None | |
}) | |
], cube_dim: CubeDim { x: 4, y: 1, z: 1 |
// 🦀 Generated by Rust Macro Expand 🦀 | |
// 🦀 Timestamp: 16/09/2024, 12:50:30 🦀 | |
#![allow(warnings)] | |
#![feature(print_internals)] | |
#![feature(panic_internals)] | |
#![feature(prelude_import)] | |
#[prelude_import] | |
use std::prelude::rust_2021::*; | |
#[macro_use] | |
extern crate std; |
[START_KERNEL_COMPILATION] | |
name: gelu::gelu_array::GeluArray< | |
cubecl_core::frontend::element::float::F32, | |
cubecl_wgpu::runtime::WgpuRuntime, | |
> | |
cube_dim: (4, 1, 1) | |
shared_memory: 0 bytes | |
info: ( | |
KernelSettings { |