import { type Buffer } from '../device.ts'; import { DefaultMap, type Metadata } from '../helpers/helpers.ts'; import { type UPatInput } from '../ops.ts'; import { PatternMatcher, UOp, UPat, type Variable } from '../ops.ts'; import { ShapeTracker } from '../shape/shapetracker.ts'; export declare const tensor_uop_spec: PatternMatcher; export declare class ScheduleItem { ast: UOp; bufs: Buffer[]; metadata: Metadata[]; constructor(ast: UOp, bufs: Buffer[], metadata: Metadata[]); /** * Read/write || write only buffers in the schedule. */ get outputs(): Buffer[]; /** * Read only buffers in the schedule. */ get inputs(): Buffer[]; output_idxs: () => number[]; toString: () => string; } export declare class ScheduleContext { tensor_uops: Map; var_vals: Map; assigns: Set; realizes: Map; allbufs: Map; ops_metadata: Map; contiguous: Map; children: DefaultMap>; preloads: DefaultMap, Map>; becomes_map: Map; constructor(tensor_uops?: Map, // this maps BUFFER uops of this schedule to the underlying lazybuffer var_vals?: Map, // this maps a BIND's DEFINE_VAR to its value assigns?: Set, // this holds all the BUFFER uops we ASSIGN to in this schedule realizes?: Map, // this holds all the BUFFER uops we mutate in this schedule allbufs?: Map, // this maps BUFFER uops the actual op ops_metadata?: Map, // this maps fused ops to Metadata contiguous?: Map, // this maps roots to places they are made contiguous children?: DefaultMap>, preloads?: DefaultMap, Map>, becomes_map?: Map); } export declare const apply_swizzle: (u: UOp) => UOp; export declare const view_right: PatternMatcher; export declare class ScheduleItemContext { var_vals: Map; sts: Set; bufs: UOp[]; constructor(var_vals?: Map, sts?: Set, bufs?: UOp[]); } export declare const _append_st_vars: (ctx: ScheduleItemContext, x: UOp) => UOp | undefined; export declare const _append_buf: (ctx: ScheduleItemContext, x: UOp) => UOp; export declare const to_si: PatternMatcher; export declare const multioutput: PatternMatcher, UOp | undefined>; export declare const PROCESS_REPLAY_CAPTURE: Map>; export declare const is_scheduled: (u: UOp) => boolean; export declare const uval: (u: UOp) => UOp; /** * recursively search the uop for groupable children, realize the UOp if a child can't group */ export declare const recursive_group: (tr: UOp, st: ShapeTracker, r: UOp, children: DefaultMap>, allbufs: Map, realizes: Map, reduce_for_op: Map, group: Map, cache: Map<[UOp, ShapeTracker], undefined>) => undefined; export declare const get_isolated_children: (r: UOp, reduce_for_op: Map, children: DefaultMap>, allbufs: Map, realizes: Map, group: Map) => Map; /** * search the big graph for all the reduceops that need to realize, sometimes group/fuse the reduceop */ export declare const group_realizes: (ctx: ScheduleContext) => UOp[][]; export declare const sym: PatternMatcher; export declare class UPatScheduled extends UPat { constructor(args?: Partial); } export declare const realize_before_view: (ctx: ScheduleContext, view: UOp, src: UOp, b: UOp) => undefined; export declare const create_subbuffer: (base: UOp, b: UOp, root: UOp, x: UOp) => UOp | undefined; export declare const do_realize: PatternMatcher; export declare const break_sched: PatternMatcher; export declare const create_ctx: PatternMatcher; export declare const remove_movement_ops: PatternMatcher; export declare const create_schedule_with_vars: (big_sink: UOp, skip_check?: boolean) => [ScheduleItem[], Map, Map];