sass2mlir / Manual

Installation

Build the current sass-mlir tool with the SASS dialect, existing opcode tables, and host regression tests.

Getting started

Build the tool used by this manual

The project is called sass2mlir; its command-line executable is sass-mlir. This manual describes the current development tree, whose CMake version is 0.10.0. That version string is not a public release announcement.

Dependencies

What the build needs

DependencyCurrent requirement
CMake3.17 or newer
C/C++ compilerC99 and C++20 support
pkg-config and libelf development filesRequired for ELF/cubin handling
LLVM and MLIRCMake packages, headers, mlir-tblgen, and monolithic shared libraries for the dialect build
Python 3Used by several host regression tests
CUDA toolkitnvcc for creating CUDA fixtures; nvdisasm for independent disassembly checks

CMake fetches spdlog, fmt, and tqdm-cpp; the first configure therefore needs access to their upstream repositories or an already populated dependency cache. The current CMake discovery hints point at LLVM/MLIR 22, with some library name fallbacks for 21. Use a matching LLVM/MLIR installation rather than assuming that any major version is interchangeable.

Basic inspection and host encoding checks do not execute GPU kernels. Numerical validation and performance measurements need the target NVIDIA GPU and a compatible driver/toolkit.

Build

Configure with MLIR, then compile serially

Run these commands from the supplied source root. Replace the two package paths with the paths in your LLVM/MLIR installation:

cmake -S . -B build -G "Unix Makefiles" \
  -DCMAKE_BUILD_TYPE=Release \
  -DSASS2MLIR_ENABLE_MLIR=ON \
  -DBUILD_TESTING=ON \
  -DLLVM_DIR=/path/to/llvm/lib/cmake/llvm \
  -DMLIR_DIR=/path/to/llvm/lib/cmake/mlir

make -C build -j1

The configure output must say that MLIR was found and dialect targets are enabled. SASS2MLIR_ENABLE_MLIR=ON requests discovery; missing MLIR can leave a reduced build rather than make configuration fail. In that build, lift, lower, optimize, and passes are unavailable.

Generated decoder translation units are large. The repository’s local build instructions require make -j1; use the serial command above. Existing opcode tables are build inputs. encoder-tsvs starts or resumes probing campaigns and is not part of a normal installation.

The main executable lands at build/sass-mlir, directly under the build directory. The dialect is linked into it. Runtime integration libraries are built separately under build/passes/; a new MLIR optimization does not need its own shared-library plugin.

Check

Verify the build before editing passes

build/sass-mlir --help
build/sass-mlir passes

ctest --test-dir build --output-on-failure -j1 \
  -R '^(sass-dialect-smoke|host-lift-lower|host-verify|host-cli)$'

These are existing CTest names. The MLIR-dependent tests are registered when the dialect and their prerequisites are available. Check that CTest actually finds the named tests; an empty selection is not a pass.

For a cubin you supply, run the host round-trip check separately:

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

verify checks encoding preservation; it does not launch the kernel. A successful raw-preserving round trip also does not prove that every instruction can be regenerated after a semantic edit. The quickstart explains that distinction.

Configuration

Use the current CMake names

SettingMeaning
SASS2MLIR_ENABLE_MLIR=ONRequest the upstream MLIR dialect and pass targets; default is ON
SASS2MLIR_ENABLE_MLIR=OFFKeep native inspection, scanner, ABI plugins, and PSIR verification; omit MLIR optimization
BUILD_TESTING=ONRegister the existing CTest checks; enabled by CTest by default
CMAKE_BUILD_TYPE=ReleaseSelect a release build; specify it explicitly
LLVM_DIR, MLIR_DIRLocate the matching CMake package files

The current tree has no SASS_MLIR or SASS_ACTIVE_SMS build option. Disabling MLIR does not substitute another implementation of every MLIR command. Decoder targets are generated from the architecture tables present in opcodes/.

If build/sass-mlir is missing, inspect the configure messages: without existing opcodes/SM*/opcodes.tsv files, CMake skips decoder-dependent targets. Obtain the tables with the source distribution instead of starting a local probe campaign to complete this tutorial.

Continue with the quickstart, then write a good pass.