Skip to content

Instantly share code, notes, and snippets.

View nihalpasham's full-sized avatar
🦂
regionaltantrums!

nihalpasham

🦂
regionaltantrums!
View GitHub Profile
@nihalpasham
nihalpasham / stable-mir.md
Last active October 8, 2025 13:58
stable-mir's goal is to provide a stable interface to the Rust compiler, enabling tool developers to perform advanced analyses with lower maintenance costs, without slowing compiler development.
@nihalpasham
nihalpasham / stable-mir-compile-errors.md
Created September 30, 2025 13:14
stable-mir-compile-errors
./x build
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.07s
$ cargo +nightly-aarch64-apple-darwin build --manifest-path /Users/nihalpasham/devspace/rust/compiler/rustc_public/rustc_public/Cargo.toml --all-targets
   Compiling rustc_public v0.1.0-preview (/Users/nihalpasham/devspace/rust/compiler/rustc_public/rustc_public)
error[E0412]: cannot find type `DynKind` in module `rustc_ty`
   --> rustc_public/src/unstable/convert/internal.rs:464:30
    |
464 |     type T<'tcx> = rustc_ty::DynKind;
    |                              ^^^^^^^
@nihalpasham
nihalpasham / gpgpu_programming.md
Created September 20, 2025 12:39
Making GP-GPU programming generally accessible

GP-GPU Programming Ramblings

#nvidia #cuda #gpu #arch #metal #rocm #triton

image
  • Tensor Cores and Tensor Memory Accelerator
  • Split Barriers (Ampere and above)
  • Thread Block Cluster (Hopper and above)
  • Producer-Consumer Queues
@nihalpasham
nihalpasham / WebGPU+WGML.md
Created September 10, 2025 02:07
The only true cross-platform GPGPU API —WebGPU (with WGML 🦀)

True cross-platform GPU compute —WebGPU + WGML

image 2 basic-webgpu-stack ![](image.png) image

WebGPU vs WebGL

@nihalpasham
nihalpasham / luminal_dl_framework.md
Created August 24, 2025 06:15
Luminal - a deep learning framework in Rust.
image

High-level overview focusing on graph structure, search-based compilation, and visualization:

Luminal Architecture Overview

1. Core Graph Structure

Luminal is built around a directed acyclic graph (DAG) representation where:

@nihalpasham
nihalpasham / crane lift_gist.md
Last active August 16, 2025 12:51
The Cranelift backend (stream notes)

Cranelift

#idempotent

sketch

Cranelift IR:

  • Functions are compiled individually
  • The instructions in the function body use and produce values in SSA form i.e. Single Static Assignment
@nihalpasham
nihalpasham / nova_gpu_driver.md
Last active October 31, 2025 19:24
Implementation specifics of the rust-based Nova Gpu driver, in the linux kernel.

Nova GPU driver

Nova Driver Architecture Overview

The Nova driver is a two-tier GPU driver architecture written in Rust for NVIDIA GPUs. It consists of two main components that work together:

1. Nova-Core (drivers/gpu/nova-core/)

This is the low-level hardware abstraction layer that directly interfaces with the GPU hardware.

Entry Point:

@nihalpasham
nihalpasham / .md
Last active July 20, 2025 09:52
How does automatic kernel fusion work in burn?

How does automatic kernel fusion work in burn?

Screenshot 2025-07-07 at 10 50 37 AM

Burn’s Tensor Abstraction:

  1. Generic Parameters Tensor<B, D, K> :
    • B: Backend - execution backend (composable)
    • D: usize - dimensionality (compile-time constant)
@nihalpasham
nihalpasham / rust_to_spirv.md
Last active June 15, 2025 10:51
🦀 Mapping Rust Shaders to SPIR-V (via rust-gpu): This Gist demonstrates how a simple Rust fragment shader is compiled into SPIR-V using rust-gpu. It includes the original Rust code, the corresponding SPIR-V output, and a concise mapping between the two. It also outlines how the rustc_codegen_spirv backend translates MIR to SPIR-V and how SPIR-T …

Mapping Rust Shader to SPIR-V

#[spirv(fragment)]				
pub fn main_fs(output: &mut Vec4) {
 *output = vec4(1.0, 0.0, 0.0, 1.0);
}
@nihalpasham
nihalpasham / .md
Last active May 24, 2025 10:35
rust-gpu

rust-gpu

What is it?

  • is a custom backend for rustc that compiles native rust code (albeit a sub-set of it) to spir-v
    • MIR -> SPIR-V: to be precise, it takes in rust’s MIR and converts it to SPIR-V

rustc front-end IR(s):

Stuff that happens at each stage in the front-end

  • AST: macro-expansion, name resolution
  • HIR (High-level IR): type-checking, type-inference and trait solving