vela: Refactor operators to use Kernel objects
- Normalise kernel availability by requiring all operators offer a kernel
describing how much data they consume from the source, per OFM element,
regardless of whether kernels are relevant to the operation.
Signed-off-by: Tim Hall <tim.hall@arm.com>
Change-Id: Idbcff64879fc2eccf292b6208a7d2038eb388017
diff --git a/ethosu/vela/architecture_features.py b/ethosu/vela/architecture_features.py
index 04c1c62..b77205b 100644
--- a/ethosu/vela/architecture_features.py
+++ b/ethosu/vela/architecture_features.py
@@ -25,16 +25,15 @@
from .ethos_u55_regs.ethos_u55_regs import resampling_mode
from .numeric_util import round_up
from .numeric_util import round_up_divide
+from .operation import Kernel
from .operation import NpuBlockType
+from .operation import PointXYZ
from .supported_operators import SupportedOperators
from .tensor import MemArea
from .tensor import MemType
from .tensor import TensorFormat
from .tensor import TensorPurpose
-PointXY = namedtuple("PointXY", "x y")
-PointXYZ = namedtuple("PointXYZ", "x y z")
-
class Block:
def __init__(self, w, h, d):
@@ -79,16 +78,6 @@
return "<Rect: ({0},{1},{2}) ({3},{4},{5})>".format(self.x, self.y, self.z, self.x2, self.y2, self.z2)
-class Kernel:
- def __init__(self, w, h, sx=1, sy=1, dx=1, dy=1):
- assert sx > 0 and sy > 0
- assert dx > 0 and dy > 0
- self.width = w
- self.height = h
- self.stride = PointXY(sx, sy)
- self.dilation = PointXY(dx, dy)
-
-
class SHRAMElements:
IFM8 = 0
IFM16 = 1