Skip to documentation
SLOP

tiny.accy.choir.dispatch

Reference tiny.accy choir dispatch

Defined in choir.

API (9)

Actions

Public operations.

Types and contracts

Public types and contracts.

Values and defaults

Public values and defaults.

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

Source

Called byCallschoir.MemoryJobcontextchoir.TensorJobcontextchoir.DispatchJobcontext
Static calls · unresolved targets: 0 · external targets: 0.
Called byCallstest sourcelib.accy.src.choir.dispatchtest: dispatch module owns tensor pro...test sourcelib.accy.src.choir.gputest: kernel module owns memory produ...choir.MemoryJobdeinittest sourcelib.accy.src.choir.memorytest: memory module owns dispatch pro...preparation.DispatchPreparationResultdeinittest sourcelib.accy.src.target.moduletest: target module owns kernel produ...choir.TensorJobdeinitchoir.DispatchJobdeinit
Static calls · unresolved targets: 0 · external targets: 1.
Called byCallsNo direct callstest sourcelib.accy.src.choir.dispatchtest: dispatch module owns tensor pro...choir.DispatchJobfingerprint
Static calls · unresolved targets: 0 · external targets: 0.
Called byCallsNo direct callstest sourcelib.accy.src.choir.dispatchtest: dispatch module owns tensor pro...test sourcelib.accy.src.choir.gputest: kernel module owns memory produ...test sourcelib.accy.src.choir.memorytest: memory module owns dispatch pro...preparationprepareDispatchJobFromTensorJobWithRuntest sourcelib.accy.src.target.moduletest: target module owns kernel produ...choir.DispatchJobinit
Static calls · unresolved targets: 0 · external targets: 4.
Called byCallschoir.MemoryJobpassContextchoir.TensorJobpassContextchoir.DispatchJobpassContext
Static calls · unresolved targets: 0 · external targets: 0.
Called byCallstest sourcelib.accy.src.choir.dispatchtest: dispatch module owns tensor pro...choir.MemoryJobverifychoir.TensorJobverifychoir.DispatchJobverify
Static calls · unresolved targets: 0 · external targets: 0.

Source: lib/accy/src/choir/dispatch.zig

zig
const std = @import("std");const choir = @import("choir");const contract = @import("contract.zig");const semantic = @import("semantic.zig");const tensor = @import("tensor.zig");const ir = choir.ir;const passes = choir.passes;pub const product_name = "accy.dispatch";pub const DispatchModule = @import("root.zig").publication.Module(.dispatch);pub const DispatchJob = struct {    allocator: std.mem.Allocator,    tensor_module: *tensor.TensorJob,    choir_module: *ir.Operation,    observed_fingerprint: u64,    pub fn init(        allocator: std.mem.Allocator,        tensor_module: *tensor.TensorJob,    ) !*DispatchJob {        const module = try allocator.create(DispatchJob);        errdefer allocator.destroy(module);        module.* = .{            .allocator = allocator,            .tensor_module = tensor_module,            .choir_module = tensor_module.choir_module,            .observed_fingerprint = 0,        };        try module.verify();        module.observed_fingerprint = try choir.operationFingerprint(allocator, module.choir_module);        return module;    }    pub fn context(self: *DispatchJob) *ir.Context {        return self.tensor_module.context();    }    pub fn deinit(self: *DispatchJob) void {        self.tensor_module.deinit();        const allocator = self.allocator;        allocator.destroy(self);    }    pub fn verify(self: *DispatchJob) !void {        try self.tensor_module.verify();    }    pub fn fingerprint(self: *const DispatchJob) u64 {        return self.observed_fingerprint;    }    pub fn passContext(self: *DispatchJob) passes.PassContext {        return self.tensor_module.passContext();    }};test "dispatch module owns tensor product" {    const allocator = std.testing.allocator;    var builder = try semantic.Builder.init(allocator, semantic.Builder.ContextLimits.standard);    defer builder.deinit();    const ty = try builder.tensor(.f32, &.{4});    var function = try builder.beginFunction("dispatch_add", &.{ ty, ty }, &.{ty});    const sum = try function.add(function.parameter(0), function.parameter(1));    try function.return_(&.{sum});    try function.finish();    const semantic_module = try builder.finish();    var contract_module = try contract.ContractJob.init(allocator, semantic_module);    var contract_owned = true;    errdefer if (contract_owned) contract_module.deinit();    var analysis_cache = passes.AnalysisCache.init(allocator, null);    var cache_owned = true;    errdefer if (cache_owned) analysis_cache.deinit();    var tensor_module = try tensor.TensorJob.init(allocator, contract_module, analysis_cache);    contract_owned = false;    cache_owned = false;    var tensor_owned = true;    errdefer if (tensor_owned) tensor_module.deinit();    var dispatch_module = try DispatchJob.init(allocator, tensor_module);    tensor_owned = false;    defer dispatch_module.deinit();    try std.testing.expectEqualStrings(product_name, "accy.dispatch");    try dispatch_module.verify();    try std.testing.expectEqual(try choir.operationFingerprint(allocator, dispatch_module.choir_module), dispatch_module.fingerprint());}

Source: lib/accy/src/choir/root.zig:12

zig
pub const dispatch = @import("dispatch.zig");

Audit

Definitions10
Public names19
Members4
Version26.7.0
Revisiondaab053ee433