docc 0.8.3 (0d44999b)
C++ API Reference
Loading...
Searching...
No Matches
swizzle.h
Go to the documentation of this file.
1#pragma once
2
4#include "sdfg/tiles/layout.h"
5
6namespace sdfg {
7namespace tiles {
8
21struct Swizzle {
22 int bits = 0;
23 int base = 0;
24 int shift = 0;
25
26 bool is_identity() const {
27 return bits == 0;
28 }
29
32
33 bool operator==(const Swizzle& other) const {
34 return bits == other.bits && base == other.base && shift == other.shift;
35 }
36};
37
43
46
47 bool is_plain() const {
48 return swizzle.is_identity();
49 }
50};
51
52} // namespace tiles
53} // namespace sdfg
std::vector< Expression > MultiExpression
Vector of symbolic expressions for multi-dimensional operations.
Definition symbolic.h:89
SymEngine::RCP< const SymEngine::Basic > Expression
Reference-counted pointer to a symbolic expression (SymEngine Basic).
Definition symbolic.h:83
Definition gpu_tile_target.h:13
math::tensor::TensorLayout Layout
The tiles geometry type is math::tensor::TensorLayout — the single source of truth for a (shape,...
Definition layout.h:11
Definition analysis.h:7
A layout with a swizzle on its output offset (S o L) — the bank-conflict ConflictPolicy::Swizzle.
Definition swizzle.h:40
symbolic::Expression apply_coords(const symbolic::MultiExpression &coords) const
apply_coords(c) = swizzle.apply(layout.resolve_element(c)).
Layout layout
Definition swizzle.h:42
Swizzle swizzle
Definition swizzle.h:41
bool is_plain() const
Definition swizzle.h:47
XOR-swizzle as a composition functor over a Layout.
Definition swizzle.h:21
int shift
S: distance between the two fields (sign = direction).
Definition swizzle.h:24
bool operator==(const Swizzle &other) const
Definition swizzle.h:33
int bits
B: width of the swizzled field (0 = identity).
Definition swizzle.h:22
symbolic::Expression apply(const symbolic::Expression &offset) const
Permute a linear offset (a symbolic bit_xor of shifted/masked fields).
bool is_identity() const
Definition swizzle.h:26
int base
M: low bit position left untouched below the field.
Definition swizzle.h:23
Symbolic system for integer-based symbol analysis.