Skip to documentation
SLOP

tiny.accy.kernel.program.graph

Reference tiny.accy kernel program graph

Defined in kernel.program.

API (27)

Actions

Public operations.

Types and contracts

Public types and contracts.

Values and defaults

Public values and defaults.

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

Source

Source: lib/accy/src/kernel/model/core/limits.zig:44

zig
pub const Limits = struct {    context: choir.ir.Context.Limits,    parameters: usize,    kernel_name_bytes: usize,    temporary_values: usize,    temporary_types: usize,    schedule: schedule.Schedule.Limits,    snapshot: schedule.Snapshot.Limits,    pub const standard: Limits = fromRaw(        RawLimits.standard,        schedule.Schedule.Limits.standard,        schedule.Snapshot.Limits.standard,    );    pub const testing: Limits = fromRaw(        RawLimits.testing,        schedule.Schedule.Limits.testing,        schedule.Snapshot.Limits.testing,    );    pub const borrowed_standard: Limits = fromRaw(        RawLimits.borrowed_standard,        schedule.Schedule.Limits.standard,        schedule.Snapshot.Limits.standard,    );    pub const borrowed_testing: Limits = fromRaw(        RawLimits.borrowed_testing,        schedule.Schedule.Limits.testing,        schedule.Snapshot.Limits.testing,    );    pub fn raw(self: Limits) RawLimits {        return .{            .context = self.context,            .parameters = self.parameters,            .kernel_name_bytes = self.kernel_name_bytes,            .temporary_values = self.temporary_values,            .temporary_types = self.temporary_types,        };    }    fn fromRaw(        raw_limits: RawLimits,        schedule_limits: schedule.Schedule.Limits,        snapshot_limits: schedule.Snapshot.Limits,    ) Limits {        return .{            .context = raw_limits.context,            .parameters = raw_limits.parameters,            .kernel_name_bytes = raw_limits.kernel_name_bytes,            .temporary_values = raw_limits.temporary_values,            .temporary_types = raw_limits.temporary_types,            .schedule = schedule_limits,            .snapshot = snapshot_limits,        };    }};

Source: lib/accy/src/kernel/model/program/graph/model.zig:16

zig
pub const Capacity = struct {    context_ownership: ContextOwnership,    body: builder.Builder.Capacity,    schedule: schedule_mod.Schedule.Capacity,    snapshot: schedule_mod.Snapshot.Capacity,    construction_bytes: usize,    maximum_overlap_bytes: usize,    pub const ContextOwnership = enum { owned, borrowed };    pub fn derive(limits: Limits) error{CapacityOverflow}!Capacity {        return deriveWithContextOwnership(limits, .owned);    }    pub fn deriveBorrowing(limits: Limits) error{CapacityOverflow}!Capacity {        return deriveWithContextOwnership(limits, .borrowed);    }    fn deriveWithContextOwnership(        limits: Limits,        context_ownership: ContextOwnership,    ) error{CapacityOverflow}!Capacity {        const body = try builder.Builder.Capacity.derive(limits.raw());        const schedule = try schedule_mod.Schedule.Capacity.derive(limits.schedule);        const snapshot = try schedule_mod.Snapshot.Capacity.derive(limits.snapshot);        const body_acquired_bytes = switch (context_ownership) {            .owned => body.owned_acquired_bytes,            .borrowed => body.borrowed_acquired_bytes,        };        const construction_bytes = std.math.add(            usize,            body_acquired_bytes,            schedule.storage_bytes,        ) catch return error.CapacityOverflow;        var maximum_overlap_bytes = std.math.add(            usize,            construction_bytes,            snapshot.storage_bytes,        ) catch return error.CapacityOverflow;        maximum_overlap_bytes = std.math.add(            usize,            maximum_overlap_bytes,            schedule.storage_bytes,        ) catch return error.CapacityOverflow;        return .{            .context_ownership = context_ownership,            .body = body,            .schedule = schedule,            .snapshot = snapshot,            .construction_bytes = construction_bytes,            .maximum_overlap_bytes = maximum_overlap_bytes,        };    }};

Source: lib/accy/src/kernel/model/program/graph/model.zig:76

zig
pub const Program = struct {    capacity: Capacity,    storage: Storage,    const Self = @This();    pub fn deinit(self: *Self) void {        self.storage.schedule.deinit(self.storage.kernel.allocator);        self.storage.kernel.deinit();        self.* = undefined;    }    pub fn verify(self: *Self) !void {        try self.storage.kernel.verify();    }    pub fn verifyWithDiagnostic(self: *Self, diagnostic: *builder.VerificationDiagnostic) !void {        try self.storage.kernel.verifyWithDiagnostic(diagnostic);    }    pub fn launch(self: *const Self) schedule_mod.ScheduleError!schedule_mod.Launch {        return self.storage.schedule.launch();    }    pub fn scheduleSnapshot(self: *const Self, allocator: std.mem.Allocator) schedule_mod.ScheduleError!schedule_mod.Snapshot {        return schedule_mod.createSnapshot(            allocator,            self.capacity.snapshot.asLimits(),            &self.storage.schedule,        );    }    pub fn createPlan(self: *Self, allocator: std.mem.Allocator, options: plan.Options) plan.Error!plan.Plan {        return plan.create(            allocator,            &self.storage.kernel,            &self.storage.schedule,            self.capacity.snapshot.asLimits(),            options,        );    }    pub fn kernelModule(self: *const Self) *ir.Operation {        return self.storage.kernel.module();    }    pub fn params(self: *const Self) []const builder.Param {        return self.storage.kernel.params();    }    pub fn createCheckedPlan(self: *Self, allocator: std.mem.Allocator, options: plan.Options) !plan.Plan {        var out = try self.createPlan(allocator, options);        errdefer out.deinit();        try self.checkPlan(allocator, &out);        return out;    }    pub fn checkPlan(self: *Self, allocator: std.mem.Allocator, out: *const plan.Plan) !void {        if (out.version != plan.plan_version) return error.PlanVersionMismatch;        if (out.schedule_version != schedule_mod.snapshot_version) return error.ScheduleVersionMismatch;        if (out.body_fingerprint != try self.bodyFingerprint(allocator)) return error.BodyFingerprintMismatch;        if (out.schedule_fingerprint != self.scheduleFingerprint()) return error.ScheduleFingerprintMismatch;        if (out.schedule.fingerprint() != out.schedule_fingerprint) return error.ScheduleFingerprintMismatch;        if (!builder.paramsEql(out.params, self.storage.kernel.params())) return error.ParameterSchemaMismatch;        const argument_count = std.math.cast(u32, self.storage.kernel.params().len) orelse return error.ArgumentCountOverflow;        if (out.argument_count != argument_count) return error.ParameterSchemaMismatch;        const entry_name = self.storage.kernel.func().getName() orelse return error.MissingKernelName;        if (!std.mem.eql(u8, out.entry_name, entry_name)) return error.EntryNameMismatch;        var replayed = try schedule_mod.replaySnapshot(            allocator,            self.capacity.schedule.asLimits(),            &out.schedule,        );        defer replayed.deinit(allocator);        if (replayed.fingerprint() != out.schedule_fingerprint) return error.ScheduleReplayMismatch;        const launch_value = try self.launch();        if (!launchEqual(out.launch, launch_value)) return error.LaunchMismatch;        if (!launchEqual(try out.schedule.launch(), launch_value)) return error.LaunchMismatch;    }    pub fn bodyFingerprint(self: *const Self, allocator: std.mem.Allocator) !u64 {        return self.storage.kernel.fingerprint(allocator);    }    pub fn scheduleFingerprint(self: *const Self) u64 {        return self.storage.schedule.fingerprint();    }    pub fn fingerprint(self: *const Self, allocator: std.mem.Allocator) !choir.product.incremental.Fingerprint {        const entry_name = self.storage.kernel.func().getName() orelse return error.MissingKernelName;        var fingerprint_builder = choir.product.incremental.FingerprintBuilder{};        fingerprint_builder.updateBytes(product_name);        fingerprint_builder.updateU32(plan.plan_version);        fingerprint_builder.updateU32(schedule_mod.snapshot_version);        fingerprint_builder.updateU64(try self.bodyFingerprint(allocator));        fingerprint_builder.updateU64(self.scheduleFingerprint());        fingerprint_builder.updateBytes(entry_name);        updateParamsFingerprint(&fingerprint_builder, self.storage.kernel.params());        return fingerprint_builder.finish();    }    pub fn productStamp(self: *const Self, allocator: std.mem.Allocator) !choir.product.incremental.ProductStamp {        return choir.product.incremental.productStamp(product_name, try self.fingerprint(allocator));    }    pub fn init(        kernel: builder.Kernel,        schedule: schedule_mod.Schedule,        capacity: Capacity,    ) Self {        return .{            .capacity = capacity,            .storage = .{                .kernel = kernel,                .schedule = schedule,            },        };    }};
Called byCallsprivate sourcelib.accy.src.kernel.model.program.graph.modelbuildCopyProgramtest sourcelib.accy.src.kernel.model.program.graph.modeltest: Program capacity distinguishes ...private sourcelib.accy.src.kernel.model.program.graph.model...deriveWithContextOwnershipkernel.program.graph.Capacityderive
Static calls · unresolved targets: 0 · external targets: 0.
Called byCallstest sourcelib.accy.src.kernel.model.program.graph.modeltest: Program capacity distinguishes ...private sourcelib.accy.src.kernel.model.program.graph.model...deriveWithContextOwnershipkernel.program.graph.CapacityderiveBorrowing
Static calls · unresolved targets: 0 · external targets: 0.
Called byCallsNo direct callskernel.program.graph.ProgramcheckPlankernel.program.graph.Programfingerprintkernel.GraphbodyFingerprintpreparation.GeneratedKernelProgrambodyFingerprint
Static calls · unresolved targets: 1 · external targets: 0.
Called byCallskernel.program.graph.ProgramcreateCheckedPlankernel.GraphcheckPlanprivate sourcelib.accy.src.kernel.model.core.builderparamsEqlkernel.program.graph.ProgrambodyFingerprintkernel.program.graph.Programlaunchkernel.program.graph.ProgramscheduleFingerprintprivate sourcelib.accy.src.kernel.model.program.graph.modellaunchEqualpreparation.GeneratedKernelProgramcheckPlan
Static calls · unresolved targets: 3 · external targets: 5.
Called byCallskernel.GraphcreateCheckedPlankernel.program.graph.ProgramcheckPlankernel.program.graph.ProgramcreatePlanpreparation.GeneratedKernelProgramcreateCheckedPlan
Static calls · unresolved targets: 0 · external targets: 1.
Called byCallsNo direct callskernel.program.graph.ProgramcreateCheckedPlankernel.GraphcreatePlanpreparation.GeneratedKernelProgramcreatePlan
Static calls · unresolved targets: 1 · external targets: 1.
Called byCallsNo direct callskernel.Graphdeinitpreparation.GeneratedKernelProgramdeinit
Static calls · unresolved targets: 2 · external targets: 0.
Called byCallskernel.program.graph.ProgramproductStampkernel.Graphfingerprintkernel.program.graph.ProgrambodyFingerprintkernel.program.graph.ProgramscheduleFingerprintprivate sourcelib.accy.src.kernel.model.program.graph.modelupdateParamsFingerprintpreparation.GeneratedKernelProgramfingerprint
Static calls · unresolved targets: 2 · external targets: 4.
Called byCallsNo direct callsprivate sourcelib.accy.src.choir.record.programrestoreInprivate sourcelib.accy.src.kernel.model.program.graph.modelbuildCopyProgramkernel.Graphinitpreparation.GeneratedKernelPrograminit
Static calls · unresolved targets: 0 · external targets: 0.
Called byCallsNo direct callskernel.GraphkernelModulepreparation.GeneratedKernelProgramkernelModule
Static calls · unresolved targets: 1 · external targets: 0.
Called byCallsNo direct callskernel.program.graph.ProgramcheckPlankernel.program.execution.ExecutorrunCpukernel.Graphlaunchpreparation.GeneratedKernelProgramlaunch
Static calls · unresolved targets: 1 · external targets: 0.
Called byCallsNo direct callskernel.Graphparamspreparation.GeneratedKernelProgramparams
Static calls · unresolved targets: 1 · external targets: 0.
Called byCallskernel.GraphproductStampkernel.program.graph.Programfingerprintpreparation.GeneratedKernelProgramproductStamp
Static calls · unresolved targets: 0 · external targets: 1.
Called byCallsNo direct callskernel.program.graph.ProgramcheckPlankernel.program.graph.Programfingerprintkernel.GraphscheduleFingerprintpreparation.GeneratedKernelProgramscheduleFingerprint
Static calls · unresolved targets: 1 · external targets: 0.
Called byCallsNo direct callskernel.GraphscheduleSnapshotpreparation.GeneratedKernelProgramscheduleSnapshot
Static calls · unresolved targets: 1 · external targets: 1.
Called byCallsNo direct callskernel.Graphverifypreparation.GeneratedKernelProgramverify
Static calls · unresolved targets: 1 · external targets: 0.
Called byCallsNo direct callskernel.GraphverifyWithDiagnosticpreparation.GeneratedKernelProgramverifyWithDiagnostic
Static calls · unresolved targets: 1 · external targets: 0.

Source: lib/accy/src/kernel/model/program/graph/model.zig:12

zig
pub const product_name = "accy.kernel_program";

Source: lib/accy/src/kernel/model/program/graph/root.zig

zig
const model = @import("model.zig");pub const product_name = model.product_name;pub const Limits = model.Limits;pub const Capacity = model.Capacity;pub const Program = model.Program;

Source: lib/accy/src/kernel/program/root.zig:4

zig
pub const graph = model.graph;

Audit

Definitions28
Public names84
Members17
Version26.7.0
Revisiondaab053ee433