Skip to content

Snitch runtime

snitch_runtime

tx_id = i32 module-attribute

slice_t_begin = i64 module-attribute

slice_t_end = i64 module-attribute

SnitchRuntime = Dialect('snrt', [GlobalCoreBaseHartidOp, GlobalCoreIdxOp, GlobalCoreNumOp, GlobalComputeCoreIdxOp, GlobalComputeCoreNumOp, GlobalDmCoreNumOp, ClusterCoreIdxOp, ClusterCoreNumOp, ClusterComputeCoreIdxOp, ClusterComputeCoreNumOp, ClusterDmCoreIdxOp, ClusterDmCoreNumOp, ClusterIdxOp, ClusterNumOp, IsComputeCoreOp, IsDmCoreOp, ClusterHwBarrierOp, ClusterSwBarrierOp, GlobalBarrierOp, BarrierRegPtrOp, GlobalMemoryOp, ClusterMemoryOp, ZeroMemoryOp, DmaStart1DWideptrOp, DmaStart1DOp, DmaStart2DWideptrOp, DmaStart2DOp, DmaWaitOp, DmaWaitAllOp, SsrLoop1dOp, SsrLoop2dOp, SsrLoop3dOp, SsrLoop4dOp, SsrRepeatOp, SsrEnableOp, SsrDisableOp, SsrReadOp, SsrWriteOp, FpuFenceOp], []) module-attribute

SnitchRuntimeBaseOperation dataclass

Bases: IRDLOperation, ABC

A base class for ops in the Snitch Runtime dialect. The Snitch Runtime dialect models the snitch runtime which contains low level routines to manage system level aspects of snitch systems.

This dialect is modeled after: https://github.com/pulp-platform/snitch_cluster/tree/main/sw/snRuntime

Source code in xdsl/dialects/snitch_runtime.py
38
39
40
41
42
43
44
45
46
47
48
class SnitchRuntimeBaseOperation(IRDLOperation, ABC):
    """
    A base class for ops in the Snitch Runtime dialect.
    The Snitch Runtime dialect models the snitch runtime which contains low level
    routines to manage system level aspects of snitch systems.

    This dialect is modeled after:
    https://github.com/pulp-platform/snitch_cluster/tree/main/sw/snRuntime
    """

    pass

SnitchRuntimeGetInfo

Bases: SnitchRuntimeBaseOperation, ABC

A base class for snitch runtime functions that get a certain value at runtime

Source code in xdsl/dialects/snitch_runtime.py
51
52
53
54
55
56
57
58
59
60
61
62
63
class SnitchRuntimeGetInfo(SnitchRuntimeBaseOperation, ABC):
    """
    A base class for snitch runtime functions that get a certain value at runtime
    """

    result = result_def(i32)

    traits = traits_def(NoMemoryEffect())

    def __init__(
        self,
    ):
        super().__init__(result_types=[i32])

result = result_def(i32) class-attribute instance-attribute

traits = traits_def(NoMemoryEffect()) class-attribute instance-attribute

__init__()

Source code in xdsl/dialects/snitch_runtime.py
60
61
62
63
def __init__(
    self,
):
    super().__init__(result_types=[i32])

SnitchRuntimeGetInfoBool

Bases: SnitchRuntimeBaseOperation, ABC

A base class for snitch runtime functions that get a certain value at runtime

Source code in xdsl/dialects/snitch_runtime.py
66
67
68
69
70
71
72
73
74
75
76
77
78
class SnitchRuntimeGetInfoBool(SnitchRuntimeBaseOperation, ABC):
    """
    A base class for snitch runtime functions that get a certain value at runtime
    """

    result = result_def(i1)

    traits = traits_def(NoMemoryEffect())

    def __init__(
        self,
    ):
        super().__init__(result_types=[i1])

result = result_def(i1) class-attribute instance-attribute

traits = traits_def(NoMemoryEffect()) class-attribute instance-attribute

__init__()

Source code in xdsl/dialects/snitch_runtime.py
75
76
77
78
def __init__(
    self,
):
    super().__init__(result_types=[i1])

NoOperandNoResultBaseOperation

Bases: SnitchRuntimeBaseOperation, ABC

A base class for operations with no operands nor results

Source code in xdsl/dialects/snitch_runtime.py
81
82
83
84
85
86
87
88
89
class NoOperandNoResultBaseOperation(SnitchRuntimeBaseOperation, ABC):
    """
    A base class for operations with no operands nor results
    """

    def __init__(
        self,
    ):
        super().__init__()

__init__()

Source code in xdsl/dialects/snitch_runtime.py
86
87
88
89
def __init__(
    self,
):
    super().__init__()

GlobalCoreBaseHartidOp dataclass

Bases: SnitchRuntimeGetInfo

Get the current core's global base Hart ID

Source code in xdsl/dialects/snitch_runtime.py
92
93
94
95
96
97
98
@irdl_op_definition
class GlobalCoreBaseHartidOp(SnitchRuntimeGetInfo):
    """
    Get the current core's global base Hart ID
    """

    name = "snrt.global_core_base_hartid"

name = 'snrt.global_core_base_hartid' class-attribute instance-attribute

GlobalCoreIdxOp dataclass

Bases: SnitchRuntimeGetInfo

Regardless of core type, return global core index, equal to the Hart ID of the current core - global base Hart ID of the cluster

Source code in xdsl/dialects/snitch_runtime.py
101
102
103
104
105
106
107
108
@irdl_op_definition
class GlobalCoreIdxOp(SnitchRuntimeGetInfo):
    """
    Regardless of core type, return global core index, equal to the Hart ID of the
    current core - global base Hart ID of the cluster
    """

    name = "snrt.global_core_idx"

name = 'snrt.global_core_idx' class-attribute instance-attribute

GlobalCoreNumOp dataclass

Bases: SnitchRuntimeGetInfo

Return total amount of cores including DMA cores per cluster

Source code in xdsl/dialects/snitch_runtime.py
111
112
113
114
115
116
117
@irdl_op_definition
class GlobalCoreNumOp(SnitchRuntimeGetInfo):
    """
    Return total amount of cores including DMA cores per cluster
    """

    name = "snrt.global_core_num"

name = 'snrt.global_core_num' class-attribute instance-attribute

GlobalComputeCoreIdxOp dataclass

Bases: SnitchRuntimeGetInfo

For compute core, return global core index

Source code in xdsl/dialects/snitch_runtime.py
120
121
122
123
124
125
126
@irdl_op_definition
class GlobalComputeCoreIdxOp(SnitchRuntimeGetInfo):
    """
    For compute core, return global core index
    """

    name = "snrt.global_compute_core_idx"

name = 'snrt.global_compute_core_idx' class-attribute instance-attribute

GlobalComputeCoreNumOp dataclass

Bases: SnitchRuntimeGetInfo

Return total amount of compute cores per cluster

Source code in xdsl/dialects/snitch_runtime.py
129
130
131
132
133
134
135
@irdl_op_definition
class GlobalComputeCoreNumOp(SnitchRuntimeGetInfo):
    """
    Return total amount of compute cores per cluster
    """

    name = "snrt.global_compute_core_num"

name = 'snrt.global_compute_core_num' class-attribute instance-attribute

GlobalDmCoreNumOp dataclass

Bases: SnitchRuntimeGetInfo

Return total amount of DMA cores

Source code in xdsl/dialects/snitch_runtime.py
138
139
140
141
142
143
144
@irdl_op_definition
class GlobalDmCoreNumOp(SnitchRuntimeGetInfo):
    """
    Return total amount of DMA cores
    """

    name = "snrt.global_dm_core_num"

name = 'snrt.global_dm_core_num' class-attribute instance-attribute

ClusterCoreIdxOp dataclass

Bases: SnitchRuntimeGetInfo

Return cluster identifier

Source code in xdsl/dialects/snitch_runtime.py
147
148
149
150
151
152
153
@irdl_op_definition
class ClusterCoreIdxOp(SnitchRuntimeGetInfo):
    """
    Return cluster identifier
    """

    name = "snrt.cluster_core_idx"

name = 'snrt.cluster_core_idx' class-attribute instance-attribute

ClusterCoreNumOp dataclass

Bases: SnitchRuntimeGetInfo

Return total amount of cores for the current cluster

Source code in xdsl/dialects/snitch_runtime.py
156
157
158
159
160
161
162
@irdl_op_definition
class ClusterCoreNumOp(SnitchRuntimeGetInfo):
    """
    Return total amount of cores for the current cluster
    """

    name = "snrt.cluster_core_num"

name = 'snrt.cluster_core_num' class-attribute instance-attribute

ClusterComputeCoreIdxOp dataclass

Bases: SnitchRuntimeGetInfo

For compute cores return core ID within a cluster

Source code in xdsl/dialects/snitch_runtime.py
165
166
167
168
169
170
171
@irdl_op_definition
class ClusterComputeCoreIdxOp(SnitchRuntimeGetInfo):
    """
    For compute cores return core ID within a cluster
    """

    name = "snrt.cluster_compute_core_idx"

name = 'snrt.cluster_compute_core_idx' class-attribute instance-attribute

ClusterComputeCoreNumOp dataclass

Bases: SnitchRuntimeGetInfo

Return number of compute cores for the current cluster

Source code in xdsl/dialects/snitch_runtime.py
174
175
176
177
178
179
180
@irdl_op_definition
class ClusterComputeCoreNumOp(SnitchRuntimeGetInfo):
    """
    Return number of compute cores for the current cluster
    """

    name = "snrt.cluster_compute_core_num"

name = 'snrt.cluster_compute_core_num' class-attribute instance-attribute

ClusterDmCoreIdxOp dataclass

Bases: SnitchRuntimeGetInfo

For DMA cores, return core ID within a cluster, currently hardcoded to number of all cores - 1

Source code in xdsl/dialects/snitch_runtime.py
183
184
185
186
187
188
189
@irdl_op_definition
class ClusterDmCoreIdxOp(SnitchRuntimeGetInfo):
    """
    For DMA cores, return core ID within a cluster, currently hardcoded to number of all cores - 1
    """

    name = "snrt.cluster_dm_core_idx"

name = 'snrt.cluster_dm_core_idx' class-attribute instance-attribute

ClusterDmCoreNumOp dataclass

Bases: SnitchRuntimeGetInfo

Return amount of DMA cores in this cluster, in the current runtime, this is hardcoded to 1

Source code in xdsl/dialects/snitch_runtime.py
192
193
194
195
196
197
198
@irdl_op_definition
class ClusterDmCoreNumOp(SnitchRuntimeGetInfo):
    """
    Return amount of DMA cores in this cluster, in the current runtime, this is hardcoded to 1
    """

    name = "snrt.cluster_dm_core_num"

name = 'snrt.cluster_dm_core_num' class-attribute instance-attribute

ClusterIdxOp dataclass

Bases: SnitchRuntimeGetInfo

Return i32 identifier for the cluster this core is a part of

Source code in xdsl/dialects/snitch_runtime.py
201
202
203
204
205
206
207
@irdl_op_definition
class ClusterIdxOp(SnitchRuntimeGetInfo):
    """
    Return i32 identifier for the cluster this core is a part of
    """

    name = "snrt.cluster_idx"

name = 'snrt.cluster_idx' class-attribute instance-attribute

ClusterNumOp dataclass

Bases: SnitchRuntimeGetInfo

Probe the amount of clusters

Source code in xdsl/dialects/snitch_runtime.py
210
211
212
213
214
215
216
@irdl_op_definition
class ClusterNumOp(SnitchRuntimeGetInfo):
    """
    Probe the amount of clusters
    """

    name = "snrt.cluster_num"

name = 'snrt.cluster_num' class-attribute instance-attribute

IsComputeCoreOp dataclass

Bases: SnitchRuntimeGetInfoBool

Return non-zero integer if current snitch core is a compute core

Source code in xdsl/dialects/snitch_runtime.py
219
220
221
222
223
224
225
@irdl_op_definition
class IsComputeCoreOp(SnitchRuntimeGetInfoBool):
    """
    Return non-zero integer if current snitch core is a compute core
    """

    name = "snrt.is_compute_core"

name = 'snrt.is_compute_core' class-attribute instance-attribute

IsDmCoreOp dataclass

Bases: SnitchRuntimeGetInfoBool

Return non-zero integer if current snitch core is a DMA core

Source code in xdsl/dialects/snitch_runtime.py
228
229
230
231
232
233
234
@irdl_op_definition
class IsDmCoreOp(SnitchRuntimeGetInfoBool):
    """
    Return non-zero integer if current snitch core is a DMA core
    """

    name = "snrt.is_dm_core"

name = 'snrt.is_dm_core' class-attribute instance-attribute

ClusterHwBarrierOp dataclass

Bases: NoOperandNoResultBaseOperation

Synchronize cores in a cluster with a hardware barrier

Source code in xdsl/dialects/snitch_runtime.py
237
238
239
240
241
242
243
@irdl_op_definition
class ClusterHwBarrierOp(NoOperandNoResultBaseOperation):
    """
    Synchronize cores in a cluster with a hardware barrier
    """

    name = "snrt.cluster_hw_barrier"

name = 'snrt.cluster_hw_barrier' class-attribute instance-attribute

ClusterSwBarrierOp dataclass

Bases: NoOperandNoResultBaseOperation

Synchronize with compute cores after loading data

Source code in xdsl/dialects/snitch_runtime.py
246
247
248
249
250
251
252
@irdl_op_definition
class ClusterSwBarrierOp(NoOperandNoResultBaseOperation):
    """
    Synchronize with compute cores after loading data
    """

    name = "snrt.cluster_sw_barrier"

name = 'snrt.cluster_sw_barrier' class-attribute instance-attribute

GlobalBarrierOp dataclass

Bases: NoOperandNoResultBaseOperation

Synchronize clusters globally with a global software barrier

Source code in xdsl/dialects/snitch_runtime.py
255
256
257
258
259
260
261
@irdl_op_definition
class GlobalBarrierOp(NoOperandNoResultBaseOperation):
    """
    Synchronize clusters globally with a global software barrier
    """

    name = "snrt.global_barrier"

name = 'snrt.global_barrier' class-attribute instance-attribute

BarrierRegPtrOp dataclass

Bases: SnitchRuntimeGetInfo

Get pointer to barrier register

Source code in xdsl/dialects/snitch_runtime.py
267
268
269
270
271
272
273
@irdl_op_definition
class BarrierRegPtrOp(SnitchRuntimeGetInfo):
    """
    Get pointer to barrier register
    """

    name = "snrt.barrier_reg_ptr"

name = 'snrt.barrier_reg_ptr' class-attribute instance-attribute

GetMemoryInfoBaseOperation

Bases: SnitchRuntimeBaseOperation, ABC

Generic base class for operations returning memory slices

Source code in xdsl/dialects/snitch_runtime.py
276
277
278
279
280
281
282
283
284
285
286
287
288
289
class GetMemoryInfoBaseOperation(SnitchRuntimeBaseOperation, ABC):
    """
    Generic base class for operations returning memory slices
    """

    slice_begin = result_def(slice_t_begin)
    slice_end = result_def(slice_t_end)

    traits = traits_def(NoMemoryEffect())

    def __init__(
        self,
    ):
        super().__init__(result_types=[slice_t_begin, slice_t_end])

slice_begin = result_def(slice_t_begin) class-attribute instance-attribute

slice_end = result_def(slice_t_end) class-attribute instance-attribute

traits = traits_def(NoMemoryEffect()) class-attribute instance-attribute

__init__()

Source code in xdsl/dialects/snitch_runtime.py
286
287
288
289
def __init__(
    self,
):
    super().__init__(result_types=[slice_t_begin, slice_t_end])

GlobalMemoryOp dataclass

Bases: GetMemoryInfoBaseOperation

Get start address of global memory

Source code in xdsl/dialects/snitch_runtime.py
292
293
294
295
296
297
298
@irdl_op_definition
class GlobalMemoryOp(GetMemoryInfoBaseOperation):
    """
    Get start address of global memory
    """

    name = "snrt.global_memory"

name = 'snrt.global_memory' class-attribute instance-attribute

ClusterMemoryOp dataclass

Bases: GetMemoryInfoBaseOperation

Get start address of the cluster's TCDM memory

Source code in xdsl/dialects/snitch_runtime.py
301
302
303
304
305
306
307
@irdl_op_definition
class ClusterMemoryOp(GetMemoryInfoBaseOperation):
    """
    Get start address of the cluster's TCDM memory
    """

    name = "snrt.cluster_memory"

name = 'snrt.cluster_memory' class-attribute instance-attribute

ZeroMemoryOp dataclass

Bases: GetMemoryInfoBaseOperation

Get start address of the cluster's zero memory

Source code in xdsl/dialects/snitch_runtime.py
310
311
312
313
314
315
316
@irdl_op_definition
class ZeroMemoryOp(GetMemoryInfoBaseOperation):
    """
    Get start address of the cluster's zero memory
    """

    name = "snrt.zero_memory"

name = 'snrt.zero_memory' class-attribute instance-attribute

DmaStart1DBaseOperation

Bases: SnitchRuntimeBaseOperation, ABC, Generic[_T]

Initiate an asynchronous 1D DMA transfer

Source code in xdsl/dialects/snitch_runtime.py
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
class DmaStart1DBaseOperation(SnitchRuntimeBaseOperation, ABC, Generic[_T]):
    """
    Initiate an asynchronous 1D DMA transfer
    """

    dst = operand_def(_T)
    src = operand_def(_T)

    size = operand_def(i32)
    transfer_id = result_def(tx_id)

    def __init__(
        self,
        dst: Operation | SSAValue,
        src: Operation | SSAValue,
        size: Operation | SSAValue,
    ):
        super().__init__(operands=[dst, src, size], result_types=[tx_id])

dst = operand_def(_T) class-attribute instance-attribute

src = operand_def(_T) class-attribute instance-attribute

size = operand_def(i32) class-attribute instance-attribute

transfer_id = result_def(tx_id) class-attribute instance-attribute

__init__(dst: Operation | SSAValue, src: Operation | SSAValue, size: Operation | SSAValue)

Source code in xdsl/dialects/snitch_runtime.py
330
331
332
333
334
335
336
def __init__(
    self,
    dst: Operation | SSAValue,
    src: Operation | SSAValue,
    size: Operation | SSAValue,
):
    super().__init__(operands=[dst, src, size], result_types=[tx_id])

DmaStart2DBaseOperation

Bases: SnitchRuntimeBaseOperation, ABC, Generic[_T]

Generic base class for starting asynchronous 2D DMA transfers

Source code in xdsl/dialects/snitch_runtime.py
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
class DmaStart2DBaseOperation(SnitchRuntimeBaseOperation, ABC, Generic[_T]):
    """
    Generic base class for starting asynchronous 2D DMA transfers
    """

    dst = operand_def(_T)
    src = operand_def(_T)
    dst_stride = operand_def(i32)
    src_stride = operand_def(i32)
    size = operand_def(i32)
    repeat = operand_def(i32)
    transfer_id = result_def(tx_id)

    def __init__(
        self,
        dst: Operation | SSAValue,
        src: Operation | SSAValue,
        dst_stride: Operation | SSAValue,
        src_stride: Operation | SSAValue,
        size: Operation | SSAValue,
        repeat: Operation | SSAValue,
    ):
        super().__init__(
            operands=[dst, src, dst_stride, src_stride, size, repeat],
            result_types=[tx_id],
        )

dst = operand_def(_T) class-attribute instance-attribute

src = operand_def(_T) class-attribute instance-attribute

dst_stride = operand_def(i32) class-attribute instance-attribute

src_stride = operand_def(i32) class-attribute instance-attribute

size = operand_def(i32) class-attribute instance-attribute

repeat = operand_def(i32) class-attribute instance-attribute

transfer_id = result_def(tx_id) class-attribute instance-attribute

__init__(dst: Operation | SSAValue, src: Operation | SSAValue, dst_stride: Operation | SSAValue, src_stride: Operation | SSAValue, size: Operation | SSAValue, repeat: Operation | SSAValue)

Source code in xdsl/dialects/snitch_runtime.py
352
353
354
355
356
357
358
359
360
361
362
363
364
def __init__(
    self,
    dst: Operation | SSAValue,
    src: Operation | SSAValue,
    dst_stride: Operation | SSAValue,
    src_stride: Operation | SSAValue,
    size: Operation | SSAValue,
    repeat: Operation | SSAValue,
):
    super().__init__(
        operands=[dst, src, dst_stride, src_stride, size, repeat],
        result_types=[tx_id],
    )

DmaStart1DOp dataclass

Bases: DmaStart1DBaseOperation[I32]

Initiate an asynchronous 1D DMA transfer with 32-bits pointers

Source code in xdsl/dialects/snitch_runtime.py
367
368
369
370
371
372
373
@irdl_op_definition
class DmaStart1DOp(DmaStart1DBaseOperation[I32]):
    """
    Initiate an asynchronous 1D DMA transfer with 32-bits pointers
    """

    name = "snrt.dma_start_1d"

name = 'snrt.dma_start_1d' class-attribute instance-attribute

DmaStart1DWideptrOp dataclass

Bases: DmaStart1DBaseOperation[I64]

Initiate an asynchronous 1D DMA transfer with 64-bits wide pointers

Source code in xdsl/dialects/snitch_runtime.py
376
377
378
379
380
381
382
@irdl_op_definition
class DmaStart1DWideptrOp(DmaStart1DBaseOperation[I64]):
    """
    Initiate an asynchronous 1D DMA transfer with 64-bits wide pointers
    """

    name = "snrt.dma_start_1d_wideptr"

name = 'snrt.dma_start_1d_wideptr' class-attribute instance-attribute

DmaStart2DOp dataclass

Bases: DmaStart2DBaseOperation[I32]

Initiate an asynchronous 2D DMA transfer with 32-bits pointers

Source code in xdsl/dialects/snitch_runtime.py
385
386
387
388
389
390
391
@irdl_op_definition
class DmaStart2DOp(DmaStart2DBaseOperation[I32]):
    """
    Initiate an asynchronous 2D DMA transfer with 32-bits pointers
    """

    name = "snrt.dma_start_2d"

name = 'snrt.dma_start_2d' class-attribute instance-attribute

DmaStart2DWideptrOp dataclass

Bases: DmaStart2DBaseOperation[I64]

Initiate an asynchronous 2D DMA transfer with 64-bits wide pointers

Source code in xdsl/dialects/snitch_runtime.py
394
395
396
397
398
399
400
@irdl_op_definition
class DmaStart2DWideptrOp(DmaStart2DBaseOperation[I64]):
    """
    Initiate an asynchronous 2D DMA transfer with 64-bits wide pointers
    """

    name = "snrt.dma_start_2d_wideptr"

name = 'snrt.dma_start_2d_wideptr' class-attribute instance-attribute

DmaWaitOp

Bases: SnitchRuntimeBaseOperation

Block until a transfer finishes

Source code in xdsl/dialects/snitch_runtime.py
403
404
405
406
407
408
409
410
411
412
413
@irdl_op_definition
class DmaWaitOp(SnitchRuntimeBaseOperation):
    """
    Block until a transfer finishes
    """

    name = "snrt.dma_wait"
    transfer_id = operand_def(tx_id)

    def __init__(self, transfer_id: Operation | SSAValue):
        super().__init__(operands=[transfer_id])

name = 'snrt.dma_wait' class-attribute instance-attribute

transfer_id = operand_def(tx_id) class-attribute instance-attribute

__init__(transfer_id: Operation | SSAValue)

Source code in xdsl/dialects/snitch_runtime.py
412
413
def __init__(self, transfer_id: Operation | SSAValue):
    super().__init__(operands=[transfer_id])

DmaWaitAllOp dataclass

Bases: NoOperandNoResultBaseOperation

Block until all operations on the DMA cease

Source code in xdsl/dialects/snitch_runtime.py
416
417
418
419
420
421
422
@irdl_op_definition
class DmaWaitAllOp(NoOperandNoResultBaseOperation):
    """
    Block until all operations on the DMA cease
    """

    name = "snrt.dma_wait_all"

name = 'snrt.dma_wait_all' class-attribute instance-attribute

SsrLoopBaseOp

Bases: SnitchRuntimeBaseOperation, ABC

Configure an SSR data mover for an n-dimensional loop nest. bounds (limits of loop) and strides (increments of size) are ordered from inner-most to outer-most loops.

for example: for (i = 0; i < 5; i++) { //bounds[1] = 5 and strides[1] = 1 for (j = 0; j < 6; j+=2) { //bounds[0] = 6 and strides[0] = 2 ... } }

Source code in xdsl/dialects/snitch_runtime.py
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
class SsrLoopBaseOp(SnitchRuntimeBaseOperation, ABC):
    """
    Configure an SSR data mover for an n-dimensional loop nest.
    bounds (limits of loop) and strides (increments of size) are ordered from inner-most to outer-most loops.

    for example:
    for (i = 0; i < 5; i++) { //bounds[1] = 5 and strides[1] = 1
        for (j = 0; j < 6; j+=2) { //bounds[0] = 6 and strides[0] = 2
            ...
        }
    }
    """

    data_mover = operand_def(i32)
    bounds = var_operand_def(IndexType)
    strides = var_operand_def(IndexType)
    irdl_options = (AttrSizedOperandSegments(),)

    def verify_(self) -> None:
        if len(self.bounds) != len(self.strides):
            raise VerifyException(
                f"the length of bounds ({len(self.bounds)}) and strides ({len(self.strides)}) must be equal."
            )
        if len(self.strides) != self.num:
            raise VerifyException(
                f"Epected {self.num} bounds and strides, got {len(self.strides)}"
            )

    def __init__(
        self,
        data_mover: Operation | SSAValue,
        bounds: Sequence[Operation | SSAValue],
        strides: Sequence[Operation | SSAValue],
    ):
        super().__init__(operands=[data_mover, bounds, strides])

    @property
    @abstractmethod
    def num(self) -> int:
        raise NotImplementedError()

data_mover = operand_def(i32) class-attribute instance-attribute

bounds = var_operand_def(IndexType) class-attribute instance-attribute

strides = var_operand_def(IndexType) class-attribute instance-attribute

irdl_options = (AttrSizedOperandSegments(),) class-attribute instance-attribute

num: int abstractmethod property

verify_() -> None

Source code in xdsl/dialects/snitch_runtime.py
443
444
445
446
447
448
449
450
451
def verify_(self) -> None:
    if len(self.bounds) != len(self.strides):
        raise VerifyException(
            f"the length of bounds ({len(self.bounds)}) and strides ({len(self.strides)}) must be equal."
        )
    if len(self.strides) != self.num:
        raise VerifyException(
            f"Epected {self.num} bounds and strides, got {len(self.strides)}"
        )

__init__(data_mover: Operation | SSAValue, bounds: Sequence[Operation | SSAValue], strides: Sequence[Operation | SSAValue])

Source code in xdsl/dialects/snitch_runtime.py
453
454
455
456
457
458
459
def __init__(
    self,
    data_mover: Operation | SSAValue,
    bounds: Sequence[Operation | SSAValue],
    strides: Sequence[Operation | SSAValue],
):
    super().__init__(operands=[data_mover, bounds, strides])

SsrLoop1dOp dataclass

Bases: SsrLoopBaseOp

Configure an SSR data mover for a 1D loop nest.

Source code in xdsl/dialects/snitch_runtime.py
467
468
469
470
471
472
473
474
475
476
477
@irdl_op_definition
class SsrLoop1dOp(SsrLoopBaseOp):
    """
    Configure an SSR data mover for a 1D loop nest.
    """

    name = "snrt.ssr_loop_1d"

    @property
    def num(self) -> int:
        return 1

name = 'snrt.ssr_loop_1d' class-attribute instance-attribute

num: int property

SsrLoop2dOp dataclass

Bases: SsrLoopBaseOp

Configure an SSR data mover for a 2D loop nest.

Source code in xdsl/dialects/snitch_runtime.py
480
481
482
483
484
485
486
487
488
489
490
@irdl_op_definition
class SsrLoop2dOp(SsrLoopBaseOp):
    """
    Configure an SSR data mover for a 2D loop nest.
    """

    name = "snrt.ssr_loop_2d"

    @property
    def num(self) -> int:
        return 2

name = 'snrt.ssr_loop_2d' class-attribute instance-attribute

num: int property

SsrLoop3dOp dataclass

Bases: SsrLoopBaseOp

Configure an SSR data mover for a 3D loop nest.

Source code in xdsl/dialects/snitch_runtime.py
493
494
495
496
497
498
499
500
501
502
503
@irdl_op_definition
class SsrLoop3dOp(SsrLoopBaseOp):
    """
    Configure an SSR data mover for a 3D loop nest.
    """

    name = "snrt.ssr_loop_3d"

    @property
    def num(self) -> int:
        return 3

name = 'snrt.ssr_loop_3d' class-attribute instance-attribute

num: int property

SsrLoop4dOp dataclass

Bases: SsrLoopBaseOp

Configure an SSR data mover for a 4D loop nest.

Source code in xdsl/dialects/snitch_runtime.py
506
507
508
509
510
511
512
513
514
515
516
@irdl_op_definition
class SsrLoop4dOp(SsrLoopBaseOp):
    """
    Configure an SSR data mover for a 4D loop nest.
    """

    name = "snrt.ssr_loop_4d"

    @property
    def num(self) -> int:
        return 4

name = 'snrt.ssr_loop_4d' class-attribute instance-attribute

num: int property

SsrRepeatOp

Bases: SnitchRuntimeBaseOperation, ABC

Configure the repetition count for a stream.

Source code in xdsl/dialects/snitch_runtime.py
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
@irdl_op_definition
class SsrRepeatOp(SnitchRuntimeBaseOperation, ABC):
    """
    Configure the repetition count for a stream.
    """

    name = "snrt.ssr_repeat"
    dm = prop_def(IntegerAttr[IntegerType])
    count = operand_def(i32)

    def __init__(
        self,
        dm: int | IntegerAttr[IntegerType],
        count: Operation | SSAValue,
    ):
        if isinstance(dm, int):
            dm = IntegerAttr(dm, i32)

        super().__init__(operands=[count], properties={"dm": dm})

name = 'snrt.ssr_repeat' class-attribute instance-attribute

dm = prop_def(IntegerAttr[IntegerType]) class-attribute instance-attribute

count = operand_def(i32) class-attribute instance-attribute

__init__(dm: int | IntegerAttr[IntegerType], count: Operation | SSAValue)

Source code in xdsl/dialects/snitch_runtime.py
529
530
531
532
533
534
535
536
537
def __init__(
    self,
    dm: int | IntegerAttr[IntegerType],
    count: Operation | SSAValue,
):
    if isinstance(dm, int):
        dm = IntegerAttr(dm, i32)

    super().__init__(operands=[count], properties={"dm": dm})

SsrEnableOp dataclass

Bases: NoOperandNoResultBaseOperation

Enable SSR.

Source code in xdsl/dialects/snitch_runtime.py
540
541
542
543
544
545
546
@irdl_op_definition
class SsrEnableOp(NoOperandNoResultBaseOperation):
    """
    Enable SSR.
    """

    name = "snrt.ssr_enable"

name = 'snrt.ssr_enable' class-attribute instance-attribute

SsrDisableOp dataclass

Bases: NoOperandNoResultBaseOperation

Disable SSR.

Source code in xdsl/dialects/snitch_runtime.py
549
550
551
552
553
554
555
@irdl_op_definition
class SsrDisableOp(NoOperandNoResultBaseOperation):
    """
    Disable SSR.
    """

    name = "snrt.ssr_disable"

name = 'snrt.ssr_disable' class-attribute instance-attribute

SsrReadWriteBaseOperation

Bases: SnitchRuntimeBaseOperation, ABC

Source code in xdsl/dialects/snitch_runtime.py
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
class SsrReadWriteBaseOperation(SnitchRuntimeBaseOperation, ABC):
    dm = prop_def(IntegerAttr[IntegerType])
    dim = prop_def(IntegerAttr[IntegerType])
    ptr = operand_def(i32)

    def __init__(
        self,
        dm: int | IntegerAttr[IntegerType],
        dim: int | IntegerAttr[IntegerType],
        ptr: Operation | SSAValue,
    ):
        if isinstance(dm, int):
            dm = IntegerAttr(dm, i32)

        if isinstance(dim, int):
            dim = IntegerAttr(dim, i32)

        super().__init__(
            operands=[ptr],
            properties={
                "dm": dm,
                "dim": dim,
            },
        )

dm = prop_def(IntegerAttr[IntegerType]) class-attribute instance-attribute

dim = prop_def(IntegerAttr[IntegerType]) class-attribute instance-attribute

ptr = operand_def(i32) class-attribute instance-attribute

__init__(dm: int | IntegerAttr[IntegerType], dim: int | IntegerAttr[IntegerType], ptr: Operation | SSAValue)

Source code in xdsl/dialects/snitch_runtime.py
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
def __init__(
    self,
    dm: int | IntegerAttr[IntegerType],
    dim: int | IntegerAttr[IntegerType],
    ptr: Operation | SSAValue,
):
    if isinstance(dm, int):
        dm = IntegerAttr(dm, i32)

    if isinstance(dim, int):
        dim = IntegerAttr(dim, i32)

    super().__init__(
        operands=[ptr],
        properties={
            "dm": dm,
            "dim": dim,
        },
    )

SsrReadOp dataclass

Bases: SsrReadWriteBaseOperation

Start a streaming read with a given dimensionality.

Source code in xdsl/dialects/snitch_runtime.py
584
585
586
587
588
589
590
@irdl_op_definition
class SsrReadOp(SsrReadWriteBaseOperation):
    """
    Start a streaming read with a given dimensionality.
    """

    name = "snrt.ssr_read"

name = 'snrt.ssr_read' class-attribute instance-attribute

SsrWriteOp dataclass

Bases: SsrReadWriteBaseOperation

Start a streaming write with a given dimensionality.

Source code in xdsl/dialects/snitch_runtime.py
593
594
595
596
597
598
599
@irdl_op_definition
class SsrWriteOp(SsrReadWriteBaseOperation):
    """
    Start a streaming write with a given dimensionality.
    """

    name = "snrt.ssr_write"

name = 'snrt.ssr_write' class-attribute instance-attribute

FpuFenceOp dataclass

Bases: NoOperandNoResultBaseOperation

Synchronize the integer and float pipelines.

Source code in xdsl/dialects/snitch_runtime.py
602
603
604
605
606
607
608
@irdl_op_definition
class FpuFenceOp(NoOperandNoResultBaseOperation):
    """
    Synchronize the integer and float pipelines.
    """

    name = "snrt.fpu_fence"

name = 'snrt.fpu_fence' class-attribute instance-attribute