Skip to documentation
SLOP

tiny.choir.dialects.ArithDialect

Reference tiny.choir dialects ArithDialect

Defined in dialects.

API (117)

Actions

Public operations.

Types and contracts

Public types and contracts.

Values and defaults

Public values and defaults.

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

Source

Source: lib/choir/src/dialects/arith/ops.zig:13

zig
pub const ArithDialect = struct {    pub const name = "arith";    const op_specs = ir.dialects.opSpec.dialect(@This());    const op_templates = ir.dialects.operationTemplate.dialect(@This());    const folds = fold_mod.Folds(@This());    const spec = ir.dialects.dialectSpec(@This(), .{        .types = types.registeredTypeSpecs(),    });    pub const ScalarTypeKind: type = types.ScalarKind;    pub const ConstantOp = struct {        op: *ir.Operation,        pub const operation_spec = op_specs.leaf(.{            .mnemonic = "constant",            .operands = 0,            .results = 1,            .required_attrs = &.{"value"},            .properties = ir.singleAttributePropertiesModel("arith.constant.properties", "value"),            .interfaces = effects.entries(.constant),        });        pub const operation_name = operation_spec.name;        pub fn createInt(ctx: *ir.Context, loc: ir.Location, result_type: ir.Type, value: i64) !ConstantOp {            var builder = ir.OperationBuilder.init(ctx);            var state = op_specs.state(@This(), loc);            state.addTypes(&.{result_type});            const value_attr = try getIntAttr(ctx, value);            const uses_properties = try state.setPropertiesAttrIfRegistered(ctx, value_attr);            const op = try builder.create(state);            errdefer op.erase();            if (!uses_properties) try op.setAttr("value", value_attr);            return .{ .op = op };        }        pub fn createFloat(ctx: *ir.Context, loc: ir.Location, result_type: ir.Type, value: f64) !ConstantOp {            var builder = ir.OperationBuilder.init(ctx);            var state = op_specs.state(@This(), loc);            state.addTypes(&.{result_type});            const value_attr = try getFloatAttr(ctx, value);            const uses_properties = try state.setPropertiesAttrIfRegistered(ctx, value_attr);            const op = try builder.create(state);            errdefer op.erase();            if (!uses_properties) try op.setAttr("value", value_attr);            return .{ .op = op };        }        pub fn createBool(ctx: *ir.Context, loc: ir.Location, value: bool) !ConstantOp {            var builder = ir.OperationBuilder.init(ctx);            const bool_type = try getScalarType(ctx, .bool);            var state = op_specs.state(@This(), loc);            state.addTypes(&.{bool_type});            const value_attr = try getBoolAttr(ctx, value);            const uses_properties = try state.setPropertiesAttrIfRegistered(ctx, value_attr);            const op = try builder.create(state);            errdefer op.erase();            if (!uses_properties) try op.setAttr("value", value_attr);            return .{ .op = op };        }        pub fn getResult(self: *const ConstantOp) *ir.Value {            return self.op.getResult(0).?;        }        pub fn getIntValue(self: ConstantOp) ?i64 {            const int_attr = self.op.getAttrAs(ir.Attribute.IntegerAttr, "value") orelse return null;            return int_attr.getValue();        }        pub fn getFloatValue(self: ConstantOp) ?f64 {            const float_attr = self.op.getAttrAs(ir.Attribute.FloatAttr, "value") orelse return null;            return float_attr.getValue();        }    };    pub const AddOp: type = op_templates.binarySameTypeFold("add", effectOptions(.add, commutativeSameTypeOptions()), folds.foldAdd);    pub const SubOp: type = op_templates.binarySameTypeFold(        "sub",        effectOptions(.sub, sameTypeOptions(.{})),        folds.foldSub,    );    pub const MulOp: type = op_templates.binarySameTypeFold("mul", effectOptions(.mul, commutativeSameTypeOptions()), folds.foldMul);    pub const UmulhiOp: type = op_templates.binarySameType("umulhi", effectOptions(.umulhi, commutativeSameTypeOptions()));    /// Overflow arithmetic returns the exact result modulo 2^64, then whether the exact    /// mathematical result is unrepresentable in the operand type. Only i64 is admitted today.    /// These operations neither trap nor inherit the single-result operations' folds.    pub const AddoOp = overflowOp("addo", .addo);    pub const SuboOp = overflowOp("subo", .subo);    pub const MuloOp = overflowOp("mulo", .mulo);    pub const DivOp: type = op_templates.binarySameTypeFold(        "div",        effectOptions(.div, sameTypeOptions(.{})),        folds.foldDiv,    );    pub const MaxOp: type = op_templates.binarySameType("max", effectOptions(.max, sameTypeOptions(.{})));    pub const MinOp: type = op_templates.binarySameType("min", effectOptions(.min, sameTypeOptions(.{})));    pub const CmpOp = struct {        op: *ir.Operation,        pub const operation_spec = op_specs.leaf(.{            .mnemonic = "cmp",            .interfaces = effects.entries(.cmp),            .operands = 2,            .results = 1,            .required_attrs = &.{"predicate"},            .result_types = &.{ir.dialects.typeConstraint.exact(0, types.type_names.boolean)},            .dynamic_traits = .{ir.traits.SameTypeOperands},        });        pub const operation_name = operation_spec.name;        pub const fold = folds.foldCmp;        pub fn create(ctx: *ir.Context, loc: ir.Location, predicate: CmpPredicate, lhs: *ir.Value, rhs: *ir.Value) !CmpOp {            var builder = ir.OperationBuilder.init(ctx);            const bool_type = try getScalarType(ctx, .bool);            var state = op_specs.state(@This(), loc);            state.addOperands(&.{ lhs, rhs });            state.addTypes(&.{bool_type});            const op = try builder.create(state);            errdefer op.erase();            var buf: [8]u8 = undefined;            const pred_str = try std.fmt.bufPrint(&buf, "{s}", .{predicate.toString()});            const pred_attr = try ctx.getDialectAttr("arith.predicate", pred_str);            try op.setAttr("predicate", pred_attr);            return .{ .op = op };        }        pub fn getResult(self: *const CmpOp) *ir.Value {            return self.op.getResult(0).?;        }        pub fn getPredicate(self: CmpOp) ?CmpPredicate {            if (self.op.getAttrAs(ir.Attribute.DialectAttr, "predicate")) |dialect_attr| {                inline for (@typeInfo(CmpPredicate).@"enum".field_names, std.meta.tags(CmpPredicate)) |field_name, value| {                    if (std.mem.eql(u8, dialect_attr.payload, field_name)) {                        return value;                    }                }            }            return null;        }    };    pub const CastOp: type = op_templates.unaryExplicitTypeFold(        "cast",        effectOptions(.cast, .{}),        folds.foldSameTypeUnary,    );    pub const SelectOp: type = op_templates.selectSameTypeFold("select", .{        .interfaces = effects.entries(.select),        .traits = .{},        .dynamic_traits = ir.dialects.opSpec.dynamicTraits(.{            ir.traits.TypesMatchWith(.{                .label = "select_result_eq_true",                .target = .{ .result = 0 },                .source = .{ .operand = 1 },            }),            ir.traits.TypesMatchWith(.{                .label = "select_true_eq_false",                .target = .{ .operand = 1 },                .source = .{ .operand = 2 },            }),        }),        .operand_types = &.{ir.dialects.typeConstraint.exact(0, types.type_names.boolean)},    }, folds.foldSelect);    pub const RemOp: type = op_templates.binarySameType("rem", effectOptions(.rem, sameTypeOptions(.{})));    pub const FmaOp: type = op_templates.ternarySameType("fma", effectOptions(.fma, sameTypeOptions(.{})));    pub const NegOp: type = op_templates.unarySameType("neg", effectOptions(.neg, sameTypeOptions(.{})));    pub const AbsOp: type = op_templates.unarySameType("abs", effectOptions(.abs, sameTypeOptions(.{})));    pub const SqrtOp: type = op_templates.unarySameType("sqrt", effectOptions(.sqrt, sameTypeOptions(.{})));    pub const ExpOp: type = op_templates.unarySameType("exp", effectOptions(.exp, sameTypeOptions(.{})));    pub const LogOp: type = op_templates.unarySameType("log", effectOptions(.log, sameTypeOptions(.{})));    pub const TanhOp: type = op_templates.unarySameType("tanh", effectOptions(.tanh, sameTypeOptions(.{})));    pub const SinOp: type = op_templates.unarySameType("sin", effectOptions(.sin, sameTypeOptions(.{})));    pub const CosOp: type = op_templates.unarySameType("cos", effectOptions(.cos, sameTypeOptions(.{})));    pub const TanOp: type = op_templates.unarySameType("tan", effectOptions(.tan, sameTypeOptions(.{})));    pub const FloorOp: type = op_templates.unarySameType("floor", effectOptions(.floor, sameTypeOptions(.{})));    pub const RoundOp: type = op_templates.unarySameType("round", effectOptions(.round, sameTypeOptions(.{})));    pub const TruncOp: type = op_templates.unarySameType("trunc", effectOptions(.trunc, sameTypeOptions(.{})));    pub const Tf32RoundOp: type = op_templates.unarySameType("tf32_round", sameTypeOptions(.{}));    pub const PowOp: type = op_templates.binarySameType("pow", effectOptions(.pow, sameTypeOptions(.{})));    pub const Atan2Op: type = op_templates.binarySameType("atan2", sameTypeOptions(.{}));    pub const AndOp: type = op_templates.binarySameTypeFold(        "and",        effectOptions(.@"and", commutativeSameTypeOptions()),        folds.foldAnd,    );    pub const OrOp: type = op_templates.binarySameTypeFold(        "or",        effectOptions(.@"or", commutativeSameTypeOptions()),        folds.foldOr,    );    pub const XorOp: type = op_templates.binarySameTypeFold(        "xor",        effectOptions(.xor, commutativeSameTypeOptions()),        folds.foldXor,    );    pub const NotOp: type = op_templates.unarySameTypeFold(        "not",        effectOptions(.not, sameTypeOptions(.{})),        folds.foldNot,    );    pub const PopCountOp: type = op_templates.unarySameType(        "popcount",        effectOptions(.popcount, sameTypeOptions(.{})),    );    pub const ShlOp: type = op_templates.binarySameTypeFold(        "shl",        effectOptions(.shl, sameTypeOptions(.{})),        folds.foldShift,    );    pub const ShrOp: type = op_templates.binarySameTypeFold(        "shr",        effectOptions(.shr, sameTypeOptions(.{})),        folds.foldShift,    );    pub const UshrOp: type = op_templates.binarySameTypeFold(        "ushr",        effectOptions(.ushr, sameTypeOptions(.{})),        folds.foldShift,    );    pub const BitcastOp: type = op_templates.unaryExplicitTypeFold(        "bitcast",        effectOptions(.bitcast, .{}),        folds.foldSameTypeUnary,    );    pub const SplatOp: type = op_templates.unaryExplicitType("splat", effectOptions(.splat, .{}));    pub const ExtractOp = struct {        op: *ir.Operation,        pub const operation_spec = op_specs.leaf(.{            .mnemonic = "extract",            .interfaces = effects.entries(.extract),            .operands = 1,            .results = 1,            .required_attrs = &.{"index"},        });        pub const operation_name = operation_spec.name;        pub fn create(            ctx: *ir.Context,            loc: ir.Location,            vector: *ir.Value,            index: i64,            result_type: ir.Type,        ) !ExtractOp {            var builder = ir.OperationBuilder.init(ctx);            var state = op_specs.state(@This(), loc);            state.addOperands(&.{vector});            state.addTypes(&.{result_type});            const op = try builder.create(state);            errdefer op.erase();            const idx_attr = try getIntAttr(ctx, index);            try op.setAttr("index", idx_attr);            return .{ .op = op };        }        pub fn getResult(self: *const ExtractOp) *ir.Value {            return self.op.getResult(0).?;        }        pub fn getVector(self: ExtractOp) *ir.Value {            return self.op.operands.items[0].value;        }        pub fn getIndex(self: ExtractOp) ?i64 {            const int_attr = self.op.getAttrAs(ir.Attribute.IntegerAttr, "index") orelse return null;            return int_attr.getValue();        }    };    pub const InsertOp = struct {        op: *ir.Operation,        pub const operation_spec = op_specs.leaf(.{            .mnemonic = "insert",            .interfaces = effects.entries(.insert),            .operands = 2,            .results = 1,            .required_attrs = &.{"index"},        });        pub const operation_name = operation_spec.name;        pub fn create(            ctx: *ir.Context,            loc: ir.Location,            vector: *ir.Value,            scalar: *ir.Value,            index: i64,        ) !InsertOp {            var builder = ir.OperationBuilder.init(ctx);            var state = op_specs.state(@This(), loc);            state.addOperands(&.{ vector, scalar });            state.addTypes(&.{vector.type});            const op = try builder.create(state);            errdefer op.erase();            const idx_attr = try getIntAttr(ctx, index);            try op.setAttr("index", idx_attr);            return .{ .op = op };        }        pub fn getResult(self: *const InsertOp) *ir.Value {            return self.op.getResult(0).?;        }        pub fn getVector(self: InsertOp) *ir.Value {            return self.op.operands.items[0].value;        }        pub fn getScalar(self: InsertOp) *ir.Value {            return self.op.operands.items[1].value;        }        pub fn getIndex(self: InsertOp) ?i64 {            const int_attr = self.op.getAttrAs(ir.Attribute.IntegerAttr, "index") orelse return null;            return int_attr.getValue();        }    };    pub const VecCmpOp = struct {        op: *ir.Operation,        pub const operation_spec = op_specs.leaf(.{            .mnemonic = "vec_cmp",            .interfaces = effects.entries(.vec_cmp),            .operands = 2,            .results = 1,            .required_attrs = &.{"predicate"},            .dynamic_traits = .{ir.traits.SameTypeOperands},        });        pub const operation_name = operation_spec.name;        pub fn create(            ctx: *ir.Context,            loc: ir.Location,            predicate: CmpPredicate,            lhs: *ir.Value,            rhs: *ir.Value,            result_type: ir.Type,        ) !VecCmpOp {            var builder = ir.OperationBuilder.init(ctx);            var state = op_specs.state(@This(), loc);            state.addOperands(&.{ lhs, rhs });            state.addTypes(&.{result_type});            const op = try builder.create(state);            errdefer op.erase();            var buf: [8]u8 = undefined;            const pred_str = try std.fmt.bufPrint(&buf, "{s}", .{predicate.toString()});            const pred_attr = try ctx.getDialectAttr(ArithDialect.name ++ ".predicate", pred_str);            try op.setAttr("predicate", pred_attr);            return .{ .op = op };        }        pub fn getResult(self: *const VecCmpOp) *ir.Value {            return self.op.getResult(0).?;        }        pub fn getPredicate(self: VecCmpOp) ?CmpPredicate {            if (self.op.getAttrAs(ir.Attribute.DialectAttr, "predicate")) |dialect_attr| {                inline for (                    @typeInfo(CmpPredicate).@"enum".field_names,                    std.meta.tags(CmpPredicate),                ) |field_name, value| {                    if (std.mem.eql(u8, dialect_attr.payload, field_name)) {                        return value;                    }                }            }            return null;        }    };    pub const VecShuffleOp = struct {        op: *ir.Operation,        pub const operation_spec = op_specs.leaf(.{            .mnemonic = "vec_shuffle",            .interfaces = effects.entries(.vec_shuffle),            .operands = 1,            .results = 1,            .required_attrs = &.{"indices"},        });        pub const operation_name = operation_spec.name;        pub const IndexParseError = error{            MissingIndices,            InvalidIndices,            TooManyIndices,        };        pub fn create(            ctx: *ir.Context,            loc: ir.Location,            vector: *ir.Value,            result_type: ir.Type,            indices: []const i64,        ) !VecShuffleOp {            var builder = ir.OperationBuilder.init(ctx);            var state = op_specs.state(@This(), loc);            state.addOperands(&.{vector});            state.addTypes(&.{result_type});            const op = try builder.create(state);            errdefer op.erase();            var buf: [256]u8 = undefined;            var pos: usize = 0;            for (indices, 0..) |idx, i| {                if (i != 0) {                    if (pos >= buf.len) return error.OutOfMemory;                    buf[pos] = ',';                    pos += 1;                }                pos = format.appendFmt(buf[0..], pos, "{d}", .{idx}) catch return error.OutOfMemory;            }            const indices_attr = try ctx.getStringAttr(buf[0..pos]);            try op.setAttr("indices", indices_attr);            return .{ .op = op };        }        pub fn getResult(self: *const VecShuffleOp) *ir.Value {            return self.op.getResult(0).?;        }        pub fn getVector(self: VecShuffleOp) *ir.Value {            return self.op.operands.items[0].value;        }        pub fn getIndices(self: VecShuffleOp, out: []i64) IndexParseError![]i64 {            const str_attr = self.op.getAttrAs(ir.Attribute.StringAttr, "indices") orelse {                if (self.op.getAttr("indices") == null) return error.MissingIndices;                return error.InvalidIndices;            };            var it = std.mem.splitScalar(u8, str_attr.value, ',');            var count: usize = 0;            while (it.next()) |chunk| {                if (chunk.len == 0) return error.InvalidIndices;                if (count >= out.len) return error.TooManyIndices;                const value = std.fmt.parseInt(i64, chunk, 10) catch return error.InvalidIndices;                out[count] = value;                count += 1;            }            return out[0..count];        }    };    pub const VecConstantOp = struct {        op: *ir.Operation,        pub const operation_spec = op_specs.leaf(.{            .mnemonic = "vec_constant",            .interfaces = effects.entries(.vec_constant),            .operands = 0,            .results = 1,            .required_attrs = &.{"value"},            .properties = ir.singleAttributePropertiesModel("arith.vec_constant.properties", "value"),        });        pub const operation_name = operation_spec.name;        pub fn createInt(            ctx: *ir.Context,            loc: ir.Location,            result_type: ir.Type,            value: i64,        ) !VecConstantOp {            var builder = ir.OperationBuilder.init(ctx);            var state = op_specs.state(@This(), loc);            state.addTypes(&.{result_type});            const value_attr = try getIntAttr(ctx, value);            const uses_properties = try state.setPropertiesAttrIfRegistered(ctx, value_attr);            const op = try builder.create(state);            errdefer op.erase();            if (!uses_properties) try op.setAttr("value", value_attr);            return .{ .op = op };        }        pub fn createFloat(            ctx: *ir.Context,            loc: ir.Location,            result_type: ir.Type,            value: f64,        ) !VecConstantOp {            var builder = ir.OperationBuilder.init(ctx);            var state = op_specs.state(@This(), loc);            state.addTypes(&.{result_type});            const value_attr = try getFloatAttr(ctx, value);            const uses_properties = try state.setPropertiesAttrIfRegistered(ctx, value_attr);            const op = try builder.create(state);            errdefer op.erase();            if (!uses_properties) try op.setAttr("value", value_attr);            return .{ .op = op };        }        pub fn getResult(self: *const VecConstantOp) *ir.Value {            return self.op.getResult(0).?;        }        pub fn getIntValue(self: VecConstantOp) ?i64 {            const int_attr = self.op.getAttrAs(ir.Attribute.IntegerAttr, "value") orelse return null;            return int_attr.getValue();        }        pub fn getFloatValue(self: VecConstantOp) ?f64 {            const float_attr = self.op.getAttrAs(ir.Attribute.FloatAttr, "value") orelse return null;            return float_attr.getValue();        }    };    fn overflowOp(comptime mnemonic: []const u8, comptime kind: effects.Kind) type {        return struct {            op: *ir.Operation,            pub const operation_spec = op_specs.leaf(.{                .mnemonic = mnemonic,                .operands = 2,                .results = 2,                .operand_types = &.{                    ir.dialects.typeConstraint.exact(0, types.type_names.int64),                    ir.dialects.typeConstraint.exact(1, types.type_names.int64),                },                .result_types = &.{                    ir.dialects.typeConstraint.exact(0, types.type_names.int64),                    ir.dialects.typeConstraint.exact(1, types.type_names.boolean),                },                .traits = ir.OperationTraits{ .is_commutative = kind != .subo },                .interfaces = effects.entries(kind),            });            pub const operation_name = operation_spec.name;            pub fn create(                ctx: *ir.Context,                loc: ir.Location,                lhs: *ir.Value,                rhs: *ir.Value,            ) !@This() {                var builder = ir.OperationBuilder.init(ctx);                var state = op_specs.state(@This(), loc);                state.addOperands(&.{ lhs, rhs });                state.addTypes(&.{ lhs.type, try getScalarType(ctx, .bool) });                return .{ .op = try builder.create(state) };            }            pub fn getResult(self: @This()) *ir.Value {                return self.op.getResult(0).?;            }            pub fn getOverflow(self: @This()) *ir.Value {                return self.op.getResult(1).?;            }        };    }    fn loadSpec(ctx: *ir.Context) !void {        try ir.dialects.loadDialectSpec(ctx, spec);    }    fn sameTypeOptions(comptime traits: ir.OperationTraits) ir.dialects.opSpec.Options {        return .{            .traits = traits,            .dynamic_traits = ir.dialects.opSpec.dynamicTraits(.{ir.traits.SameOperandsAndResultType}),        };    }    fn effectOptions(        comptime kind: effects.Kind,        base: ir.dialects.opSpec.Options,    ) ir.dialects.opSpec.Options {        var result = base;        result.interfaces = effects.entries(kind);        return result;    }    fn commutativeSameTypeOptions() ir.dialects.opSpec.Options {        return sameTypeOptions(commutative_op_traits);    }    pub fn getScalarType(ctx: *ir.Context, kind: ScalarTypeKind) !ir.Type {        try loadSpec(ctx);        return ctx.getDialectTypeFromName(types.scalarTypeName(kind));    }    pub fn getI8Type(ctx: *ir.Context) !ir.Type {        return getScalarType(ctx, .i8);    }    pub fn getI16Type(ctx: *ir.Context) !ir.Type {        return getScalarType(ctx, .i16);    }    pub fn getU8Type(ctx: *ir.Context) !ir.Type {        return getScalarType(ctx, .u8);    }    pub fn getU16Type(ctx: *ir.Context) !ir.Type {        return getScalarType(ctx, .u16);    }    pub fn getI32Type(ctx: *ir.Context) !ir.Type {        return getScalarType(ctx, .i32);    }    pub fn getU32Type(ctx: *ir.Context) !ir.Type {        return getScalarType(ctx, .u32);    }    pub fn getU64Type(ctx: *ir.Context) !ir.Type {        return getScalarType(ctx, .u64);    }    pub fn getF16Type(ctx: *ir.Context) !ir.Type {        return getScalarType(ctx, .f16);    }    pub fn getBf16Type(ctx: *ir.Context) !ir.Type {        return getScalarType(ctx, .bf16);    }    pub fn getF64Type(ctx: *ir.Context) !ir.Type {        return getScalarType(ctx, .f64);    }    pub fn getIndexType(ctx: *ir.Context) !ir.Type {        return getScalarType(ctx, .index);    }    pub fn getVecType(ctx: *ir.Context, width: u32, element_type_name: []const u8) !?ir.Type {        try loadSpec(ctx);        const vec_name = types.vectorTypeNameForElement(width, element_type_name) orelse return null;        return try ctx.getDialectTypeFromName(vec_name);    }    pub fn getVec4xF32Type(ctx: *ir.Context) !ir.Type {        try loadSpec(ctx);        return ctx.getDialectTypeFromName(types.type_names.vec4xf32);    }    pub fn getVec4xI32Type(ctx: *ir.Context) !ir.Type {        try loadSpec(ctx);        return ctx.getDialectTypeFromName(types.type_names.vec4xi32);    }    pub fn getVec8xF32Type(ctx: *ir.Context) !ir.Type {        try loadSpec(ctx);        return ctx.getDialectTypeFromName(types.type_names.vec8xf32);    }    pub fn getVec8xI32Type(ctx: *ir.Context) !ir.Type {        try loadSpec(ctx);        return ctx.getDialectTypeFromName(types.type_names.vec8xi32);    }    pub fn getIntAttr(ctx: *ir.Context, value: i64) !ir.Attribute {        return ctx.getI64Attr(value);    }    pub fn getIntValue(attr: ir.Attribute) ?i64 {        const int_attr = attr.cast(ir.Attribute.IntegerAttr) orelse return null;        return int_attr.getValue();    }    pub fn getFloatAttr(ctx: *ir.Context, value: f64) !ir.Attribute {        return ctx.getF64Attr(value);    }    pub fn getFloatValue(attr: ir.Attribute) ?f64 {        const float_attr = attr.cast(ir.Attribute.FloatAttr) orelse return null;        return float_attr.getValue();    }    pub fn getBoolAttr(ctx: *ir.Context, value: bool) !ir.Attribute {        return ctx.getBoolAttr(value);    }    pub fn getBoolValue(attr: ir.Attribute) ?bool {        const bool_attr = attr.cast(ir.Attribute.BoolAttr) orelse return null;        return bool_attr.getValue();    }};

Source: lib/choir/src/dialects/root.zig:14

zig
pub const ArithDialect = arith.ArithDialect;
Called byCallsprivate sourcelib.accy.src.kernel.model.core.builder.Buildercompareprivate sourcelib.chant.src.lower.expression.binarylowerprivate sourcelib.chant.src.lower.expression.builtinemitCmpprivate sourcelib.chant.src.lower.statement.conditionlowerprivate sourcelib.choir.src.backends.aarch64.backendblockCompare+29 moredialects.ArithDialectgetScalarTypedialects.ArithDialect.CmpOpcreate
Static calls · unresolved targets: 0 · external targets: 9.
Called byCallsprivate sourcelib.accy.src.kernel.model.core.builder.BuilderconstantBoolprivate sourcelib.choir.src.backends.aarch64.backendblockConstanttest sourcelib.choir.src.backends.aarch64.backendtest: aarch64 native admitted scalar ...test sourcelib.choir.src.backends.aarch64.backendtest: aarch64 native boolean argument...test sourcelib.choir.src.backends.gpu.nvptx.conversiontest: nvptx conversion lowers gpu idx...+28 moredialects.ArithDialectgetBoolAttrdialects.ArithDialectgetScalarTypedialects.ArithDialect.ConstantOpcreateBool
Static calls · unresolved targets: 0 · external targets: 7.
Called byCallsprivate sourcelib.accy.src.kernel.model.core.builder.BuilderconstantFloatprivate sourcelib.chant.src.lower.expression.atomlowerFloatLiteralprivate sourcelib.chant.src.lower.localzeroValuetest sourcelib.choir.src.backends.aarch64.backendtest: aarch64 control rejects floatin...private sourcelib.choir.src.backends.gpu.cpu.stage.LowererlowerSample+57 moredialects.ArithDialectgetFloatAttrdialects.ArithDialect.ConstantOpcreateFloat
Static calls · unresolved targets: 0 · external targets: 7.
Called byCallsprivate sourcelib.accy.src.kernel.model.core.builder.BuilderconstantIndexprivate sourcelib.accy.src.kernel.model.core.builder.BuilderconstantIntprivate sourcelib.accy.src.validation.composition.hostbuildModuletiny.chantlower.emitindexConstantprivate sourcelib.chant.src.lower.expression.atomlowerIntegerLiteral+161 moredialects.ArithDialectgetIntAttrdialects.ArithDialect.ConstantOpcreateInt
Static calls · unresolved targets: 0 · external targets: 7.
Called byCallsprivate sourcelib.accy.src.kernel.model.core.builder.BuilderextractLanetest sourcelib.choir.src.backends.x64.backendtest: x86 64 JIT executes vec4xu32 ex...test sourcelib.choir.src.backends.x64.vectortest: x86 64 vector extract f64x2 emi...test sourcelib.choir.src.backends.x64.vectortest: x86 64 vector extract u32x4 emi...private sourcelib.choir.src.dialects.arith.opscheckArithConstructorAllocationFailur...+2 moredialects.ArithDialectgetIntAttrdialects.ArithDialect.ExtractOpcreate
Static calls · unresolved targets: 0 · external targets: 7.
Called byCallsprivate sourcelib.accy.src.kernel.model.core.builder.BuilderinsertLanetest sourcelib.choir.src.backends.x64.backend.test_x86_6...add over vec2xf64 through native pack...test sourcelib.choir.src.backends.x64.backend.test_x86_6...max over vec4xu32test sourcelib.choir.src.backends.x64.backend.test_x86_6...min over vec4xf32 with NaN lanestest sourcelib.choir.src.backends.x64.backend.test_x86_6...neg over vec4xu32 through native pack...+10 moredialects.ArithDialectgetIntAttrdialects.ArithDialect.InsertOpcreate
Static calls · unresolved targets: 0 · external targets: 7.
Called byCallsNo direct callsprivate sourcelib.accy.src.kernel.model.core.builder.Buildercomparetest sourcelib.choir.src.backends.x64.vectortest: x86 64 vector cmp f32x4 lt emit...test sourcelib.choir.src.backends.x64.vectortest: x86 64 vector cmp f64x2 ge emit...test sourcelib.choir.src.backends.x64.vectortest: x86 64 vector cmp i32x4 slt emi...test sourcelib.choir.src.backends.x64.vectortest: x86 64 vector cmp i64x2 eq emit...+8 moredialects.ArithDialect.VecCmpOpcreate
Static calls · unresolved targets: 0 · external targets: 9.
Called byCallstest sourcelib.choir.src.backends.x64.backend.test_x86_6...add over vec2xf64 through native pack...test sourcelib.choir.src.backends.x64.backend.test_x86_6...min over vec4xf32 with NaN lanestest sourcelib.choir.src.backends.x64.backendtest: x86 64 JIT executes vec2xf64 ne...test sourcelib.choir.src.backends.x64.backendtest: x86 64 JIT executes vec4xf32 th...test sourcelib.choir.src.backends.x64.vectortest: x86 64 vector binary f32x4 div ...+26 moredialects.ArithDialectgetFloatAttrdialects.ArithDialect.VecConstantOpcreateFloat
Static calls · unresolved targets: 0 · external targets: 7.
Called byCallstest sourcelib.choir.src.backends.x64.backend.test_x86_6...popcount over vec2xu64 through native...test sourcelib.choir.src.backends.x64.backend.test_x86_6...popcount over vec4xu32 through native...test sourcelib.choir.src.backends.x64.backend.test_x86_6...select over vec4xu32 with scalar bool...test sourcelib.choir.src.backends.x64.backend.test_x86_6...umulhi over vec4xu32 through native p...test sourcelib.choir.src.backends.x64.backend.test_x86_6...max over vec4xu32+48 moredialects.ArithDialectgetIntAttrdialects.ArithDialect.VecConstantOpcreateInt
Static calls · unresolved targets: 0 · external targets: 7.
Called byCallsprivate sourcelib.accy.src.kernel.model.core.builder.BuildershuffleVectortest sourcelib.choir.src.backends.x64.backendtest: x86 64 JIT executes vec2xf64 sp...test sourcelib.choir.src.backends.x64.backendtest: x86 64 JIT executes vec4xf32 th...test sourcelib.choir.src.backends.x64.backendtest: x86 64 JIT executes vec4xu32 sh...test sourcelib.choir.src.backends.x64.vectortest: x86 64 vector shuffle f32x4 emi...+6 moreir.formatappendFmtdialects.ArithDialect.VecShuffleOpcreate
Static calls · unresolved targets: 0 · external targets: 8.
Called byCallstest sourcelib.choir.src.dialects.arith.testtest: ArithDialect registers bf16 sca...dialects.ArithDialectgetScalarTypedialects.ArithDialectgetBf16Type
Static calls · unresolved targets: 0 · external targets: 0.
Called byCallsNo direct callsdialects.ArithDialect.ConstantOpcreateBooltest sourcelib.choir.src.dialects.arith.testtest: arith dialect registers semanti...dialects.ArithDialectgetBoolAttr
Static calls · unresolved targets: 0 · external targets: 1.
Called byCallsNo direct callstest sourcelib.choir.src.dialects.arith.testtest: overflow arithmetic evaluator r...dialects.ArithDialectgetBoolValue
Static calls · unresolved targets: 0 · external targets: 2.
Called byCallstest sourcelib.choir.src.backends.x64.backend.test_x86_6...cast: f16 still rejected (no Float16 ...dialects.ArithDialectgetScalarTypedialects.ArithDialectgetF16Type
Static calls · unresolved targets: 0 · external targets: 0.
Called byCallsprivate sourcelib.choir.src.backends.x64.backendrunUnaryFloatInScfIftest sourcelib.choir.src.backends.x64.backend.test_x86_6...fma rejects f16, integers, and mismat...test sourcelib.choir.src.backends.x64.backend.test_x86_6...if body (emitArithMinMax via dispatch...test sourcelib.choir.src.backends.x64.backend.test_x86_6...if body (emitArithLibmBinary via disp...test sourcelib.choir.src.dialects.arith.test.test_arithfma with mismatched 3rd operand fails...+2 moredialects.ArithDialectgetScalarTypedialects.ArithDialectgetF64Type
Static calls · unresolved targets: 0 · external targets: 0.
Called byCallsNo direct callsdialects.ArithDialect.ConstantOpcreateFloatdialects.ArithDialect.VecConstantOpcreateFloatdialects.ArithDialectgetFloatAttr
Static calls · unresolved targets: 0 · external targets: 1.
Called byCallsNo direct callersdialects.ArithDialectgetScalarTypedialects.ArithDialectgetI16Type
Static calls · unresolved targets: 0 · external targets: 0.
Called byCallstest sourcelib.choir.src.backends.contracttest: verifyModuleWithOptionsAndDiagn...test sourcelib.choir.src.backends.gpu.nvptx.conversiontest: nvptx conversion lowers gpu idx...private sourcelib.choir.src.backends.gpu.spirv.emitter.codegenbuildReductionKernelJobprivate sourcelib.choir.src.backends.gpu.spirv.emitter.codegenbuildVecAddKernelJobtest sourcelib.choir.src.backends.gpu.spirv.emitter.codegentest: spirv catalog drives supported ...+44 moredialects.ArithDialectgetScalarTypedialects.ArithDialectgetI32Type
Static calls · unresolved targets: 0 · external targets: 0.
Called byCallstest sourcelib.choir.src.dialects.arith.testtest: Precision1 partial integer doma...dialects.ArithDialectgetScalarTypedialects.ArithDialectgetI8Type
Static calls · unresolved targets: 0 · external targets: 0.
Called byCallsprivate sourcelib.accy.src.kernel.model.core.builder.BuildercastIndexprivate sourcelib.accy.src.kernel.model.core.builder.BuilderconstantIndextiny.chantlower.converttoIndextiny.chantlower.emitindexConstantprivate sourcelib.choir.src.backends.gpu.cpu.loweringcreateIndexConstant+34 moredialects.ArithDialectgetScalarTypedialects.ArithDialectgetIndexType
Static calls · unresolved targets: 0 · external targets: 0.
Called byCallsNo direct callsdialects.ArithDialect.ConstantOpcreateIntdialects.ArithDialect.ExtractOpcreatedialects.ArithDialect.InsertOpcreatedialects.ArithDialect.VecConstantOpcreateIntdialects.ArithDialectgetIntAttr
Static calls · unresolved targets: 0 · external targets: 1.
Called byCallsNo direct callsprivate sourcelib.choir.src.backends.aarch64.backendexpectEvaluatortest sourcelib.choir.src.dialects.arith.testtest: overflow arithmetic evaluator r...private sourcelib.choir.src.properties.codegenevaluatedResultsdialects.ArithDialectgetIntValue
Static calls · unresolved targets: 0 · external targets: 2.
Called byCallsprivate sourcelib.accy.src.kernel.model.core.builderscalarTypeprivate sourcelib.accy.src.validation.composition.hostbuildModuletiny.chantlower.convertscalarTypeprivate sourcelib.choir.src.backends.aarch64.backend.WitnessinitSignatureprivate sourcelib.choir.src.backends.aarch64.backendblockConstant+203 moreprivate sourcelib.choir.src.dialects.arith.ops.ArithDialectloadSpecdialects.arith.typesscalarTypeNamedialects.ArithDialectgetScalarType
Static calls · unresolved targets: 0 · external targets: 1.
Called byCallsNo direct callersdialects.ArithDialectgetScalarTypedialects.ArithDialectgetU16Type
Static calls · unresolved targets: 0 · external targets: 0.
Called byCallstest sourcelib.choir.src.dialects.arith.testtest: ArithDialect registers unsigned...dialects.ArithDialectgetScalarTypedialects.ArithDialectgetU32Type
Static calls · unresolved targets: 0 · external targets: 0.
Called byCallstest sourcelib.choir.src.dialects.arith.testtest: ArithDialect registers unsigned...dialects.ArithDialectgetScalarTypedialects.ArithDialectgetU64Type
Static calls · unresolved targets: 0 · external targets: 0.
Called byCallsNo direct callersdialects.ArithDialectgetScalarTypedialects.ArithDialectgetU8Type
Static calls · unresolved targets: 0 · external targets: 0.
Called byCallsprivate sourcelib.choir.src.dialects.arith.opscheckArithConstructorAllocationFailur...test sourcelib.choir.src.dialects.arith.test.test_ArithD...AddOp creates vector additiontest sourcelib.choir.src.dialects.arith.test.test_ArithD...ExtractOp creates vector extracttest sourcelib.choir.src.dialects.arith.test.test_ArithD...InsertOp creates vector inserttest sourcelib.choir.src.dialects.arith.test.test_ArithD...NegOp creates vector negation+8 moreprivate sourcelib.choir.src.dialects.arith.ops.ArithDialectloadSpecdialects.ArithDialectgetVec4xF32Type
Static calls · unresolved targets: 0 · external targets: 1.
Called byCallsprivate sourcelib.choir.src.dialects.arith.opscheckArithConstructorAllocationFailur...test sourcelib.choir.src.dialects.arith.test.test_ArithD...MulOp creates vector multiplicationtest sourcelib.choir.src.dialects.arith.test.test_ArithD...VecShuffleOp creates vector shuffleprivate sourcelib.choir.src.dialects.arith.ops.ArithDialectloadSpecdialects.ArithDialectgetVec4xI32Type
Static calls · unresolved targets: 0 · external targets: 1.
Called byCallsNo direct callersprivate sourcelib.choir.src.dialects.arith.ops.ArithDialectloadSpecdialects.ArithDialectgetVec8xF32Type
Static calls · unresolved targets: 0 · external targets: 1.
Called byCallsNo direct callersprivate sourcelib.choir.src.dialects.arith.ops.ArithDialectloadSpecdialects.ArithDialectgetVec8xI32Type
Static calls · unresolved targets: 0 · external targets: 1.
Called byCallsprivate sourcelib.accy.src.kernel.model.core.buildermemrefVectorTypeprivate sourcelib.accy.src.kernel.model.core.builderscalarVectorTypetest sourcelib.choir.src.backends.x64.backend.test_x86_6...popcount over vec2xu64 through native...test sourcelib.choir.src.backends.x64.backend.test_x86_6...popcount over vec4xu32 through native...test sourcelib.choir.src.backends.x64.backend.test_x86_6...select over vec4xu32 with scalar bool...+83 moreprivate sourcelib.choir.src.dialects.arith.ops.ArithDialectloadSpecdialects.arith.typesvectorTypeNameForElementdialects.ArithDialectgetVecType
Static calls · unresolved targets: 0 · external targets: 1.

Also reachable as

dialects.arith.ArithDialect.

Complete caller list for dialects.ArithDialect.CmpOp.create

34 direct callers.

Complete caller list for dialects.ArithDialect.ConstantOp.createBool

33 direct callers.

Complete caller list for dialects.ArithDialect.ConstantOp.createFloat

62 direct callers.

Complete caller list for dialects.ArithDialect.ConstantOp.createInt

166 direct callers.

Complete caller list for dialects.ArithDialect.ExtractOp.create

7 direct callers.

Complete caller list for dialects.ArithDialect.InsertOp.create

15 direct callers.

Complete caller list for dialects.ArithDialect.VecCmpOp.create

13 direct callers.

Complete caller list for dialects.ArithDialect.VecConstantOp.createFloat

31 direct callers.

Complete caller list for dialects.ArithDialect.VecConstantOp.createInt

53 direct callers.

Complete caller list for dialects.ArithDialect.VecShuffleOp.create

11 direct callers.

Complete caller list for dialects.ArithDialect.getF64Type

7 direct callers.

Complete caller list for dialects.ArithDialect.getI32Type

49 direct callers.

Complete caller list for dialects.ArithDialect.getIndexType

39 direct callers.

Complete caller list for dialects.ArithDialect.getScalarType

208 direct callers.

Complete caller list for dialects.ArithDialect.getVec4xF32Type

13 direct callers.

Complete caller list for dialects.ArithDialect.getVecType

88 direct callers.

Audit

Definitions118
Public names236
Members10
Version26.7.0
Revisiondaab053ee433