tileprintf

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 4, 2026 License: Apache-2.0 Imports: 4 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

func Expressions(format string) (int, error)

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

func Sprintf(format string, tiles ...Tile) (string, error)

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.

func Float

func Float(v float64) Arg

Float returns the floating-point element v. An element of 32 bits or fewer is passed as the float64 that holds it, as C's varargs do.

func Int

func Int(v int64, bits uint) Arg

Int returns the integer element whose low bits bits hold the two's complement encoding of v: 1, 8, 16, 32 or 64.

type Tile

type Tile struct {
	Shape []int64
	Elems []Arg
}

A Tile is a tile to print: its shape, empty for a scalar, and its elements in row-major order.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL