# stinkytofu-opt `stinkytofu-opt` is a command-line tool for parsing, analyzing, and optimizing StinkyTofu IR (Intermediate Representation). --- ## Table of Contents - [Build](#build) - [Quick Start](#quick-start) - [User Guide](#user-guide) - [Basic Usage](#basic-usage) - [Available Passes](#available-passes) - [Examples](#examples) - [Developer Guide](#developer-guide) - [Architecture Overview](#architecture-overview) - [Configuration Components](#configuration-components) - [IR Format](#ir-format) --- ## Build Then, navigate to the `rocm-libraries/shared/stinkytofu` directory: ```bash cmake -B build . cmake --build build --target stinkytofu-opt -j ``` The binary will be located at: `build/tools/stinkytofu-opt/stinkytofu-opt` --- ## Quick Start ```bash # List all available passes ./build/tools/stinkytofu-opt/stinkytofu-opt --list-passes # Parse and deserialize IR (no optimization) ./build/tools/stinkytofu-opt/stinkytofu-opt --arch gfx1250 func.arch-gfx1250.stir # Apply optimization passes ./build/tools/stinkytofu-opt/stinkytofu-opt \ --arch gfx1250 func.arch-gfx1250.stir \ --StinkyDAGSchedulerPass ``` --- ## User Guide ### Basic Usage ```bash stinkytofu-opt [options] [--pass1] [--pass2] ... ``` **Arguments:** - ``: Path to the StinkyTofu IR file to process - `--passN`: Optional pass names to apply (use `--` prefix) **Options:** - `--arch `: Target GPU architecture (default: gfx1250). Supported: `gfx1250` - `--remarks`: Enable optimization remarks on stderr (e.g. loop region diagnostics) - `--list-passes`: Display all available optimization passes - `--help`: Show usage information **Output flags:** - `--print-output`: Emit optimized IR (StinkyTofu text format) - `--emit-asm`: Emit optimized GPU assembly (always on for `.s` input) - `-o `: Write output to file instead of stdout **Region selection (asm input only):** - `--from-label