Documentation
¶
Overview ¶
Package tileprintf formats what the Tile IR operation print_tko prints: a C printf format whose expressions each print a tile of integers or floats.
This package is outside the compatibility promise of github.com/tmc/lib/nvidia. Its API may change or be removed in patch releases.
Package tileprintf formats what the Tile IR operation print_tko prints: a C printf format whose expressions each print a tile of integers or floats.
A device prints the format once, and each expression prints its whole tile as a list: the elements, each by the expression's conversion, separated by a comma and a space inside square brackets, as in "[1, 2, 3]" for %d of a tile of three elements, and nested for a tile of more than one dimension: "[[1, 2], [3, 4]]" for two rows of two. That is what a device was observed to print for tiles of one, two and three dimensions, through the CUDA driver (API version 13050, CUDA 13.5) on an sm_121 GPU, compiling Tile IR 13.4, and through CUBINs that tileiras 13.4 and 13.5 assembled from it. A tile of rank zero is printed without brackets.
It is the reference for the CPU implementation of a print and for the Tile IR interpreter, which share it so that they cannot disagree. It has the part of printf that applies to the elements: the flags "-+ #0", a width, a precision, and the conversions d, i, u, o, x, X, c, e, E, f, F, g and G. A length modifier is read and ignored, because an element has the width of its own type. The width applies to each element. A conversion that does not fit its element is an error, where a device's output is undefined.
The import path of this package is provisional: the package may move.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Expressions ¶
Expressions returns the number of format expressions in format: each starts with a % that is not the second of a %% pair, and ends at the first character of "diuoxXeEfFgGaAcsSpn%" after it. A "%%" is an escaped percent sign, not an expression. It is the count that the vendor verifier of print_tko requires to equal the number of arguments (CudaTile.cpp:5880-5913). It returns an error for an expression that is not ended.
func Sprintf ¶
Sprintf formats tiles by the C printf format, one tile for each expression. An integer given to a float conversion, or a float to an integer one, is an error, as are a format with other than one expression for each tile, a tile with other than as many elements as its shape has, and a conversion that is not one of those in the package comment.
Types ¶
type Arg ¶
type Arg struct {
// contains filtered or unexported fields
}
An Arg is one element to format: an integer of some width, or a float. Tile IR integers have no sign, so an Int holds the bits of the element, sign-extended from its width.