Home / Examples
Blyx by Example
A curated collection of runnable code patterns demonstrating static tensors, GPU kernel acceleration, and actor concurrency.
Static Neural Network Layer
AI & TensorCompile-time dimension checked matrix multiplication pass.
import std.tensor;
fn forward(w: tensor<f32, 128, 64>, x: tensor<f32, 64, 32>) -> tensor<f32, 128, 32> {
return matmul(w, x);
}Inline GPU Thread Grid Vector Scaling
GPUDirect PTX lower GPU kernel.
gpu {
let tid = thread_id();
data[tid] = data[tid] * 2.5;
}Lock-Free Ping-Pong Message Passing
Actors142M msg/sec concurrency runtime.
actor PingPong {
fn receive(msg: Message) {
match msg { Ping => send(Pong) }
}
}Fast Arguments Parser & Streaming Input
CLIZero dependency CLI utility.
import std.cli;
fn main() {
let args = cli::parse();
println("Command: {}", args.command);
}Asynchronous HTTP/3 Server
NetworkingHigh throughput web service.
import std.net.http;
fn main() {
let server = http::Server::bind("127.0.0.1:8080");
server.listen(|req| -> Response { Response::ok("Blyx Server") });
}