Blyx v0.1.0-alpha: AI-Native Systems Language with Rust Runtime •View on GitHub
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 & Tensor

Compile-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

GPU

Direct PTX lower GPU kernel.

gpu {
    let tid = thread_id();
    data[tid] = data[tid] * 2.5;
}

Lock-Free Ping-Pong Message Passing

Actors

142M msg/sec concurrency runtime.

actor PingPong {
    fn receive(msg: Message) {
        match msg { Ping => send(Pong) }
    }
}

Fast Arguments Parser & Streaming Input

CLI

Zero dependency CLI utility.

import std.cli;

fn main() {
    let args = cli::parse();
    println("Command: {}", args.command);
}

Asynchronous HTTP/3 Server

Networking

High 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") });
}