Skip to documentation
SLOP

tiny.accy.preparation.schedule

Reference tiny.accy preparation schedule

Defined in preparation.

API (16)

Actions

Public operations.

Types and contracts

Public types and contracts.

Values and defaults

Public values and defaults.

No direct callersNo direct callspreparationschedule
Static calls · unresolved targets: unknown · external targets: unknown.

Source

Source: lib/accy/src/preparation/schedule/pass.zig:46

zig
pub const SchedulePlanAnalysis = struct {    allocator: std.mem.Allocator,    work_items: std.ArrayListUnmanaged(ScheduleWorkItem),    root_to_item: std.AutoHashMap(*ir.Operation, usize),    single_work_count: usize = 0,    fusion_work_count: usize = 0,    kernel_call_work_count: usize = 0,    scheduled_op_count: usize = 0,    total_static_elements: u64 = 0,    pub fn init(allocator: std.mem.Allocator) SchedulePlanAnalysis {        return .{            .allocator = allocator,            .work_items = .empty,            .root_to_item = std.AutoHashMap(*ir.Operation, usize).init(allocator),        };    }    pub fn deinit(self: *SchedulePlanAnalysis) void {        for (self.work_items.items) |*item| {            item.deinit(self.allocator);        }        self.work_items.deinit(self.allocator);        self.root_to_item.deinit();        self.* = undefined;    }    pub fn workItemCount(self: SchedulePlanAnalysis) usize {        return self.work_items.items.len;    }    pub fn getWorkForRoot(        self: *const SchedulePlanAnalysis,        root: *ir.Operation,    ) ?*const ScheduleWorkItem {        const index = self.root_to_item.get(root) orelse return null;        return &self.work_items.items[index];    }    fn addWorkItem(        self: *SchedulePlanAnalysis,        kind: ScheduleWorkKind,        root: *ir.Operation,        ops: []const *ir.Operation,        output_value: *ir.Value,        info: shape_analysis.TensorInfo,        shapes: *const shape_analysis.ShapeLayoutAnalysis,    ) !void {        if (ops.len == 0) return;        if (self.root_to_item.contains(root)) return;        const element_count = info.element_count orelse return;        const total_elements = try accounting.add(self.total_static_elements, element_count);        const owned_ops = try self.allocator.alloc(*ir.Operation, ops.len);        errdefer self.allocator.free(owned_ops);        @memcpy(owned_ops, ops);        const id = self.work_items.items.len;        const resources = try resourceEstimateForWork(            self.allocator,            ops,            info,            shapes,        );        try self.root_to_item.put(root, id);        errdefer _ = self.root_to_item.remove(root);        try self.work_items.append(self.allocator, .{            .id = id,            .kind = kind,            .root = root,            .ops = owned_ops,            .output_value = output_value,            .dtype = info.dtype,            .rank = info.rank(),            .element_count = element_count,            .resources = resources,        });        switch (kind) {            .elementwise_single => self.single_work_count += 1,            .elementwise_fusion => self.fusion_work_count += 1,            .shape => self.single_work_count += 1,            .dot_general => self.single_work_count += 1,            .reduction => self.single_work_count += 1,            .kernel_call => self.kernel_call_work_count += 1,            .row_pipeline => self.fusion_work_count += 1,            .iterate => self.single_work_count += 1,            .flash_attention => self.fusion_work_count += 1,            .scan => self.single_work_count += 1,        }        self.scheduled_op_count += ops.len;        self.total_static_elements = total_elements;    }};

Source: lib/accy/src/preparation/schedule/pass.zig:25

zig
pub const ScheduleWorkItem = struct {    id: usize,    kind: ScheduleWorkKind,    root: *ir.Operation,    ops: []*ir.Operation,    output_value: *ir.Value,    dtype: choir_abi.DType,    rank: usize,    element_count: u64,    resources: ScheduleResourceEstimate,    pub fn opCount(self: ScheduleWorkItem) usize {        return self.ops.len;    }    fn deinit(self: *ScheduleWorkItem, allocator: std.mem.Allocator) void {        allocator.free(self.ops);        self.* = undefined;    }};
Called byCallsNo direct callsprivate sourcelib.accy.src.preparation.schedule.passcleanupSchedulePlanAnalysispreparation.schedule.SchedulePlanAnalysisdeinit
Static calls · unresolved targets: 0 · external targets: 3.
Called byCallsNo direct callsprivate sourcelib.accy.src.preparation.schedule.passcheckScheduleStoragepreparation.schedule.SchedulePlanAnalysisgetWorkForRoot
Static calls · unresolved targets: 1 · external targets: 0.
Called byCallsNo direct callsprivate sourcelib.accy.src.preparation.schedule.passcomputeSchedulePlanAnalysispreparation.schedule.SchedulePlanAnalysisinit
Static calls · unresolved targets: 0 · external targets: 0.
Called byCallsNo direct callsprivate sourcelib.accy.src.preparation.schedule.passcheckScheduleStoragepreparation.schedule.SchedulePlanAnalysisworkItemCount
Static calls · unresolved targets: 0 · external targets: 0.

Source: lib/accy/src/preparation/schedule/pass.zig:262

zig
pub fn getSchedulePlanAnalysis(    pass_ctx: *passes.PassContext,    op: *ir.Operation,) !*SchedulePlanAnalysis {    const ptr = try pass_ctx.getAnalysis(        op,        &schedule_plan_analysis_descriptor,        computeSchedulePlanAnalysis,        cleanupSchedulePlanAnalysis,    );    return @ptrCast(@alignCast(ptr));}
Called byCallsNo direct callsprivate sourcelib.accy.src.preparation.schedule.passcheckScheduleChainprivate sourcelib.accy.src.preparation.schedule.passrunSchedulePlanningPasstest sourcelib.accy.src.preparation.schedule.passtest: schedule planning emits dot gen...test sourcelib.accy.src.preparation.schedule.passtest: schedule planning emits kernel ...test sourcelib.accy.src.preparation.schedule.passtest: schedule planning emits one wor...+11 morepreparation.schedulegetSchedulePlanAnalysis
Static calls · unresolved targets: 0 · external targets: 1.

Source: lib/accy/src/preparation/schedule/pass.zig:881

zig
pub fn kernelInputValueForOperand(    work: ScheduleWorkItem,    operand: *ir.Value,) *ir.Value {    switch (work.kind) {        .elementwise_single,        .elementwise_fusion,        .dot_general,        .reduction,        .row_pipeline,        .iterate,        .flash_attention,        => {            const def_any = operand.getDefiningOp() orelse return operand;            const def_op: *ir.Operation = @ptrCast(@alignCast(def_any));            const broadcast_name = dialect_mod.AccyDialect.BroadcastInDimOp.operation_name;            if (!std.mem.eql(u8, def_op.name.name, broadcast_name)) {                return operand;            }            const operands = def_op.getOperandValues();            if (operands.len != 1) return operand;            return operands[0];        },        else => return operand,    }}
Called byCallsNo direct callsprivate sourcelib.accy.src.preparation.schedule.passaddBroadcastWorkItemsprivate sourcelib.accy.src.preparation.schedule.passorderWorkItemsByDependenciespreparation.schedulekernelInputValueForOperand
Static calls · unresolved targets: 0 · external targets: 2.

Source: lib/accy/src/preparation/schedule/pass.zig:275

zig
pub fn schedulePlanningPass() passes.Pass {    return .{        .name = schedule_planning_pass_name,        .description = schedule_planning_pass_description,        .run_fn = runSchedulePlanningPass,        .work_contract = .{            .identity = .{ .name = schedule_planning_pass_name, .version = 1 },            .estimate = schedulePassWork,        },    };}
Called byCallsNo direct callsprivate sourcelib.accy.src.preparation.schedule.passcheckScheduleAdmissiontest sourcelib.accy.src.preparation.schedule.passtest: schedule planning pass preserve...preparation.scheduleschedulePlanningPass
Static calls · unresolved targets: 0 · external targets: 0.

Source: lib/accy/src/preparation/schedule/pass.zig:253

zig
pub const schedule_plan_analysis_descriptor = passes.AnalysisDescriptor{    .id = passes.analysisId(schedule_plan_analysis_name),    .name = schedule_plan_analysis_name,    .work_contract = .{        .identity = .{ .name = schedule_plan_analysis_name, .version = 1 },        .estimate = scheduleAnalysisWork,    },};

Source: lib/accy/src/preparation/schedule/pass.zig:16

zig
pub const schedule_plan_analysis_name = "accy-choir-schedule-plan";

Source: lib/accy/src/preparation/schedule/pass.zig:18

zig
pub const schedule_planning_pass_description =    "Plan static Accy Choir tensor work items before kernel outlining";

Source: lib/accy/src/preparation/schedule/pass.zig:23

zig
pub const ScheduleResourceEstimate = accy_choir.record.dispatch.ScheduleResourceEstimate;

Source: lib/accy/src/preparation/schedule/pass.zig:21

zig
pub const ScheduleWorkKind = accy_choir.record.dispatch.ScheduleWorkKind;

Source: lib/accy/src/preparation/root.zig:21

zig
pub const schedule = @import("schedule/root.zig");

Source: lib/accy/src/preparation/schedule/root.zig

zig
const pass = @import("pass.zig");pub const schedule_plan_analysis_name = pass.schedule_plan_analysis_name;pub const schedule_planning_pass_name = pass.schedule_planning_pass_name;pub const schedule_planning_pass_description = pass.schedule_planning_pass_description;pub const ScheduleWorkKind = pass.ScheduleWorkKind;pub const ScheduleResourceEstimate = pass.ScheduleResourceEstimate;pub const ScheduleWorkItem = pass.ScheduleWorkItem;pub const SchedulePlanAnalysis = pass.SchedulePlanAnalysis;pub const schedule_plan_analysis_descriptor = pass.schedule_plan_analysis_descriptor;pub const getSchedulePlanAnalysis = pass.getSchedulePlanAnalysis;pub const schedulePlanningPass = pass.schedulePlanningPass;pub const kernelInputValueForOperand = pass.kernelInputValueForOperand;

Complete caller list for preparation.schedule.getSchedulePlanAnalysis

16 direct callers.

Audit

Definitions16
Public names16
Members17
Version26.7.0
Revisiondaab053ee433