Convert memref stream to snitch stream
convert_memref_stream_to_snitch_stream
¶
ReadOpLowering
¶
Bases: RewritePattern
Source code in xdsl/transforms/convert_memref_stream_to_snitch_stream.py
match_and_rewrite(op: memref_stream.ReadOp, rewriter: PatternRewriter) -> None
¶
Source code in xdsl/transforms/convert_memref_stream_to_snitch_stream.py
WriteOpLowering
¶
Bases: RewritePattern
Source code in xdsl/transforms/convert_memref_stream_to_snitch_stream.py
match_and_rewrite(op: memref_stream.WriteOp, rewriter: PatternRewriter) -> None
¶
Source code in xdsl/transforms/convert_memref_stream_to_snitch_stream.py
StreamOpLowering
¶
Bases: RewritePattern
Source code in xdsl/transforms/convert_memref_stream_to_snitch_stream.py
match_and_rewrite(op: memref_stream.StreamingRegionOp, rewriter: PatternRewriter) -> None
¶
Source code in xdsl/transforms/convert_memref_stream_to_snitch_stream.py
ConvertMemRefStreamToSnitchStreamPass
dataclass
¶
Bases: ModulePass
Converts memref_stream read and write operations to the snitch_stream equivalents.
Care needs to be taken to preserve the semantics of the program.
In assembly, the reads and writes are implicit, by using a register.
In IR, they are modeled by read and write ops, which are not printed at the
assembly level.
To preserve semantics, additional move ops are inserted in the following cases: - reading form a stream: if the value read has multiple uses, - writing to a stream: if the value is defined by an operation outside of the streaming region or if the defining operation is a stream read.
Source code in xdsl/transforms/convert_memref_stream_to_snitch_stream.py
snitch_stream_element_type_is_valid(attr: Attribute) -> bool
¶
An override of the helper to account for Snitch packed SIMD.
Source code in xdsl/transforms/convert_memref_stream_to_snitch_stream.py
strides_for_affine_map(affine_map: AffineMap, memref_type: MemRefType[AttributeCovT]) -> list[int]
¶
Given an iteration space represented as an affine map (for indexing) and a shape (for bounds), returns the corresponding iteration strides for each dimension.
The affine map must not have symbols.