MLBEDSW-2420: Improved support for dilated convolution

- Dilation added to SET_KERNEL_STRIDE instruction
- Kernel height/width adjusted for dilation
- Updated padding calculation
- Updated weight compression

Change-Id: I0c8190223e223b039a305aba0f37896ae1de2b80
Signed-off-by: Louis Verhaard <louis.verhaard@arm.com>
diff --git a/ethosu/vela/mark_tensors.py b/ethosu/vela/mark_tensors.py
index cd70446..bf7bc45 100644
--- a/ethosu/vela/mark_tensors.py
+++ b/ethosu/vela/mark_tensors.py
@@ -17,7 +17,6 @@
 # Mark purpose and select formats for Tensors. Also compresses the weights.
 from . import rewrite_graph
 from . import weight_compressor
-from .operation import NpuBlockType
 from .tensor import TensorFormat
 from .tensor import TensorPurpose
 
@@ -319,14 +318,6 @@
             assert 0, "unknown tensor purpose %s" % (tens.purpose,)
         return fmt
 
-    def find_npu_usage_of_tensor(tens):
-        for op in tens.consumers():
-            if op.type == "DMA":
-                return find_npu_usage_of_tensor(op.outputs[0])
-            if "npu_block_type" in op.attrs:
-                return op.attrs["npu_block_type"]
-            return NpuBlockType.Default
-
     def visit_tens(tens, ps):
         if tens not in formats_for_tensor:
             fmt = init_tens(tens)
@@ -349,8 +340,9 @@
         if fmt == TensorFormat.WeightsCompressed and tens.values is not None:
             src_tens = tens.get_dma_src_tensor()
             if src_tens is not None:
-                npu_block_type = find_npu_usage_of_tensor(tens)
-                weight_compressor.compress_weights(arch, nng, tens, npu_block_type, 32, 32)
+                op = tens.find_npu_op()
+                npu_block_type = op.attrs["npu_block_type"]
+                weight_compressor.compress_weights(arch, nng, tens, npu_block_type, 32, 32, op.get_dilation_h_w())
                 # Alias compressed weights back into source tensor
                 src_tens.copy_compressed_weight_info(tens)