Documentation
¶
Overview ¶
Package main generates the Tile IR operation encoding table from NVIDIA's TableGen sources.
The bytecode encoding of an operation is not ad hoc: cuda-tile's BytecodeGen.cpp derives a writer for every operation from its ODS definition, emitting result types, a flags field, attributes, operands and regions in that order (tools/cuda-tile-tblgen/BytecodeGen.cpp:660-666, after the caller has written the opcode). What varies per operation is only shape: how many results, whether they are variadic, which arguments are attributes rather than operands, which of those are optional and so carry a flags bit instead of or alongside a payload, and where counts appear.
The flags field is the part a reading of the emission order misses. It is a single varint bitmask covering every optional attribute and, under AttrSizedOperandSegments, every optional operand; a UnitAttr has no payload at all and exists only as its bit. An encoder that writes attributes and operands without it produces a stream that is wrong from the first operation that has one.
This program recovers that shape from the TableGen sources and writes it as a Go table, so the encoder is derived from NVIDIA's definitions rather than transcribed from a reading of them.