Csl
csl
¶
The CSL dialect models the Cerebras Systems Language.
It aims to be used as a target (using the -t cls commandline option) to do automatic
codegen for the CS2.
See external documentation.
Target = Literal['wse2', 'wse3']
module-attribute
¶
StructLikeConstr = base(ImportedModuleType) | base(ComptimeStructType)
module-attribute
¶
IntPtrCastTypeConstr = base(PtrType) | base(IntegerType) | base(IndexType)
module-attribute
¶
DsdElementTypeConstr = base(Float16Type) | base(Float32Type) | eq(IntegerType(16, Signedness.SIGNED)) | eq(IntegerType(16, Signedness.UNSIGNED)) | eq(IntegerType(32, Signedness.SIGNED)) | eq(IntegerType(32, Signedness.UNSIGNED))
module-attribute
¶
f16_pointer = PtrType(f16, PtrKindAttr(PtrKind.SINGLE), PtrConstAttr(PtrConst.VAR))
module-attribute
¶
f32_pointer = PtrType(f32, PtrKindAttr(PtrKind.SINGLE), PtrConstAttr(PtrConst.VAR))
module-attribute
¶
i8_value = IntegerType(8, Signedness.SIGNED)
module-attribute
¶
u16_value = IntegerType(16, Signedness.UNSIGNED)
module-attribute
¶
i16_value = IntegerType(16, Signedness.SIGNED)
module-attribute
¶
u32_value = IntegerType(32, Signedness.UNSIGNED)
module-attribute
¶
i32_value = IntegerType(32, Signedness.SIGNED)
module-attribute
¶
i16_pointer = PtrType(i16_value, PtrKindAttr(PtrKind.SINGLE), PtrConstAttr(PtrConst.VAR))
module-attribute
¶
u16_pointer = PtrType(u16_value, PtrKindAttr(PtrKind.SINGLE), PtrConstAttr(PtrConst.VAR))
module-attribute
¶
i32_pointer = PtrType(i32_value, PtrKindAttr(PtrKind.SINGLE), PtrConstAttr(PtrConst.VAR))
module-attribute
¶
u32_pointer = PtrType(u32_value, PtrKindAttr(PtrKind.SINGLE), PtrConstAttr(PtrConst.VAR))
module-attribute
¶
ColorId = IntegerType[Literal[5, 6], Signedness.UNSIGNED]
module-attribute
¶
ColorIdAttr: TypeAlias = IntegerAttr[ColorId]
module-attribute
¶
I3 = IntegerType[3, Signedness.SIGNLESS]
module-attribute
¶
QueueIdAttr: TypeAlias = IntegerAttr[I3]
module-attribute
¶
ParamAttr: TypeAlias = FloatAttr | IntegerAttr
module-attribute
¶
ZerosOpAttr: TypeAlias = IntegerType | Float32Type | Float16Type
module-attribute
¶
ZerosOpAttrConstr = BaseAttr(IntegerType) | BaseAttr(Float32Type) | BaseAttr(Float16Type)
module-attribute
¶
FunctionSignatures = list[tuple[Attribute | type[Attribute], ...]]
module-attribute
¶
ParamOpAttr: TypeAlias = Float16Type | Float32Type | IntegerType | ColorType | FunctionType | ImportedModuleType | ComptimeStructType
module-attribute
¶
ParamOpAttrConstr = BaseAttr(Float16Type) | BaseAttr(Float32Type) | BaseAttr(IntegerType) | BaseAttr(ColorType) | BaseAttr(FunctionType) | BaseAttr(ImportedModuleType) | BaseAttr(ComptimeStructType)
module-attribute
¶
CSL = Dialect('csl', [Add16Op, Add16cOp, AddressOfFnOp, AddressOfOp, And16Op, CallOp, ClzOp, ConcatStructOp, ConstStrOp, ConstStructOp, ConstantsOp, CslModuleOp, CtzOp, DirectionOp, FabshOp, FabssOp, FaddhOp, FaddhsOp, FaddsOp, Fh2sOp, Fh2xp16Op, FmachOp, FmachsOp, FmacsOp, FmaxhOp, FmaxsOp, FmovhOp, FmovsOp, FmulhOp, FmulsOp, FneghOp, FnegsOp, FnormhOp, FnormsOp, Fs2hOp, Fs2xp16Op, FscalehOp, FscalesOp, FsubhOp, FsubsOp, FuncOp, GetColorOp, GetFabDsdOp, GetMemDsdOp, ImportModuleConstOp, IncrementDsdOffsetOp, IntPtrCastOp, LayoutOp, MemberAccessOp, MemberCallOp, Mov16Op, Mov32Op, Or16Op, ParamOp, PopcntOp, PtrCastOp, ReturnOp, RpcOp, Sar16Op, SetDsdBaseAddrOp, SetDsdLengthOp, SetDsdStrideOp, SetRectangleOp, SetTileCodeOp, SignednessCastOp, Sll16Op, Slr16Op, Sub16Op, SymbolExportOp, TaskOp, ActivateOp, Xor16Op, Xp162fhOp, Xp162fsOp, ZerosOp, VariableOp, LoadVarOp, StoreVarOp], [ColorType, ComptimeStringType, ComptimeStructType, DsdType, ImportedModuleType, PtrType, ModuleKindAttr, DirectionAttr, DirectionType, PtrConstAttr, PtrKindAttr, TaskKindAttr, VarType], [CslConstantMaterializationInterface()])
module-attribute
¶
PtrKind
¶
PtrConst
¶
ModuleKind
¶
InModuleKind
dataclass
¶
Bases: OpTrait
Constrain an op to a particular module kind
Optionally specify if the op has to be a direct child of CslModuleOp (default is yes).
Ops with this trait are always allowed inside a csl_wrapper.module
Source code in xdsl/dialects/csl.py
kind: ModuleKind = field()
class-attribute
instance-attribute
¶
_: KW_ONLY
instance-attribute
¶
direct_child: bool = field(default=True)
class-attribute
instance-attribute
¶
__init__(kind: ModuleKind = field(), *, direct_child: bool = True) -> None
¶
verify(op: Operation) -> None
¶
Source code in xdsl/dialects/csl.py
ComptimeStructType
dataclass
¶
Bases: ParametrizedAttribute, TypeAttribute
Represents a compile time struct.
The type makes no guarantees on the fields available.
Source code in xdsl/dialects/csl.py
name = 'csl.comptime_struct'
class-attribute
instance-attribute
¶
ImportedModuleType
dataclass
¶
Bases: ParametrizedAttribute, TypeAttribute
Represents an imported module (behaves the same as a comptime_struct otherwise).
The type makes no guarantees on the fields available.
Source code in xdsl/dialects/csl.py
name = 'csl.imported_module'
class-attribute
instance-attribute
¶
ComptimeStringType
dataclass
¶
Bases: ParametrizedAttribute, TypeAttribute
Represents a compile time string.
Source code in xdsl/dialects/csl.py
name = 'csl.comptime_string'
class-attribute
instance-attribute
¶
PtrKindAttr
dataclass
¶
Bases: EnumAttribute[PtrKind], SpacedOpaqueSyntaxAttribute
Attribute representing whether a pointer is a single () or many ([]) pointer
Source code in xdsl/dialects/csl.py
name = 'csl.ptr_kind'
class-attribute
instance-attribute
¶
PtrConstAttr
dataclass
¶
Bases: EnumAttribute[PtrConst], SpacedOpaqueSyntaxAttribute
Attribute representing whether a pointer's mutability
Source code in xdsl/dialects/csl.py
name = 'csl.ptr_const'
class-attribute
instance-attribute
¶
ModuleKindAttr
dataclass
¶
Bases: EnumAttribute[ModuleKind], SpacedOpaqueSyntaxAttribute
Attribute representing the kind of CSL module, either layout or program
Source code in xdsl/dialects/csl.py
name = 'csl.module_kind'
class-attribute
instance-attribute
¶
TaskKindAttr
dataclass
¶
Bases: EnumAttribute[TaskKind], SpacedOpaqueSyntaxAttribute
Source code in xdsl/dialects/csl.py
DirectionAttr
dataclass
¶
Bases: EnumAttribute[Direction], SpacedOpaqueSyntaxAttribute
Source code in xdsl/dialects/csl.py
name = 'csl.dir_kind'
class-attribute
instance-attribute
¶
DirectionType
dataclass
¶
Bases: ParametrizedAttribute, TypeAttribute
Source code in xdsl/dialects/csl.py
name = 'csl.direction'
class-attribute
instance-attribute
¶
PtrType
dataclass
¶
Bases: ParametrizedAttribute, TypeAttribute, ContainerType
Represents a typed pointer in CSL.
kind refers to CSL having two types of pointers, single *type and many [*]type.
Source code in xdsl/dialects/csl.py
PtrCastOp
¶
Bases: IRDLOperation
Implements @ptrcast(destination_ptr_type, ptr)
Source code in xdsl/dialects/csl.py
IntPtrCastOp
¶
Bases: IRDLOperation
Implements @bitcast(destination_type, value) between a pointer and an integer.
Exactly one of the input and result types must be a pointer, the other must be
an integer or index. Use csl.ptrcast for pointer to pointer casts.
Source code in xdsl/dialects/csl.py
name = 'csl.intptrcast'
class-attribute
instance-attribute
¶
input = operand_def(IntPtrCastTypeConstr)
class-attribute
instance-attribute
¶
result = result_def(IntPtrCastTypeConstr)
class-attribute
instance-attribute
¶
traits = traits_def(NoMemoryEffect())
class-attribute
instance-attribute
¶
assembly_format = '$input attr-dict `:` type($input) `to` type($result)'
class-attribute
instance-attribute
¶
__init__(input: Operation | SSAValue, result_type: PtrType | IntegerType | IndexType)
¶
verify_() -> None
¶
Source code in xdsl/dialects/csl.py
DsdType
dataclass
¶
Bases: EnumAttribute[DsdKind], TypeAttribute, SpacedOpaqueSyntaxAttribute
Represents a DSD in CSL.
Source code in xdsl/dialects/csl.py
name = 'csl.dsd'
class-attribute
instance-attribute
¶
ColorType
dataclass
¶
Bases: ParametrizedAttribute, TypeAttribute
Type representing a color type in CSL
Source code in xdsl/dialects/csl.py
name = 'csl.color'
class-attribute
instance-attribute
¶
VarType
dataclass
¶
Bases: ParametrizedAttribute, TypeAttribute, ContainerType
Source code in xdsl/dialects/csl.py
VariableOp
dataclass
¶
Bases: IRDLOperation
Declares a variable.
The variable cannot be mutated directly. SSA values of the variable have to be loaded and stored using LoadVarOp and StoreVarOp.
This is similar to how memref works.
Source code in xdsl/dialects/csl.py
name = 'csl.variable'
class-attribute
instance-attribute
¶
default = opt_prop_def(ParamAttr)
class-attribute
instance-attribute
¶
res = result_def(VarType)
class-attribute
instance-attribute
¶
assembly_format = '`(` $default `)` `:` type($res) attr-dict'
class-attribute
instance-attribute
¶
get_element_type()
¶
from_type(child_type: Attribute) -> VariableOp
staticmethod
¶
from_value(value: ParamAttr) -> VariableOp
staticmethod
¶
verify_() -> None
¶
Source code in xdsl/dialects/csl.py
LoadVarOp
¶
Bases: IRDLOperation
Obtain the SSA value of a CSL variable. The obtained value itself is not
modifiable, but it can be stored in the variable using StoreVarOp.
Source code in xdsl/dialects/csl.py
name = 'csl.load_var'
class-attribute
instance-attribute
¶
var = operand_def(VarType)
class-attribute
instance-attribute
¶
res = result_def()
class-attribute
instance-attribute
¶
traits = traits_def(MemoryReadEffect())
class-attribute
instance-attribute
¶
assembly_format = '`(` $var `:` type($var) `)` `:` type($res) attr-dict'
class-attribute
instance-attribute
¶
__init__(var: VariableOp | SSAValue)
¶
Source code in xdsl/dialects/csl.py
verify_() -> None
¶
Source code in xdsl/dialects/csl.py
StoreVarOp
¶
Bases: IRDLOperation
Update the value of a variable.
Source code in xdsl/dialects/csl.py
name = 'csl.store_var'
class-attribute
instance-attribute
¶
var = operand_def(VarType)
class-attribute
instance-attribute
¶
new_value = operand_def()
class-attribute
instance-attribute
¶
traits = traits_def(MemoryWriteEffect())
class-attribute
instance-attribute
¶
assembly_format = '$var `:` type($var) `=` $new_value `:` type($new_value) attr-dict'
class-attribute
instance-attribute
¶
__init__(var: VariableOp, new_value: Operation | SSAValue)
¶
verify_() -> None
¶
Source code in xdsl/dialects/csl.py
DirectionOp
¶
Bases: IRDLOperation
Source code in xdsl/dialects/csl.py
name = 'csl.get_dir'
class-attribute
instance-attribute
¶
dir = prop_def(DirectionAttr)
class-attribute
instance-attribute
¶
res = result_def(DirectionType)
class-attribute
instance-attribute
¶
traits = traits_def(NoMemoryEffect())
class-attribute
instance-attribute
¶
__init__(direction: DirectionAttr | Direction)
¶
CslModuleOp
dataclass
¶
Bases: IRDLOperation
Separates layout module from program module
Source code in xdsl/dialects/csl.py
name = 'csl.module'
class-attribute
instance-attribute
¶
body = region_def('single_block')
class-attribute
instance-attribute
¶
kind = prop_def(ModuleKindAttr)
class-attribute
instance-attribute
¶
sym_name = prop_def(SymbolNameConstraint())
class-attribute
instance-attribute
¶
traits = traits_def(HasParent(ModuleOp), IsolatedFromAbove(), NoTerminator(), SymbolOpInterface())
class-attribute
instance-attribute
¶
ImportModuleConstOp
¶
Bases: IRDLOperation
Equivalent to an const <va_name> = @import_module("<module_name>", <params>) call.
Source code in xdsl/dialects/csl.py
name = 'csl.import_module'
class-attribute
instance-attribute
¶
traits = traits_def(HasParent(CslModuleOp))
class-attribute
instance-attribute
¶
module = prop_def(StringAttr)
class-attribute
instance-attribute
¶
params = opt_operand_def(StructLikeConstr)
class-attribute
instance-attribute
¶
result = result_def(ImportedModuleType)
class-attribute
instance-attribute
¶
__init__(name: str | StringAttr, params: SSAValue | Operation | None = None)
¶
Source code in xdsl/dialects/csl.py
ConstStrOp
¶
Bases: IRDLOperation, HasFolderInterface
A compile time string literal.
Source code in xdsl/dialects/csl.py
name = 'csl.const_str'
class-attribute
instance-attribute
¶
traits = traits_def(Pure(), ConstantLike())
class-attribute
instance-attribute
¶
value = prop_def(StringAttr)
class-attribute
instance-attribute
¶
res = result_def(ComptimeStringType)
class-attribute
instance-attribute
¶
assembly_format = '$value attr-dict'
class-attribute
instance-attribute
¶
__init__(value: str | StringAttr)
¶
ConstStructOp
¶
Bases: IRDLOperation
Source code in xdsl/dialects/csl.py
name = 'csl.const_struct'
class-attribute
instance-attribute
¶
traits = traits_def(NoMemoryEffect())
class-attribute
instance-attribute
¶
items = opt_prop_def(DictionaryAttr)
class-attribute
instance-attribute
¶
ssa_fields = opt_prop_def(ArrayAttr[StringAttr])
class-attribute
instance-attribute
¶
ssa_values = var_operand_def()
class-attribute
instance-attribute
¶
res = result_def(ComptimeStructType)
class-attribute
instance-attribute
¶
__init__(*args: tuple[str | StringAttr, Operation | SSAValue])
¶
Source code in xdsl/dialects/csl.py
verify_() -> None
¶
Source code in xdsl/dialects/csl.py
ZerosOp
¶
Bases: IRDLOperation
Represents the @zeros operation in CSL.
Source code in xdsl/dialects/csl.py
name = 'csl.zeros'
class-attribute
instance-attribute
¶
T: ClassVar = VarConstraint('T', ZerosOpAttrConstr)
class-attribute
instance-attribute
¶
size = opt_operand_def(T)
class-attribute
instance-attribute
¶
result = result_def(MemRefType.constr(T))
class-attribute
instance-attribute
¶
is_const = opt_prop_def(builtin.UnitAttr)
class-attribute
instance-attribute
¶
__init__(memref: MemRefType[IntegerType | Float32Type | Float16Type], dynamic_size: SSAValue | Operation | None = None, is_const: builtin.UnitAttr | None = None)
¶
Source code in xdsl/dialects/csl.py
ConstantsOp
¶
Bases: IRDLOperation
Represents the @constants operation in CSL.
This can also be used as a stand-in for @zeros by passing a zero constant as the second argument.
If is_const is present, it is printed with the const prefix, otherwise it's assumed var by the csl printer.
Source code in xdsl/dialects/csl.py
name = 'csl.constants'
class-attribute
instance-attribute
¶
T: ClassVar = VarConstraint('T', BaseAttr(IntegerType) | BaseAttr(Float32Type) | BaseAttr(Float16Type))
class-attribute
instance-attribute
¶
size = operand_def(IntegerType)
class-attribute
instance-attribute
¶
value = operand_def(T)
class-attribute
instance-attribute
¶
result = result_def(MemRefType.constr(T))
class-attribute
instance-attribute
¶
is_const = opt_prop_def(builtin.UnitAttr)
class-attribute
instance-attribute
¶
__init__(size: SSAValue | Operation, value: SSAValue | Operation)
¶
GetColorOp
¶
Bases: IRDLOperation
Source code in xdsl/dialects/csl.py
MemberAccessOp
dataclass
¶
Bases: IRDLOperation
Access a member of a struct and assigna a new variable.
Source code in xdsl/dialects/csl.py
name = 'csl.member_access'
class-attribute
instance-attribute
¶
traits = traits_def(NoMemoryEffect())
class-attribute
instance-attribute
¶
struct = operand_def(StructLikeConstr)
class-attribute
instance-attribute
¶
field = prop_def(StringAttr)
class-attribute
instance-attribute
¶
result = result_def(Attribute)
class-attribute
instance-attribute
¶
MemberCallOp
¶
Bases: IRDLOperation
Call a member of a struct, optionally assign a value to the result.
Source code in xdsl/dialects/csl.py
name = 'csl.member_call'
class-attribute
instance-attribute
¶
struct = operand_def(StructLikeConstr)
class-attribute
instance-attribute
¶
field = prop_def(StringAttr)
class-attribute
instance-attribute
¶
args = var_operand_def(Attribute)
class-attribute
instance-attribute
¶
result = opt_result_def(Attribute)
class-attribute
instance-attribute
¶
__init__(fname: str | StringAttr, result_type: Attribute | None, struct: Operation, params: Sequence[SSAValue | Operation])
¶
Source code in xdsl/dialects/csl.py
FuncOp
¶
Bases: _FuncBase
Almost the same as func.func, but only has one result, and is not isolated from above.
We dropped IsolatedFromAbove because CSL functions often times access global parameters or constants.
Source code in xdsl/dialects/csl.py
name = 'csl.func'
class-attribute
instance-attribute
¶
__init__(name: str | StringAttr, function_type: FunctionType | tuple[Sequence[Attribute], Attribute | None], region: Region | type[Region.DEFAULT] = Region.DEFAULT, *, arg_attrs: ArrayAttr[DictionaryAttr] | None = None, res_attrs: ArrayAttr[DictionaryAttr] | None = None)
¶
Source code in xdsl/dialects/csl.py
verify_() -> None
¶
parse(parser: Parser) -> FuncOp
classmethod
¶
Source code in xdsl/dialects/csl.py
TaskOp
¶
Bases: _FuncBase
Represents a task in CSL. All three types of task are represented by this Op.
It carries the ID it should be bound to, in case of local and control tasks this is the task ID, in the case of the data task, it's the id of the color the task is bound to.
NOTE: Control tasks not yet implemented
Source code in xdsl/dialects/csl.py
897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 | |
name = 'csl.task'
class-attribute
instance-attribute
¶
kind = prop_def(TaskKindAttr)
class-attribute
instance-attribute
¶
id = opt_prop_def(ColorIdAttr)
class-attribute
instance-attribute
¶
traits = traits_def(InModuleKind(ModuleKind.PROGRAM))
class-attribute
instance-attribute
¶
__init__(name: str | StringAttr, function_type: FunctionType | tuple[Sequence[Attribute], Attribute | None], region: Region | type[Region.DEFAULT] = Region.DEFAULT, *, task_kind: TaskKindAttr | TaskKind, arg_attrs: ArrayAttr[DictionaryAttr] | None = None, res_attrs: ArrayAttr[DictionaryAttr] | None = None, id: ColorIdAttr | int | None)
¶
Source code in xdsl/dialects/csl.py
verify_() -> None
¶
Source code in xdsl/dialects/csl.py
parse(parser: Parser) -> TaskOp
classmethod
¶
Source code in xdsl/dialects/csl.py
ActivateOp
¶
Bases: IRDLOperation
This operation corresponds directly to the builtin @activate combined with a call to the
corresponding @get_<kind>_task_id to convert the numeric ID to a task id, e.g.:
Source code in xdsl/dialects/csl.py
name = 'csl.activate'
class-attribute
instance-attribute
¶
id = prop_def(ColorIdAttr)
class-attribute
instance-attribute
¶
kind = prop_def(TaskKindAttr)
class-attribute
instance-attribute
¶
assembly_format = 'attr-dict $kind `,` $id'
class-attribute
instance-attribute
¶
__init__(id: int | ColorIdAttr, kind: TaskKind | TaskKindAttr)
¶
Source code in xdsl/dialects/csl.py
ReturnOp
¶
Bases: IRDLOperation
Return for CSL operations such as functions and tasks.
Source code in xdsl/dialects/csl.py
name = 'csl.return'
class-attribute
instance-attribute
¶
ret_val = opt_operand_def(Attribute)
class-attribute
instance-attribute
¶
assembly_format = 'attr-dict ($ret_val^ `:` type($ret_val))?'
class-attribute
instance-attribute
¶
traits = traits_def(HasParent(FuncOp, TaskOp), IsTerminator())
class-attribute
instance-attribute
¶
__init__(return_val: SSAValue | Operation | None = None)
¶
verify_() -> None
¶
Source code in xdsl/dialects/csl.py
LayoutOp
¶
Bases: IRDLOperation
Source code in xdsl/dialects/csl.py
name = 'csl.layout'
class-attribute
instance-attribute
¶
body = region_def()
class-attribute
instance-attribute
¶
traits = traits_def(NoTerminator(), InModuleKind(ModuleKind.LAYOUT))
class-attribute
instance-attribute
¶
__init__(ops: Sequence[Operation] | Region)
¶
parse(parser: Parser) -> LayoutOp
classmethod
¶
CallOp
¶
Bases: IRDLOperation
Call a regular function or task by name
Source code in xdsl/dialects/csl.py
name = 'csl.call'
class-attribute
instance-attribute
¶
callee = prop_def(SymbolRefAttr)
class-attribute
instance-attribute
¶
args = var_operand_def(Attribute)
class-attribute
instance-attribute
¶
result = opt_result_def(Attribute)
class-attribute
instance-attribute
¶
__init__(callee: str | StringAttr | SymbolRefAttr, args: Sequence[SSAValue | Operation] | None = None, result: Attribute | None = None)
¶
Source code in xdsl/dialects/csl.py
SetRectangleOp
dataclass
¶
Bases: IRDLOperation
Source code in xdsl/dialects/csl.py
SetTileCodeOp
¶
Bases: IRDLOperation
Source code in xdsl/dialects/csl.py
name = 'csl.set_tile_code'
class-attribute
instance-attribute
¶
traits = traits_def(HasAncestor(LayoutOp))
class-attribute
instance-attribute
¶
file = prop_def(StringAttr)
class-attribute
instance-attribute
¶
x_coord = operand_def(IntegerType)
class-attribute
instance-attribute
¶
y_coord = operand_def(IntegerType)
class-attribute
instance-attribute
¶
params = opt_operand_def(ComptimeStructType)
class-attribute
instance-attribute
¶
__init__(fname: str | StringAttr, x_coord: SSAValue | Operation, y_coord: SSAValue | Operation, params: SSAValue | Operation | None = None)
¶
Source code in xdsl/dialects/csl.py
DsdOpHasCanonicalizationPatternsTrait
dataclass
¶
Bases: HasCanonicalizationPatternsTrait
Source code in xdsl/dialects/csl.py
get_canonicalization_patterns() -> tuple[RewritePattern, ...]
classmethod
¶
Source code in xdsl/dialects/csl.py
IncrementDsdOffsetOpHasCanonicalizationPatternsTrait
dataclass
¶
Bases: HasCanonicalizationPatternsTrait
Source code in xdsl/dialects/csl.py
get_canonicalization_patterns() -> tuple[RewritePattern, ...]
classmethod
¶
SetDsdLengthOpHasCanonicalizationPatternsTrait
dataclass
¶
Bases: HasCanonicalizationPatternsTrait
Source code in xdsl/dialects/csl.py
get_canonicalization_patterns() -> tuple[RewritePattern, ...]
classmethod
¶
SetDsdStrideOpHasCanonicalizationPatternsTrait
dataclass
¶
Bases: HasCanonicalizationPatternsTrait
Source code in xdsl/dialects/csl.py
get_canonicalization_patterns() -> tuple[RewritePattern, ...]
classmethod
¶
GetMemDsdOp
dataclass
¶
Bases: _GetDsdOp
CSL built-in for DSDs of the form
@get_dsd( [ mem1d_dsd | mem4d_dsd ] .{ .tensor_access = |i, j| {$sizes[0], $sizes[1]} -> \(array_var[\)strides[0] * i + $offsets[0], $strides[1] * j + offsets[1]] });
Source code in xdsl/dialects/csl.py
name = 'csl.get_mem_dsd'
class-attribute
instance-attribute
¶
base_addr = operand_def(base(MemRefType) | base(TensorType[Attribute]))
class-attribute
instance-attribute
¶
tensor_access = opt_prop_def(AffineMapAttr)
class-attribute
instance-attribute
¶
traits = traits_def(Pure(), DsdOpHasCanonicalizationPatternsTrait())
class-attribute
instance-attribute
¶
verify_() -> None
¶
Source code in xdsl/dialects/csl.py
GetFabDsdOp
dataclass
¶
Bases: _GetDsdOp
CSL built-in for DSDs of the form
@get_dsd( [ fabin_dsd | fabout_dsd ], .{ .extent = $sizes[0], .fabric_color = $fabric_color, .control = $control, # fabout_dsd only, not implemented .wavelet_index_offset = $wavelet_index_offset, # fabout_dsd only, not implemented });
Source code in xdsl/dialects/csl.py
name = 'csl.get_fab_dsd'
class-attribute
instance-attribute
¶
fabric_color = prop_def(ColorIdAttr)
class-attribute
instance-attribute
¶
queue_id = prop_def(QueueIdAttr)
class-attribute
instance-attribute
¶
control = opt_prop_def(BoolAttr)
class-attribute
instance-attribute
¶
wavelet_index_offset = opt_prop_def(BoolAttr)
class-attribute
instance-attribute
¶
verify_() -> None
¶
Source code in xdsl/dialects/csl.py
SetDsdBaseAddrOp
dataclass
¶
Bases: IRDLOperation
Returns a clone of the DSD with a different base_addr. Only works on memory DSDs, i.e. mem1d_dsd or mem4d_dsd.
Implements the CSL built-in @set_dsd_base_addr(input_dsd, base_addr)
Source code in xdsl/dialects/csl.py
name = 'csl.set_dsd_base_addr'
class-attribute
instance-attribute
¶
op = operand_def(DsdType)
class-attribute
instance-attribute
¶
base_addr = operand_def(base(MemRefType) | base(TensorType[Attribute]) | base(PtrType))
class-attribute
instance-attribute
¶
result = result_def(DsdType)
class-attribute
instance-attribute
¶
traits = traits_def(Pure())
class-attribute
instance-attribute
¶
verify_() -> None
¶
Source code in xdsl/dialects/csl.py
IncrementDsdOffsetOp
dataclass
¶
Bases: IRDLOperation
Returns a clone of the DSD with a different offset Only works on memory DSDs, i.e. mem1d_dsd or mem4d_dsd.
Implements the CSL built-in @increment_dsd_offset(input_dsd, offset, elem_type)
where offset is a 16-bit signed int that may be negative, and elem_type is used to convert offset into words (any u,i,f type of 16,32 bit) elem_type should be derived by the printer
Source code in xdsl/dialects/csl.py
name = 'csl.increment_dsd_offset'
class-attribute
instance-attribute
¶
op = operand_def(DsdType)
class-attribute
instance-attribute
¶
offset = operand_def(eq(i16) | eq(i16_value))
class-attribute
instance-attribute
¶
elem_type = prop_def(DsdElementTypeConstr)
class-attribute
instance-attribute
¶
result = result_def(DsdType)
class-attribute
instance-attribute
¶
traits = traits_def(Pure(), IncrementDsdOffsetOpHasCanonicalizationPatternsTrait())
class-attribute
instance-attribute
¶
verify_() -> None
¶
Source code in xdsl/dialects/csl.py
SetDsdLengthOp
dataclass
¶
Bases: IRDLOperation
Returns a clone of the DSD with a different length Only works on 1-dimensional DSDs, i.e., mem1d_dsd and any fabric DSDs
Implements the CSL built-in @set_dsd_length(input_dsd, length)
Source code in xdsl/dialects/csl.py
name = 'csl.set_dsd_length'
class-attribute
instance-attribute
¶
op = operand_def(DsdType)
class-attribute
instance-attribute
¶
length = operand_def(eq(i16) | eq(u16_value))
class-attribute
instance-attribute
¶
result = result_def(DsdType)
class-attribute
instance-attribute
¶
traits = traits_def(Pure(), SetDsdLengthOpHasCanonicalizationPatternsTrait())
class-attribute
instance-attribute
¶
SetDsdStrideOp
dataclass
¶
Bases: IRDLOperation
Returns a clone of the DSD with a different stride Only works mem1d_dsd
Implements the CSL built-in @set_dsd_stride(input_dsd, stride)
Source code in xdsl/dialects/csl.py
name = 'csl.set_dsd_stride'
class-attribute
instance-attribute
¶
op = operand_def(DsdType)
class-attribute
instance-attribute
¶
stride = operand_def(eq(i8) | eq(i8_value))
class-attribute
instance-attribute
¶
result = result_def(DsdType)
class-attribute
instance-attribute
¶
traits = traits_def(Pure(), SetDsdStrideOpHasCanonicalizationPatternsTrait())
class-attribute
instance-attribute
¶
BuiltinDsdOp
dataclass
¶
Bases: IRDLOperation, ABC
Source code in xdsl/dialects/csl.py
ops = var_operand_def()
class-attribute
instance-attribute
¶
SIGNATURES: FunctionSignatures
class-attribute
¶
verify_() -> None
¶
Source code in xdsl/dialects/csl.py
SymmetricBinary16BitOp
dataclass
¶
Bases: BuiltinDsdOp
Source code in xdsl/dialects/csl.py
SIGNATURES: FunctionSignatures = [(DsdType, DsdType, DsdType), (DsdType, i16_value, DsdType), (DsdType, u16_value, DsdType), (DsdType, DsdType, i16_value), (DsdType, DsdType, u16_value)]
class-attribute
¶
Unary16BitOp
dataclass
¶
Bases: BuiltinDsdOp
Source code in xdsl/dialects/csl.py
SIGNATURES: FunctionSignatures = [(DsdType, DsdType), (DsdType, i16_value), (DsdType, u16_value)]
class-attribute
¶
Add16Op
dataclass
¶
Bases: SymmetricBinary16BitOp
Source code in xdsl/dialects/csl.py
name = 'csl.add16'
class-attribute
instance-attribute
¶
Add16cOp
dataclass
¶
Bases: SymmetricBinary16BitOp
Source code in xdsl/dialects/csl.py
name = 'csl.addc16'
class-attribute
instance-attribute
¶
And16Op
dataclass
¶
Bases: SymmetricBinary16BitOp
Source code in xdsl/dialects/csl.py
name = 'csl.and16'
class-attribute
instance-attribute
¶
ClzOp
dataclass
¶
Bases: Unary16BitOp
Source code in xdsl/dialects/csl.py
name = 'csl.clz'
class-attribute
instance-attribute
¶
CtzOp
dataclass
¶
Bases: Unary16BitOp
Source code in xdsl/dialects/csl.py
name = 'csl.ctz'
class-attribute
instance-attribute
¶
FabshOp
dataclass
¶
Bases: BuiltinDsdOp
Source code in xdsl/dialects/csl.py
FabssOp
dataclass
¶
Bases: BuiltinDsdOp
Source code in xdsl/dialects/csl.py
FaddhOp
dataclass
¶
Bases: BuiltinDsdOp
Source code in xdsl/dialects/csl.py
FaddhsOp
dataclass
¶
Bases: BuiltinDsdOp
Source code in xdsl/dialects/csl.py
FaddsOp
dataclass
¶
Bases: BuiltinDsdOp
Source code in xdsl/dialects/csl.py
Fh2sOp
dataclass
¶
Bases: BuiltinDsdOp
Source code in xdsl/dialects/csl.py
Fh2xp16Op
dataclass
¶
Bases: BuiltinDsdOp
Source code in xdsl/dialects/csl.py
FmachOp
dataclass
¶
Bases: BuiltinDsdOp
Source code in xdsl/dialects/csl.py
FmachsOp
dataclass
¶
Bases: BuiltinDsdOp
Source code in xdsl/dialects/csl.py
FmacsOp
dataclass
¶
Bases: BuiltinDsdOp
Source code in xdsl/dialects/csl.py
FmaxhOp
dataclass
¶
Bases: BuiltinDsdOp
Source code in xdsl/dialects/csl.py
FmaxsOp
dataclass
¶
Bases: BuiltinDsdOp
Source code in xdsl/dialects/csl.py
FmovhOp
dataclass
¶
Bases: BuiltinDsdOp
Source code in xdsl/dialects/csl.py
FmovsOp
dataclass
¶
Bases: BuiltinDsdOp
Source code in xdsl/dialects/csl.py
FmulhOp
dataclass
¶
Bases: BuiltinDsdOp
Source code in xdsl/dialects/csl.py
FmulsOp
dataclass
¶
Bases: BuiltinDsdOp
Source code in xdsl/dialects/csl.py
FneghOp
dataclass
¶
Bases: BuiltinDsdOp
Source code in xdsl/dialects/csl.py
FnegsOp
dataclass
¶
Bases: BuiltinDsdOp
Source code in xdsl/dialects/csl.py
FnormhOp
dataclass
¶
Bases: BuiltinDsdOp
Source code in xdsl/dialects/csl.py
FnormsOp
dataclass
¶
Bases: BuiltinDsdOp
Source code in xdsl/dialects/csl.py
Fs2hOp
dataclass
¶
Bases: BuiltinDsdOp
Source code in xdsl/dialects/csl.py
Fs2xp16Op
dataclass
¶
Bases: BuiltinDsdOp
Implements @fs2xp16 Note: this actually converts to i16, not to i32
Source code in xdsl/dialects/csl.py
FscalehOp
dataclass
¶
Bases: BuiltinDsdOp
Source code in xdsl/dialects/csl.py
FscalesOp
dataclass
¶
Bases: BuiltinDsdOp
Source code in xdsl/dialects/csl.py
FsubhOp
dataclass
¶
Bases: BuiltinDsdOp
Source code in xdsl/dialects/csl.py
FsubsOp
dataclass
¶
Bases: BuiltinDsdOp
Source code in xdsl/dialects/csl.py
Mov16Op
dataclass
¶
Bases: BuiltinDsdOp
Source code in xdsl/dialects/csl.py
Mov32Op
dataclass
¶
Bases: BuiltinDsdOp
Source code in xdsl/dialects/csl.py
Or16Op
dataclass
¶
Bases: SymmetricBinary16BitOp
Source code in xdsl/dialects/csl.py
name = 'csl.or16'
class-attribute
instance-attribute
¶
PopcntOp
dataclass
¶
Bases: Unary16BitOp
Source code in xdsl/dialects/csl.py
name = 'csl.popcnt'
class-attribute
instance-attribute
¶
Sar16Op
dataclass
¶
Bases: SymmetricBinary16BitOp
Source code in xdsl/dialects/csl.py
name = 'csl.sar16'
class-attribute
instance-attribute
¶
Sll16Op
dataclass
¶
Bases: SymmetricBinary16BitOp
Source code in xdsl/dialects/csl.py
name = 'csl.sll16'
class-attribute
instance-attribute
¶
Slr16Op
dataclass
¶
Bases: SymmetricBinary16BitOp
Source code in xdsl/dialects/csl.py
name = 'csl.slr16'
class-attribute
instance-attribute
¶
Sub16Op
dataclass
¶
Bases: BuiltinDsdOp
Source code in xdsl/dialects/csl.py
Xor16Op
dataclass
¶
Bases: SymmetricBinary16BitOp
Source code in xdsl/dialects/csl.py
name = 'csl.xor16'
class-attribute
instance-attribute
¶
Xp162fhOp
dataclass
¶
Bases: BuiltinDsdOp
Source code in xdsl/dialects/csl.py
Xp162fsOp
dataclass
¶
Bases: BuiltinDsdOp
Source code in xdsl/dialects/csl.py
SymbolExportOp
¶
Bases: IRDLOperation
This op does not correspond to any particular csl operation, it allows a symbol to be exported in a single operation in both layout and program module.
It corresponds to @export_name in layout and @export_symbol in program.
This op comes in two modes
- var_name: StringAttr, type: PtrType, value: Op(PtrType)
- var_name: SymbolRefAttr, type: FunctionType, value: None
Source code in xdsl/dialects/csl.py
1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 | |
name = 'csl.export'
class-attribute
instance-attribute
¶
traits = traits_def(InModuleKind(ModuleKind.PROGRAM))
class-attribute
instance-attribute
¶
value = opt_operand_def(PtrType)
class-attribute
instance-attribute
¶
var_name = prop_def(base(StringAttr) | base(SymbolRefAttr))
class-attribute
instance-attribute
¶
type = prop_def(base(PtrType) | base(FunctionType))
class-attribute
instance-attribute
¶
__init__(sym_name: str | StringAttr, type_or_op: SSAValue | FunctionType)
¶
Source code in xdsl/dialects/csl.py
get_name() -> str
¶
verify_() -> None
¶
Source code in xdsl/dialects/csl.py
AddressOfFnOp
¶
Bases: IRDLOperation
Takes the address of a function from symbol ref.
Result has to have kind SINGLE and constness CONST
Source code in xdsl/dialects/csl.py
name = 'csl.addressof_fn'
class-attribute
instance-attribute
¶
fn_name = prop_def(SymbolRefAttr)
class-attribute
instance-attribute
¶
res = result_def(PtrType)
class-attribute
instance-attribute
¶
__init__(fn: FuncOp)
¶
Source code in xdsl/dialects/csl.py
verify_() -> None
¶
Source code in xdsl/dialects/csl.py
AddressOfOp
¶
Bases: IRDLOperation
Take the address of a scalar or an array (memref)
When taking the address of an array, the type of the returned pointer can be either a single pointer to the array or a many pointer to its contained type.
Source code in xdsl/dialects/csl.py
1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 | |
name = 'csl.addressof'
class-attribute
instance-attribute
¶
value = operand_def()
class-attribute
instance-attribute
¶
res = result_def(PtrType)
class-attribute
instance-attribute
¶
traits = traits_def(NoMemoryEffect())
class-attribute
instance-attribute
¶
__init__(value: SSAValue | Operation, result_type: PtrType)
¶
verify_() -> None
¶
Source code in xdsl/dialects/csl.py
RpcOp
dataclass
¶
Bases: IRDLOperation
represents a call to @rpc
When printing should wrap id in @get_data_task_id
Source code in xdsl/dialects/csl.py
ParamOp
¶
Bases: IRDLOperation
Represents param declarations in CSL
Whilst we can inline most things, the result of memcpy get_params
function still has to be passed as param.
It can also be useful to change some configuration parameters from the command line by passing params to the compiler.
Source code in xdsl/dialects/csl.py
T: ClassVar = VarConstraint('T', ParamOpAttrConstr)
class-attribute
instance-attribute
¶
name = 'csl.param'
class-attribute
instance-attribute
¶
traits = traits_def(HasParent(CslModuleOp))
class-attribute
instance-attribute
¶
param_name = prop_def(StringAttr)
class-attribute
instance-attribute
¶
init_value = opt_operand_def(T)
class-attribute
instance-attribute
¶
res = result_def(T)
class-attribute
instance-attribute
¶
__init__(name: str | StringAttr, result_type: ParamOpAttr, init_value: SSAValue | Operation | None = None)
¶
Source code in xdsl/dialects/csl.py
SignednessCastOp
¶
Bases: IRDLOperation
Cast that throws away signedness attributes
Source code in xdsl/dialects/csl.py
traits = traits_def(NoMemoryEffect())
class-attribute
instance-attribute
¶
name = 'csl.mlir.signedness_cast'
class-attribute
instance-attribute
¶
inp = operand_def(IntegerType)
class-attribute
instance-attribute
¶
result = result_def(IntegerType)
class-attribute
instance-attribute
¶
assembly_format = '$inp attr-dict `:` type($inp) `to` type($result)'
class-attribute
instance-attribute
¶
__init__(op: SSAValue | Operation, result_type: IntegerType | None = None)
¶
Create a signedness cast op.
If result_type is not provided, the signedness of the input type will be reversed in the following way: - Unsigned => Signless - Signed => Unsigned - Signless => Unsigned
Source code in xdsl/dialects/csl.py
verify_() -> None
¶
Source code in xdsl/dialects/csl.py
ConcatStructOp
¶
Bases: IRDLOperation
Concatenate two compile-time known structs
@concat_structs(this_struct, another_struct);
this_struct and another_struct are comptime expressions of anonymous struct type.
Attempting to concatenate a struct with named fields and a struct with nameless fields (e.g. .{1, 2}) results in an error.
Attempting to concatenate two structs with overlapping named fields also results in an error.
Source code in xdsl/dialects/csl.py
name = 'csl.concat_structs'
class-attribute
instance-attribute
¶
this_struct = operand_def(ComptimeStructType)
class-attribute
instance-attribute
¶
another_struct = operand_def(ComptimeStructType)
class-attribute
instance-attribute
¶
result = result_def(ComptimeStructType)
class-attribute
instance-attribute
¶
__init__(struct_a: Operation | SSAValue, struct_b: Operation | SSAValue)
¶
CslConstantMaterializationInterface
¶
Bases: ConstantMaterializationInterface