NVidia sass disassembler. See chaotic and incomplete documentation in my blog
I used gcc built-in __uint128_t type, so probably on other platforms it's better to use something like abseil Numeric
As an illustration sub-dir test contains 4 small applications:
sed-like tool for inline patching of sass instructions within cubin files. See details in my blog
Practical example - how to read SR_MACHINE_ID registers
sass disassembler - of course not a complete replica of nvdisasm (however you can have syntax compatible with nvdisasm with -c option), instead it can show
- values of all encoding fields with -O option
- scheduling tables with -S option
- predicates of instructions with -p option
- registers tracking with -T option
- LUT operations - see details in my blog
Also note that original nvdisasm can produce ambigious output
interactive sass assembler
because the instruction can have many forms (for example LDG have 14 and F2FP - 60) I add filtering for forms selection, format is (+|-)letter where letter can be
- f - floating point imm operand
- i - integer imm operand
- C - const bank
- m - memory ref operand
- d - desc ref operand
- u - uniform register
You can reset filters with '!'
You can save your instructions to binary file with -o option
parser of nvdisasm output - some details
You can run "strange loop" to consume output of nvd - for this later must use option -c
By default all 3 trying to load corresponding sm_xx.so from current directory - but you can peek those dir with env var SM_DIR