Module Tolk_uop.Render

Tinygrad-shaped UOp graph rendering.

This module mirrors tinygrad's tinygrad/uop/render.py organization for stable graph listings. The output is intended for debugging and golden tests, not for parsing.

val uops_list_to_string : Uop.t list -> string

uops_list_to_string uops is a tinygrad-shaped debug listing of uops in the supplied order. Rows contain the row index, operation, live range column, dtype, sources, and payload. Sources that refer to constants in uops are printed as quoted constant values; other sources in uops are printed as row indexes. The output is deterministic and intended for golden tests. Side Uop.metadata is not printed.

val pp_uops : Stdlib.Format.formatter -> Uop.t list -> unit

pp_uops ppf uops formats uops_list_to_string uops on ppf.

val uops_to_string : ?label:string -> Uop.t -> string

uops_to_string ?label root is uops_list_to_string over Uop.toposort root. When supplied, label is printed as a "=== label ===" header before the rows.

val expr_to_string : ?simplify:bool -> Uop.t -> string

expr_to_string ?simplify u is a compact one-line rendering of the scalar expression u: named parameters print as their name, constants as their value, and arithmetic with the usual infix operators (redundant parentheses stripped by precedence). Used for kernel names and debug shape displays. simplify (default true) canonicalises u first.