Skip to documentation
SLOP

tiny.accy.choir.dialect.AccyDialect

Reference tiny.accy choir dialect AccyDialect

Defined in choir.dialect.

API (213)

Actions

Public operations.

Types and contracts

Public types and contracts.

Values and defaults

Public values and defaults.

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

Source

Source: lib/accy/src/choir/dialect.zig:29

zig
pub const AccyDialect = struct {    pub const name = "accy";    const op_templates = ir.dialects.operationTemplate.dialect(@This());    const op_attr = ir.dialects.attribute;    pub const spec = ir.dialects.dialectSpec(@This(), .{        .types = &.{ir.dialects.typeName(tensor_type_name)},    });    pub const IotaOp = struct {        op: *ir.Operation,        pub const leaf = op_templates.explicitLeaf(@This(), .{            .mnemonic = "iota",            .interfaces = &.{accyEffectsEntry()},            .operands = 0,            .results = .{"result"},            .required_attrs = .{op_attr.integer("iota_dimension")},        });        pub const operation_name = leaf.operation_name;        pub const getResult = leaf.getResult;        pub const verify = verifyAccyChoirOp;        pub fn create(            ctx: *ir.Context,            loc: ir.Location,            result_type: ir.Type,            iota_dimension: i64,        ) !IotaOp {            const self = try leaf.createLeaf(ctx, loc, &.{}, &.{result_type});            errdefer self.op.erase();            try leaf.setI64Attr(self, "iota_dimension", iota_dimension);            return self;        }    };    pub const ConstantOp = struct {        op: *ir.Operation,        pub const leaf = op_templates.explicitLeaf(@This(), .{            .mnemonic = "constant",            .interfaces = &.{accyEffectsEntry()},            .operands = 0,            .results = .{"result"},            .required_attrs = .{op_attr.dialect("payload", "accy.constant_payload")},        });        pub const operation_name = leaf.operation_name;        pub const getResult = leaf.getResult;        pub const verify = verifyAccyChoirOp;        pub const payload_attr_name = leaf.dialectAttrName("payload");        pub fn create(            ctx: *ir.Context,            loc: ir.Location,            payload: []const u8,            result_type: ir.Type,        ) !ConstantOp {            const self = try leaf.createLeaf(ctx, loc, &.{}, &.{result_type});            errdefer self.op.erase();            try leaf.setDialectAttrPayload(self, "payload", payload);            return self;        }        pub fn getPayload(self: ConstantOp) ?[]const u8 {            return leaf.getDialectAttrPayload(self, "payload");        }    };    pub const AddOp: type = op_templates.binarySameType("add", verifiedOptions());    pub const SubOp: type = op_templates.binarySameType("sub", verifiedOptions());    pub const MulOp: type = op_templates.binarySameType("mul", verifiedOptions());    pub const DivOp: type = op_templates.binarySameType("div", verifiedOptions());    pub const MaxOp: type = op_templates.binarySameType("max", verifiedOptions());    pub const MinOp: type = op_templates.binarySameType("min", verifiedOptions());    pub const NegOp: type = op_templates.unarySameType("neg", verifiedOptions());    pub const ExpOp: type = op_templates.unarySameType("exp", verifiedOptions());    pub const LogOp: type = op_templates.unarySameType("log", verifiedOptions());    pub const TanhOp: type = op_templates.unarySameType("tanh", verifiedOptions());    pub const SqrtOp: type = op_templates.unarySameType("sqrt", verifiedOptions());    pub const ActivationOp = struct {        op: *ir.Operation,        pub const leaf = op_templates.explicitLeaf(@This(), .{            .mnemonic = "activation",            .operands = .{"input"},            .results = .{"result"},            .required_attrs = .{op_attr.dialect("activation_kind", "accy.activation_kind")},            .interfaces = &.{ ir.dialects.opSpec.verifier(verifyAccyChoirOp), accyEffectsEntry() },        });        pub const operation_name = leaf.operation_name;        pub const getResult = leaf.getResult;        pub const verify = verifyAccyChoirOp;        pub const dialectAttrName = leaf.dialectAttrName;        pub const activation_kind_attr_name = leaf.dialectAttrName("activation_kind");        pub fn create(            ctx: *ir.Context,            loc: ir.Location,            input: *ir.Value,            result_type: ir.Type,            kind: semantics.ActivationKind,        ) !ActivationOp {            const self = try leaf.createLeaf(ctx, loc, &.{input}, &.{result_type});            errdefer self.op.erase();            try leaf.setDialectAttrPayload(self, "activation_kind", @tagName(kind));            return self;        }        pub fn getKind(self: ActivationOp) ?[]const u8 {            return leaf.getDialectAttrPayload(self, "activation_kind");        }    };    pub const AbsOp: type = op_templates.unarySameType("abs", verifiedOptions());    pub const SinOp: type = op_templates.unarySameType("sin", verifiedOptions());    pub const CosOp: type = op_templates.unarySameType("cos", verifiedOptions());    pub const TanOp: type = op_templates.unarySameType("tan", verifiedOptions());    pub const FloorOp: type = op_templates.unarySameType("floor", verifiedOptions());    pub const RoundOp: type = op_templates.unarySameType("round", verifiedOptions());    pub const TruncOp: type = op_templates.unarySameType("trunc", verifiedOptions());    pub const PowOp: type = op_templates.binarySameType("pow", verifiedOptions());    pub const Atan2Op: type = op_templates.binarySameType("atan2", verifiedOptions());    pub const CompareOp = struct {        op: *ir.Operation,        pub const leaf = op_templates.explicitLeaf(@This(), .{            .mnemonic = "compare",            .interfaces = &.{accyEffectsEntry()},            .operands = .{ "lhs", "rhs" },            .results = .{"result"},            .required_attrs = .{op_attr.dialect("compare_direction", "accy.compare_direction")},        });        pub const operation_name = leaf.operation_name;        pub const getResult = leaf.getResult;        pub const verify = verifyAccyChoirOp;        pub const dialectAttrName = leaf.dialectAttrName;        pub fn create(            ctx: *ir.Context,            loc: ir.Location,            lhs: *ir.Value,            rhs: *ir.Value,            result_type: ir.Type,            direction: []const u8,        ) !CompareOp {            const self = try leaf.createLeaf(ctx, loc, &.{ lhs, rhs }, &.{result_type});            errdefer self.op.erase();            try leaf.setDialectAttrPayload(self, "compare_direction", direction);            return self;        }    };    pub const ConvertOp = struct {        op: *ir.Operation,        pub const leaf = op_templates.explicitLeaf(@This(), .{            .mnemonic = "convert",            .interfaces = &.{accyEffectsEntry()},            .operands = .{"input"},            .results = .{"result"},            .required_attrs = .{op_attr.dialect("convert_to", "accy.convert_to")},        });        pub const operation_name = leaf.operation_name;        pub const getResult = leaf.getResult;        pub const verify = verifyAccyChoirOp;        pub const dialectAttrName = leaf.dialectAttrName;        pub fn create(            ctx: *ir.Context,            loc: ir.Location,            input: *ir.Value,            result_type: ir.Type,            target_dtype: []const u8,        ) !ConvertOp {            const self = try leaf.createLeaf(ctx, loc, &.{input}, &.{result_type});            errdefer self.op.erase();            try leaf.setDialectAttrPayload(self, "convert_to", target_dtype);            return self;        }    };    pub const SelectOp: type = op_templates.selectSameType("select", verifiedOptions());    pub const ReduceOp = struct {        op: *ir.Operation,        pub const leaf = op_templates.explicitLeaf(@This(), .{            .mnemonic = "reduce",            .interfaces = &.{accyEffectsEntry()},            .operands = .{ "operand", "init" },            .results = .{"result"},            .required_attrs = .{                op_attr.dialect("dimensions", "accy.reduce_dimensions"),                op_attr.dialect("reducer_kind", "accy.reducer_kind"),            },        });        pub const operation_name = leaf.operation_name;        pub const getResult = leaf.getResult;        pub const verify = verifyAccyChoirOp;        pub const dialectAttrName = leaf.dialectAttrName;        pub fn create(            ctx: *ir.Context,            loc: ir.Location,            operand: *ir.Value,            init: *ir.Value,            result_type: ir.Type,            reducer_kind: []const u8,            dimensions: []const i64,        ) !ReduceOp {            const self = try leaf.createLeaf(ctx, loc, &.{ operand, init }, &.{result_type});            errdefer self.op.erase();            try leaf.setDialectAttrPayload(self, "reducer_kind", reducer_kind);            try leaf.setDialectAttrPayload(self, "dimensions", std.mem.sliceAsBytes(dimensions));            return self;        }    };    pub const DotGeneralOp = struct {        op: *ir.Operation,        pub const leaf = op_templates.explicitLeaf(@This(), .{            .mnemonic = "dot_general",            .interfaces = &.{accyEffectsEntry()},            .operands = .{ "lhs", "rhs" },            .results = .{"result"},            .required_attrs = .{                op_attr.dialect("lhs_batch", "accy.dot_lhs_batch"),                op_attr.dialect("lhs_contract", "accy.dot_lhs_contract"),                op_attr.dialect("rhs_batch", "accy.dot_rhs_batch"),                op_attr.dialect("rhs_contract", "accy.dot_rhs_contract"),            },        });        pub const operation_name = leaf.operation_name;        pub const getResult = leaf.getResult;        pub const verify = verifyAccyChoirOp;        pub const dialectAttrName = leaf.dialectAttrName;        pub fn create(            ctx: *ir.Context,            loc: ir.Location,            lhs: *ir.Value,            rhs: *ir.Value,            result_type: ir.Type,            lhs_batch: []const i64,            rhs_batch: []const i64,            lhs_contract: []const i64,            rhs_contract: []const i64,        ) !DotGeneralOp {            const self = try leaf.createLeaf(ctx, loc, &.{ lhs, rhs }, &.{result_type});            errdefer self.op.erase();            try leaf.setDialectAttrPayload(self, "lhs_batch", std.mem.sliceAsBytes(lhs_batch));            try leaf.setDialectAttrPayload(self, "rhs_batch", std.mem.sliceAsBytes(rhs_batch));            try leaf.setDialectAttrPayload(self, "lhs_contract", std.mem.sliceAsBytes(lhs_contract));            try leaf.setDialectAttrPayload(self, "rhs_contract", std.mem.sliceAsBytes(rhs_contract));            return self;        }        pub fn getLhsBatchPayload(self: DotGeneralOp) ?[]const u8 {            return leaf.getDialectAttrPayload(self, "lhs_batch");        }        pub fn getRhsBatchPayload(self: DotGeneralOp) ?[]const u8 {            return leaf.getDialectAttrPayload(self, "rhs_batch");        }        pub fn getLhsContractPayload(self: DotGeneralOp) ?[]const u8 {            return leaf.getDialectAttrPayload(self, "lhs_contract");        }        pub fn getRhsContractPayload(self: DotGeneralOp) ?[]const u8 {            return leaf.getDialectAttrPayload(self, "rhs_contract");        }    };    pub const EinsumOp = struct {        op: *ir.Operation,        pub const leaf = op_templates.explicitLeaf(@This(), .{            .mnemonic = "einsum",            .operands = ir.dialects.shape.atLeast(1),            .results = .{"result"},            .required_attrs = .{op_attr.dialect("equation", "accy.einsum_equation")},            .interfaces = &.{ ir.dialects.opSpec.verifier(verifyAccyChoirOp), accyEffectsEntry() },        });        pub const operation_name = leaf.operation_name;        pub const getResult = leaf.getResult;        pub const verify = verifyAccyChoirOp;        pub const dialectAttrName = leaf.dialectAttrName;        pub const equation_attr_name = leaf.dialectAttrName("equation");        pub fn create(            ctx: *ir.Context,            loc: ir.Location,            operands: []const *ir.Value,            result_type: ir.Type,            equation: []const u8,        ) !EinsumOp {            const self = try leaf.createLeaf(ctx, loc, operands, &.{result_type});            errdefer self.op.erase();            try leaf.setDialectAttrPayload(self, "equation", equation);            return self;        }        pub fn getEquation(self: EinsumOp) ?[]const u8 {            return leaf.getDialectAttrPayload(self, "equation");        }    };    pub const BroadcastOp = struct {        op: *ir.Operation,        pub const leaf = op_templates.explicitLeaf(@This(), .{            .mnemonic = "broadcast",            .interfaces = &.{accyEffectsEntry()},            .operands = .{"input"},            .results = .{"result"},            .required_attrs = .{op_attr.dialect("sizes", "accy.broadcast_sizes")},        });        pub const operation_name = leaf.operation_name;        pub const getResult = leaf.getResult;        pub const verify = verifyAccyChoirOp;        pub const dialectAttrName = leaf.dialectAttrName;        pub fn create(            ctx: *ir.Context,            loc: ir.Location,            input: *ir.Value,            result_type: ir.Type,            sizes: []const i64,        ) !BroadcastOp {            const self = try leaf.createLeaf(ctx, loc, &.{input}, &.{result_type});            errdefer self.op.erase();            try leaf.setDialectAttrPayload(self, "sizes", std.mem.sliceAsBytes(sizes));            return self;        }    };    pub const BroadcastInDimOp = struct {        op: *ir.Operation,        pub const leaf = op_templates.explicitLeaf(@This(), .{            .mnemonic = "broadcast_in_dim",            .interfaces = &.{accyEffectsEntry()},            .operands = .{"input"},            .results = .{"result"},            .required_attrs = .{                op_attr.dialect("broadcast_dims", "accy.broadcast_dims"),                op_attr.dialect("result_shape", "accy.broadcast_result_shape"),            },        });        pub const operation_name = leaf.operation_name;        pub const getResult = leaf.getResult;        pub const verify = verifyAccyChoirOp;        pub const dialectAttrName = leaf.dialectAttrName;        pub fn create(            ctx: *ir.Context,            loc: ir.Location,            input: *ir.Value,            result_type: ir.Type,            broadcast_dims: []const i64,            result_shape: []const i64,        ) !BroadcastInDimOp {            const self = try leaf.createLeaf(ctx, loc, &.{input}, &.{result_type});            errdefer self.op.erase();            try leaf.setDialectAttrPayload(self, "broadcast_dims", std.mem.sliceAsBytes(broadcast_dims));            try leaf.setDialectAttrPayload(self, "result_shape", std.mem.sliceAsBytes(result_shape));            return self;        }    };    pub const ReshapeOp = struct {        op: *ir.Operation,        pub const leaf = op_templates.explicitLeaf(@This(), .{            .mnemonic = "reshape",            .interfaces = &.{accyEffectsEntry()},            .operands = .{"input"},            .results = .{"result"},            .required_attrs = .{op_attr.dialect("new_shape", "accy.reshape_new_shape")},        });        pub const operation_name = leaf.operation_name;        pub const getResult = leaf.getResult;        pub const verify = verifyAccyChoirOp;        pub const dialectAttrName = leaf.dialectAttrName;        pub fn create(            ctx: *ir.Context,            loc: ir.Location,            input: *ir.Value,            result_type: ir.Type,            new_shape: []const i64,        ) !ReshapeOp {            const self = try leaf.createLeaf(ctx, loc, &.{input}, &.{result_type});            errdefer self.op.erase();            try leaf.setDialectAttrPayload(self, "new_shape", std.mem.sliceAsBytes(new_shape));            return self;        }    };    pub const TransposeOp = struct {        op: *ir.Operation,        pub const leaf = op_templates.explicitLeaf(@This(), .{            .mnemonic = "transpose",            .interfaces = &.{accyEffectsEntry()},            .operands = .{"input"},            .results = .{"result"},            .required_attrs = .{op_attr.dialect("permutation", "accy.transpose_permutation")},        });        pub const operation_name = leaf.operation_name;        pub const getResult = leaf.getResult;        pub const verify = verifyAccyChoirOp;        pub const dialectAttrName = leaf.dialectAttrName;        pub fn create(            ctx: *ir.Context,            loc: ir.Location,            input: *ir.Value,            result_type: ir.Type,            permutation: []const i64,        ) !TransposeOp {            const self = try leaf.createLeaf(ctx, loc, &.{input}, &.{result_type});            errdefer self.op.erase();            try leaf.setDialectAttrPayload(self, "permutation", std.mem.sliceAsBytes(permutation));            return self;        }    };    pub const SliceOp = struct {        op: *ir.Operation,        pub const leaf = op_templates.explicitLeaf(@This(), .{            .mnemonic = "slice",            .interfaces = &.{accyEffectsEntry()},            .operands = .{"input"},            .results = .{"result"},            .required_attrs = .{                op_attr.dialect("limits", "accy.slice_limits"),                op_attr.dialect("starts", "accy.slice_starts"),                op_attr.dialect("strides", "accy.slice_strides"),            },        });        pub const operation_name = leaf.operation_name;        pub const getResult = leaf.getResult;        pub const verify = verifyAccyChoirOp;        pub const dialectAttrName = leaf.dialectAttrName;        pub fn create(            ctx: *ir.Context,            loc: ir.Location,            input: *ir.Value,            result_type: ir.Type,            starts: []const i64,            limits: []const i64,            strides: []const i64,        ) !SliceOp {            const self = try leaf.createLeaf(ctx, loc, &.{input}, &.{result_type});            errdefer self.op.erase();            try leaf.setDialectAttrPayload(self, "starts", std.mem.sliceAsBytes(starts));            try leaf.setDialectAttrPayload(self, "limits", std.mem.sliceAsBytes(limits));            try leaf.setDialectAttrPayload(self, "strides", std.mem.sliceAsBytes(strides));            return self;        }    };    pub const GatherOp = struct {        op: *ir.Operation,        pub const leaf = op_templates.explicitLeaf(@This(), .{            .mnemonic = "gather",            .interfaces = &.{accyEffectsEntry()},            .operands = .{ "input", "indices" },            .results = .{"result"},            .required_attrs = .{op_attr.integer("axis")},        });        pub const operation_name = leaf.operation_name;        pub const getResult = leaf.getResult;        pub const verify = verifyAccyChoirOp;        pub fn create(            ctx: *ir.Context,            loc: ir.Location,            input: *ir.Value,            indices: *ir.Value,            result_type: ir.Type,            axis: i64,        ) !GatherOp {            const self = try leaf.createLeaf(ctx, loc, &.{ input, indices }, &.{result_type});            errdefer self.op.erase();            try leaf.setI64Attr(self, "axis", axis);            return self;        }        pub fn getAxis(self: GatherOp) ?i64 {            const attr = self.op.getAttrAs(ir.Attribute.IntegerAttr, "axis") orelse return null;            return attr.getValue();        }    };    pub const ScatterOp = struct {        op: *ir.Operation,        pub const leaf = op_templates.explicitLeaf(@This(), .{            .mnemonic = "scatter",            .interfaces = &.{accyEffectsEntry()},            .operands = .{ "input", "indices", "updates" },            .results = .{"result"},            .required_attrs = .{op_attr.integer("axis")},        });        pub const operation_name = leaf.operation_name;        pub const getResult = leaf.getResult;        pub const verify = verifyAccyChoirOp;        pub fn create(            ctx: *ir.Context,            loc: ir.Location,            input: *ir.Value,            indices: *ir.Value,            updates: *ir.Value,            result_type: ir.Type,            axis: i64,        ) !ScatterOp {            const self = try leaf.createLeaf(ctx, loc, &.{ input, indices, updates }, &.{result_type});            errdefer self.op.erase();            try leaf.setI64Attr(self, "axis", axis);            return self;        }        pub fn getAxis(self: ScatterOp) ?i64 {            const attr = self.op.getAttrAs(ir.Attribute.IntegerAttr, "axis") orelse return null;            return attr.getValue();        }    };    pub const ScatterAddOp = struct {        op: *ir.Operation,        pub const leaf = op_templates.explicitLeaf(@This(), .{            .mnemonic = "scatter_add",            .interfaces = &.{accyEffectsEntry()},            .operands = .{ "input", "indices", "updates" },            .results = .{"result"},            .required_attrs = .{op_attr.integer("axis")},        });        pub const operation_name = leaf.operation_name;        pub const getResult = leaf.getResult;        pub const verify = verifyAccyChoirOp;        pub fn create(            ctx: *ir.Context,            loc: ir.Location,            input: *ir.Value,            indices: *ir.Value,            updates: *ir.Value,            result_type: ir.Type,            axis: i64,        ) !ScatterAddOp {            const self = try leaf.createLeaf(ctx, loc, &.{ input, indices, updates }, &.{result_type});            errdefer self.op.erase();            try leaf.setI64Attr(self, "axis", axis);            return self;        }        pub fn getAxis(self: ScatterAddOp) ?i64 {            const attr = self.op.getAttrAs(ir.Attribute.IntegerAttr, "axis") orelse return null;            return attr.getValue();        }    };    pub const SparseCrossEntropyOp = struct {        op: *ir.Operation,        pub const leaf = op_templates.explicitLeaf(@This(), .{            .mnemonic = "sparse_cross_entropy",            .interfaces = &.{accyEffectsEntry()},            .operands = .{ "logits", "targets" },            .results = .{"result"},        });        pub const operation_name = leaf.operation_name;        pub const getResult = leaf.getResult;        pub const verify = verifyAccyChoirOp;        pub fn create(            ctx: *ir.Context,            loc: ir.Location,            logits: *ir.Value,            targets: *ir.Value,            result_type: ir.Type,        ) !SparseCrossEntropyOp {            return try leaf.createLeaf(ctx, loc, &.{ logits, targets }, &.{result_type});        }    };    pub const PadOp = struct {        op: *ir.Operation,        pub const leaf = op_templates.explicitLeaf(@This(), .{            .mnemonic = "pad",            .interfaces = &.{accyEffectsEntry()},            .operands = .{ "input", "padding_value" },            .results = .{"result"},            .required_attrs = .{                op_attr.dialect("edge_high", "accy.pad_edge_high"),                op_attr.dialect("edge_low", "accy.pad_edge_low"),                op_attr.dialect("interior", "accy.pad_interior"),            },        });        pub const operation_name = leaf.operation_name;        pub const getResult = leaf.getResult;        pub const verify = verifyAccyChoirOp;        pub const dialectAttrName = leaf.dialectAttrName;        pub fn create(            ctx: *ir.Context,            loc: ir.Location,            input: *ir.Value,            padding_value: *ir.Value,            result_type: ir.Type,            edge_low: []const i64,            edge_high: []const i64,            interior: []const i64,        ) !PadOp {            const self = try leaf.createLeaf(ctx, loc, &.{ input, padding_value }, &.{result_type});            errdefer self.op.erase();            try leaf.setDialectAttrPayload(self, "edge_low", std.mem.sliceAsBytes(edge_low));            try leaf.setDialectAttrPayload(self, "edge_high", std.mem.sliceAsBytes(edge_high));            try leaf.setDialectAttrPayload(self, "interior", std.mem.sliceAsBytes(interior));            return self;        }    };    pub const ConcatenateOp = struct {        op: *ir.Operation,        pub const leaf = op_templates.explicitLeaf(@This(), .{            .mnemonic = "concatenate",            .interfaces = &.{accyEffectsEntry()},            .operands = ir.dialects.shape.atLeast(1),            .results = .{"result"},            .required_attrs = .{op_attr.integer("dimension")},        });        pub const operation_name = leaf.operation_name;        pub const getResult = leaf.getResult;        pub const verify = verifyAccyChoirOp;        pub fn create(            ctx: *ir.Context,            loc: ir.Location,            operands: []const *ir.Value,            result_type: ir.Type,            dimension: i64,        ) !ConcatenateOp {            const self = try leaf.createLeaf(ctx, loc, operands, &.{result_type});            errdefer self.op.erase();            try leaf.setI64Attr(self, "dimension", dimension);            return self;        }    };    pub const KernelCallOp = struct {        op: *ir.Operation,        pub const leaf = op_templates.explicitLeaf(@This(), .{            .mnemonic = "kernel_call",            .results = ir.dialects.shape.atLeast(1),            .required_attrs = .{                op_attr.dialect("target", "accy.kernel_call_target"),                op_attr.integer("version"),                op_attr.boolean("has_side_effects"),                op_attr.dialect("operand_effects", "accy.kernel_call_operand_effects"),                op_attr.dialect("result_aliases", "accy.kernel_call_result_aliases"),            },            .interfaces = &.{                ir.dialects.opSpec.verifier(verifyAccyChoirOp),                effect_facts.EffectOpInterface.entryFor(.{                    .capacity = .{ .entries = 2, .per_operand = 2, .per_result = 1 },                    .enumerate = kernelCallEffects,                }),            },        });        pub const operation_name = leaf.operation_name;        pub const verify = verifyAccyChoirOp;        pub const target_attr_name = leaf.dialectAttrName("target");        pub const operand_effects_attr_name = leaf.dialectAttrName("operand_effects");        pub const result_aliases_attr_name = leaf.dialectAttrName("result_aliases");        pub const runtime_scalars_attr_name = "accy.kernel_call_runtime_scalars";        pub const dialectAttrName = leaf.dialectAttrName;        pub fn create(            ctx: *ir.Context,            loc: ir.Location,            operands: []const *ir.Value,            result_types: []const ir.Type,            target: []const u8,            version: u32,            has_side_effects: bool,            operand_effects: []const semantics.KernelOperandEffect,            result_aliases: []const ?usize,        ) !KernelCallOp {            const kernel_call = try leaf.createLeaf(ctx, loc, operands, result_types);            errdefer kernel_call.op.erase();            try leaf.setDialectAttrPayload(kernel_call, "target", target);            try leaf.setI64Attr(kernel_call, "version", @intCast(version));            try leaf.setBoolAttr(kernel_call, "has_side_effects", has_side_effects);            try leaf.setDialectAttrPayload(kernel_call, "operand_effects", std.mem.sliceAsBytes(operand_effects));            try setKernelCallResultAliasesAttr(ctx, kernel_call.op, result_aliases);            return kernel_call;        }        pub fn getResult(self: KernelCallOp, index: usize) ?*ir.Value {            return self.op.getResult(index);        }        pub fn getFirstResult(self: KernelCallOp) *ir.Value {            return self.op.getResult(0).?;        }    };    pub const KernelCallScalarKind = enum(u64) {        i32,        u32,        i64,        u64,        f32,        f64,    };    pub const KernelCallScalar = extern struct {        kind: KernelCallScalarKind,        bits: u64,    };    pub const max_kernel_call_runtime_scalars = 16;    pub const KernelCallRuntimeScalars = struct {        count: usize = 0,        items: [max_kernel_call_runtime_scalars]KernelCallScalar = undefined,        pub fn slice(self: *const KernelCallRuntimeScalars) []const KernelCallScalar {            return self.items[0..self.count];        }    };    pub const ScratchOp = struct {        op: *ir.Operation,        pub const leaf = op_templates.explicitLeaf(@This(), .{            .mnemonic = "scratch",            .interfaces = &.{accyEffectsEntry()},            .results = .{"result"},            .required_attrs = .{op_attr.integer("words")},        });        pub const operation_name = leaf.operation_name;        pub const getResult = leaf.getResult;        pub const verify = verifyAccyChoirOp;        pub fn create(            ctx: *ir.Context,            loc: ir.Location,            result_type: ir.Type,            words: i64,        ) !ScratchOp {            const self = try leaf.createLeaf(ctx, loc, &.{}, &.{result_type});            errdefer self.op.erase();            try leaf.setI64Attr(self, "words", words);            return self;        }    };    pub const CumsumOp = struct {        op: *ir.Operation,        pub const leaf = op_templates.explicitLeaf(@This(), .{            .mnemonic = "cumsum",            .interfaces = &.{accyEffectsEntry()},            .operands = ir.dialects.shape.between(1, 2),            .results = .{"result"},            .required_attrs = .{op_attr.integer("axis")},        });        pub const operation_name = leaf.operation_name;        pub const getResult = leaf.getResult;        pub const verify = verifyAccyChoirOp;        pub fn create(            ctx: *ir.Context,            loc: ir.Location,            operand: *ir.Value,            result_type: ir.Type,            axis: i64,        ) !CumsumOp {            const self = try leaf.createLeaf(ctx, loc, &.{operand}, &.{result_type});            errdefer self.op.erase();            try leaf.setI64Attr(self, "axis", axis);            return self;        }        pub fn createWithScratch(            ctx: *ir.Context,            loc: ir.Location,            operand: *ir.Value,            scratch: *ir.Value,            result_type: ir.Type,            axis: i64,        ) !CumsumOp {            const self = try leaf.createLeaf(ctx, loc, &.{ operand, scratch }, &.{result_type});            errdefer self.op.erase();            try leaf.setI64Attr(self, "axis", axis);            return self;        }    };    pub const IterateOp = struct {        op: *ir.Operation,        pub const template = op_templates.explicit(@This(), .{            .mnemonic = "iterate",            .interfaces = &.{accyEffectsEntry()},            .operands = ir.dialects.shape.atLeast(1),            .results = ir.dialects.shape.atLeast(1),            .regions = ir.dialects.shape.exactly(1),            .region_names = .{"body"},            .required_attrs = .{op_attr.integer("max_iters")},        });        pub const operation_name = template.operation_name;        pub const verify = verifyAccyChoirOp;        pub const getRegion = template.getRegion;        pub fn create(            ctx: *ir.Context,            loc: ir.Location,            carries: []const *ir.Value,            max_iters: i64,        ) !IterateOp {            var body = ir.context.initRegion(ctx);            defer body.deinit();            var body_builder = ir.OperationBuilder.init(ctx);            var carry_types_buffer: [8]ir.Type = undefined;            if (carries.len > carry_types_buffer.len) return error.OutOfMemory;            for (carries, 0..) |carry, index| {                carry_types_buffer[index] = carry.type;            }            _ = try body_builder.createBlockWithLoc(&body, carry_types_buffer[0..carries.len], loc);            var regions = [_]*ir.Region{&body};            const self = try template.createOperation(ctx, loc, carries, carry_types_buffer[0..carries.len], &regions, &.{});            errdefer self.op.erase();            try template.setI64Attr(self, "max_iters", max_iters);            return self;        }        pub fn bodyBlock(self: IterateOp) ?*ir.Block {            const region = self.op.getRegion(0) orelse return null;            return region.getEntryBlock();        }        pub fn getMaxIters(self: IterateOp) ?i64 {            return template.getI64Attr(self, "max_iters");        }        pub fn getResult(self: IterateOp, index: usize) ?*ir.Value {            return self.op.getResult(index);        }    };    pub const IterateYieldOp = struct {        op: *ir.Operation,        pub const term = op_templates.explicitTerminator(@This(), .{            .mnemonic = "iterate_yield",            .interfaces = &.{accyEffectsEntry()},        });        pub const operation_name = term.operation_name;        pub const verify = verifyAccyChoirOp;        pub fn create(            ctx: *ir.Context,            loc: ir.Location,            predicate: *ir.Value,            carries: []const *ir.Value,        ) !IterateYieldOp {            var operands_buffer: [9]*ir.Value = undefined;            if (carries.len + 1 > operands_buffer.len) return error.OutOfMemory;            operands_buffer[0] = predicate;            for (carries, 0..) |carry, index| {                operands_buffer[index + 1] = carry;            }            return try term.createTerminator(ctx, loc, operands_buffer[0 .. carries.len + 1], &.{});        }    };    pub const ReturnOp = struct {        op: *ir.Operation,        pub const term = op_templates.explicitTerminator(@This(), .{            .mnemonic = "return",        });        pub const operation_name = term.operation_name;        pub const verify = verifyAccyChoirOp;        pub fn create(            ctx: *ir.Context,            loc: ir.Location,            operands: []const *ir.Value,        ) !ReturnOp {            return try term.createTerminator(ctx, loc, operands, &.{});        }    };    fn verifiedOptions() ir.dialects.opSpec.Options {        return .{            .interfaces = &.{ ir.dialects.opSpec.verifier(verifyAccyChoirOp), accyEffectsEntry() },        };    }    pub fn setKernelCallRuntimeScalars(        ctx: *ir.Context,        op: *ir.Operation,        scalars: []const KernelCallScalar,    ) !void {        if (scalars.len > max_kernel_call_runtime_scalars) return error.InvalidKernelCallContract;        try op.setAttr(            "runtime_scalars",            try ctx.getDialectAttr(KernelCallOp.runtime_scalars_attr_name, std.mem.sliceAsBytes(scalars)),        );    }    pub fn kernelCallRuntimeScalars(op: *const ir.Operation) !?KernelCallRuntimeScalars {        const attr = op.getAttr("runtime_scalars") orelse return null;        if (!std.mem.eql(u8, attr.abstract.name, KernelCallOp.runtime_scalars_attr_name)) {            return error.InvalidKernelCallContract;        }        const dialect_attr = attr.cast(ir.Attribute.DialectAttr) orelse return error.InvalidKernelCallContract;        const payload = dialect_attr.payload;        const record_size = @sizeOf(KernelCallScalar);        if (payload.len % record_size != 0) return error.InvalidKernelCallContract;        const count = payload.len / record_size;        if (count > max_kernel_call_runtime_scalars) return error.InvalidKernelCallContract;        var decoded = KernelCallRuntimeScalars{ .count = count };        for (0..count) |index| {            const record = payload[index * record_size ..][0..record_size];            const kind_bits = std.mem.readInt(u64, record[0..8], native_endian);            const kind = std.enums.fromInt(KernelCallScalarKind, kind_bits) orelse {                return error.InvalidKernelCallContract;            };            decoded.items[index] = .{                .kind = kind,                .bits = std.mem.readInt(u64, record[8..16], native_endian),            };        }        return decoded;    }};
Called byCallsNo direct callsprivate sourcelib.accy.src.choir.dialectexerciseAttributedFactoriestest sourcelib.accy.src.choir.dialecttest: accy Choir verifier accepts act...choir.semantic.FunctionBuilderactivationchoir.AccyDialect.ActivationOpcreate
Static calls · unresolved targets: 0 · external targets: 3.
Called byCallsNo direct callsprivate sourcelib.accy.src.choir.dialectexerciseAttributedFactoriesprivate sourcelib.accy.src.choir.einsum.lowering.RewriterSinkbroadcastInDimchoir.semantic.FunctionBuilderbroadcastInDimchoir.AccyDialect.BroadcastInDimOpcreate
Static calls · unresolved targets: 0 · external targets: 3.
Called byCallsNo direct callsprivate sourcelib.accy.src.choir.dialectexerciseAttributedFactorieschoir.semantic.FunctionBuilderbroadcastchoir.AccyDialect.BroadcastOpcreate
Static calls · unresolved targets: 0 · external targets: 3.
Called byCallsNo direct callsprivate sourcelib.accy.src.choir.dialectexerciseAttributedFactorieschoir.semantic.FunctionBuildercomparechoir.AccyDialect.CompareOpcreate
Static calls · unresolved targets: 0 · external targets: 3.
Called byCallsNo direct callsprivate sourcelib.accy.src.choir.dialectexerciseAttributedFactorieschoir.semantic.FunctionBuilderconcatenatechoir.AccyDialect.ConcatenateOpcreate
Static calls · unresolved targets: 0 · external targets: 3.
Called byCallsNo direct callsprivate sourcelib.accy.src.choir.dialecteffectScalarprivate sourcelib.accy.src.choir.dialectexerciseAttributedFactoriestest sourcelib.accy.src.choir.dialecttest: accy Choir verifier rejects mal...private sourcelib.accy.src.choir.einsum.lowering.RewriterSinkconstantchoir.semantic.FunctionBuilderconstantchoir.AccyDialect.ConstantOpcreate
Static calls · unresolved targets: 0 · external targets: 3.
Called byCallsNo direct callsprivate sourcelib.accy.src.choir.dialectexerciseAttributedFactoriestest sourcelib.accy.src.choir.dialecttest: accy effect conversion and inde...choir.semantic.FunctionBuilderconvertchoir.AccyDialect.ConvertOpcreate
Static calls · unresolved targets: 0 · external targets: 3.
Called byCallsNo direct callsprivate sourcelib.accy.src.choir.dialectexerciseAttributedFactorieschoir.semantic.FunctionBuildercumsumchoir.AccyDialect.CumsumOpcreate
Static calls · unresolved targets: 0 · external targets: 3.
Called byCallsNo direct callsprivate sourcelib.accy.src.choir.dialectexerciseAttributedFactoriesprivate sourcelib.accy.src.preparation.canonicalizationcanonicalizeCumsumchoir.AccyDialect.CumsumOpcreateWithScratch
Static calls · unresolved targets: 0 · external targets: 3.
Called byCallsNo direct callsprivate sourcelib.accy.src.choir.dialectexerciseAttributedFactoriesprivate sourcelib.accy.src.choir.einsum.lowering.RewriterSinkdotGeneralchoir.semantic.FunctionBuilderdotGeneralchoir.AccyDialect.DotGeneralOpcreate
Static calls · unresolved targets: 0 · external targets: 3.
Called byCallsNo direct callsprivate sourcelib.accy.src.choir.dialectexerciseAttributedFactoriestest sourcelib.accy.src.choir.dialecttest: accy Choir verifier accepts ein...choir.semantic.FunctionBuildereinsumchoir.AccyDialect.EinsumOpcreate
Static calls · unresolved targets: 0 · external targets: 3.
Called byCallsNo direct callsprivate sourcelib.accy.src.choir.dialectexerciseAttributedFactoriestest sourcelib.accy.src.choir.dialecttest: accy effect conversion and inde...choir.semantic.FunctionBuildergatherchoir.AccyDialect.GatherOpcreate
Static calls · unresolved targets: 0 · external targets: 3.
Called byCallsNo direct callsprivate sourcelib.accy.src.choir.dialectexerciseAttributedFactoriestest sourcelib.accy.src.choir.dialect.test_accyiota constructor produces a result of...test sourcelib.accy.src.choir.dialect.test_accyreturn accepts variadic operand countstest sourcelib.accy.src.choir.dialecttest: accy Choir verifier accepts act...test sourcelib.accy.src.choir.dialecttest: accy Choir verifier accepts ein...+12 morechoir.AccyDialect.IotaOpcreate
Static calls · unresolved targets: 0 · external targets: 3.
Called byCallsNo direct callsprivate sourcelib.accy.src.choir.dialectexerciseAttributedFactorieschoir.semantic.FunctionBuilderbeginIteratechoir.AccyDialect.IterateOpcreate
Static calls · unresolved targets: 0 · external targets: 7.
Called byCallsNo direct callschoir.semantic.IterateBuilderresultchoir.AccyDialect.IterateOpgetResult
Static calls · unresolved targets: 0 · external targets: 1.
Called byCallsNo direct callschoir.semantic.IterateBuilderyield choir.AccyDialect.IterateYieldOpcreate
Static calls · unresolved targets: 0 · external targets: 1.
Called byCallsprivate sourcelib.accy.src.choir.dialectexerciseAttributedFactoriestest sourcelib.accy.src.choir.dialecttest: accy Choir verifier accepts ker...test sourcelib.accy.src.choir.dialecttest: accy Choir verifier rejects mal...test sourcelib.accy.src.choir.dialecttest: accy effect declarations never ...test sourcelib.accy.src.choir.dialecttest: accy effect foreign kernel call...choir.semantic.FunctionBuilderkernelCallprivate sourcelib.accy.src.choir.dialectsetKernelCallResultAliasesAttrchoir.AccyDialect.KernelCallOpcreate
Static calls · unresolved targets: 0 · external targets: 5.
Called byCallsNo direct callsprivate sourcelib.accy.src.choir.dialectexerciseAttributedFactorieschoir.semantic.FunctionBuilderpadchoir.AccyDialect.PadOpcreate
Static calls · unresolved targets: 0 · external targets: 3.
Called byCallsNo direct callsprivate sourcelib.accy.src.choir.dialectexerciseAttributedFactoriesprivate sourcelib.accy.src.choir.einsum.lowering.RewriterSinkreducechoir.semantic.FunctionBuilderreducechoir.AccyDialect.ReduceOpcreate
Static calls · unresolved targets: 0 · external targets: 3.
Called byCallsNo direct callsprivate sourcelib.accy.src.choir.dialectexerciseAttributedFactoriesprivate sourcelib.accy.src.choir.einsum.lowering.RewriterSinkreshapechoir.semantic.FunctionBuilderreshapechoir.AccyDialect.ReshapeOpcreate
Static calls · unresolved targets: 0 · external targets: 3.
Called byCallsNo direct callstest sourcelib.accy.src.choir.dialect.test_accyreturn accepts variadic operand countschoir.AccyDialect.ReturnOpcreate
Static calls · unresolved targets: 0 · external targets: 1.
Called byCallsNo direct callsprivate sourcelib.accy.src.choir.dialectexerciseAttributedFactorieschoir.semantic.FunctionBuilderscatterAddchoir.AccyDialect.ScatterAddOpcreate
Static calls · unresolved targets: 0 · external targets: 3.
Called byCallsNo direct callsprivate sourcelib.accy.src.choir.dialectexerciseAttributedFactorieschoir.semantic.FunctionBuilderscatterchoir.AccyDialect.ScatterOpcreate
Static calls · unresolved targets: 0 · external targets: 3.
Called byCallsNo direct callsprivate sourcelib.accy.src.choir.dialectexerciseAttributedFactoriestest sourcelib.accy.src.choir.dialecttest: accy effect conversion and inde...private sourcelib.accy.src.preparation.canonicalizationcanonicalizeCumsumchoir.AccyDialect.ScratchOpcreate
Static calls · unresolved targets: 0 · external targets: 3.
Called byCallsNo direct callsprivate sourcelib.accy.src.choir.dialectexerciseAttributedFactorieschoir.semantic.FunctionBuilderslicechoir.AccyDialect.SliceOpcreate
Static calls · unresolved targets: 0 · external targets: 3.
Called byCallsNo direct callschoir.semantic.FunctionBuildersparseCrossEntropychoir.AccyDialect.SparseCrossEntropyOpcreate
Static calls · unresolved targets: 0 · external targets: 1.
Called byCallsNo direct callsprivate sourcelib.accy.src.choir.dialectexerciseAttributedFactoriesprivate sourcelib.accy.src.choir.einsum.lowering.RewriterSinktransposechoir.semantic.FunctionBuildertransposechoir.AccyDialect.TransposeOpcreate
Static calls · unresolved targets: 0 · external targets: 3.

Also reachable as

choir.AccyDialect.

Complete caller list for choir.AccyDialect.IotaOp.create

17 direct callers.

Audit

Definitions214
Public names428
Members35
Version26.7.0
Revisiondaab053ee433