sass2mlir / Manual

Capturing & lifting kernels

Inspect a cubin on disk, or capture loaded images and launch geometry with the sassdump ABI plugin.

Input

Start with a cubin

If you already have a cubin, no interception is needed. Use a supported target and an MLIR-enabled build:

build/sass-mlir inspect kernel.cubin
build/sass-mlir lift kernel.cubin --out ir
build/sass-mlir verify kernel.cubin --threads 1

inspect lists architecture and kernel names. lift emits textual MLIR; verify checks byte identity through the encoding paths without GPU execution. A host library or application executable is not itself a cubin: extract its embedded CUDA images with the CUDA toolkit, or capture images as they load.

Runtime capture

Preload the built sassdump plugin

The sassdump diagnostic plugin records distinct loaded cubins and observed launch geometry. After building the sassdump target, run a CUDA application through the unified launcher, from the repository root:

SASSDUMP_DIR="$PWD/capture" \
  build/sass-mlir intercept \
  "$PWD/build/passes/sassdump/sass2mlir-pass-sassdump.so" \
  -- ./application

Replace ./application with your program and its arguments. The separator -- marks the start of that program’s command line. The plugin itself is the preloaded shared library; there is no separate capture executable.

The plugin writes under capture/<process>-<pid>/:

ArtifactContents
0000.cubin, 0001.cubin, …Distinct images observed by the module hooks.
run.csvSequence, kernel name, grid, block and dynamic shared-memory bytes for observed launches.

SASSDUMP_DIR enables recording. SASSDUMP_TRACE=1 also prints capture and launch messages. The smaller harvest ABI plugin records images only; it is distinct from the removed top-level harvest command.

Runtime optimization

Run MLIR passes as modules load

The same sass-mlir intercept launcher can load the kernel-rewrite plugin to optimize the application’s kernels. Select the kernel with SASS2MLIR_KERNEL and the MLIR pipeline with SASS2MLIR_PASS. Supported module loads then run through the shared rewrite core before CUDA receives the image. The runtime quickstart gives the command, library layout, fallback behavior and launch-contract checks.

Inspect

Lift one captured image

Choose an actual path from the capture directory; this example path is a placeholder:

cubin=capture/application-12345/0000.cubin
build/sass-mlir inspect "$cubin"
build/sass-mlir lift "$cubin" > captured.mlir
build/sass-mlir research analyze "$cubin" --liveness --uniformity
build/sass-mlir lower captured.mlir --out sections
build/sass-mlir verify "$cubin" --threads 1

lower writes each kernel text section as a .bin file. It does not rebuild a complete ELF image or install a replacement into the running application. Use the optimization workflow when you need a transformed cubin.

See the current docs/cli.md, diagnostics/sassdump/sassdump.cpp and CMakeLists.txt. Continue with analyses or writing a pass.