From 747ca3aa7e2faeec3cd62fe8f1cd83dde1c734d7 Mon Sep 17 00:00:00 2001 From: Erika Hunhoff Date: Mon, 21 Oct 2024 12:01:23 -0600 Subject: [PATCH 01/35] First version of tensor tiler --- python/helpers/tensortiler/tensortiler2D.py | 318 ++++++++++++++++++++ test/python/tensortiler.py | 44 +++ test/python/util.py | 6 + 3 files changed, 368 insertions(+) create mode 100644 python/helpers/tensortiler/tensortiler2D.py create mode 100644 test/python/tensortiler.py diff --git a/python/helpers/tensortiler/tensortiler2D.py b/python/helpers/tensortiler/tensortiler2D.py new file mode 100644 index 0000000000..1d93607696 --- /dev/null +++ b/python/helpers/tensortiler/tensortiler2D.py @@ -0,0 +1,318 @@ +import numpy as np + + +class TensorTile: + def __init__( + self, + tensor_height: int, + tensor_width: int, + offset: int, + sizes: list[int], + strides: list[int], + ): + self.tensor_height = tensor_height + self.tensor_width = tensor_width + self.offset = offset + self.sizes = sizes + self.strides = strides + + def visualize(self, show_arrows: bool = True, show_numbers: bool = False): + TensorTiler2D.access_heatmap( + self.tensor_height, + self.tensor_width, + self.sizes, + self.strides, + offset=self.offset, + show_arrows=show_arrows, + show_numbers=show_numbers, + ) + + +class TensorTile2DIter: + def __init__( + self, + tensor_height: int, + tensor_width: int, + sizes: list[int], + strides: list[int], + offset_fn, + num_steps: int, + ): + self.__num_steps = num_steps + self.__current_step = 0 + + self.__tensor_height = tensor_height + self.__tensor_width = tensor_width + self.__sizes = sizes + self.__strides = strides + self.__offset_fn = offset_fn + + def __iter__(self): + return self + + def __next__(self): + if self.__current_step == self.__num_steps: + raise StopIteration + step = self.__current_step + self.__current_step += 1 + return TensorTile( + self.__tensor_height, + self.__tensor_width, + self.__offset_fn(step), + self.__sizes, + self.__strides, + ) + + +class TensorTiler2D: + def __init__( + self, + tensor_height: int, + tensor_width: int, + tile_height: int, + tile_width: int, + tensor_col_major=False, + tile_col_major=False, + ): + assert tensor_height % tile_height == 0 + assert tensor_width % tile_width == 0 + + self.__tensor_height = tensor_height + self.__tensor_width = tensor_width + self.__tile_height = tile_height + self.__tile_width = tile_width + + self.__num_tiles_per_row = self.__tensor_width // self.__tile_width + self.__num_tiles_per_column = self.__tensor_height // self.__tile_height + + # For row-major tiling for row-major tiles + self.__sizes = [ + self.__num_tiles_per_column, + self.__num_tiles_per_row, + self.__tile_height, + self.__tile_width, + ] + self.__strides = [ + self.__tile_width * self.__tile_height * self.__num_tiles_per_row, + self.__tile_width, + self.__tensor_width, + 1, + ] + + self.__tensor_col_major = tensor_col_major + if tensor_col_major: + self.__sizes[0], self.__sizes[1] = self.__sizes[1], self.__sizes[0] + self.__strides[0], self.__strides[1] = self.__strides[1], self.__strides[0] + if tile_col_major: + self.__sizes[2], self.__sizes[3] = self.__sizes[3], self.__sizes[2] + self.__strides[2], self.__strides[3] = self.__strides[3], self.__strides[2] + + def tile_iter(self, chunk_height: int = 1, chunk_width: int = 1, col_major=False): + assert self.__num_tiles_per_row % chunk_width == 0 + assert self.__num_tiles_per_column % chunk_height == 0 + + chunks_per_row = self.__num_tiles_per_row // chunk_width + chunks_per_column = self.__num_tiles_per_column // chunk_height + + steps = chunks_per_row * chunks_per_column + + def calc_offset(iter_num): + if not col_major: + row_idx = iter_num % chunks_per_row + col_idx = iter_num // chunks_per_row + else: + col_idx = iter_num % chunks_per_column + row_idx = iter_num // chunks_per_column + + offset = row_idx * chunk_width * self.__tile_width + offset += col_idx * chunk_height * self.__tensor_width * self.__tile_height + return offset + + iter_sizes = self.__sizes.copy() + + size_idx = [0, 1] + if self.__tensor_col_major: + size_idx = [1, 0] + iter_sizes[size_idx[0]] = chunk_height + iter_sizes[size_idx[1]] = chunk_width + + return TensorTile2DIter( + self.__tensor_height, + self.__tensor_width, + iter_sizes, + self.__strides, + offset_fn=calc_offset, + num_steps=steps, + ) + + def __str__(self): + return f"sizes={self.__sizes}, strides={self.__strides}" + + @classmethod + def _generate_access_map( + cls, + access_order_map: type[np.ndarray], + title="Access Order", + show_arrows=True, + show_numbers=False, + ): + try: + import matplotlib + import matplotlib.pyplot as plt + import matplotlib.patheffects as pe + except: + raise ImportError( + "You must pip install matplotlib in order to render visual access maps" + ) + + # In inches + matplotlib.rcParams["figure.figsize"] = [10, 7] + + _fig, ax = plt.subplots() + _heatmap = ax.pcolor(access_order_map, cmap="gnuplot2") + + # Thanks to https://stackoverflow.com/questions/14406214/moving-x-axis-to-the-top-of-a-plot-in-matplotlib + # put the major ticks at the middle of each cell, (0, 0) in upper left corner + ax.set_xticks(np.arange(access_order_map.shape[1]) + 0.5, minor=False) + ax.set_yticks(np.arange(access_order_map.shape[0]) + 0.5, minor=False) + ax.invert_yaxis() + ax.xaxis.tick_top() + ax.set_xticklabels( + np.arange(0, access_order_map.shape[1]), minor=False, rotation="vertical" + ) + ax.set_yticklabels(np.arange(0, access_order_map.shape[0]), minor=False) + plt.title(title) + + # add numbers to the plot + if show_numbers: + # thanks to https://stackoverflow.com/questions/37719304/python-imshow-set-certain-value-to-defined-color + # thanks to tmdavison answer here https://stackoverflow.com/a/40890587/7871710 + for i in range(access_order_map.shape[0]): + for j in range(access_order_map.shape[1]): + c = access_order_map[i, j] + if c != -1: + ax.text( + j + 0.45, + i + 0.45, + str(c), + path_effects=[ + pe.withStroke(linewidth=3, foreground="white") + ], + ) + + # add arrows to show access order + if show_arrows: + order_dict = {} + for i in range(access_order_map.shape[0]): + for j in range(access_order_map.shape[1]): + if access_order_map[i, j] != -1: + order_dict[access_order_map[i, j]] = (i, j) + for i in range(len(order_dict) - 1): + y1, x1 = order_dict[i] + y2, x2 = order_dict[i + 1] + ax.arrow( + x1 + 0.5, + y1 + 0.5, + x2 - x1, + y2 - y1, + length_includes_head=True, + head_width=0.1, + head_length=0.15, + overhang=0.2, + path_effects=[pe.withStroke(linewidth=3, foreground="white")], + ) + plt.show() + + @classmethod + def access_order_map( + cls, + tensor_height: int, + tensor_width: int, + sizes: list[int], + strides: list[int], + tile_height: int | None = None, + tile_width: int | None = None, + offset: int = 0, + ): + assert tensor_height > 0 and tensor_width > 0 + assert len(sizes) == 4 + assert len(strides) == 4 + assert (tile_height is None and tile_width is None) or ( + (tile_height != None and tile_width != None) + and (tile_height > 0 and tile_width > 0) + ) + + # Generate access order map + access_order_tensor = np.full( + (tensor_height * tensor_width,), -1, dtype=np.int32 + ) + access_count = 0 + for i in range(sizes[0]): + for j in range(sizes[1]): + for k in range(sizes[2]): + for l in range(sizes[3]): + access_order_tensor[ + offset + + i * strides[0] + + j * strides[1] + + k * strides[2] + + l * strides[3] + ] = access_count + access_count += 1 + access_order_tensor = access_order_tensor.reshape((tensor_height, tensor_width)) + return access_order_tensor + + @classmethod + def access_heatmap( + cls, + tensor_height: int, + tensor_width: int, + sizes: list[int], + strides: list[int], + tile_height: int | None = None, + tile_width: int | None = None, + offset: int = 0, + show_arrows=True, + show_numbers=False, + ): + access_order_tensor = cls.access_order_map( + tensor_height, + tensor_width, + sizes, + strides, + tile_height=tile_height, + tile_width=tile_width, + offset=offset, + ) + + # Show a graph for a single tile + if tile_height != None and tile_width != None: + cls._generate_access_map( + access_order_tensor[0:tile_height, 0:tile_width], + title="Per-Tile Access Order", + show_arrows=show_arrows, + show_numbers=show_numbers, + ) + + cls._generate_access_map( + access_order_tensor, show_arrows=show_arrows, show_numbers=show_numbers + ) + + def visualize( + self, + show_tile: bool = True, + show_arrows: bool = True, + show_numbers: bool = False, + ): + tile_height = self.__tile_height if show_tile else None + tile_width = self.__tile_width if show_tile else None + self.access_heatmap( + self.__tensor_height, + self.__tensor_width, + self.__sizes, + self.__strides, + tile_height=tile_height, + tile_width=tile_width, + show_arrows=show_arrows, + show_numbers=show_numbers, + ) diff --git a/test/python/tensortiler.py b/test/python/tensortiler.py new file mode 100644 index 0000000000..7610e312df --- /dev/null +++ b/test/python/tensortiler.py @@ -0,0 +1,44 @@ +import numpy as np + +from aie.helpers.tensortiler import TensorTiler2D +from util import construct_test + + +# CHECK-LABEL: tensor_tiler_row_major +@construct_test +def tensor_tiler_simple(): + TENSOR_HEIGHT = 2 + TENSOR_WIDTH = 3 + + tiler = TensorTiler2D(TENSOR_HEIGHT, TENSOR_WIDTH, TENSOR_HEIGHT, TENSOR_WIDTH) + access_map = tiler.access_order_map() + + expected = np.ndarray([[0, 1, 2], [3, 4, 5]]) + assert expected.shape == access_map.shape + assert (expected == access_map).all() + + iter = tiler.tile_iter() + t = next(iter) + + assert ( + t.tensor_height == TENSOR_HEIGHT + ), f"Expected tensor height {TENSOR_HEIGHT} but got {t.tensor_height}" + assert ( + t.tensor_width == TENSOR_WIDTH + ), f"Expected tensor width {TENSOR_WIDTH} but got {t.tensor_width}" + assert t.offset == 0, f"Expected offset 0 but got {t.offset}" + + expected_sizes = [0, 0, TENSOR_HEIGHT, TENSOR_WIDTH] + assert ( + t.sizes == expected_sizes + ), f"Expected sizes {expected_sizes} but got {t.sizes}" + expected_strides = [1, 1, 1, 1] + assert ( + t.strides == expected_strides + ), f"Expected strides {expected_strides} but got {t.strides}" + + t2 = next(iter) + assert t2 is None, "Should only be one tile in iter" + + # CHECK: Pass! + print("Pass!") diff --git a/test/python/util.py b/test/python/util.py index f9cea831db..60ed1735c1 100644 --- a/test/python/util.py +++ b/test/python/util.py @@ -2,6 +2,12 @@ from aie.ir import Context, Location, Module, InsertionPoint +# Run test +def construct_test(f): + print("\nTEST:", f.__name__) + f() + + # Create and print ModuleOp. def construct_and_print_module(f): print("\nTEST:", f.__name__) From 1f86f0592a1d9702296f97d373a559616c279f45 Mon Sep 17 00:00:00 2001 From: Erika Hunhoff Date: Mon, 21 Oct 2024 13:29:30 -0600 Subject: [PATCH 02/35] Add some tests for the tiler --- python/CMakeLists.txt | 1 + python/helpers/tensortiler/tensortiler2D.py | 19 + runtime_lib/test_lib/test_library.cpp | 18 +- test/python/tensortiler.py | 370 +++++++++++++++++++- 4 files changed, 390 insertions(+), 18 deletions(-) diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt index 97d2dbceb3..fa95393a48 100644 --- a/python/CMakeLists.txt +++ b/python/CMakeLists.txt @@ -42,6 +42,7 @@ declare_mlir_python_sources(AIEPythonSources.Helpers helpers/*.py helpers/dialects/ext/*.py helpers/runtime/*.py + helpers/tensortiler/*.py ) declare_mlir_dialect_python_bindings( diff --git a/python/helpers/tensortiler/tensortiler2D.py b/python/helpers/tensortiler/tensortiler2D.py index 1d93607696..1705472421 100644 --- a/python/helpers/tensortiler/tensortiler2D.py +++ b/python/helpers/tensortiler/tensortiler2D.py @@ -27,6 +27,15 @@ def visualize(self, show_arrows: bool = True, show_numbers: bool = False): show_numbers=show_numbers, ) + def access_map(self): + return TensorTiler2D.access_order_map( + self.tensor_height, + self.tensor_width, + self.sizes, + self.strides, + offset=self.offset, + ) + class TensorTile2DIter: def __init__( @@ -316,3 +325,13 @@ def visualize( show_arrows=show_arrows, show_numbers=show_numbers, ) + + def access_map(self): + return self.access_order_map( + self.__tensor_height, + self.__tensor_width, + self.__sizes, + self.__strides, + self.__tile_height, + self.__tile_width, + ) diff --git a/runtime_lib/test_lib/test_library.cpp b/runtime_lib/test_lib/test_library.cpp index 8d214eb5c0..1a5c3720dc 100644 --- a/runtime_lib/test_lib/test_library.cpp +++ b/runtime_lib/test_lib/test_library.cpp @@ -357,7 +357,7 @@ void mlir_aie_data_mem_wr_word(aie_libxaie_ctx_t *ctx, int col, int row, /// The configuration address space of most tiles is very similar, /// relative to this base address. u64 mlir_aie_get_tile_addr(aie_libxaie_ctx_t *ctx, int col, int row) { - return _XAie_GetTileAddr(&(ctx->DevInst), row, col); + return XAie_GetTileAddr(&(ctx->DevInst), row, col); } /// @brief Dump the tile memory of the given tile @@ -407,7 +407,7 @@ static void print_aie2_dmachannel_status(aie_libxaie_ctx_t *ctx, int col, const char *channel, int channelNum, u32 statusOffset, u32 controlOffset, int ¤t_bd) { - u64 tileAddr = _XAie_GetTileAddr(&(ctx->DevInst), row, col); + u64 tileAddr = XAie_GetTileAddr(&(ctx->DevInst), row, col); u32 status, control; XAie_Read32(&(ctx->DevInst), tileAddr + statusOffset, &status); XAie_Read32(&(ctx->DevInst), tileAddr + controlOffset, &control); @@ -505,7 +505,7 @@ static void print_bd(int bd, int bd_valid, u32 nextBd, u32 useNextBd, /// @brief Print a summary of the status of the given Tile DMA. void mlir_aie_print_dma_status(aie_libxaie_ctx_t *ctx, int col, int row) { - u64 tileAddr = _XAie_GetTileAddr(&(ctx->DevInst), row, col); + u64 tileAddr = XAie_GetTileAddr(&(ctx->DevInst), row, col); auto TileType = ctx->DevInst.DevOps->GetTTypefromLoc(&(ctx->DevInst), XAie_TileLoc(col, row)); assert(TileType == XAIEGBL_TILE_TYPE_AIETILE); @@ -696,7 +696,7 @@ void mlir_aie_print_dma_status(aie_libxaie_ctx_t *ctx, int col, int row) { void print_aie2_lock_status(aie_libxaie_ctx_t *ctx, int col, int row, const char *type, int lockOffset, int locks) { - u64 tileAddr = _XAie_GetTileAddr(&(ctx->DevInst), row, col); + u64 tileAddr = XAie_GetTileAddr(&(ctx->DevInst), row, col); printf("%s [%d, %d] AIE2 locks are: ", type, col, row); int lockAddr = tileAddr + lockOffset; for (int lock = 0; lock < locks; lock++) { @@ -711,7 +711,7 @@ void print_aie2_lock_status(aie_libxaie_ctx_t *ctx, int col, int row, /// @brief Print a summary of the status of the given MemTile DMA. void mlir_aie_print_memtiledma_status(aie_libxaie_ctx_t *ctx, int col, int row) { - u64 tileAddr = _XAie_GetTileAddr(&(ctx->DevInst), row, col); + u64 tileAddr = XAie_GetTileAddr(&(ctx->DevInst), row, col); auto TileType = ctx->DevInst.DevOps->GetTTypefromLoc(&(ctx->DevInst), XAie_TileLoc(col, row)); assert(TileType == XAIEGBL_TILE_TYPE_MEMTILE); @@ -774,7 +774,7 @@ void mlir_aie_print_memtiledma_status(aie_libxaie_ctx_t *ctx, int col, void mlir_aie_print_shimdma_status(aie_libxaie_ctx_t *ctx, int col, int row) { // int col = loc.Col; // int row = loc.Row; - u64 tileAddr = _XAie_GetTileAddr(&(ctx->DevInst), row, col); + u64 tileAddr = XAie_GetTileAddr(&(ctx->DevInst), row, col); auto TileType = ctx->DevInst.DevOps->GetTTypefromLoc(&(ctx->DevInst), XAie_TileLoc(col, row)); assert(TileType == XAIEGBL_TILE_TYPE_SHIMNOC); @@ -944,7 +944,7 @@ void mlir_aie_print_shimdma_status(aie_libxaie_ctx_t *ctx, int col, int row) { void mlir_aie_print_tile_status(aie_libxaie_ctx_t *ctx, int col, int row) { // int col = loc.Col; // int row = loc.Row; - u64 tileAddr = _XAie_GetTileAddr(&(ctx->DevInst), row, col); + u64 tileAddr = XAie_GetTileAddr(&(ctx->DevInst), row, col); u32 status, coreTimerLow, PC, LR, SP, locks, R0, R4; u32 trace_status; if (ctx->AieConfigPtr.AieGen == XAIE_DEV_GEN_AIEML) { @@ -1043,7 +1043,7 @@ static void clear_range(XAie_DevInst *devInst, u64 tileAddr, u64 low, /// This includes: clearing the program memory, data memory, /// DMA descriptors, and stream switch configuration. void mlir_aie_clear_config(aie_libxaie_ctx_t *ctx, int col, int row) { - u64 tileAddr = _XAie_GetTileAddr(&(ctx->DevInst), row, col); + u64 tileAddr = XAie_GetTileAddr(&(ctx->DevInst), row, col); // Put the core in reset first, otherwise bus collisions // result in arm bus errors. @@ -1073,7 +1073,7 @@ void mlir_aie_clear_config(aie_libxaie_ctx_t *ctx, int col, int row) { /// This includes: clearing the program memory, data memory, /// DMA descriptors, and stream switch configuration. void mlir_aie_clear_shim_config(aie_libxaie_ctx_t *ctx, int col, int row) { - u64 tileAddr = _XAie_GetTileAddr(&(ctx->DevInst), row, col); + u64 tileAddr = XAie_GetTileAddr(&(ctx->DevInst), row, col); // ShimDMA clear_range(&(ctx->DevInst), tileAddr, 0x1D000, 0x1D13C); diff --git a/test/python/tensortiler.py b/test/python/tensortiler.py index 7610e312df..931d328b70 100644 --- a/test/python/tensortiler.py +++ b/test/python/tensortiler.py @@ -1,19 +1,21 @@ import numpy as np -from aie.helpers.tensortiler import TensorTiler2D +from aie.helpers.tensortiler.tensortiler2D import TensorTiler2D from util import construct_test +# RUN: %python %s | FileCheck %s -# CHECK-LABEL: tensor_tiler_row_major + +# CHECK-LABEL: tensortiler_simple @construct_test -def tensor_tiler_simple(): +def tensortiler_simple(): TENSOR_HEIGHT = 2 TENSOR_WIDTH = 3 tiler = TensorTiler2D(TENSOR_HEIGHT, TENSOR_WIDTH, TENSOR_HEIGHT, TENSOR_WIDTH) - access_map = tiler.access_order_map() + access_map = tiler.access_map() - expected = np.ndarray([[0, 1, 2], [3, 4, 5]]) + expected = np.array([[0, 1, 2], [3, 4, 5]]) assert expected.shape == access_map.shape assert (expected == access_map).all() @@ -28,17 +30,367 @@ def tensor_tiler_simple(): ), f"Expected tensor width {TENSOR_WIDTH} but got {t.tensor_width}" assert t.offset == 0, f"Expected offset 0 but got {t.offset}" - expected_sizes = [0, 0, TENSOR_HEIGHT, TENSOR_WIDTH] + expected_sizes = [1, 1, TENSOR_HEIGHT, TENSOR_WIDTH] + assert ( + t.sizes == expected_sizes + ), f"Expected sizes {expected_sizes} but got {t.sizes}" + expected_strides = [6, 3, 3, 1] + assert ( + t.strides == expected_strides + ), f"Expected strides {expected_strides} but got {t.strides}" + + assert ( + expected == t.access_map() + ).all(), f"Expected {expected} but got {t.access_map()}" + + try: + next(iter) + assert False, "Iterator should only have one step" + except StopIteration: + pass + + # CHECK: Pass! + print("Pass!") + + +# CHECK-LABEL: tensortiler_tensor_row_major_tile_col_major +@construct_test +def tensortiler_tensor_row_major_tile_col_major(): + TENSOR_HEIGHT = 12 + TENSOR_WIDTH = 12 + TILE_HEIGHT = 3 + TILE_WIDTH = 4 + + tiler = TensorTiler2D( + TENSOR_HEIGHT, + TENSOR_WIDTH, + TILE_HEIGHT, + TILE_WIDTH, + tensor_col_major=False, + tile_col_major=True, + ) + access_map = tiler.access_map() + + expected_tile = np.array([[0, 3, 6, 9], [1, 4, 7, 10], [2, 5, 8, 11]]) + assert (TENSOR_HEIGHT, TENSOR_WIDTH) == access_map.shape + assert (expected_tile == access_map[0:TILE_HEIGHT, 0:TILE_WIDTH]).all() + + expected_tile = expected_tile + expected_tile2 = np.array([[12, 15, 18, 21], [13, 16, 19, 22], [14, 17, 20, 23]]) + assert ( + expected_tile2 == access_map[0:TILE_HEIGHT, TILE_WIDTH : 2 * TILE_WIDTH] + ).all() + + iter = tiler.tile_iter() + tiles = list(iter) + expected_num_tiles = (TENSOR_HEIGHT // TILE_HEIGHT) * (TENSOR_WIDTH // TILE_WIDTH) + assert ( + len(tiles) == expected_num_tiles + ), f"Expected {expected_num_tiles} tiles but got {len(tiles)}" + + t = tiles[0] + assert ( + t.tensor_height == TENSOR_HEIGHT + ), f"Expected tensor height {TENSOR_HEIGHT} but got {t.tensor_height}" + assert ( + t.tensor_width == TENSOR_WIDTH + ), f"Expected tensor width {TENSOR_WIDTH} but got {t.tensor_width}" + assert t.offset == 0, f"Expected offset 0 but got {t.offset}" + + expected_sizes = [1, 1, TILE_WIDTH, TILE_HEIGHT] + assert ( + t.sizes == expected_sizes + ), f"Expected sizes {expected_sizes} but got {t.sizes}" + expected_strides = [36, 4, 1, 12] + assert ( + t.strides == expected_strides + ), f"Expected strides {expected_strides} but got {t.strides}" + + assert ( + expected_tile == t.access_map()[0:TILE_HEIGHT, 0:TILE_WIDTH] + ).all(), f"Expected {expected_tile} but got {t.access_map()[0:TILE_HEIGHT, 0:TILE_WIDTH]}" + + # CHECK: Pass! + print("Pass!") + + +# CHECK-LABEL: tensortiler_tensor_col_major_tile_col_major +@construct_test +def tensortiler_tensor_col_major_tile_col_major(): + TENSOR_HEIGHT = 12 + TENSOR_WIDTH = 12 + TILE_HEIGHT = 3 + TILE_WIDTH = 4 + + tiler = TensorTiler2D( + TENSOR_HEIGHT, + TENSOR_WIDTH, + TILE_HEIGHT, + TILE_WIDTH, + tensor_col_major=True, + tile_col_major=True, + ) + access_map = tiler.access_map() + + expected_tile = np.array([[0, 3, 6, 9], [1, 4, 7, 10], [2, 5, 8, 11]]) + assert (TENSOR_HEIGHT, TENSOR_WIDTH) == access_map.shape + assert (expected_tile == access_map[0:TILE_HEIGHT, 0:TILE_WIDTH]).all() + + expected_tile = expected_tile + expected_tile2 = np.array([[12, 15, 18, 21], [13, 16, 19, 22], [14, 17, 20, 23]]) + assert ( + expected_tile2 == access_map[TILE_HEIGHT : 2 * TILE_HEIGHT, 0:TILE_WIDTH] + ).all() + + iter = tiler.tile_iter() + tiles = list(iter) + expected_num_tiles = (TENSOR_HEIGHT // TILE_HEIGHT) * (TENSOR_WIDTH // TILE_WIDTH) + assert ( + len(tiles) == expected_num_tiles + ), f"Expected {expected_num_tiles} tiles but got {len(tiles)}" + + t = tiles[0] + assert ( + t.tensor_height == TENSOR_HEIGHT + ), f"Expected tensor height {TENSOR_HEIGHT} but got {t.tensor_height}" + assert ( + t.tensor_width == TENSOR_WIDTH + ), f"Expected tensor width {TENSOR_WIDTH} but got {t.tensor_width}" + assert t.offset == 0, f"Expected offset 0 but got {t.offset}" + + expected_sizes = [1, 1, TILE_WIDTH, TILE_HEIGHT] + assert ( + t.sizes == expected_sizes + ), f"Expected sizes {expected_sizes} but got {t.sizes}" + expected_strides = [4, 36, 1, 12] + assert ( + t.strides == expected_strides + ), f"Expected strides {expected_strides} but got {t.strides}" + + assert ( + expected_tile == t.access_map()[0:TILE_HEIGHT, 0:TILE_WIDTH] + ).all(), f"Expected {expected_tile} but got {t.access_map()[0:TILE_HEIGHT, 0:TILE_WIDTH]}" + + # CHECK: Pass! + print("Pass!") + + +# CHECK-LABEL: tensortiler_tensor_col_major_tile_row_major +@construct_test +def tensortiler_tensor_col_major_tile_row_major(): + TENSOR_HEIGHT = 12 + TENSOR_WIDTH = 12 + TILE_HEIGHT = 3 + TILE_WIDTH = 4 + + tiler = TensorTiler2D( + TENSOR_HEIGHT, + TENSOR_WIDTH, + TILE_HEIGHT, + TILE_WIDTH, + tensor_col_major=True, + tile_col_major=False, + ) + access_map = tiler.access_map() + + expected_tile = np.array([[0, 1, 2, 3], [4, 5, 6, 7], [8, 9, 10, 11]]) + assert (TENSOR_HEIGHT, TENSOR_WIDTH) == access_map.shape + assert (expected_tile == access_map[0:TILE_HEIGHT, 0:TILE_WIDTH]).all() + + expected_tile = expected_tile + expected_tile2 = np.array([[12, 13, 14, 15], [16, 17, 18, 19], [20, 21, 22, 23]]) + assert ( + expected_tile2 == access_map[TILE_HEIGHT : 2 * TILE_HEIGHT, 0:TILE_WIDTH] + ).all() + + iter = tiler.tile_iter() + tiles = list(iter) + expected_num_tiles = (TENSOR_HEIGHT // TILE_HEIGHT) * (TENSOR_WIDTH // TILE_WIDTH) + assert ( + len(tiles) == expected_num_tiles + ), f"Expected {expected_num_tiles} tiles but got {len(tiles)}" + + t = tiles[0] + assert ( + t.tensor_height == TENSOR_HEIGHT + ), f"Expected tensor height {TENSOR_HEIGHT} but got {t.tensor_height}" + assert ( + t.tensor_width == TENSOR_WIDTH + ), f"Expected tensor width {TENSOR_WIDTH} but got {t.tensor_width}" + assert t.offset == 0, f"Expected offset 0 but got {t.offset}" + + expected_sizes = [1, 1, TILE_HEIGHT, TILE_WIDTH] + assert ( + t.sizes == expected_sizes + ), f"Expected sizes {expected_sizes} but got {t.sizes}" + expected_strides = [4, 36, 12, 1] + assert ( + t.strides == expected_strides + ), f"Expected strides {expected_strides} but got {t.strides}" + + assert ( + expected_tile == t.access_map()[0:TILE_HEIGHT, 0:TILE_WIDTH] + ).all(), f"Expected {expected_tile} but got {t.access_map()[0:TILE_HEIGHT, 0:TILE_WIDTH]}" + + # CHECK: Pass! + print("Pass!") + + +# CHECK-LABEL: tensortiler_tensor_iter_chunk_row_major +@construct_test +def tensortiler_tensor_iter_chunk_row_major(): + TENSOR_HEIGHT = 12 + TENSOR_WIDTH = 12 + TILE_HEIGHT = 3 + TILE_WIDTH = 2 + + tiler = TensorTiler2D( + TENSOR_HEIGHT, + TENSOR_WIDTH, + TILE_HEIGHT, + TILE_WIDTH, + ) + + expected_tile = np.array([[0, 1], [2, 3], [4, 5]]) + + CHUNK_HEIGHT = 2 + CHUNK_WIDTH = 2 + iter = tiler.tile_iter(chunk_height=2, chunk_width=2) + tiles = list(iter) + expected_num_tiles = (TENSOR_HEIGHT // (TILE_HEIGHT * CHUNK_HEIGHT)) * ( + TENSOR_WIDTH // (TILE_WIDTH * CHUNK_WIDTH) + ) + assert ( + len(tiles) == expected_num_tiles + ), f"Expected {expected_num_tiles} tiles but got {len(tiles)}" + + t = tiles[0] + assert ( + t.tensor_height == TENSOR_HEIGHT + ), f"Expected tensor height {TENSOR_HEIGHT} but got {t.tensor_height}" + assert ( + t.tensor_width == TENSOR_WIDTH + ), f"Expected tensor width {TENSOR_WIDTH} but got {t.tensor_width}" + assert t.offset == 0, f"Expected offset 0 but got {t.offset}" + + expected_sizes = [CHUNK_HEIGHT, CHUNK_WIDTH, TILE_HEIGHT, TILE_WIDTH] + assert ( + t.sizes == expected_sizes + ), f"Expected sizes {expected_sizes} but got {t.sizes}" + expected_strides = [36, 2, 12, 1] + assert ( + t.strides == expected_strides + ), f"Expected strides {expected_strides} but got {t.strides}" + + assert ( + expected_tile == t.access_map()[0:TILE_HEIGHT, 0:TILE_WIDTH] + ).all(), f"Expected {expected_tile} but got {t.access_map()[0:TILE_HEIGHT, 0:TILE_WIDTH]}" + + t = tiles[1] + assert ( + t.tensor_height == TENSOR_HEIGHT + ), f"Expected tensor height {TENSOR_HEIGHT} but got {t.tensor_height}" + assert ( + t.tensor_width == TENSOR_WIDTH + ), f"Expected tensor width {TENSOR_WIDTH} but got {t.tensor_width}" + assert ( + t.offset == CHUNK_WIDTH * TILE_WIDTH + ), f"Expected offset {CHUNK_WIDTH * TILE_WIDTH} but got {t.offset}" + + expected_sizes = [CHUNK_HEIGHT, CHUNK_WIDTH, TILE_HEIGHT, TILE_WIDTH] + assert ( + t.sizes == expected_sizes + ), f"Expected sizes {expected_sizes} but got {t.sizes}" + expected_strides = [36, 2, 12, 1] + assert ( + t.strides == expected_strides + ), f"Expected strides {expected_strides} but got {t.strides}" + + assert ( + expected_tile + == t.access_map()[ + 0:TILE_HEIGHT, CHUNK_WIDTH * TILE_WIDTH : CHUNK_WIDTH * (TILE_WIDTH + 1) + ] + ).all(), f"Expected {expected_tile} but got {t.access_map()[0:TILE_HEIGHT, CHUNK_WIDTH*TILE_WIDTH:CHUNK_WIDTH*(TILE_WIDTH+1)]}" + + # CHECK: Pass! + print("Pass!") + + +# CHECK-LABEL: tensortiler_tensor_iter_chunk_col_major +@construct_test +def tensortiler_tensor_iter_chunk_col_major(): + TENSOR_HEIGHT = 12 + TENSOR_WIDTH = 8 + TILE_HEIGHT = 3 + TILE_WIDTH = 2 + + expected_tile = np.array([[0, 1], [2, 3], [4, 5]]) + + tiler = TensorTiler2D( + TENSOR_HEIGHT, + TENSOR_WIDTH, + TILE_HEIGHT, + TILE_WIDTH, + ) + + CHUNK_HEIGHT = 2 + CHUNK_WIDTH = 2 + iter = tiler.tile_iter(chunk_height=2, chunk_width=2, col_major=True) + tiles = list(iter) + expected_num_tiles = (TENSOR_HEIGHT // (TILE_HEIGHT * CHUNK_HEIGHT)) * ( + TENSOR_WIDTH // (TILE_WIDTH * CHUNK_WIDTH) + ) + assert ( + len(tiles) == expected_num_tiles + ), f"Expected {expected_num_tiles} tiles but got {len(tiles)}" + + t = tiles[0] + assert ( + t.tensor_height == TENSOR_HEIGHT + ), f"Expected tensor height {TENSOR_HEIGHT} but got {t.tensor_height}" + assert ( + t.tensor_width == TENSOR_WIDTH + ), f"Expected tensor width {TENSOR_WIDTH} but got {t.tensor_width}" + assert t.offset == 0, f"Expected offset 0 but got {t.offset}" + + expected_sizes = [CHUNK_HEIGHT, CHUNK_WIDTH, TILE_HEIGHT, TILE_WIDTH] + assert ( + t.sizes == expected_sizes + ), f"Expected sizes {expected_sizes} but got {t.sizes}" + expected_strides = [24, 2, 8, 1] + assert ( + t.strides == expected_strides + ), f"Expected strides {expected_strides} but got {t.strides}" + + assert ( + expected_tile == t.access_map()[0:TILE_HEIGHT, 0:TILE_WIDTH] + ).all(), f"Expected {expected_tile} but got {t.access_map()[0:TILE_HEIGHT, 0:TILE_WIDTH]}" + + t = tiles[1] + assert ( + t.tensor_height == TENSOR_HEIGHT + ), f"Expected tensor height {TENSOR_HEIGHT} but got {t.tensor_height}" + assert ( + t.tensor_width == TENSOR_WIDTH + ), f"Expected tensor width {TENSOR_WIDTH} but got {t.tensor_width}" + assert t.offset == 48, f"Expected offset 48 but got {t.offset}" + + expected_sizes = [CHUNK_HEIGHT, CHUNK_WIDTH, TILE_HEIGHT, TILE_WIDTH] assert ( t.sizes == expected_sizes ), f"Expected sizes {expected_sizes} but got {t.sizes}" - expected_strides = [1, 1, 1, 1] + expected_strides = [24, 2, 8, 1] assert ( t.strides == expected_strides ), f"Expected strides {expected_strides} but got {t.strides}" - t2 = next(iter) - assert t2 is None, "Should only be one tile in iter" + assert ( + expected_tile + == t.access_map()[ + CHUNK_HEIGHT * TILE_HEIGHT : (CHUNK_HEIGHT + 1) * TILE_HEIGHT, 0:TILE_WIDTH + ] + ).all(), f"Expected {expected_tile} but got {t.access_map()[CHUNK_HEIGHT*TILE_HEIGHT:(CHUNK_HEIGHT+1)*TILE_HEIGHT, 0:TILE_WIDTH]}" # CHECK: Pass! print("Pass!") From 39e0a5debee817e5d9dfd669740e498190c73f38 Mon Sep 17 00:00:00 2001 From: Erika Hunhoff Date: Mon, 21 Oct 2024 16:28:23 -0600 Subject: [PATCH 03/35] Some improvements --- .../basic/matrix_scalar_add/aie2.py | 12 +- .../basic/row_wise_bias_add/aie2.py | 20 ++- python/helpers/tensortiler/tensortiler2D.py | 135 ++++++++++++++---- test/python/tensortiler.py | 8 +- 4 files changed, 134 insertions(+), 41 deletions(-) diff --git a/programming_examples/basic/matrix_scalar_add/aie2.py b/programming_examples/basic/matrix_scalar_add/aie2.py index 87d75fd88b..bb951e3691 100644 --- a/programming_examples/basic/matrix_scalar_add/aie2.py +++ b/programming_examples/basic/matrix_scalar_add/aie2.py @@ -12,6 +12,7 @@ from aie.dialects.aiex import * from aie.extras.context import mlir_mod_ctx from aie.helpers.dialects.ext.scf import _for as range_ +from aie.helpers.tensortiler.tensortiler2D import TensorTiler2D # Size of the entire image IMAGE_HEIGHT = 16 @@ -68,14 +69,17 @@ def core_body(): of_out1.release(ObjectFifoPort.Produce, 1) # To/from AIE-array data movement + tiler = TensorTiler2D(IMAGE_HEIGHT, IMAGE_WIDTH, TILE_HEIGHT, TILE_WIDTH) + t = next(tiler.tile_iter()) # Only transfer one tile of data + @runtime_sequence(tile_ty, tile_ty, tile_ty) def sequence(inTensor, notUsed, outTensor): npu_dma_memcpy_nd( metadata=of_in1, bd_id=1, mem=inTensor, - sizes=[1, 1, TILE_HEIGHT, TILE_WIDTH], - strides=[1, 1, IMAGE_WIDTH, 1], + sizes=t.sizes, + strides=t.strides, issue_token=True, ) @@ -83,8 +87,8 @@ def sequence(inTensor, notUsed, outTensor): metadata=of_out1, bd_id=0, mem=outTensor, - sizes=[1, 1, TILE_HEIGHT, TILE_WIDTH], - strides=[1, 1, IMAGE_WIDTH, 1], + sizes=t.sizes, + strides=t.strides, ) dma_wait(of_in1, of_out1) diff --git a/programming_examples/basic/row_wise_bias_add/aie2.py b/programming_examples/basic/row_wise_bias_add/aie2.py index 1589473636..a79d3bea76 100644 --- a/programming_examples/basic/row_wise_bias_add/aie2.py +++ b/programming_examples/basic/row_wise_bias_add/aie2.py @@ -11,6 +11,7 @@ from aie.dialects.aiex import * from aie.extras.context import mlir_mod_ctx from aie.helpers.dialects.ext.scf import _for as range_ +from aie.helpers.tensortiler.tensortiler2D import TensorTiler2D def row_wise_bias_add(M, N, m, n): @@ -48,28 +49,35 @@ def core_body(): in_fifo.release(ObjectFifoPort.Consume, 1) bias_fifo.release(ObjectFifoPort.Consume, 1) + tiler = TensorTiler2D(M, N, m, n, tensor_col_major=True) + t = next( + tiler.tile_iter(chunk_height=M // m, chunk_width=N // n) + ) # Transfer all tiles at once + bias_tiler = TensorTiler2D(1, N, 1, n) + bias_t = next(bias_tiler.tile_iter(chunk_width=N // n)) + @runtime_sequence(tensor_ty, bias_ty, tensor_ty) def sequence(inp, bias, out): npu_dma_memcpy_nd( metadata=in_fifo, bd_id=0, mem=inp, - sizes=[1, N // n, M, n], - strides=[0, n, N, 1], + sizes=t.sizes, + strides=t.strides, ) npu_dma_memcpy_nd( metadata=bias_fifo, bd_id=1, mem=bias, - sizes=[1, 1, N // n, n], - strides=[0, 0, n, 1], + sizes=bias_t.sizes, + strides=bias_t.strides, ) npu_dma_memcpy_nd( metadata=out_fifo, bd_id=2, mem=out, - sizes=[1, N // n, M, n], - strides=[0, n, N, 1], + sizes=t.sizes, + strides=t.strides, ) # of_out will only complete after of_in completes, so we just wait on of_out instead of both dma_wait(out_fifo) diff --git a/python/helpers/tensortiler/tensortiler2D.py b/python/helpers/tensortiler/tensortiler2D.py index 1705472421..2c2024af03 100644 --- a/python/helpers/tensortiler/tensortiler2D.py +++ b/python/helpers/tensortiler/tensortiler2D.py @@ -74,6 +74,11 @@ def __next__(self): class TensorTiler2D: + """ + This class tries really hard to keep the innermost stride dimension as 1, + but is not always successful. + """ + def __init__( self, tensor_height: int, @@ -94,27 +99,71 @@ def __init__( self.__num_tiles_per_row = self.__tensor_width // self.__tile_width self.__num_tiles_per_column = self.__tensor_height // self.__tile_height - # For row-major tiling for row-major tiles - self.__sizes = [ - self.__num_tiles_per_column, - self.__num_tiles_per_row, - self.__tile_height, - self.__tile_width, - ] - self.__strides = [ - self.__tile_width * self.__tile_height * self.__num_tiles_per_row, - self.__tile_width, - self.__tensor_width, - 1, - ] - self.__tensor_col_major = tensor_col_major - if tensor_col_major: - self.__sizes[0], self.__sizes[1] = self.__sizes[1], self.__sizes[0] - self.__strides[0], self.__strides[1] = self.__strides[1], self.__strides[0] - if tile_col_major: - self.__sizes[2], self.__sizes[3] = self.__sizes[3], self.__sizes[2] - self.__strides[2], self.__strides[3] = self.__strides[3], self.__strides[2] + self.__tile_col_major = tile_col_major + + if not self.__tile_col_major and ( + self.__tensor_col_major or self.__tile_width == self.__tensor_width + ): + # This will work in one piece + self.__sizes = [ + 1, + self.__num_tiles_per_row, + self.__tensor_height, + self.__tile_width, + ] + self.__strides = [1, self.__tile_width, self.__tensor_width, 1] + elif self.__tile_col_major and ( + not self.__tensor_col_major or self.__tile_height == self.__tensor_height + ): + # This will also work in one piece + self.__sizes = [ + 1, + self.__num_tiles_per_column, + self.__tensor_width, + self.__tile_height, + ] + self.__strides = [ + 1, + self.__tensor_width * self.__tile_height, + 1, + self.__tensor_width, + ] + else: + # These cases need to be done either column by column or row by row + self.__sizes = [ + self.__num_tiles_per_column, + self.__num_tiles_per_row, + self.__tile_height, + self.__tile_width, + ] + self.__strides = [ + self.__tile_width * self.__tile_height * self.__num_tiles_per_row, + self.__tile_width, + self.__tensor_width, + 1, + ] + + if self.__tensor_col_major: + self.__sizes[0], self.__sizes[1] = self.__sizes[1], self.__sizes[0] + self.__strides[0], self.__strides[1] = ( + self.__strides[1], + self.__strides[0], + ) + if self.__tile_col_major: + self.__sizes[2], self.__sizes[3] = self.__sizes[3], self.__sizes[2] + self.__strides[2], self.__strides[3] = ( + self.__strides[3], + self.__strides[2], + ) + + @property + def sizes(self): + return self.__sizes.copy() + + @property + def strides(self): + return self.__strides.copy() def tile_iter(self, chunk_height: int = 1, chunk_width: int = 1, col_major=False): assert self.__num_tiles_per_row % chunk_width == 0 @@ -138,18 +187,50 @@ def calc_offset(iter_num): return offset iter_sizes = self.__sizes.copy() - - size_idx = [0, 1] - if self.__tensor_col_major: - size_idx = [1, 0] - iter_sizes[size_idx[0]] = chunk_height - iter_sizes[size_idx[1]] = chunk_width + iter_strides = self.__strides.copy() + + if self.__tile_col_major and not self.__tensor_col_major: + iter_sizes[1] = chunk_height + iter_sizes[2] = chunk_width * self.__tile_width + elif not self.__tile_col_major and self.__tensor_col_major: + iter_sizes[1] = chunk_width + iter_sizes[2] = chunk_height * self.__tile_height + elif chunk_width == 1 and not self.__tile_col_major: + if self.__tile_col_major: + iter_sizes = [1, chunk_height, self.__tile_width, self.__tile_height] + iter_strides = [ + 1, + self.__tile_height * self.__tensor_width, + 1, + self.__tensor_width, + ] + else: + iter_sizes = [ + 1, + 1, + self.__tile_height * chunk_height, + self.__tile_width, + ] + iter_strides = [1, self.__tile_width, self.__tensor_width, 1] + elif chunk_height == 1: + if self.__tile_col_major: + iter_sizes = [1, 1, self.__tile_width * chunk_width, self.__tile_height] + iter_strides = [1, 1, 1, self.__tensor_width] + else: + iter_sizes = [1, chunk_width, self.__tile_height, self.__tile_width] + iter_strides = [1, self.__tile_width, self.__tensor_width, 1] + else: + size_idx = [0, 1] + if self.__tensor_col_major: + size_idx = [1, 0] + iter_sizes[size_idx[0]] = chunk_height + iter_sizes[size_idx[1]] = chunk_width return TensorTile2DIter( self.__tensor_height, self.__tensor_width, iter_sizes, - self.__strides, + iter_strides, offset_fn=calc_offset, num_steps=steps, ) diff --git a/test/python/tensortiler.py b/test/python/tensortiler.py index 931d328b70..2fb628261c 100644 --- a/test/python/tensortiler.py +++ b/test/python/tensortiler.py @@ -34,7 +34,7 @@ def tensortiler_simple(): assert ( t.sizes == expected_sizes ), f"Expected sizes {expected_sizes} but got {t.sizes}" - expected_strides = [6, 3, 3, 1] + expected_strides = [1, 3, 3, 1] assert ( t.strides == expected_strides ), f"Expected strides {expected_strides} but got {t.strides}" @@ -101,7 +101,7 @@ def tensortiler_tensor_row_major_tile_col_major(): assert ( t.sizes == expected_sizes ), f"Expected sizes {expected_sizes} but got {t.sizes}" - expected_strides = [36, 4, 1, 12] + expected_strides = [1, 36, 1, 12] assert ( t.strides == expected_strides ), f"Expected strides {expected_strides} but got {t.strides}" @@ -162,7 +162,7 @@ def tensortiler_tensor_col_major_tile_col_major(): assert ( t.sizes == expected_sizes ), f"Expected sizes {expected_sizes} but got {t.sizes}" - expected_strides = [4, 36, 1, 12] + expected_strides = [1, 1, 1, 12] assert ( t.strides == expected_strides ), f"Expected strides {expected_strides} but got {t.strides}" @@ -223,7 +223,7 @@ def tensortiler_tensor_col_major_tile_row_major(): assert ( t.sizes == expected_sizes ), f"Expected sizes {expected_sizes} but got {t.sizes}" - expected_strides = [4, 36, 12, 1] + expected_strides = [1, 4, 12, 1] assert ( t.strides == expected_strides ), f"Expected strides {expected_strides} but got {t.strides}" From 8d67307558979153dc4da6b5e2122ed573e51cc1 Mon Sep 17 00:00:00 2001 From: Erika Hunhoff Date: Tue, 22 Oct 2024 11:12:32 -0600 Subject: [PATCH 04/35] Some small improvements to tensortiler --- python/helpers/tensortiler/tensortiler2D.py | 203 +- test/python/tensortiler.py | 2245 ++++++++++++++++++- 2 files changed, 2363 insertions(+), 85 deletions(-) diff --git a/python/helpers/tensortiler/tensortiler2D.py b/python/helpers/tensortiler/tensortiler2D.py index 2c2024af03..26fdd3646a 100644 --- a/python/helpers/tensortiler/tensortiler2D.py +++ b/python/helpers/tensortiler/tensortiler2D.py @@ -1,4 +1,7 @@ import numpy as np +import os +import sys +from typing import Callable class TensorTile: @@ -16,8 +19,14 @@ def __init__( self.sizes = sizes self.strides = strides - def visualize(self, show_arrows: bool = True, show_numbers: bool = False): - TensorTiler2D.access_heatmap( + def visualize( + self, + show_arrows: bool = True, + show_numbers: bool = False, + file_path: str | None = None, + show_plot: bool = True, + ) -> None: + TensorTiler2D.generate_access_graph( self.tensor_height, self.tensor_width, self.sizes, @@ -25,10 +34,12 @@ def visualize(self, show_arrows: bool = True, show_numbers: bool = False): offset=self.offset, show_arrows=show_arrows, show_numbers=show_numbers, + file_path=file_path, + show_plot=show_plot, ) - def access_map(self): - return TensorTiler2D.access_order_map( + def access_order(self) -> np.ndarray: + return TensorTiler2D.get_access_order_tensor( self.tensor_height, self.tensor_width, self.sizes, @@ -44,7 +55,7 @@ def __init__( tensor_width: int, sizes: list[int], strides: list[int], - offset_fn, + offset_fn: Callable[[int], int], num_steps: int, ): self.__num_steps = num_steps @@ -59,7 +70,7 @@ def __init__( def __iter__(self): return self - def __next__(self): + def __next__(self) -> TensorTile: if self.__current_step == self.__num_steps: raise StopIteration step = self.__current_step @@ -75,21 +86,27 @@ def __next__(self): class TensorTiler2D: """ - This class tries really hard to keep the innermost stride dimension as 1, - but is not always successful. + This is an experimental class to help with defining data transformations. + It is a work in progress. """ + DTYPE = np.int32 + def __init__( self, tensor_height: int, tensor_width: int, tile_height: int, tile_width: int, - tensor_col_major=False, - tile_col_major=False, + tensor_col_major: bool = False, + tile_col_major: bool = False, ): - assert tensor_height % tile_height == 0 - assert tensor_width % tile_width == 0 + assert ( + tensor_height % tile_height == 0 + ), "Tensor height must be divisible by tile height" + assert ( + tensor_width % tile_width == 0 + ), "Tensor width must be divisible by tile width" self.__tensor_height = tensor_height self.__tensor_width = tensor_width @@ -105,7 +122,7 @@ def __init__( if not self.__tile_col_major and ( self.__tensor_col_major or self.__tile_width == self.__tensor_width ): - # This will work in one piece + # This is a special case where we can express the transformation with a less complicated transform self.__sizes = [ 1, self.__num_tiles_per_row, @@ -116,7 +133,7 @@ def __init__( elif self.__tile_col_major and ( not self.__tensor_col_major or self.__tile_height == self.__tensor_height ): - # This will also work in one piece + # This is a special case where we can express the transformation with a less complicated transform self.__sizes = [ 1, self.__num_tiles_per_column, @@ -130,7 +147,15 @@ def __init__( self.__tensor_width, ] else: - # These cases need to be done either column by column or row by row + """ + This is the case that *should* always represent a correct/valid + transformation (according to my modelling using visualization tools). + + It should work even with the special cases above. + + But in my experience, these transformations are not always valid to the NPU + as stride dimension size may exceed allowable, hence the special cases above. + """ self.__sizes = [ self.__num_tiles_per_column, self.__num_tiles_per_row, @@ -158,14 +183,16 @@ def __init__( ) @property - def sizes(self): + def sizes(self) -> list[int]: return self.__sizes.copy() @property - def strides(self): + def strides(self) -> list[int]: return self.__strides.copy() - def tile_iter(self, chunk_height: int = 1, chunk_width: int = 1, col_major=False): + def tile_iter( + self, chunk_height: int = 1, chunk_width: int = 1, col_major: bool = False + ) -> TensorTile2DIter: assert self.__num_tiles_per_row % chunk_width == 0 assert self.__num_tiles_per_column % chunk_height == 0 @@ -190,12 +217,15 @@ def calc_offset(iter_num): iter_strides = self.__strides.copy() if self.__tile_col_major and not self.__tensor_col_major: + # This is a special case where we can combine a chunk into one logical tile (horizontally) iter_sizes[1] = chunk_height iter_sizes[2] = chunk_width * self.__tile_width elif not self.__tile_col_major and self.__tensor_col_major: + # This is a special case where we can combine a chunk into one logical tile (vertically) iter_sizes[1] = chunk_width iter_sizes[2] = chunk_height * self.__tile_height - elif chunk_width == 1 and not self.__tile_col_major: + elif chunk_width == 1: + # These are two more special cases; we can combine tiles here too to get a simpler transform if self.__tile_col_major: iter_sizes = [1, chunk_height, self.__tile_width, self.__tile_height] iter_strides = [ @@ -213,6 +243,7 @@ def calc_offset(iter_num): ] iter_strides = [1, self.__tile_width, self.__tensor_width, 1] elif chunk_height == 1: + # These are two more special cases; we can combine tiles here too to get a simpler transform if self.__tile_col_major: iter_sizes = [1, 1, self.__tile_width * chunk_width, self.__tile_height] iter_strides = [1, 1, 1, self.__tensor_width] @@ -220,12 +251,20 @@ def calc_offset(iter_num): iter_sizes = [1, chunk_width, self.__tile_height, self.__tile_width] iter_strides = [1, self.__tile_width, self.__tensor_width, 1] else: + # This should always be the case that creates a correct transfrom; + # however, it may be needlessly complex (large values in out dimensions) size_idx = [0, 1] if self.__tensor_col_major: size_idx = [1, 0] iter_sizes[size_idx[0]] = chunk_height iter_sizes[size_idx[1]] = chunk_width + if iter_strides[3] != 1: + print( + f"WARNING: innermost strides dimension in {iter_strides[3]}, but current hardware requires it to be 1.", + file=sys.stderr, + ) + return TensorTile2DIter( self.__tensor_height, self.__tensor_width, @@ -235,16 +274,18 @@ def calc_offset(iter_num): num_steps=steps, ) - def __str__(self): + def __str__(self) -> str: return f"sizes={self.__sizes}, strides={self.__strides}" @classmethod - def _generate_access_map( + def _generate_access_graph_from_tensor( cls, - access_order_map: type[np.ndarray], - title="Access Order", - show_arrows=True, - show_numbers=False, + access_order_tensor: np.ndarray, + title: str = "Access Order", + show_arrows: bool = True, + show_numbers: bool = False, + file_path: str | None = None, + show_plot: bool = True, ): try: import matplotlib @@ -252,34 +293,35 @@ def _generate_access_map( import matplotlib.patheffects as pe except: raise ImportError( - "You must pip install matplotlib in order to render visual access maps" + "You must pip install matplotlib in order to render access graphs" ) - # In inches + # In inches, this is a little hacky + # should maybe be defined by the size of the tensor e.g., how many elem per inch matplotlib.rcParams["figure.figsize"] = [10, 7] _fig, ax = plt.subplots() - _heatmap = ax.pcolor(access_order_map, cmap="gnuplot2") + _heatmap = ax.pcolor(access_order_tensor, cmap="gnuplot2") # Thanks to https://stackoverflow.com/questions/14406214/moving-x-axis-to-the-top-of-a-plot-in-matplotlib # put the major ticks at the middle of each cell, (0, 0) in upper left corner - ax.set_xticks(np.arange(access_order_map.shape[1]) + 0.5, minor=False) - ax.set_yticks(np.arange(access_order_map.shape[0]) + 0.5, minor=False) + ax.set_xticks(np.arange(access_order_tensor.shape[1]) + 0.5, minor=False) + ax.set_yticks(np.arange(access_order_tensor.shape[0]) + 0.5, minor=False) ax.invert_yaxis() ax.xaxis.tick_top() ax.set_xticklabels( - np.arange(0, access_order_map.shape[1]), minor=False, rotation="vertical" + np.arange(0, access_order_tensor.shape[1]), minor=False, rotation="vertical" ) - ax.set_yticklabels(np.arange(0, access_order_map.shape[0]), minor=False) + ax.set_yticklabels(np.arange(0, access_order_tensor.shape[0]), minor=False) plt.title(title) - # add numbers to the plot + # Add numbers to the plot if show_numbers: - # thanks to https://stackoverflow.com/questions/37719304/python-imshow-set-certain-value-to-defined-color - # thanks to tmdavison answer here https://stackoverflow.com/a/40890587/7871710 - for i in range(access_order_map.shape[0]): - for j in range(access_order_map.shape[1]): - c = access_order_map[i, j] + # Thanks to https://stackoverflow.com/questions/37719304/python-imshow-set-certain-value-to-defined-color + # Thanks to tmdavison answer here https://stackoverflow.com/a/40890587/7871710 + for i in range(access_order_tensor.shape[0]): + for j in range(access_order_tensor.shape[1]): + c = access_order_tensor[i, j] if c != -1: ax.text( j + 0.45, @@ -290,13 +332,13 @@ def _generate_access_map( ], ) - # add arrows to show access order + # Add arrows to show access order if show_arrows: order_dict = {} - for i in range(access_order_map.shape[0]): - for j in range(access_order_map.shape[1]): - if access_order_map[i, j] != -1: - order_dict[access_order_map[i, j]] = (i, j) + for i in range(access_order_tensor.shape[0]): + for j in range(access_order_tensor.shape[1]): + if access_order_tensor[i, j] != -1: + order_dict[access_order_tensor[i, j]] = (i, j) for i in range(len(order_dict) - 1): y1, x1 = order_dict[i] y2, x2 = order_dict[i + 1] @@ -311,10 +353,19 @@ def _generate_access_map( overhang=0.2, path_effects=[pe.withStroke(linewidth=3, foreground="white")], ) - plt.show() + + if show_plot: + plt.show() + if file_path: + if os.path.exists(file_path): + print( + f"Cannot save plot to {file_path}; file already exists", + file=sys.stderr, + ) + plt.savefig(file_path) @classmethod - def access_order_map( + def get_access_order_tensor( cls, tensor_height: int, tensor_width: int, @@ -323,37 +374,44 @@ def access_order_map( tile_height: int | None = None, tile_width: int | None = None, offset: int = 0, - ): - assert tensor_height > 0 and tensor_width > 0 - assert len(sizes) == 4 - assert len(strides) == 4 + ) -> np.ndarray: + assert tensor_height > 0 and tensor_width > 0, "Tensor dimensions must be > 0" + assert len(sizes) == 4, "Sizes should be a list of size 4" + assert len(strides) == 4, "Strides should be a list of size 4" assert (tile_height is None and tile_width is None) or ( (tile_height != None and tile_width != None) and (tile_height > 0 and tile_width > 0) - ) + ), "Tile Height and Tile Width should both be specified, or neither specified" # Generate access order map access_order_tensor = np.full( - (tensor_height * tensor_width,), -1, dtype=np.int32 + (tensor_height * tensor_width,), -1, dtype=cls.DTYPE ) access_count = 0 for i in range(sizes[0]): for j in range(sizes[1]): for k in range(sizes[2]): for l in range(sizes[3]): - access_order_tensor[ + access_idx = ( offset + i * strides[0] + j * strides[1] + k * strides[2] + l * strides[3] - ] = access_count + ) + assert ( + access_order_tensor[access_idx] == -1 + ), f"Attempted to access index={access_idx} twice." + access_order_tensor[access_idx] = access_count access_count += 1 + assert access_count <= np.prod( + access_order_tensor.shape + ), f"Access pattern has too many elements (expected max {np.prod(access_order_tensor.shape)}, got {access_count})" access_order_tensor = access_order_tensor.reshape((tensor_height, tensor_width)) return access_order_tensor @classmethod - def access_heatmap( + def generate_access_graph( cls, tensor_height: int, tensor_width: int, @@ -362,10 +420,12 @@ def access_heatmap( tile_height: int | None = None, tile_width: int | None = None, offset: int = 0, - show_arrows=True, - show_numbers=False, + show_arrows: bool = True, + show_numbers: bool = False, + file_path: str | None = None, + show_plot: bool = True, ): - access_order_tensor = cls.access_order_map( + access_order_tensor = cls.get_access_order_tensor( tensor_height, tensor_width, sizes, @@ -377,15 +437,25 @@ def access_heatmap( # Show a graph for a single tile if tile_height != None and tile_width != None: - cls._generate_access_map( + if file_path: + tile_file_path = file_path + ".tile.png" + else: + tile_file_path = None + cls._generate_access_graph_from_tensor( access_order_tensor[0:tile_height, 0:tile_width], title="Per-Tile Access Order", show_arrows=show_arrows, show_numbers=show_numbers, + file_path=tile_file_path, + show_plot=show_plot, ) - cls._generate_access_map( - access_order_tensor, show_arrows=show_arrows, show_numbers=show_numbers + cls._generate_access_graph_from_tensor( + access_order_tensor, + show_arrows=show_arrows, + show_numbers=show_numbers, + file_path=file_path, + show_plot=show_plot, ) def visualize( @@ -393,10 +463,12 @@ def visualize( show_tile: bool = True, show_arrows: bool = True, show_numbers: bool = False, - ): + file_path: str | None = None, + show_plot: bool = True, + ) -> None: tile_height = self.__tile_height if show_tile else None tile_width = self.__tile_width if show_tile else None - self.access_heatmap( + self.generate_access_graph( self.__tensor_height, self.__tensor_width, self.__sizes, @@ -405,10 +477,13 @@ def visualize( tile_width=tile_width, show_arrows=show_arrows, show_numbers=show_numbers, + file_path=file_path, + show_plot=show_plot, ) - def access_map(self): - return self.access_order_map( + def access_order(self) -> np.ndarray: + # Call class method + return self.get_access_order_tensor( self.__tensor_height, self.__tensor_width, self.__sizes, diff --git a/test/python/tensortiler.py b/test/python/tensortiler.py index 2fb628261c..f60275c0e5 100644 --- a/test/python/tensortiler.py +++ b/test/python/tensortiler.py @@ -13,7 +13,7 @@ def tensortiler_simple(): TENSOR_WIDTH = 3 tiler = TensorTiler2D(TENSOR_HEIGHT, TENSOR_WIDTH, TENSOR_HEIGHT, TENSOR_WIDTH) - access_map = tiler.access_map() + access_map = tiler.access_order() expected = np.array([[0, 1, 2], [3, 4, 5]]) assert expected.shape == access_map.shape @@ -40,8 +40,8 @@ def tensortiler_simple(): ), f"Expected strides {expected_strides} but got {t.strides}" assert ( - expected == t.access_map() - ).all(), f"Expected {expected} but got {t.access_map()}" + expected == t.access_order() + ).all(), f"Expected {expected} but got {t.access_order()}" try: next(iter) @@ -69,7 +69,7 @@ def tensortiler_tensor_row_major_tile_col_major(): tensor_col_major=False, tile_col_major=True, ) - access_map = tiler.access_map() + access_map = tiler.access_order() expected_tile = np.array([[0, 3, 6, 9], [1, 4, 7, 10], [2, 5, 8, 11]]) assert (TENSOR_HEIGHT, TENSOR_WIDTH) == access_map.shape @@ -107,8 +107,8 @@ def tensortiler_tensor_row_major_tile_col_major(): ), f"Expected strides {expected_strides} but got {t.strides}" assert ( - expected_tile == t.access_map()[0:TILE_HEIGHT, 0:TILE_WIDTH] - ).all(), f"Expected {expected_tile} but got {t.access_map()[0:TILE_HEIGHT, 0:TILE_WIDTH]}" + expected_tile == t.access_order()[0:TILE_HEIGHT, 0:TILE_WIDTH] + ).all(), f"Expected {expected_tile} but got {t.access_order()[0:TILE_HEIGHT, 0:TILE_WIDTH]}" # CHECK: Pass! print("Pass!") @@ -130,7 +130,7 @@ def tensortiler_tensor_col_major_tile_col_major(): tensor_col_major=True, tile_col_major=True, ) - access_map = tiler.access_map() + access_map = tiler.access_order() expected_tile = np.array([[0, 3, 6, 9], [1, 4, 7, 10], [2, 5, 8, 11]]) assert (TENSOR_HEIGHT, TENSOR_WIDTH) == access_map.shape @@ -162,14 +162,14 @@ def tensortiler_tensor_col_major_tile_col_major(): assert ( t.sizes == expected_sizes ), f"Expected sizes {expected_sizes} but got {t.sizes}" - expected_strides = [1, 1, 1, 12] + expected_strides = [1, 36, 1, 12] assert ( t.strides == expected_strides ), f"Expected strides {expected_strides} but got {t.strides}" assert ( - expected_tile == t.access_map()[0:TILE_HEIGHT, 0:TILE_WIDTH] - ).all(), f"Expected {expected_tile} but got {t.access_map()[0:TILE_HEIGHT, 0:TILE_WIDTH]}" + expected_tile == t.access_order()[0:TILE_HEIGHT, 0:TILE_WIDTH] + ).all(), f"Expected {expected_tile} but got {t.access_order()[0:TILE_HEIGHT, 0:TILE_WIDTH]}" # CHECK: Pass! print("Pass!") @@ -191,7 +191,7 @@ def tensortiler_tensor_col_major_tile_row_major(): tensor_col_major=True, tile_col_major=False, ) - access_map = tiler.access_map() + access_map = tiler.access_order() expected_tile = np.array([[0, 1, 2, 3], [4, 5, 6, 7], [8, 9, 10, 11]]) assert (TENSOR_HEIGHT, TENSOR_WIDTH) == access_map.shape @@ -229,8 +229,8 @@ def tensortiler_tensor_col_major_tile_row_major(): ), f"Expected strides {expected_strides} but got {t.strides}" assert ( - expected_tile == t.access_map()[0:TILE_HEIGHT, 0:TILE_WIDTH] - ).all(), f"Expected {expected_tile} but got {t.access_map()[0:TILE_HEIGHT, 0:TILE_WIDTH]}" + expected_tile == t.access_order()[0:TILE_HEIGHT, 0:TILE_WIDTH] + ).all(), f"Expected {expected_tile} but got {t.access_order()[0:TILE_HEIGHT, 0:TILE_WIDTH]}" # CHECK: Pass! print("Pass!") @@ -283,8 +283,8 @@ def tensortiler_tensor_iter_chunk_row_major(): ), f"Expected strides {expected_strides} but got {t.strides}" assert ( - expected_tile == t.access_map()[0:TILE_HEIGHT, 0:TILE_WIDTH] - ).all(), f"Expected {expected_tile} but got {t.access_map()[0:TILE_HEIGHT, 0:TILE_WIDTH]}" + expected_tile == t.access_order()[0:TILE_HEIGHT, 0:TILE_WIDTH] + ).all(), f"Expected {expected_tile} but got {t.access_order()[0:TILE_HEIGHT, 0:TILE_WIDTH]}" t = tiles[1] assert ( @@ -308,10 +308,10 @@ def tensortiler_tensor_iter_chunk_row_major(): assert ( expected_tile - == t.access_map()[ + == t.access_order()[ 0:TILE_HEIGHT, CHUNK_WIDTH * TILE_WIDTH : CHUNK_WIDTH * (TILE_WIDTH + 1) ] - ).all(), f"Expected {expected_tile} but got {t.access_map()[0:TILE_HEIGHT, CHUNK_WIDTH*TILE_WIDTH:CHUNK_WIDTH*(TILE_WIDTH+1)]}" + ).all(), f"Expected {expected_tile} but got {t.access_order()[0:TILE_HEIGHT, CHUNK_WIDTH*TILE_WIDTH:CHUNK_WIDTH*(TILE_WIDTH+1)]}" # CHECK: Pass! print("Pass!") @@ -364,8 +364,8 @@ def tensortiler_tensor_iter_chunk_col_major(): ), f"Expected strides {expected_strides} but got {t.strides}" assert ( - expected_tile == t.access_map()[0:TILE_HEIGHT, 0:TILE_WIDTH] - ).all(), f"Expected {expected_tile} but got {t.access_map()[0:TILE_HEIGHT, 0:TILE_WIDTH]}" + expected_tile == t.access_order()[0:TILE_HEIGHT, 0:TILE_WIDTH] + ).all(), f"Expected {expected_tile} but got {t.access_order()[0:TILE_HEIGHT, 0:TILE_WIDTH]}" t = tiles[1] assert ( @@ -387,10 +387,2213 @@ def tensortiler_tensor_iter_chunk_col_major(): assert ( expected_tile - == t.access_map()[ + == t.access_order()[ CHUNK_HEIGHT * TILE_HEIGHT : (CHUNK_HEIGHT + 1) * TILE_HEIGHT, 0:TILE_WIDTH ] - ).all(), f"Expected {expected_tile} but got {t.access_map()[CHUNK_HEIGHT*TILE_HEIGHT:(CHUNK_HEIGHT+1)*TILE_HEIGHT, 0:TILE_WIDTH]}" + ).all(), f"Expected {expected_tile} but got {t.access_order()[CHUNK_HEIGHT*TILE_HEIGHT:(CHUNK_HEIGHT+1)*TILE_HEIGHT, 0:TILE_WIDTH]}" # CHECK: Pass! print("Pass!") + + +# CHECK-LABEL: square_tiler +@construct_test +def square_tiler(): + tiler = TensorTiler2D(32, 32, 4, 4) + access_order = tiler.access_order() + reference_access = np.array( + [ + [ + 0, + 1, + 2, + 3, + 16, + 17, + 18, + 19, + 32, + 33, + 34, + 35, + 48, + 49, + 50, + 51, + 64, + 65, + 66, + 67, + 80, + 81, + 82, + 83, + 96, + 97, + 98, + 99, + 112, + 113, + 114, + 115, + ], + [ + 4, + 5, + 6, + 7, + 20, + 21, + 22, + 23, + 36, + 37, + 38, + 39, + 52, + 53, + 54, + 55, + 68, + 69, + 70, + 71, + 84, + 85, + 86, + 87, + 100, + 101, + 102, + 103, + 116, + 117, + 118, + 119, + ], + [ + 8, + 9, + 10, + 11, + 24, + 25, + 26, + 27, + 40, + 41, + 42, + 43, + 56, + 57, + 58, + 59, + 72, + 73, + 74, + 75, + 88, + 89, + 90, + 91, + 104, + 105, + 106, + 107, + 120, + 121, + 122, + 123, + ], + [ + 12, + 13, + 14, + 15, + 28, + 29, + 30, + 31, + 44, + 45, + 46, + 47, + 60, + 61, + 62, + 63, + 76, + 77, + 78, + 79, + 92, + 93, + 94, + 95, + 108, + 109, + 110, + 111, + 124, + 125, + 126, + 127, + ], + [ + 128, + 129, + 130, + 131, + 144, + 145, + 146, + 147, + 160, + 161, + 162, + 163, + 176, + 177, + 178, + 179, + 192, + 193, + 194, + 195, + 208, + 209, + 210, + 211, + 224, + 225, + 226, + 227, + 240, + 241, + 242, + 243, + ], + [ + 132, + 133, + 134, + 135, + 148, + 149, + 150, + 151, + 164, + 165, + 166, + 167, + 180, + 181, + 182, + 183, + 196, + 197, + 198, + 199, + 212, + 213, + 214, + 215, + 228, + 229, + 230, + 231, + 244, + 245, + 246, + 247, + ], + [ + 136, + 137, + 138, + 139, + 152, + 153, + 154, + 155, + 168, + 169, + 170, + 171, + 184, + 185, + 186, + 187, + 200, + 201, + 202, + 203, + 216, + 217, + 218, + 219, + 232, + 233, + 234, + 235, + 248, + 249, + 250, + 251, + ], + [ + 140, + 141, + 142, + 143, + 156, + 157, + 158, + 159, + 172, + 173, + 174, + 175, + 188, + 189, + 190, + 191, + 204, + 205, + 206, + 207, + 220, + 221, + 222, + 223, + 236, + 237, + 238, + 239, + 252, + 253, + 254, + 255, + ], + [ + 256, + 257, + 258, + 259, + 272, + 273, + 274, + 275, + 288, + 289, + 290, + 291, + 304, + 305, + 306, + 307, + 320, + 321, + 322, + 323, + 336, + 337, + 338, + 339, + 352, + 353, + 354, + 355, + 368, + 369, + 370, + 371, + ], + [ + 260, + 261, + 262, + 263, + 276, + 277, + 278, + 279, + 292, + 293, + 294, + 295, + 308, + 309, + 310, + 311, + 324, + 325, + 326, + 327, + 340, + 341, + 342, + 343, + 356, + 357, + 358, + 359, + 372, + 373, + 374, + 375, + ], + [ + 264, + 265, + 266, + 267, + 280, + 281, + 282, + 283, + 296, + 297, + 298, + 299, + 312, + 313, + 314, + 315, + 328, + 329, + 330, + 331, + 344, + 345, + 346, + 347, + 360, + 361, + 362, + 363, + 376, + 377, + 378, + 379, + ], + [ + 268, + 269, + 270, + 271, + 284, + 285, + 286, + 287, + 300, + 301, + 302, + 303, + 316, + 317, + 318, + 319, + 332, + 333, + 334, + 335, + 348, + 349, + 350, + 351, + 364, + 365, + 366, + 367, + 380, + 381, + 382, + 383, + ], + [ + 384, + 385, + 386, + 387, + 400, + 401, + 402, + 403, + 416, + 417, + 418, + 419, + 432, + 433, + 434, + 435, + 448, + 449, + 450, + 451, + 464, + 465, + 466, + 467, + 480, + 481, + 482, + 483, + 496, + 497, + 498, + 499, + ], + [ + 388, + 389, + 390, + 391, + 404, + 405, + 406, + 407, + 420, + 421, + 422, + 423, + 436, + 437, + 438, + 439, + 452, + 453, + 454, + 455, + 468, + 469, + 470, + 471, + 484, + 485, + 486, + 487, + 500, + 501, + 502, + 503, + ], + [ + 392, + 393, + 394, + 395, + 408, + 409, + 410, + 411, + 424, + 425, + 426, + 427, + 440, + 441, + 442, + 443, + 456, + 457, + 458, + 459, + 472, + 473, + 474, + 475, + 488, + 489, + 490, + 491, + 504, + 505, + 506, + 507, + ], + [ + 396, + 397, + 398, + 399, + 412, + 413, + 414, + 415, + 428, + 429, + 430, + 431, + 444, + 445, + 446, + 447, + 460, + 461, + 462, + 463, + 476, + 477, + 478, + 479, + 492, + 493, + 494, + 495, + 508, + 509, + 510, + 511, + ], + [ + 512, + 513, + 514, + 515, + 528, + 529, + 530, + 531, + 544, + 545, + 546, + 547, + 560, + 561, + 562, + 563, + 576, + 577, + 578, + 579, + 592, + 593, + 594, + 595, + 608, + 609, + 610, + 611, + 624, + 625, + 626, + 627, + ], + [ + 516, + 517, + 518, + 519, + 532, + 533, + 534, + 535, + 548, + 549, + 550, + 551, + 564, + 565, + 566, + 567, + 580, + 581, + 582, + 583, + 596, + 597, + 598, + 599, + 612, + 613, + 614, + 615, + 628, + 629, + 630, + 631, + ], + [ + 520, + 521, + 522, + 523, + 536, + 537, + 538, + 539, + 552, + 553, + 554, + 555, + 568, + 569, + 570, + 571, + 584, + 585, + 586, + 587, + 600, + 601, + 602, + 603, + 616, + 617, + 618, + 619, + 632, + 633, + 634, + 635, + ], + [ + 524, + 525, + 526, + 527, + 540, + 541, + 542, + 543, + 556, + 557, + 558, + 559, + 572, + 573, + 574, + 575, + 588, + 589, + 590, + 591, + 604, + 605, + 606, + 607, + 620, + 621, + 622, + 623, + 636, + 637, + 638, + 639, + ], + [ + 640, + 641, + 642, + 643, + 656, + 657, + 658, + 659, + 672, + 673, + 674, + 675, + 688, + 689, + 690, + 691, + 704, + 705, + 706, + 707, + 720, + 721, + 722, + 723, + 736, + 737, + 738, + 739, + 752, + 753, + 754, + 755, + ], + [ + 644, + 645, + 646, + 647, + 660, + 661, + 662, + 663, + 676, + 677, + 678, + 679, + 692, + 693, + 694, + 695, + 708, + 709, + 710, + 711, + 724, + 725, + 726, + 727, + 740, + 741, + 742, + 743, + 756, + 757, + 758, + 759, + ], + [ + 648, + 649, + 650, + 651, + 664, + 665, + 666, + 667, + 680, + 681, + 682, + 683, + 696, + 697, + 698, + 699, + 712, + 713, + 714, + 715, + 728, + 729, + 730, + 731, + 744, + 745, + 746, + 747, + 760, + 761, + 762, + 763, + ], + [ + 652, + 653, + 654, + 655, + 668, + 669, + 670, + 671, + 684, + 685, + 686, + 687, + 700, + 701, + 702, + 703, + 716, + 717, + 718, + 719, + 732, + 733, + 734, + 735, + 748, + 749, + 750, + 751, + 764, + 765, + 766, + 767, + ], + [ + 768, + 769, + 770, + 771, + 784, + 785, + 786, + 787, + 800, + 801, + 802, + 803, + 816, + 817, + 818, + 819, + 832, + 833, + 834, + 835, + 848, + 849, + 850, + 851, + 864, + 865, + 866, + 867, + 880, + 881, + 882, + 883, + ], + [ + 772, + 773, + 774, + 775, + 788, + 789, + 790, + 791, + 804, + 805, + 806, + 807, + 820, + 821, + 822, + 823, + 836, + 837, + 838, + 839, + 852, + 853, + 854, + 855, + 868, + 869, + 870, + 871, + 884, + 885, + 886, + 887, + ], + [ + 776, + 777, + 778, + 779, + 792, + 793, + 794, + 795, + 808, + 809, + 810, + 811, + 824, + 825, + 826, + 827, + 840, + 841, + 842, + 843, + 856, + 857, + 858, + 859, + 872, + 873, + 874, + 875, + 888, + 889, + 890, + 891, + ], + [ + 780, + 781, + 782, + 783, + 796, + 797, + 798, + 799, + 812, + 813, + 814, + 815, + 828, + 829, + 830, + 831, + 844, + 845, + 846, + 847, + 860, + 861, + 862, + 863, + 876, + 877, + 878, + 879, + 892, + 893, + 894, + 895, + ], + [ + 896, + 897, + 898, + 899, + 912, + 913, + 914, + 915, + 928, + 929, + 930, + 931, + 944, + 945, + 946, + 947, + 960, + 961, + 962, + 963, + 976, + 977, + 978, + 979, + 992, + 993, + 994, + 995, + 1008, + 1009, + 1010, + 1011, + ], + [ + 900, + 901, + 902, + 903, + 916, + 917, + 918, + 919, + 932, + 933, + 934, + 935, + 948, + 949, + 950, + 951, + 964, + 965, + 966, + 967, + 980, + 981, + 982, + 983, + 996, + 997, + 998, + 999, + 1012, + 1013, + 1014, + 1015, + ], + [ + 904, + 905, + 906, + 907, + 920, + 921, + 922, + 923, + 936, + 937, + 938, + 939, + 952, + 953, + 954, + 955, + 968, + 969, + 970, + 971, + 984, + 985, + 986, + 987, + 1000, + 1001, + 1002, + 1003, + 1016, + 1017, + 1018, + 1019, + ], + [ + 908, + 909, + 910, + 911, + 924, + 925, + 926, + 927, + 940, + 941, + 942, + 943, + 956, + 957, + 958, + 959, + 972, + 973, + 974, + 975, + 988, + 989, + 990, + 991, + 1004, + 1005, + 1006, + 1007, + 1020, + 1021, + 1022, + 1023, + ], + ], + dtype=TensorTiler2D.DTYPE, + ) + assert (reference_access == access_order).all() + + tile1_reference_order = np.array( + [ + [ + -1, + -1, + -1, + -1, + 0, + 1, + 2, + 3, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + 4, + 5, + 6, + 7, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + 8, + 9, + 10, + 11, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + 12, + 13, + 14, + 15, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + ], + dtype=TensorTiler2D.DTYPE, + ) + + tile_count = 0 + for t in tiler.tile_iter(): + if tile_count == 1: + tile_access_order = t.access_order() + assert (tile_access_order == tile1_reference_order).all() + tile_count += 1 + assert tile_count == 64 From 637e314329a301f21888ae64a47da8d31de37334 Mon Sep 17 00:00:00 2001 From: Erika Hunhoff Date: Tue, 22 Oct 2024 12:10:11 -0600 Subject: [PATCH 05/35] Stub out example --- .../basic/tiling_exploration/Makefile | 39 +++++++++ .../basic/tiling_exploration/aie2.py | 81 +++++++++++++++++ .../basic/tiling_exploration/run_makefile.lit | 10 +++ .../basic/tiling_exploration/test.py | 87 +++++++++++++++++++ python/utils/xrt.py | 8 +- 5 files changed, 222 insertions(+), 3 deletions(-) create mode 100644 programming_examples/basic/tiling_exploration/Makefile create mode 100644 programming_examples/basic/tiling_exploration/aie2.py create mode 100644 programming_examples/basic/tiling_exploration/run_makefile.lit create mode 100644 programming_examples/basic/tiling_exploration/test.py diff --git a/programming_examples/basic/tiling_exploration/Makefile b/programming_examples/basic/tiling_exploration/Makefile new file mode 100644 index 0000000000..93071a5457 --- /dev/null +++ b/programming_examples/basic/tiling_exploration/Makefile @@ -0,0 +1,39 @@ +##===- Makefile -----------------------------------------------------------===## +# +# This file licensed under the Apache License v2.0 with LLVM Exceptions. +# See https://llvm.org/LICENSE.txt for license information. +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +# +# Copyright (C) 2024, Advanced Micro Devices, Inc. +# +##===----------------------------------------------------------------------===## + +srcdir := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST)))) + +include ${srcdir}/../../makefile-common + +tensor_height = 32 +tensor_width = 32 +tile_height = 4 +tile_width = 4 +data_str=${tensor_height}_${tensor_width}_${tile_height}_${tile_width} + +.PHONY: all template clean + +all: build/final_${data_size}.xclbin + +build/aie_${data_str}.mlir: ${srcdir}/aie2.py + mkdir -p ${@D} + python3 $< --tensor-height ${tensor_height} --tensor-width ${tensor_width} --tile-height ${tile_height} --tile-width ${tile_width} > $@ + +build/final_${data_str}.xclbin: build/aie_${data_str}.mlir + mkdir -p ${@D} + cd ${@D} && aiecc.py --aie-generate-cdo --aie-generate-npu --no-compile-host \ + --no-xchesscc --no-xbridge \ + --xclbin-name=${@F} --npu-insts-name=insts_${data_str}.txt $(<:%=../%) + +run: build/final_${data_str}.xclbin build/insts_${data_str}.txt + ${powershell} python3 ${srcdir}/test.py -x build/final_${data_str}.xclbin -i build/insts_${data_str}.txt -k MLIR_AIE --tensor-height ${tensor_height} --tensor-width ${tensor_width} --tile-height ${tile_height} --tile-width ${tile_width} + +clean: + rm -rf build diff --git a/programming_examples/basic/tiling_exploration/aie2.py b/programming_examples/basic/tiling_exploration/aie2.py new file mode 100644 index 0000000000..3de433b916 --- /dev/null +++ b/programming_examples/basic/tiling_exploration/aie2.py @@ -0,0 +1,81 @@ +# tiling_exploration/aie2.py -*- Python -*- +# +# This file is licensed under the Apache License v2.0 with LLVM Exceptions. +# See https://llvm.org/LICENSE.txt for license information. +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +# +# (c) Copyright 2024 Advanced Micro Devices, Inc. or its affiliates +import argparse +import numpy as np +import sys + +from aie.dialects.aie import * +from aie.dialects.aiex import * +from aie.dialects import arith +from aie.extras.context import mlir_mod_ctx +from aie.helpers.dialects.ext.scf import _for as range_ +from aie.helpers.tensortiler.tensortiler2D import TensorTiler2D + + +def generate_module(tensor_height, tensor_width, tile_height, tile_width): + @device(AIEDevice.npu1_1col) + def device_body(): + # define types + tensor_size = tensor_height * tensor_width + flattened_tensor = np.ndarray[(tensor_size,), np.dtype[TensorTiler2D.DTYPE]] + + # Tile declarations + ShimTile = tile(0, 0) + ComputeTile2 = tile(0, 2) + + # AIE-array data movement with object fifos + of_out = object_fifo("out", ComputeTile2, ShimTile, 2, flattened_tensor) + + # Set up compute tiles + + # Compute tile 2 + @core(ComputeTile2) + def core_body(): + for _ in range_(sys.maxsize): + elemOut = of_out.acquire(ObjectFifoPort.Produce, 1) + for i in range_(tensor_size): + # TODO: fix need for cast here. + elemOut[i] = arith.index_cast(T.i32(), i) + of_out.release(ObjectFifoPort.Produce, 1) + + @runtime_sequence(flattened_tensor) + def sequence(access_count): + tiler = TensorTiler2D(tensor_height, tensor_width, tile_height, tile_width) + for t in tiler.tile_iter(): + npu_dma_memcpy_nd( + metadata=of_out, + bd_id=1, + mem=access_count, + sizes=t.sizes, + strides=t.strides, + offsets=[1, 1, 1, t.offset], + ) + dma_wait(of_out) + + +def main(opts): + with mlir_mod_ctx() as ctx: + generate_module( + opts.tensor_height, opts.tensor_width, opts.tile_height, opts.tile_width + ) + print(ctx.module) + + +def get_arg_parser(): + p = argparse.ArgumentParser() + p.add_argument("--tensor-height", required=True, help="Tensor height", type=int) + p.add_argument("--tensor-width", required=True, help="Tensor width", type=int) + p.add_argument("--tile-height", required=True, help="Tile height", type=int) + p.add_argument("--tile-width", required=True, help="Tile width", type=int) + return p + + +if __name__ == "__main__": + p = get_arg_parser() + opts = p.parse_args() + main(opts) diff --git a/programming_examples/basic/tiling_exploration/run_makefile.lit b/programming_examples/basic/tiling_exploration/run_makefile.lit new file mode 100644 index 0000000000..bdafa81a59 --- /dev/null +++ b/programming_examples/basic/tiling_exploration/run_makefile.lit @@ -0,0 +1,10 @@ +// (c) Copyright 2024 Advanced Micro Devices, Inc. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +// REQUIRES: ryzen_ai, peano +// +// RUN: make -f %S/Makefile clean +// RUN: make -f %S/Makefile +// RUN: %run_on_npu make -f %S/Makefile run | FileCheck %s +// CHECK: Running... +// CHECK: PASS! diff --git a/programming_examples/basic/tiling_exploration/test.py b/programming_examples/basic/tiling_exploration/test.py new file mode 100644 index 0000000000..18aa534ce0 --- /dev/null +++ b/programming_examples/basic/tiling_exploration/test.py @@ -0,0 +1,87 @@ +# tiling_exploration/test.py -*- Python -*- +# +# This file is licensed under the Apache License v2.0 with LLVM Exceptions. +# See https://llvm.org/LICENSE.txt for license information. +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +# +# (c) Copyright 2024 Advanced Micro Devices, Inc. or its affiliates +import argparse +import numpy as np + +from aie.helpers.tensortiler.tensortiler2D import TensorTiler2D +from aie.utils.xrt import setup_aie, execute as execute_on_aie + + +def main(opts): + print("Running...\n") + + dtype = TensorTiler2D.DTYPE + data_size = opts.tensor_height * opts.tensor_width + + reference_tiler = TensorTiler2D( + opts.tensor_height, opts.tensor_width, opts.tile_height, opts.tile_width + ) + reference_access_order = reference_tiler.access_order() + + app = setup_aie( + opts.xclbin, + opts.instr, + None, + None, + None, + None, + data_size, + dtype, + ) + aie_output = execute_on_aie(app) + aie_output = aie_output.reshape((opts.tensor_height, opts.tensor_width)) + + # Copy output results and verify they are correct + errors = 0 + if opts.verbosity >= 1: + print("Verifying results ...") + e = np.equal(reference_access_order, aie_output) + errors = np.size(e) - np.count_nonzero(e) + + if not errors: + print("\nPASS!\n") + exit(0) + else: + print("\nError count: ", errors) + print("\nFailed.\n") + exit(-1) + + +def get_arg_parser(): + p = argparse.ArgumentParser() + p.add_argument( + "-x", "--xclbin", default="final.xclbin", dest="xclbin", help="the xclbin path" + ) + p.add_argument( + "-k", + "--kernel", + dest="kernel", + default="MLIR_AIE", + help="the kernel name in the XCLBIN (for instance MLIR_AIE)", + ) + p.add_argument( + "-v", "--verbosity", default=0, type=int, help="the verbosity of the output" + ) + p.add_argument( + "-i", + "--instr", + dest="instr", + default="instr.txt", + help="path of file containing userspace instructions sent to the NPU", + ) + p.add_argument("--tensor-height", required=True, help="Tensor height", type=int) + p.add_argument("--tensor-width", required=True, help="Tensor width", type=int) + p.add_argument("--tile-height", required=True, help="Tile height", type=int) + p.add_argument("--tile-width", required=True, help="Tile width", type=int) + return p + + +if __name__ == "__main__": + p = get_arg_parser() + opts = p.parse_args() + main(opts) diff --git a/python/utils/xrt.py b/python/utils/xrt.py index 276e9e2cde..bd4fc1e3a8 100644 --- a/python/utils/xrt.py +++ b/python/utils/xrt.py @@ -131,7 +131,8 @@ def setup_aie( ): app = AIE_Application(xclbin_path, insts_path, kernel_name) - app.register_buffer(3, shape=in_0_shape, dtype=in_0_dtype) + if in_0_shape or in_0_dtype: + app.register_buffer(3, shape=in_0_shape, dtype=in_0_dtype) if in_1_shape or in_1_dtype: app.register_buffer(4, shape=in_1_shape, dtype=in_1_dtype) @@ -159,8 +160,9 @@ def write_out_trace(trace, file_name): f.write(out_str) -def execute(app, input_one, input_two=None): - app.buffers[3].write(input_one) +def execute(app, input_one=None, input_two=None): + if not (input_one is None): + app.buffers[3].write(input_one) if not (input_two is None): app.buffers[4].write(input_two) app.run() From d18a2effa52d63fb4868b4a3a7233a49d13679af Mon Sep 17 00:00:00 2001 From: Erika Hunhoff Date: Tue, 22 Oct 2024 12:23:10 -0600 Subject: [PATCH 06/35] Added simple tiling examples --- .../{ => per_tile}/Makefile | 2 +- .../tiling_exploration/per_tile/README.md | 31 +++++++ .../basic/tiling_exploration/per_tile/aie2.py | 91 +++++++++++++++++++ .../{ => per_tile}/run_makefile.lit | 0 .../tiling_exploration/{ => per_tile}/test.py | 0 .../single_transform/Makefile | 39 ++++++++ .../single_transform/README.md | 31 +++++++ .../{ => single_transform}/aie2.py | 18 ++-- .../single_transform/run_makefile.lit | 10 ++ .../single_transform/test.py | 87 ++++++++++++++++++ 10 files changed, 298 insertions(+), 11 deletions(-) rename programming_examples/basic/tiling_exploration/{ => per_tile}/Makefile (97%) create mode 100644 programming_examples/basic/tiling_exploration/per_tile/README.md create mode 100644 programming_examples/basic/tiling_exploration/per_tile/aie2.py rename programming_examples/basic/tiling_exploration/{ => per_tile}/run_makefile.lit (100%) rename programming_examples/basic/tiling_exploration/{ => per_tile}/test.py (100%) create mode 100644 programming_examples/basic/tiling_exploration/single_transform/Makefile create mode 100644 programming_examples/basic/tiling_exploration/single_transform/README.md rename programming_examples/basic/tiling_exploration/{ => single_transform}/aie2.py (87%) create mode 100644 programming_examples/basic/tiling_exploration/single_transform/run_makefile.lit create mode 100644 programming_examples/basic/tiling_exploration/single_transform/test.py diff --git a/programming_examples/basic/tiling_exploration/Makefile b/programming_examples/basic/tiling_exploration/per_tile/Makefile similarity index 97% rename from programming_examples/basic/tiling_exploration/Makefile rename to programming_examples/basic/tiling_exploration/per_tile/Makefile index 93071a5457..9932769410 100644 --- a/programming_examples/basic/tiling_exploration/Makefile +++ b/programming_examples/basic/tiling_exploration/per_tile/Makefile @@ -10,7 +10,7 @@ srcdir := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST)))) -include ${srcdir}/../../makefile-common +include ${srcdir}/../../../makefile-common tensor_height = 32 tensor_width = 32 diff --git a/programming_examples/basic/tiling_exploration/per_tile/README.md b/programming_examples/basic/tiling_exploration/per_tile/README.md new file mode 100644 index 0000000000..cfb0936362 --- /dev/null +++ b/programming_examples/basic/tiling_exploration/per_tile/README.md @@ -0,0 +1,31 @@ + + +# Tiling Exploration + +This IRON design flow example, called "Tiling Exploration", demonstrates how data may be `tiled` on input/output. This is a common data transformation pattern, and this example is meant to be interactive. + +## Source Files Overview + +TODO + +## Design Overview + +TODO + +## Design Component Details + +### AIE Array Structural Design + +TODO + +## Usage + +TODO diff --git a/programming_examples/basic/tiling_exploration/per_tile/aie2.py b/programming_examples/basic/tiling_exploration/per_tile/aie2.py new file mode 100644 index 0000000000..3c4934af76 --- /dev/null +++ b/programming_examples/basic/tiling_exploration/per_tile/aie2.py @@ -0,0 +1,91 @@ +# tiling_exploration/aie2.py -*- Python -*- +# +# This file is licensed under the Apache License v2.0 with LLVM Exceptions. +# See https://llvm.org/LICENSE.txt for license information. +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +# +# (c) Copyright 2024 Advanced Micro Devices, Inc. or its affiliates +import argparse +import numpy as np +import sys + +from aie.dialects.aie import * +from aie.dialects.aiex import * +from aie.dialects import arith +from aie.extras.context import mlir_mod_ctx +from aie.helpers.dialects.ext.scf import _for as range_ +from aie.helpers.tensortiler.tensortiler2D import TensorTiler2D + + +def generate_module(tensor_height, tensor_width, tile_height, tile_width): + @device(AIEDevice.npu1_1col) + def device_body(): + # define types + tensor_size = tensor_height * tensor_width + tile_size = tile_height * tile_width + flattened_tensor = np.ndarray[(tensor_size,), np.dtype[TensorTiler2D.DTYPE]] + flattened_tile = np.ndarray[(tile_size,), np.dtype[TensorTiler2D.DTYPE]] + + # Tile declarations + ShimTile = tile(0, 0) + ComputeTile2 = tile(0, 2) + + # AIE-array data movement with object fifos + of_out = object_fifo("out", ComputeTile2, ShimTile, 2, flattened_tile) + + # Set up compute tiles + + # Compute tile 2 + @core(ComputeTile2) + def core_body(): + # TODO: better way to get mutable constant than buffer?? + access_counter = buffer( + ComputeTile2, + np.ndarray[(1,), np.dtype[TensorTiler2D.DTYPE]], + "access_counter", + initial_value=np.array([0], dtype=TensorTiler2D.DTYPE), + ) + + for _ in range_(sys.maxsize): + elemOut = of_out.acquire(ObjectFifoPort.Produce, 1) + for i in range_(tile_size): + elemOut[i] = access_counter[0] + access_counter[0] += 1 + of_out.release(ObjectFifoPort.Produce, 1) + + @runtime_sequence(flattened_tensor) + def sequence(access_count): + tiler = TensorTiler2D(tensor_height, tensor_width, tile_height, tile_width) + for t in tiler.tile_iter(): + npu_dma_memcpy_nd( + metadata=of_out, + bd_id=1, + mem=access_count, + sizes=t.sizes, + strides=t.strides, + offsets=[0, 0, 0, t.offset], + ) + dma_wait(of_out) + + +def main(opts): + with mlir_mod_ctx() as ctx: + generate_module( + opts.tensor_height, opts.tensor_width, opts.tile_height, opts.tile_width + ) + print(ctx.module) + + +def get_arg_parser(): + p = argparse.ArgumentParser() + p.add_argument("--tensor-height", required=True, help="Tensor height", type=int) + p.add_argument("--tensor-width", required=True, help="Tensor width", type=int) + p.add_argument("--tile-height", required=True, help="Tile height", type=int) + p.add_argument("--tile-width", required=True, help="Tile width", type=int) + return p + + +if __name__ == "__main__": + p = get_arg_parser() + opts = p.parse_args() + main(opts) diff --git a/programming_examples/basic/tiling_exploration/run_makefile.lit b/programming_examples/basic/tiling_exploration/per_tile/run_makefile.lit similarity index 100% rename from programming_examples/basic/tiling_exploration/run_makefile.lit rename to programming_examples/basic/tiling_exploration/per_tile/run_makefile.lit diff --git a/programming_examples/basic/tiling_exploration/test.py b/programming_examples/basic/tiling_exploration/per_tile/test.py similarity index 100% rename from programming_examples/basic/tiling_exploration/test.py rename to programming_examples/basic/tiling_exploration/per_tile/test.py diff --git a/programming_examples/basic/tiling_exploration/single_transform/Makefile b/programming_examples/basic/tiling_exploration/single_transform/Makefile new file mode 100644 index 0000000000..9932769410 --- /dev/null +++ b/programming_examples/basic/tiling_exploration/single_transform/Makefile @@ -0,0 +1,39 @@ +##===- Makefile -----------------------------------------------------------===## +# +# This file licensed under the Apache License v2.0 with LLVM Exceptions. +# See https://llvm.org/LICENSE.txt for license information. +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +# +# Copyright (C) 2024, Advanced Micro Devices, Inc. +# +##===----------------------------------------------------------------------===## + +srcdir := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST)))) + +include ${srcdir}/../../../makefile-common + +tensor_height = 32 +tensor_width = 32 +tile_height = 4 +tile_width = 4 +data_str=${tensor_height}_${tensor_width}_${tile_height}_${tile_width} + +.PHONY: all template clean + +all: build/final_${data_size}.xclbin + +build/aie_${data_str}.mlir: ${srcdir}/aie2.py + mkdir -p ${@D} + python3 $< --tensor-height ${tensor_height} --tensor-width ${tensor_width} --tile-height ${tile_height} --tile-width ${tile_width} > $@ + +build/final_${data_str}.xclbin: build/aie_${data_str}.mlir + mkdir -p ${@D} + cd ${@D} && aiecc.py --aie-generate-cdo --aie-generate-npu --no-compile-host \ + --no-xchesscc --no-xbridge \ + --xclbin-name=${@F} --npu-insts-name=insts_${data_str}.txt $(<:%=../%) + +run: build/final_${data_str}.xclbin build/insts_${data_str}.txt + ${powershell} python3 ${srcdir}/test.py -x build/final_${data_str}.xclbin -i build/insts_${data_str}.txt -k MLIR_AIE --tensor-height ${tensor_height} --tensor-width ${tensor_width} --tile-height ${tile_height} --tile-width ${tile_width} + +clean: + rm -rf build diff --git a/programming_examples/basic/tiling_exploration/single_transform/README.md b/programming_examples/basic/tiling_exploration/single_transform/README.md new file mode 100644 index 0000000000..cfb0936362 --- /dev/null +++ b/programming_examples/basic/tiling_exploration/single_transform/README.md @@ -0,0 +1,31 @@ + + +# Tiling Exploration + +This IRON design flow example, called "Tiling Exploration", demonstrates how data may be `tiled` on input/output. This is a common data transformation pattern, and this example is meant to be interactive. + +## Source Files Overview + +TODO + +## Design Overview + +TODO + +## Design Component Details + +### AIE Array Structural Design + +TODO + +## Usage + +TODO diff --git a/programming_examples/basic/tiling_exploration/aie2.py b/programming_examples/basic/tiling_exploration/single_transform/aie2.py similarity index 87% rename from programming_examples/basic/tiling_exploration/aie2.py rename to programming_examples/basic/tiling_exploration/single_transform/aie2.py index 3de433b916..38d519d9f5 100644 --- a/programming_examples/basic/tiling_exploration/aie2.py +++ b/programming_examples/basic/tiling_exploration/single_transform/aie2.py @@ -46,16 +46,14 @@ def core_body(): @runtime_sequence(flattened_tensor) def sequence(access_count): tiler = TensorTiler2D(tensor_height, tensor_width, tile_height, tile_width) - for t in tiler.tile_iter(): - npu_dma_memcpy_nd( - metadata=of_out, - bd_id=1, - mem=access_count, - sizes=t.sizes, - strides=t.strides, - offsets=[1, 1, 1, t.offset], - ) - dma_wait(of_out) + npu_dma_memcpy_nd( + metadata=of_out, + bd_id=1, + mem=access_count, + sizes=tiler.sizes, + strides=tiler.strides, + ) + dma_wait(of_out) def main(opts): diff --git a/programming_examples/basic/tiling_exploration/single_transform/run_makefile.lit b/programming_examples/basic/tiling_exploration/single_transform/run_makefile.lit new file mode 100644 index 0000000000..bdafa81a59 --- /dev/null +++ b/programming_examples/basic/tiling_exploration/single_transform/run_makefile.lit @@ -0,0 +1,10 @@ +// (c) Copyright 2024 Advanced Micro Devices, Inc. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +// REQUIRES: ryzen_ai, peano +// +// RUN: make -f %S/Makefile clean +// RUN: make -f %S/Makefile +// RUN: %run_on_npu make -f %S/Makefile run | FileCheck %s +// CHECK: Running... +// CHECK: PASS! diff --git a/programming_examples/basic/tiling_exploration/single_transform/test.py b/programming_examples/basic/tiling_exploration/single_transform/test.py new file mode 100644 index 0000000000..18aa534ce0 --- /dev/null +++ b/programming_examples/basic/tiling_exploration/single_transform/test.py @@ -0,0 +1,87 @@ +# tiling_exploration/test.py -*- Python -*- +# +# This file is licensed under the Apache License v2.0 with LLVM Exceptions. +# See https://llvm.org/LICENSE.txt for license information. +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +# +# (c) Copyright 2024 Advanced Micro Devices, Inc. or its affiliates +import argparse +import numpy as np + +from aie.helpers.tensortiler.tensortiler2D import TensorTiler2D +from aie.utils.xrt import setup_aie, execute as execute_on_aie + + +def main(opts): + print("Running...\n") + + dtype = TensorTiler2D.DTYPE + data_size = opts.tensor_height * opts.tensor_width + + reference_tiler = TensorTiler2D( + opts.tensor_height, opts.tensor_width, opts.tile_height, opts.tile_width + ) + reference_access_order = reference_tiler.access_order() + + app = setup_aie( + opts.xclbin, + opts.instr, + None, + None, + None, + None, + data_size, + dtype, + ) + aie_output = execute_on_aie(app) + aie_output = aie_output.reshape((opts.tensor_height, opts.tensor_width)) + + # Copy output results and verify they are correct + errors = 0 + if opts.verbosity >= 1: + print("Verifying results ...") + e = np.equal(reference_access_order, aie_output) + errors = np.size(e) - np.count_nonzero(e) + + if not errors: + print("\nPASS!\n") + exit(0) + else: + print("\nError count: ", errors) + print("\nFailed.\n") + exit(-1) + + +def get_arg_parser(): + p = argparse.ArgumentParser() + p.add_argument( + "-x", "--xclbin", default="final.xclbin", dest="xclbin", help="the xclbin path" + ) + p.add_argument( + "-k", + "--kernel", + dest="kernel", + default="MLIR_AIE", + help="the kernel name in the XCLBIN (for instance MLIR_AIE)", + ) + p.add_argument( + "-v", "--verbosity", default=0, type=int, help="the verbosity of the output" + ) + p.add_argument( + "-i", + "--instr", + dest="instr", + default="instr.txt", + help="path of file containing userspace instructions sent to the NPU", + ) + p.add_argument("--tensor-height", required=True, help="Tensor height", type=int) + p.add_argument("--tensor-width", required=True, help="Tensor width", type=int) + p.add_argument("--tile-height", required=True, help="Tile height", type=int) + p.add_argument("--tile-width", required=True, help="Tile width", type=int) + return p + + +if __name__ == "__main__": + p = get_arg_parser() + opts = p.parse_args() + main(opts) From d293c96b1140e665c39afb73b5795608b45f47b3 Mon Sep 17 00:00:00 2001 From: Erika Hunhoff Date: Tue, 22 Oct 2024 12:28:53 -0600 Subject: [PATCH 07/35] Update programming_examples/basic/tiling_exploration/per_tile/aie2.py Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- programming_examples/basic/tiling_exploration/per_tile/aie2.py | 1 - 1 file changed, 1 deletion(-) diff --git a/programming_examples/basic/tiling_exploration/per_tile/aie2.py b/programming_examples/basic/tiling_exploration/per_tile/aie2.py index 3c4934af76..2db640e9ad 100644 --- a/programming_examples/basic/tiling_exploration/per_tile/aie2.py +++ b/programming_examples/basic/tiling_exploration/per_tile/aie2.py @@ -45,7 +45,6 @@ def core_body(): "access_counter", initial_value=np.array([0], dtype=TensorTiler2D.DTYPE), ) - for _ in range_(sys.maxsize): elemOut = of_out.acquire(ObjectFifoPort.Produce, 1) for i in range_(tile_size): From 9c2ce5fbe7fc9fc57e15624e6f3cf41203059e35 Mon Sep 17 00:00:00 2001 From: Erika Hunhoff Date: Tue, 22 Oct 2024 12:42:55 -0600 Subject: [PATCH 08/35] Fix makefile typos --- programming_examples/basic/tiling_exploration/per_tile/Makefile | 2 +- .../basic/tiling_exploration/single_transform/Makefile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/programming_examples/basic/tiling_exploration/per_tile/Makefile b/programming_examples/basic/tiling_exploration/per_tile/Makefile index 9932769410..ccec0077b0 100644 --- a/programming_examples/basic/tiling_exploration/per_tile/Makefile +++ b/programming_examples/basic/tiling_exploration/per_tile/Makefile @@ -20,7 +20,7 @@ data_str=${tensor_height}_${tensor_width}_${tile_height}_${tile_width} .PHONY: all template clean -all: build/final_${data_size}.xclbin +all: build/final_${data_str}.xclbin build/aie_${data_str}.mlir: ${srcdir}/aie2.py mkdir -p ${@D} diff --git a/programming_examples/basic/tiling_exploration/single_transform/Makefile b/programming_examples/basic/tiling_exploration/single_transform/Makefile index 9932769410..ccec0077b0 100644 --- a/programming_examples/basic/tiling_exploration/single_transform/Makefile +++ b/programming_examples/basic/tiling_exploration/single_transform/Makefile @@ -20,7 +20,7 @@ data_str=${tensor_height}_${tensor_width}_${tile_height}_${tile_width} .PHONY: all template clean -all: build/final_${data_size}.xclbin +all: build/final_${data_str}.xclbin build/aie_${data_str}.mlir: ${srcdir}/aie2.py mkdir -p ${@D} From 2a3a4846accbb41c0585d01b3b1368512d6b8d18 Mon Sep 17 00:00:00 2001 From: Erika Hunhoff Date: Tue, 22 Oct 2024 14:22:28 -0600 Subject: [PATCH 09/35] Add tensor tiler tests --- .../square_tiler.py} | 393 +-- test/python/tensortiler2d/square_tiler2.py | 2212 +++++++++++++++++ .../square_tiler_col_major_tensor.py | 2212 +++++++++++++++++ .../square_tiler_col_major_tile.py | 2212 +++++++++++++++++ .../square_tiler_col_major_tile_and_tensor.py | 2212 +++++++++++++++++ test/python/tensortiler2d/template.py | 34 + test/python/tensortiler2d/tensortiler2d.py | 396 +++ test/python/tensortiler2d/util.py | 4 + test/python/util.py | 6 - 9 files changed, 9285 insertions(+), 396 deletions(-) rename test/python/{tensortiler.py => tensortiler2d/square_tiler.py} (77%) create mode 100644 test/python/tensortiler2d/square_tiler2.py create mode 100644 test/python/tensortiler2d/square_tiler_col_major_tensor.py create mode 100644 test/python/tensortiler2d/square_tiler_col_major_tile.py create mode 100644 test/python/tensortiler2d/square_tiler_col_major_tile_and_tensor.py create mode 100644 test/python/tensortiler2d/template.py create mode 100644 test/python/tensortiler2d/tensortiler2d.py create mode 100644 test/python/tensortiler2d/util.py diff --git a/test/python/tensortiler.py b/test/python/tensortiler2d/square_tiler.py similarity index 77% rename from test/python/tensortiler.py rename to test/python/tensortiler2d/square_tiler.py index f60275c0e5..dd9b8ee141 100644 --- a/test/python/tensortiler.py +++ b/test/python/tensortiler2d/square_tiler.py @@ -6,396 +6,6 @@ # RUN: %python %s | FileCheck %s -# CHECK-LABEL: tensortiler_simple -@construct_test -def tensortiler_simple(): - TENSOR_HEIGHT = 2 - TENSOR_WIDTH = 3 - - tiler = TensorTiler2D(TENSOR_HEIGHT, TENSOR_WIDTH, TENSOR_HEIGHT, TENSOR_WIDTH) - access_map = tiler.access_order() - - expected = np.array([[0, 1, 2], [3, 4, 5]]) - assert expected.shape == access_map.shape - assert (expected == access_map).all() - - iter = tiler.tile_iter() - t = next(iter) - - assert ( - t.tensor_height == TENSOR_HEIGHT - ), f"Expected tensor height {TENSOR_HEIGHT} but got {t.tensor_height}" - assert ( - t.tensor_width == TENSOR_WIDTH - ), f"Expected tensor width {TENSOR_WIDTH} but got {t.tensor_width}" - assert t.offset == 0, f"Expected offset 0 but got {t.offset}" - - expected_sizes = [1, 1, TENSOR_HEIGHT, TENSOR_WIDTH] - assert ( - t.sizes == expected_sizes - ), f"Expected sizes {expected_sizes} but got {t.sizes}" - expected_strides = [1, 3, 3, 1] - assert ( - t.strides == expected_strides - ), f"Expected strides {expected_strides} but got {t.strides}" - - assert ( - expected == t.access_order() - ).all(), f"Expected {expected} but got {t.access_order()}" - - try: - next(iter) - assert False, "Iterator should only have one step" - except StopIteration: - pass - - # CHECK: Pass! - print("Pass!") - - -# CHECK-LABEL: tensortiler_tensor_row_major_tile_col_major -@construct_test -def tensortiler_tensor_row_major_tile_col_major(): - TENSOR_HEIGHT = 12 - TENSOR_WIDTH = 12 - TILE_HEIGHT = 3 - TILE_WIDTH = 4 - - tiler = TensorTiler2D( - TENSOR_HEIGHT, - TENSOR_WIDTH, - TILE_HEIGHT, - TILE_WIDTH, - tensor_col_major=False, - tile_col_major=True, - ) - access_map = tiler.access_order() - - expected_tile = np.array([[0, 3, 6, 9], [1, 4, 7, 10], [2, 5, 8, 11]]) - assert (TENSOR_HEIGHT, TENSOR_WIDTH) == access_map.shape - assert (expected_tile == access_map[0:TILE_HEIGHT, 0:TILE_WIDTH]).all() - - expected_tile = expected_tile - expected_tile2 = np.array([[12, 15, 18, 21], [13, 16, 19, 22], [14, 17, 20, 23]]) - assert ( - expected_tile2 == access_map[0:TILE_HEIGHT, TILE_WIDTH : 2 * TILE_WIDTH] - ).all() - - iter = tiler.tile_iter() - tiles = list(iter) - expected_num_tiles = (TENSOR_HEIGHT // TILE_HEIGHT) * (TENSOR_WIDTH // TILE_WIDTH) - assert ( - len(tiles) == expected_num_tiles - ), f"Expected {expected_num_tiles} tiles but got {len(tiles)}" - - t = tiles[0] - assert ( - t.tensor_height == TENSOR_HEIGHT - ), f"Expected tensor height {TENSOR_HEIGHT} but got {t.tensor_height}" - assert ( - t.tensor_width == TENSOR_WIDTH - ), f"Expected tensor width {TENSOR_WIDTH} but got {t.tensor_width}" - assert t.offset == 0, f"Expected offset 0 but got {t.offset}" - - expected_sizes = [1, 1, TILE_WIDTH, TILE_HEIGHT] - assert ( - t.sizes == expected_sizes - ), f"Expected sizes {expected_sizes} but got {t.sizes}" - expected_strides = [1, 36, 1, 12] - assert ( - t.strides == expected_strides - ), f"Expected strides {expected_strides} but got {t.strides}" - - assert ( - expected_tile == t.access_order()[0:TILE_HEIGHT, 0:TILE_WIDTH] - ).all(), f"Expected {expected_tile} but got {t.access_order()[0:TILE_HEIGHT, 0:TILE_WIDTH]}" - - # CHECK: Pass! - print("Pass!") - - -# CHECK-LABEL: tensortiler_tensor_col_major_tile_col_major -@construct_test -def tensortiler_tensor_col_major_tile_col_major(): - TENSOR_HEIGHT = 12 - TENSOR_WIDTH = 12 - TILE_HEIGHT = 3 - TILE_WIDTH = 4 - - tiler = TensorTiler2D( - TENSOR_HEIGHT, - TENSOR_WIDTH, - TILE_HEIGHT, - TILE_WIDTH, - tensor_col_major=True, - tile_col_major=True, - ) - access_map = tiler.access_order() - - expected_tile = np.array([[0, 3, 6, 9], [1, 4, 7, 10], [2, 5, 8, 11]]) - assert (TENSOR_HEIGHT, TENSOR_WIDTH) == access_map.shape - assert (expected_tile == access_map[0:TILE_HEIGHT, 0:TILE_WIDTH]).all() - - expected_tile = expected_tile - expected_tile2 = np.array([[12, 15, 18, 21], [13, 16, 19, 22], [14, 17, 20, 23]]) - assert ( - expected_tile2 == access_map[TILE_HEIGHT : 2 * TILE_HEIGHT, 0:TILE_WIDTH] - ).all() - - iter = tiler.tile_iter() - tiles = list(iter) - expected_num_tiles = (TENSOR_HEIGHT // TILE_HEIGHT) * (TENSOR_WIDTH // TILE_WIDTH) - assert ( - len(tiles) == expected_num_tiles - ), f"Expected {expected_num_tiles} tiles but got {len(tiles)}" - - t = tiles[0] - assert ( - t.tensor_height == TENSOR_HEIGHT - ), f"Expected tensor height {TENSOR_HEIGHT} but got {t.tensor_height}" - assert ( - t.tensor_width == TENSOR_WIDTH - ), f"Expected tensor width {TENSOR_WIDTH} but got {t.tensor_width}" - assert t.offset == 0, f"Expected offset 0 but got {t.offset}" - - expected_sizes = [1, 1, TILE_WIDTH, TILE_HEIGHT] - assert ( - t.sizes == expected_sizes - ), f"Expected sizes {expected_sizes} but got {t.sizes}" - expected_strides = [1, 36, 1, 12] - assert ( - t.strides == expected_strides - ), f"Expected strides {expected_strides} but got {t.strides}" - - assert ( - expected_tile == t.access_order()[0:TILE_HEIGHT, 0:TILE_WIDTH] - ).all(), f"Expected {expected_tile} but got {t.access_order()[0:TILE_HEIGHT, 0:TILE_WIDTH]}" - - # CHECK: Pass! - print("Pass!") - - -# CHECK-LABEL: tensortiler_tensor_col_major_tile_row_major -@construct_test -def tensortiler_tensor_col_major_tile_row_major(): - TENSOR_HEIGHT = 12 - TENSOR_WIDTH = 12 - TILE_HEIGHT = 3 - TILE_WIDTH = 4 - - tiler = TensorTiler2D( - TENSOR_HEIGHT, - TENSOR_WIDTH, - TILE_HEIGHT, - TILE_WIDTH, - tensor_col_major=True, - tile_col_major=False, - ) - access_map = tiler.access_order() - - expected_tile = np.array([[0, 1, 2, 3], [4, 5, 6, 7], [8, 9, 10, 11]]) - assert (TENSOR_HEIGHT, TENSOR_WIDTH) == access_map.shape - assert (expected_tile == access_map[0:TILE_HEIGHT, 0:TILE_WIDTH]).all() - - expected_tile = expected_tile - expected_tile2 = np.array([[12, 13, 14, 15], [16, 17, 18, 19], [20, 21, 22, 23]]) - assert ( - expected_tile2 == access_map[TILE_HEIGHT : 2 * TILE_HEIGHT, 0:TILE_WIDTH] - ).all() - - iter = tiler.tile_iter() - tiles = list(iter) - expected_num_tiles = (TENSOR_HEIGHT // TILE_HEIGHT) * (TENSOR_WIDTH // TILE_WIDTH) - assert ( - len(tiles) == expected_num_tiles - ), f"Expected {expected_num_tiles} tiles but got {len(tiles)}" - - t = tiles[0] - assert ( - t.tensor_height == TENSOR_HEIGHT - ), f"Expected tensor height {TENSOR_HEIGHT} but got {t.tensor_height}" - assert ( - t.tensor_width == TENSOR_WIDTH - ), f"Expected tensor width {TENSOR_WIDTH} but got {t.tensor_width}" - assert t.offset == 0, f"Expected offset 0 but got {t.offset}" - - expected_sizes = [1, 1, TILE_HEIGHT, TILE_WIDTH] - assert ( - t.sizes == expected_sizes - ), f"Expected sizes {expected_sizes} but got {t.sizes}" - expected_strides = [1, 4, 12, 1] - assert ( - t.strides == expected_strides - ), f"Expected strides {expected_strides} but got {t.strides}" - - assert ( - expected_tile == t.access_order()[0:TILE_HEIGHT, 0:TILE_WIDTH] - ).all(), f"Expected {expected_tile} but got {t.access_order()[0:TILE_HEIGHT, 0:TILE_WIDTH]}" - - # CHECK: Pass! - print("Pass!") - - -# CHECK-LABEL: tensortiler_tensor_iter_chunk_row_major -@construct_test -def tensortiler_tensor_iter_chunk_row_major(): - TENSOR_HEIGHT = 12 - TENSOR_WIDTH = 12 - TILE_HEIGHT = 3 - TILE_WIDTH = 2 - - tiler = TensorTiler2D( - TENSOR_HEIGHT, - TENSOR_WIDTH, - TILE_HEIGHT, - TILE_WIDTH, - ) - - expected_tile = np.array([[0, 1], [2, 3], [4, 5]]) - - CHUNK_HEIGHT = 2 - CHUNK_WIDTH = 2 - iter = tiler.tile_iter(chunk_height=2, chunk_width=2) - tiles = list(iter) - expected_num_tiles = (TENSOR_HEIGHT // (TILE_HEIGHT * CHUNK_HEIGHT)) * ( - TENSOR_WIDTH // (TILE_WIDTH * CHUNK_WIDTH) - ) - assert ( - len(tiles) == expected_num_tiles - ), f"Expected {expected_num_tiles} tiles but got {len(tiles)}" - - t = tiles[0] - assert ( - t.tensor_height == TENSOR_HEIGHT - ), f"Expected tensor height {TENSOR_HEIGHT} but got {t.tensor_height}" - assert ( - t.tensor_width == TENSOR_WIDTH - ), f"Expected tensor width {TENSOR_WIDTH} but got {t.tensor_width}" - assert t.offset == 0, f"Expected offset 0 but got {t.offset}" - - expected_sizes = [CHUNK_HEIGHT, CHUNK_WIDTH, TILE_HEIGHT, TILE_WIDTH] - assert ( - t.sizes == expected_sizes - ), f"Expected sizes {expected_sizes} but got {t.sizes}" - expected_strides = [36, 2, 12, 1] - assert ( - t.strides == expected_strides - ), f"Expected strides {expected_strides} but got {t.strides}" - - assert ( - expected_tile == t.access_order()[0:TILE_HEIGHT, 0:TILE_WIDTH] - ).all(), f"Expected {expected_tile} but got {t.access_order()[0:TILE_HEIGHT, 0:TILE_WIDTH]}" - - t = tiles[1] - assert ( - t.tensor_height == TENSOR_HEIGHT - ), f"Expected tensor height {TENSOR_HEIGHT} but got {t.tensor_height}" - assert ( - t.tensor_width == TENSOR_WIDTH - ), f"Expected tensor width {TENSOR_WIDTH} but got {t.tensor_width}" - assert ( - t.offset == CHUNK_WIDTH * TILE_WIDTH - ), f"Expected offset {CHUNK_WIDTH * TILE_WIDTH} but got {t.offset}" - - expected_sizes = [CHUNK_HEIGHT, CHUNK_WIDTH, TILE_HEIGHT, TILE_WIDTH] - assert ( - t.sizes == expected_sizes - ), f"Expected sizes {expected_sizes} but got {t.sizes}" - expected_strides = [36, 2, 12, 1] - assert ( - t.strides == expected_strides - ), f"Expected strides {expected_strides} but got {t.strides}" - - assert ( - expected_tile - == t.access_order()[ - 0:TILE_HEIGHT, CHUNK_WIDTH * TILE_WIDTH : CHUNK_WIDTH * (TILE_WIDTH + 1) - ] - ).all(), f"Expected {expected_tile} but got {t.access_order()[0:TILE_HEIGHT, CHUNK_WIDTH*TILE_WIDTH:CHUNK_WIDTH*(TILE_WIDTH+1)]}" - - # CHECK: Pass! - print("Pass!") - - -# CHECK-LABEL: tensortiler_tensor_iter_chunk_col_major -@construct_test -def tensortiler_tensor_iter_chunk_col_major(): - TENSOR_HEIGHT = 12 - TENSOR_WIDTH = 8 - TILE_HEIGHT = 3 - TILE_WIDTH = 2 - - expected_tile = np.array([[0, 1], [2, 3], [4, 5]]) - - tiler = TensorTiler2D( - TENSOR_HEIGHT, - TENSOR_WIDTH, - TILE_HEIGHT, - TILE_WIDTH, - ) - - CHUNK_HEIGHT = 2 - CHUNK_WIDTH = 2 - iter = tiler.tile_iter(chunk_height=2, chunk_width=2, col_major=True) - tiles = list(iter) - expected_num_tiles = (TENSOR_HEIGHT // (TILE_HEIGHT * CHUNK_HEIGHT)) * ( - TENSOR_WIDTH // (TILE_WIDTH * CHUNK_WIDTH) - ) - assert ( - len(tiles) == expected_num_tiles - ), f"Expected {expected_num_tiles} tiles but got {len(tiles)}" - - t = tiles[0] - assert ( - t.tensor_height == TENSOR_HEIGHT - ), f"Expected tensor height {TENSOR_HEIGHT} but got {t.tensor_height}" - assert ( - t.tensor_width == TENSOR_WIDTH - ), f"Expected tensor width {TENSOR_WIDTH} but got {t.tensor_width}" - assert t.offset == 0, f"Expected offset 0 but got {t.offset}" - - expected_sizes = [CHUNK_HEIGHT, CHUNK_WIDTH, TILE_HEIGHT, TILE_WIDTH] - assert ( - t.sizes == expected_sizes - ), f"Expected sizes {expected_sizes} but got {t.sizes}" - expected_strides = [24, 2, 8, 1] - assert ( - t.strides == expected_strides - ), f"Expected strides {expected_strides} but got {t.strides}" - - assert ( - expected_tile == t.access_order()[0:TILE_HEIGHT, 0:TILE_WIDTH] - ).all(), f"Expected {expected_tile} but got {t.access_order()[0:TILE_HEIGHT, 0:TILE_WIDTH]}" - - t = tiles[1] - assert ( - t.tensor_height == TENSOR_HEIGHT - ), f"Expected tensor height {TENSOR_HEIGHT} but got {t.tensor_height}" - assert ( - t.tensor_width == TENSOR_WIDTH - ), f"Expected tensor width {TENSOR_WIDTH} but got {t.tensor_width}" - assert t.offset == 48, f"Expected offset 48 but got {t.offset}" - - expected_sizes = [CHUNK_HEIGHT, CHUNK_WIDTH, TILE_HEIGHT, TILE_WIDTH] - assert ( - t.sizes == expected_sizes - ), f"Expected sizes {expected_sizes} but got {t.sizes}" - expected_strides = [24, 2, 8, 1] - assert ( - t.strides == expected_strides - ), f"Expected strides {expected_strides} but got {t.strides}" - - assert ( - expected_tile - == t.access_order()[ - CHUNK_HEIGHT * TILE_HEIGHT : (CHUNK_HEIGHT + 1) * TILE_HEIGHT, 0:TILE_WIDTH - ] - ).all(), f"Expected {expected_tile} but got {t.access_order()[CHUNK_HEIGHT*TILE_HEIGHT:(CHUNK_HEIGHT+1)*TILE_HEIGHT, 0:TILE_WIDTH]}" - - # CHECK: Pass! - print("Pass!") - - # CHECK-LABEL: square_tiler @construct_test def square_tiler(): @@ -2597,3 +2207,6 @@ def square_tiler(): assert (tile_access_order == tile1_reference_order).all() tile_count += 1 assert tile_count == 64 + + # CHECK: Pass! + print("Pass!") diff --git a/test/python/tensortiler2d/square_tiler2.py b/test/python/tensortiler2d/square_tiler2.py new file mode 100644 index 0000000000..bbc3e57d79 --- /dev/null +++ b/test/python/tensortiler2d/square_tiler2.py @@ -0,0 +1,2212 @@ +import numpy as np + +from aie.helpers.tensortiler.tensortiler2D import TensorTiler2D +from util import construct_test + +# RUN: %python %s | FileCheck %s + + +# CHECK-LABEL: square_tiler2 +@construct_test +def square_tiler2(): + tiler = TensorTiler2D(32, 32, 8, 8) + access_order = tiler.access_order() + reference_access = np.array( + [ + [ + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 64, + 65, + 66, + 67, + 68, + 69, + 70, + 71, + 128, + 129, + 130, + 131, + 132, + 133, + 134, + 135, + 192, + 193, + 194, + 195, + 196, + 197, + 198, + 199, + ], + [ + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 72, + 73, + 74, + 75, + 76, + 77, + 78, + 79, + 136, + 137, + 138, + 139, + 140, + 141, + 142, + 143, + 200, + 201, + 202, + 203, + 204, + 205, + 206, + 207, + ], + [ + 16, + 17, + 18, + 19, + 20, + 21, + 22, + 23, + 80, + 81, + 82, + 83, + 84, + 85, + 86, + 87, + 144, + 145, + 146, + 147, + 148, + 149, + 150, + 151, + 208, + 209, + 210, + 211, + 212, + 213, + 214, + 215, + ], + [ + 24, + 25, + 26, + 27, + 28, + 29, + 30, + 31, + 88, + 89, + 90, + 91, + 92, + 93, + 94, + 95, + 152, + 153, + 154, + 155, + 156, + 157, + 158, + 159, + 216, + 217, + 218, + 219, + 220, + 221, + 222, + 223, + ], + [ + 32, + 33, + 34, + 35, + 36, + 37, + 38, + 39, + 96, + 97, + 98, + 99, + 100, + 101, + 102, + 103, + 160, + 161, + 162, + 163, + 164, + 165, + 166, + 167, + 224, + 225, + 226, + 227, + 228, + 229, + 230, + 231, + ], + [ + 40, + 41, + 42, + 43, + 44, + 45, + 46, + 47, + 104, + 105, + 106, + 107, + 108, + 109, + 110, + 111, + 168, + 169, + 170, + 171, + 172, + 173, + 174, + 175, + 232, + 233, + 234, + 235, + 236, + 237, + 238, + 239, + ], + [ + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 112, + 113, + 114, + 115, + 116, + 117, + 118, + 119, + 176, + 177, + 178, + 179, + 180, + 181, + 182, + 183, + 240, + 241, + 242, + 243, + 244, + 245, + 246, + 247, + ], + [ + 56, + 57, + 58, + 59, + 60, + 61, + 62, + 63, + 120, + 121, + 122, + 123, + 124, + 125, + 126, + 127, + 184, + 185, + 186, + 187, + 188, + 189, + 190, + 191, + 248, + 249, + 250, + 251, + 252, + 253, + 254, + 255, + ], + [ + 256, + 257, + 258, + 259, + 260, + 261, + 262, + 263, + 320, + 321, + 322, + 323, + 324, + 325, + 326, + 327, + 384, + 385, + 386, + 387, + 388, + 389, + 390, + 391, + 448, + 449, + 450, + 451, + 452, + 453, + 454, + 455, + ], + [ + 264, + 265, + 266, + 267, + 268, + 269, + 270, + 271, + 328, + 329, + 330, + 331, + 332, + 333, + 334, + 335, + 392, + 393, + 394, + 395, + 396, + 397, + 398, + 399, + 456, + 457, + 458, + 459, + 460, + 461, + 462, + 463, + ], + [ + 272, + 273, + 274, + 275, + 276, + 277, + 278, + 279, + 336, + 337, + 338, + 339, + 340, + 341, + 342, + 343, + 400, + 401, + 402, + 403, + 404, + 405, + 406, + 407, + 464, + 465, + 466, + 467, + 468, + 469, + 470, + 471, + ], + [ + 280, + 281, + 282, + 283, + 284, + 285, + 286, + 287, + 344, + 345, + 346, + 347, + 348, + 349, + 350, + 351, + 408, + 409, + 410, + 411, + 412, + 413, + 414, + 415, + 472, + 473, + 474, + 475, + 476, + 477, + 478, + 479, + ], + [ + 288, + 289, + 290, + 291, + 292, + 293, + 294, + 295, + 352, + 353, + 354, + 355, + 356, + 357, + 358, + 359, + 416, + 417, + 418, + 419, + 420, + 421, + 422, + 423, + 480, + 481, + 482, + 483, + 484, + 485, + 486, + 487, + ], + [ + 296, + 297, + 298, + 299, + 300, + 301, + 302, + 303, + 360, + 361, + 362, + 363, + 364, + 365, + 366, + 367, + 424, + 425, + 426, + 427, + 428, + 429, + 430, + 431, + 488, + 489, + 490, + 491, + 492, + 493, + 494, + 495, + ], + [ + 304, + 305, + 306, + 307, + 308, + 309, + 310, + 311, + 368, + 369, + 370, + 371, + 372, + 373, + 374, + 375, + 432, + 433, + 434, + 435, + 436, + 437, + 438, + 439, + 496, + 497, + 498, + 499, + 500, + 501, + 502, + 503, + ], + [ + 312, + 313, + 314, + 315, + 316, + 317, + 318, + 319, + 376, + 377, + 378, + 379, + 380, + 381, + 382, + 383, + 440, + 441, + 442, + 443, + 444, + 445, + 446, + 447, + 504, + 505, + 506, + 507, + 508, + 509, + 510, + 511, + ], + [ + 512, + 513, + 514, + 515, + 516, + 517, + 518, + 519, + 576, + 577, + 578, + 579, + 580, + 581, + 582, + 583, + 640, + 641, + 642, + 643, + 644, + 645, + 646, + 647, + 704, + 705, + 706, + 707, + 708, + 709, + 710, + 711, + ], + [ + 520, + 521, + 522, + 523, + 524, + 525, + 526, + 527, + 584, + 585, + 586, + 587, + 588, + 589, + 590, + 591, + 648, + 649, + 650, + 651, + 652, + 653, + 654, + 655, + 712, + 713, + 714, + 715, + 716, + 717, + 718, + 719, + ], + [ + 528, + 529, + 530, + 531, + 532, + 533, + 534, + 535, + 592, + 593, + 594, + 595, + 596, + 597, + 598, + 599, + 656, + 657, + 658, + 659, + 660, + 661, + 662, + 663, + 720, + 721, + 722, + 723, + 724, + 725, + 726, + 727, + ], + [ + 536, + 537, + 538, + 539, + 540, + 541, + 542, + 543, + 600, + 601, + 602, + 603, + 604, + 605, + 606, + 607, + 664, + 665, + 666, + 667, + 668, + 669, + 670, + 671, + 728, + 729, + 730, + 731, + 732, + 733, + 734, + 735, + ], + [ + 544, + 545, + 546, + 547, + 548, + 549, + 550, + 551, + 608, + 609, + 610, + 611, + 612, + 613, + 614, + 615, + 672, + 673, + 674, + 675, + 676, + 677, + 678, + 679, + 736, + 737, + 738, + 739, + 740, + 741, + 742, + 743, + ], + [ + 552, + 553, + 554, + 555, + 556, + 557, + 558, + 559, + 616, + 617, + 618, + 619, + 620, + 621, + 622, + 623, + 680, + 681, + 682, + 683, + 684, + 685, + 686, + 687, + 744, + 745, + 746, + 747, + 748, + 749, + 750, + 751, + ], + [ + 560, + 561, + 562, + 563, + 564, + 565, + 566, + 567, + 624, + 625, + 626, + 627, + 628, + 629, + 630, + 631, + 688, + 689, + 690, + 691, + 692, + 693, + 694, + 695, + 752, + 753, + 754, + 755, + 756, + 757, + 758, + 759, + ], + [ + 568, + 569, + 570, + 571, + 572, + 573, + 574, + 575, + 632, + 633, + 634, + 635, + 636, + 637, + 638, + 639, + 696, + 697, + 698, + 699, + 700, + 701, + 702, + 703, + 760, + 761, + 762, + 763, + 764, + 765, + 766, + 767, + ], + [ + 768, + 769, + 770, + 771, + 772, + 773, + 774, + 775, + 832, + 833, + 834, + 835, + 836, + 837, + 838, + 839, + 896, + 897, + 898, + 899, + 900, + 901, + 902, + 903, + 960, + 961, + 962, + 963, + 964, + 965, + 966, + 967, + ], + [ + 776, + 777, + 778, + 779, + 780, + 781, + 782, + 783, + 840, + 841, + 842, + 843, + 844, + 845, + 846, + 847, + 904, + 905, + 906, + 907, + 908, + 909, + 910, + 911, + 968, + 969, + 970, + 971, + 972, + 973, + 974, + 975, + ], + [ + 784, + 785, + 786, + 787, + 788, + 789, + 790, + 791, + 848, + 849, + 850, + 851, + 852, + 853, + 854, + 855, + 912, + 913, + 914, + 915, + 916, + 917, + 918, + 919, + 976, + 977, + 978, + 979, + 980, + 981, + 982, + 983, + ], + [ + 792, + 793, + 794, + 795, + 796, + 797, + 798, + 799, + 856, + 857, + 858, + 859, + 860, + 861, + 862, + 863, + 920, + 921, + 922, + 923, + 924, + 925, + 926, + 927, + 984, + 985, + 986, + 987, + 988, + 989, + 990, + 991, + ], + [ + 800, + 801, + 802, + 803, + 804, + 805, + 806, + 807, + 864, + 865, + 866, + 867, + 868, + 869, + 870, + 871, + 928, + 929, + 930, + 931, + 932, + 933, + 934, + 935, + 992, + 993, + 994, + 995, + 996, + 997, + 998, + 999, + ], + [ + 808, + 809, + 810, + 811, + 812, + 813, + 814, + 815, + 872, + 873, + 874, + 875, + 876, + 877, + 878, + 879, + 936, + 937, + 938, + 939, + 940, + 941, + 942, + 943, + 1000, + 1001, + 1002, + 1003, + 1004, + 1005, + 1006, + 1007, + ], + [ + 816, + 817, + 818, + 819, + 820, + 821, + 822, + 823, + 880, + 881, + 882, + 883, + 884, + 885, + 886, + 887, + 944, + 945, + 946, + 947, + 948, + 949, + 950, + 951, + 1008, + 1009, + 1010, + 1011, + 1012, + 1013, + 1014, + 1015, + ], + [ + 824, + 825, + 826, + 827, + 828, + 829, + 830, + 831, + 888, + 889, + 890, + 891, + 892, + 893, + 894, + 895, + 952, + 953, + 954, + 955, + 956, + 957, + 958, + 959, + 1016, + 1017, + 1018, + 1019, + 1020, + 1021, + 1022, + 1023, + ], + ], + dtype=TensorTiler2D.DTYPE, + ) + assert (reference_access == access_order).all() + + tile1_reference_order = np.array( + [ + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + 16, + 17, + 18, + 19, + 20, + 21, + 22, + 23, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + 24, + 25, + 26, + 27, + 28, + 29, + 30, + 31, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + 32, + 33, + 34, + 35, + 36, + 37, + 38, + 39, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + 40, + 41, + 42, + 43, + 44, + 45, + 46, + 47, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + 56, + 57, + 58, + 59, + 60, + 61, + 62, + 63, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + ], + dtype=TensorTiler2D.DTYPE, + ) + + tile_count = 0 + for t in tiler.tile_iter(): + if tile_count == 3: + tile_access_order = t.access_order() + assert (tile_access_order == tile1_reference_order).all() + tile_count += 1 + assert tile_count == (32 // 8) * (32 // 8) + + # CHECK: Pass! + print("Pass!") diff --git a/test/python/tensortiler2d/square_tiler_col_major_tensor.py b/test/python/tensortiler2d/square_tiler_col_major_tensor.py new file mode 100644 index 0000000000..430fbc5311 --- /dev/null +++ b/test/python/tensortiler2d/square_tiler_col_major_tensor.py @@ -0,0 +1,2212 @@ +import numpy as np + +from aie.helpers.tensortiler.tensortiler2D import TensorTiler2D +from util import construct_test + +# RUN: %python %s | FileCheck %s + + +# CHECK-LABEL: square_tiler_col_major_tensor +@construct_test +def square_tiler_col_major_tensor(): + tiler = TensorTiler2D(32, 32, 4, 4, tensor_col_major=True) + access_order = tiler.access_order() + reference_access = np.array( + [ + [ + 0, + 1, + 2, + 3, + 128, + 129, + 130, + 131, + 256, + 257, + 258, + 259, + 384, + 385, + 386, + 387, + 512, + 513, + 514, + 515, + 640, + 641, + 642, + 643, + 768, + 769, + 770, + 771, + 896, + 897, + 898, + 899, + ], + [ + 4, + 5, + 6, + 7, + 132, + 133, + 134, + 135, + 260, + 261, + 262, + 263, + 388, + 389, + 390, + 391, + 516, + 517, + 518, + 519, + 644, + 645, + 646, + 647, + 772, + 773, + 774, + 775, + 900, + 901, + 902, + 903, + ], + [ + 8, + 9, + 10, + 11, + 136, + 137, + 138, + 139, + 264, + 265, + 266, + 267, + 392, + 393, + 394, + 395, + 520, + 521, + 522, + 523, + 648, + 649, + 650, + 651, + 776, + 777, + 778, + 779, + 904, + 905, + 906, + 907, + ], + [ + 12, + 13, + 14, + 15, + 140, + 141, + 142, + 143, + 268, + 269, + 270, + 271, + 396, + 397, + 398, + 399, + 524, + 525, + 526, + 527, + 652, + 653, + 654, + 655, + 780, + 781, + 782, + 783, + 908, + 909, + 910, + 911, + ], + [ + 16, + 17, + 18, + 19, + 144, + 145, + 146, + 147, + 272, + 273, + 274, + 275, + 400, + 401, + 402, + 403, + 528, + 529, + 530, + 531, + 656, + 657, + 658, + 659, + 784, + 785, + 786, + 787, + 912, + 913, + 914, + 915, + ], + [ + 20, + 21, + 22, + 23, + 148, + 149, + 150, + 151, + 276, + 277, + 278, + 279, + 404, + 405, + 406, + 407, + 532, + 533, + 534, + 535, + 660, + 661, + 662, + 663, + 788, + 789, + 790, + 791, + 916, + 917, + 918, + 919, + ], + [ + 24, + 25, + 26, + 27, + 152, + 153, + 154, + 155, + 280, + 281, + 282, + 283, + 408, + 409, + 410, + 411, + 536, + 537, + 538, + 539, + 664, + 665, + 666, + 667, + 792, + 793, + 794, + 795, + 920, + 921, + 922, + 923, + ], + [ + 28, + 29, + 30, + 31, + 156, + 157, + 158, + 159, + 284, + 285, + 286, + 287, + 412, + 413, + 414, + 415, + 540, + 541, + 542, + 543, + 668, + 669, + 670, + 671, + 796, + 797, + 798, + 799, + 924, + 925, + 926, + 927, + ], + [ + 32, + 33, + 34, + 35, + 160, + 161, + 162, + 163, + 288, + 289, + 290, + 291, + 416, + 417, + 418, + 419, + 544, + 545, + 546, + 547, + 672, + 673, + 674, + 675, + 800, + 801, + 802, + 803, + 928, + 929, + 930, + 931, + ], + [ + 36, + 37, + 38, + 39, + 164, + 165, + 166, + 167, + 292, + 293, + 294, + 295, + 420, + 421, + 422, + 423, + 548, + 549, + 550, + 551, + 676, + 677, + 678, + 679, + 804, + 805, + 806, + 807, + 932, + 933, + 934, + 935, + ], + [ + 40, + 41, + 42, + 43, + 168, + 169, + 170, + 171, + 296, + 297, + 298, + 299, + 424, + 425, + 426, + 427, + 552, + 553, + 554, + 555, + 680, + 681, + 682, + 683, + 808, + 809, + 810, + 811, + 936, + 937, + 938, + 939, + ], + [ + 44, + 45, + 46, + 47, + 172, + 173, + 174, + 175, + 300, + 301, + 302, + 303, + 428, + 429, + 430, + 431, + 556, + 557, + 558, + 559, + 684, + 685, + 686, + 687, + 812, + 813, + 814, + 815, + 940, + 941, + 942, + 943, + ], + [ + 48, + 49, + 50, + 51, + 176, + 177, + 178, + 179, + 304, + 305, + 306, + 307, + 432, + 433, + 434, + 435, + 560, + 561, + 562, + 563, + 688, + 689, + 690, + 691, + 816, + 817, + 818, + 819, + 944, + 945, + 946, + 947, + ], + [ + 52, + 53, + 54, + 55, + 180, + 181, + 182, + 183, + 308, + 309, + 310, + 311, + 436, + 437, + 438, + 439, + 564, + 565, + 566, + 567, + 692, + 693, + 694, + 695, + 820, + 821, + 822, + 823, + 948, + 949, + 950, + 951, + ], + [ + 56, + 57, + 58, + 59, + 184, + 185, + 186, + 187, + 312, + 313, + 314, + 315, + 440, + 441, + 442, + 443, + 568, + 569, + 570, + 571, + 696, + 697, + 698, + 699, + 824, + 825, + 826, + 827, + 952, + 953, + 954, + 955, + ], + [ + 60, + 61, + 62, + 63, + 188, + 189, + 190, + 191, + 316, + 317, + 318, + 319, + 444, + 445, + 446, + 447, + 572, + 573, + 574, + 575, + 700, + 701, + 702, + 703, + 828, + 829, + 830, + 831, + 956, + 957, + 958, + 959, + ], + [ + 64, + 65, + 66, + 67, + 192, + 193, + 194, + 195, + 320, + 321, + 322, + 323, + 448, + 449, + 450, + 451, + 576, + 577, + 578, + 579, + 704, + 705, + 706, + 707, + 832, + 833, + 834, + 835, + 960, + 961, + 962, + 963, + ], + [ + 68, + 69, + 70, + 71, + 196, + 197, + 198, + 199, + 324, + 325, + 326, + 327, + 452, + 453, + 454, + 455, + 580, + 581, + 582, + 583, + 708, + 709, + 710, + 711, + 836, + 837, + 838, + 839, + 964, + 965, + 966, + 967, + ], + [ + 72, + 73, + 74, + 75, + 200, + 201, + 202, + 203, + 328, + 329, + 330, + 331, + 456, + 457, + 458, + 459, + 584, + 585, + 586, + 587, + 712, + 713, + 714, + 715, + 840, + 841, + 842, + 843, + 968, + 969, + 970, + 971, + ], + [ + 76, + 77, + 78, + 79, + 204, + 205, + 206, + 207, + 332, + 333, + 334, + 335, + 460, + 461, + 462, + 463, + 588, + 589, + 590, + 591, + 716, + 717, + 718, + 719, + 844, + 845, + 846, + 847, + 972, + 973, + 974, + 975, + ], + [ + 80, + 81, + 82, + 83, + 208, + 209, + 210, + 211, + 336, + 337, + 338, + 339, + 464, + 465, + 466, + 467, + 592, + 593, + 594, + 595, + 720, + 721, + 722, + 723, + 848, + 849, + 850, + 851, + 976, + 977, + 978, + 979, + ], + [ + 84, + 85, + 86, + 87, + 212, + 213, + 214, + 215, + 340, + 341, + 342, + 343, + 468, + 469, + 470, + 471, + 596, + 597, + 598, + 599, + 724, + 725, + 726, + 727, + 852, + 853, + 854, + 855, + 980, + 981, + 982, + 983, + ], + [ + 88, + 89, + 90, + 91, + 216, + 217, + 218, + 219, + 344, + 345, + 346, + 347, + 472, + 473, + 474, + 475, + 600, + 601, + 602, + 603, + 728, + 729, + 730, + 731, + 856, + 857, + 858, + 859, + 984, + 985, + 986, + 987, + ], + [ + 92, + 93, + 94, + 95, + 220, + 221, + 222, + 223, + 348, + 349, + 350, + 351, + 476, + 477, + 478, + 479, + 604, + 605, + 606, + 607, + 732, + 733, + 734, + 735, + 860, + 861, + 862, + 863, + 988, + 989, + 990, + 991, + ], + [ + 96, + 97, + 98, + 99, + 224, + 225, + 226, + 227, + 352, + 353, + 354, + 355, + 480, + 481, + 482, + 483, + 608, + 609, + 610, + 611, + 736, + 737, + 738, + 739, + 864, + 865, + 866, + 867, + 992, + 993, + 994, + 995, + ], + [ + 100, + 101, + 102, + 103, + 228, + 229, + 230, + 231, + 356, + 357, + 358, + 359, + 484, + 485, + 486, + 487, + 612, + 613, + 614, + 615, + 740, + 741, + 742, + 743, + 868, + 869, + 870, + 871, + 996, + 997, + 998, + 999, + ], + [ + 104, + 105, + 106, + 107, + 232, + 233, + 234, + 235, + 360, + 361, + 362, + 363, + 488, + 489, + 490, + 491, + 616, + 617, + 618, + 619, + 744, + 745, + 746, + 747, + 872, + 873, + 874, + 875, + 1000, + 1001, + 1002, + 1003, + ], + [ + 108, + 109, + 110, + 111, + 236, + 237, + 238, + 239, + 364, + 365, + 366, + 367, + 492, + 493, + 494, + 495, + 620, + 621, + 622, + 623, + 748, + 749, + 750, + 751, + 876, + 877, + 878, + 879, + 1004, + 1005, + 1006, + 1007, + ], + [ + 112, + 113, + 114, + 115, + 240, + 241, + 242, + 243, + 368, + 369, + 370, + 371, + 496, + 497, + 498, + 499, + 624, + 625, + 626, + 627, + 752, + 753, + 754, + 755, + 880, + 881, + 882, + 883, + 1008, + 1009, + 1010, + 1011, + ], + [ + 116, + 117, + 118, + 119, + 244, + 245, + 246, + 247, + 372, + 373, + 374, + 375, + 500, + 501, + 502, + 503, + 628, + 629, + 630, + 631, + 756, + 757, + 758, + 759, + 884, + 885, + 886, + 887, + 1012, + 1013, + 1014, + 1015, + ], + [ + 120, + 121, + 122, + 123, + 248, + 249, + 250, + 251, + 376, + 377, + 378, + 379, + 504, + 505, + 506, + 507, + 632, + 633, + 634, + 635, + 760, + 761, + 762, + 763, + 888, + 889, + 890, + 891, + 1016, + 1017, + 1018, + 1019, + ], + [ + 124, + 125, + 126, + 127, + 252, + 253, + 254, + 255, + 380, + 381, + 382, + 383, + 508, + 509, + 510, + 511, + 636, + 637, + 638, + 639, + 764, + 765, + 766, + 767, + 892, + 893, + 894, + 895, + 1020, + 1021, + 1022, + 1023, + ], + ], + dtype=TensorTiler2D.DTYPE, + ) + assert (reference_access == access_order).all() + + tile1_reference_order = np.array( + [ + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + 0, + 1, + 2, + 3, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + 4, + 5, + 6, + 7, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + 8, + 9, + 10, + 11, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + 12, + 13, + 14, + 15, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + ], + dtype=TensorTiler2D.DTYPE, + ) + + tile_count = 0 + for t in tiler.tile_iter(): + if tile_count == 11: + tile_access_order = t.access_order() + assert (tile_access_order == tile1_reference_order).all() + tile_count += 1 + assert tile_count == (32 // 4) * (32 // 4) + + # CHECK: Pass! + print("Pass!") diff --git a/test/python/tensortiler2d/square_tiler_col_major_tile.py b/test/python/tensortiler2d/square_tiler_col_major_tile.py new file mode 100644 index 0000000000..0eee1e592a --- /dev/null +++ b/test/python/tensortiler2d/square_tiler_col_major_tile.py @@ -0,0 +1,2212 @@ +import numpy as np + +from aie.helpers.tensortiler.tensortiler2D import TensorTiler2D +from util import construct_test + +# RUN: %python %s | FileCheck %s + + +# CHECK-LABEL: square_tiler_col_major_tile +@construct_test +def square_tiler_col_major_tile(): + tiler = TensorTiler2D(32, 32, 4, 4, tile_col_major=True) + access_order = tiler.access_order() + reference_access = np.array( + [ + [ + 0, + 4, + 8, + 12, + 16, + 20, + 24, + 28, + 32, + 36, + 40, + 44, + 48, + 52, + 56, + 60, + 64, + 68, + 72, + 76, + 80, + 84, + 88, + 92, + 96, + 100, + 104, + 108, + 112, + 116, + 120, + 124, + ], + [ + 1, + 5, + 9, + 13, + 17, + 21, + 25, + 29, + 33, + 37, + 41, + 45, + 49, + 53, + 57, + 61, + 65, + 69, + 73, + 77, + 81, + 85, + 89, + 93, + 97, + 101, + 105, + 109, + 113, + 117, + 121, + 125, + ], + [ + 2, + 6, + 10, + 14, + 18, + 22, + 26, + 30, + 34, + 38, + 42, + 46, + 50, + 54, + 58, + 62, + 66, + 70, + 74, + 78, + 82, + 86, + 90, + 94, + 98, + 102, + 106, + 110, + 114, + 118, + 122, + 126, + ], + [ + 3, + 7, + 11, + 15, + 19, + 23, + 27, + 31, + 35, + 39, + 43, + 47, + 51, + 55, + 59, + 63, + 67, + 71, + 75, + 79, + 83, + 87, + 91, + 95, + 99, + 103, + 107, + 111, + 115, + 119, + 123, + 127, + ], + [ + 128, + 132, + 136, + 140, + 144, + 148, + 152, + 156, + 160, + 164, + 168, + 172, + 176, + 180, + 184, + 188, + 192, + 196, + 200, + 204, + 208, + 212, + 216, + 220, + 224, + 228, + 232, + 236, + 240, + 244, + 248, + 252, + ], + [ + 129, + 133, + 137, + 141, + 145, + 149, + 153, + 157, + 161, + 165, + 169, + 173, + 177, + 181, + 185, + 189, + 193, + 197, + 201, + 205, + 209, + 213, + 217, + 221, + 225, + 229, + 233, + 237, + 241, + 245, + 249, + 253, + ], + [ + 130, + 134, + 138, + 142, + 146, + 150, + 154, + 158, + 162, + 166, + 170, + 174, + 178, + 182, + 186, + 190, + 194, + 198, + 202, + 206, + 210, + 214, + 218, + 222, + 226, + 230, + 234, + 238, + 242, + 246, + 250, + 254, + ], + [ + 131, + 135, + 139, + 143, + 147, + 151, + 155, + 159, + 163, + 167, + 171, + 175, + 179, + 183, + 187, + 191, + 195, + 199, + 203, + 207, + 211, + 215, + 219, + 223, + 227, + 231, + 235, + 239, + 243, + 247, + 251, + 255, + ], + [ + 256, + 260, + 264, + 268, + 272, + 276, + 280, + 284, + 288, + 292, + 296, + 300, + 304, + 308, + 312, + 316, + 320, + 324, + 328, + 332, + 336, + 340, + 344, + 348, + 352, + 356, + 360, + 364, + 368, + 372, + 376, + 380, + ], + [ + 257, + 261, + 265, + 269, + 273, + 277, + 281, + 285, + 289, + 293, + 297, + 301, + 305, + 309, + 313, + 317, + 321, + 325, + 329, + 333, + 337, + 341, + 345, + 349, + 353, + 357, + 361, + 365, + 369, + 373, + 377, + 381, + ], + [ + 258, + 262, + 266, + 270, + 274, + 278, + 282, + 286, + 290, + 294, + 298, + 302, + 306, + 310, + 314, + 318, + 322, + 326, + 330, + 334, + 338, + 342, + 346, + 350, + 354, + 358, + 362, + 366, + 370, + 374, + 378, + 382, + ], + [ + 259, + 263, + 267, + 271, + 275, + 279, + 283, + 287, + 291, + 295, + 299, + 303, + 307, + 311, + 315, + 319, + 323, + 327, + 331, + 335, + 339, + 343, + 347, + 351, + 355, + 359, + 363, + 367, + 371, + 375, + 379, + 383, + ], + [ + 384, + 388, + 392, + 396, + 400, + 404, + 408, + 412, + 416, + 420, + 424, + 428, + 432, + 436, + 440, + 444, + 448, + 452, + 456, + 460, + 464, + 468, + 472, + 476, + 480, + 484, + 488, + 492, + 496, + 500, + 504, + 508, + ], + [ + 385, + 389, + 393, + 397, + 401, + 405, + 409, + 413, + 417, + 421, + 425, + 429, + 433, + 437, + 441, + 445, + 449, + 453, + 457, + 461, + 465, + 469, + 473, + 477, + 481, + 485, + 489, + 493, + 497, + 501, + 505, + 509, + ], + [ + 386, + 390, + 394, + 398, + 402, + 406, + 410, + 414, + 418, + 422, + 426, + 430, + 434, + 438, + 442, + 446, + 450, + 454, + 458, + 462, + 466, + 470, + 474, + 478, + 482, + 486, + 490, + 494, + 498, + 502, + 506, + 510, + ], + [ + 387, + 391, + 395, + 399, + 403, + 407, + 411, + 415, + 419, + 423, + 427, + 431, + 435, + 439, + 443, + 447, + 451, + 455, + 459, + 463, + 467, + 471, + 475, + 479, + 483, + 487, + 491, + 495, + 499, + 503, + 507, + 511, + ], + [ + 512, + 516, + 520, + 524, + 528, + 532, + 536, + 540, + 544, + 548, + 552, + 556, + 560, + 564, + 568, + 572, + 576, + 580, + 584, + 588, + 592, + 596, + 600, + 604, + 608, + 612, + 616, + 620, + 624, + 628, + 632, + 636, + ], + [ + 513, + 517, + 521, + 525, + 529, + 533, + 537, + 541, + 545, + 549, + 553, + 557, + 561, + 565, + 569, + 573, + 577, + 581, + 585, + 589, + 593, + 597, + 601, + 605, + 609, + 613, + 617, + 621, + 625, + 629, + 633, + 637, + ], + [ + 514, + 518, + 522, + 526, + 530, + 534, + 538, + 542, + 546, + 550, + 554, + 558, + 562, + 566, + 570, + 574, + 578, + 582, + 586, + 590, + 594, + 598, + 602, + 606, + 610, + 614, + 618, + 622, + 626, + 630, + 634, + 638, + ], + [ + 515, + 519, + 523, + 527, + 531, + 535, + 539, + 543, + 547, + 551, + 555, + 559, + 563, + 567, + 571, + 575, + 579, + 583, + 587, + 591, + 595, + 599, + 603, + 607, + 611, + 615, + 619, + 623, + 627, + 631, + 635, + 639, + ], + [ + 640, + 644, + 648, + 652, + 656, + 660, + 664, + 668, + 672, + 676, + 680, + 684, + 688, + 692, + 696, + 700, + 704, + 708, + 712, + 716, + 720, + 724, + 728, + 732, + 736, + 740, + 744, + 748, + 752, + 756, + 760, + 764, + ], + [ + 641, + 645, + 649, + 653, + 657, + 661, + 665, + 669, + 673, + 677, + 681, + 685, + 689, + 693, + 697, + 701, + 705, + 709, + 713, + 717, + 721, + 725, + 729, + 733, + 737, + 741, + 745, + 749, + 753, + 757, + 761, + 765, + ], + [ + 642, + 646, + 650, + 654, + 658, + 662, + 666, + 670, + 674, + 678, + 682, + 686, + 690, + 694, + 698, + 702, + 706, + 710, + 714, + 718, + 722, + 726, + 730, + 734, + 738, + 742, + 746, + 750, + 754, + 758, + 762, + 766, + ], + [ + 643, + 647, + 651, + 655, + 659, + 663, + 667, + 671, + 675, + 679, + 683, + 687, + 691, + 695, + 699, + 703, + 707, + 711, + 715, + 719, + 723, + 727, + 731, + 735, + 739, + 743, + 747, + 751, + 755, + 759, + 763, + 767, + ], + [ + 768, + 772, + 776, + 780, + 784, + 788, + 792, + 796, + 800, + 804, + 808, + 812, + 816, + 820, + 824, + 828, + 832, + 836, + 840, + 844, + 848, + 852, + 856, + 860, + 864, + 868, + 872, + 876, + 880, + 884, + 888, + 892, + ], + [ + 769, + 773, + 777, + 781, + 785, + 789, + 793, + 797, + 801, + 805, + 809, + 813, + 817, + 821, + 825, + 829, + 833, + 837, + 841, + 845, + 849, + 853, + 857, + 861, + 865, + 869, + 873, + 877, + 881, + 885, + 889, + 893, + ], + [ + 770, + 774, + 778, + 782, + 786, + 790, + 794, + 798, + 802, + 806, + 810, + 814, + 818, + 822, + 826, + 830, + 834, + 838, + 842, + 846, + 850, + 854, + 858, + 862, + 866, + 870, + 874, + 878, + 882, + 886, + 890, + 894, + ], + [ + 771, + 775, + 779, + 783, + 787, + 791, + 795, + 799, + 803, + 807, + 811, + 815, + 819, + 823, + 827, + 831, + 835, + 839, + 843, + 847, + 851, + 855, + 859, + 863, + 867, + 871, + 875, + 879, + 883, + 887, + 891, + 895, + ], + [ + 896, + 900, + 904, + 908, + 912, + 916, + 920, + 924, + 928, + 932, + 936, + 940, + 944, + 948, + 952, + 956, + 960, + 964, + 968, + 972, + 976, + 980, + 984, + 988, + 992, + 996, + 1000, + 1004, + 1008, + 1012, + 1016, + 1020, + ], + [ + 897, + 901, + 905, + 909, + 913, + 917, + 921, + 925, + 929, + 933, + 937, + 941, + 945, + 949, + 953, + 957, + 961, + 965, + 969, + 973, + 977, + 981, + 985, + 989, + 993, + 997, + 1001, + 1005, + 1009, + 1013, + 1017, + 1021, + ], + [ + 898, + 902, + 906, + 910, + 914, + 918, + 922, + 926, + 930, + 934, + 938, + 942, + 946, + 950, + 954, + 958, + 962, + 966, + 970, + 974, + 978, + 982, + 986, + 990, + 994, + 998, + 1002, + 1006, + 1010, + 1014, + 1018, + 1022, + ], + [ + 899, + 903, + 907, + 911, + 915, + 919, + 923, + 927, + 931, + 935, + 939, + 943, + 947, + 951, + 955, + 959, + 963, + 967, + 971, + 975, + 979, + 983, + 987, + 991, + 995, + 999, + 1003, + 1007, + 1011, + 1015, + 1019, + 1023, + ], + ], + dtype=TensorTiler2D.DTYPE, + ) + assert (reference_access == access_order).all() + + tile1_reference_order = np.array( + [ + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + 0, + 4, + 8, + 12, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + 1, + 5, + 9, + 13, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + 2, + 6, + 10, + 14, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + 3, + 7, + 11, + 15, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + ], + dtype=TensorTiler2D.DTYPE, + ) + + tile_count = 0 + for t in tiler.tile_iter(): + if tile_count == 5: + tile_access_order = t.access_order() + assert (tile_access_order == tile1_reference_order).all() + tile_count += 1 + assert tile_count == (32 // 4) * (32 // 4) + + # CHECK: Pass! + print("Pass!") diff --git a/test/python/tensortiler2d/square_tiler_col_major_tile_and_tensor.py b/test/python/tensortiler2d/square_tiler_col_major_tile_and_tensor.py new file mode 100644 index 0000000000..08a2ba78ae --- /dev/null +++ b/test/python/tensortiler2d/square_tiler_col_major_tile_and_tensor.py @@ -0,0 +1,2212 @@ +import numpy as np + +from aie.helpers.tensortiler.tensortiler2D import TensorTiler2D +from util import construct_test + +# RUN: %python %s | FileCheck %s + + +# CHECK-LABEL: square_tiler_col_major_tile_and_tensor +@construct_test +def square_tiler_col_major_tile_and_tensor(): + tiler = TensorTiler2D(32, 32, 4, 4, tensor_col_major=True, tile_col_major=True) + access_order = tiler.access_order() + reference_access = np.array( + [ + [ + 0, + 4, + 8, + 12, + 128, + 132, + 136, + 140, + 256, + 260, + 264, + 268, + 384, + 388, + 392, + 396, + 512, + 516, + 520, + 524, + 640, + 644, + 648, + 652, + 768, + 772, + 776, + 780, + 896, + 900, + 904, + 908, + ], + [ + 1, + 5, + 9, + 13, + 129, + 133, + 137, + 141, + 257, + 261, + 265, + 269, + 385, + 389, + 393, + 397, + 513, + 517, + 521, + 525, + 641, + 645, + 649, + 653, + 769, + 773, + 777, + 781, + 897, + 901, + 905, + 909, + ], + [ + 2, + 6, + 10, + 14, + 130, + 134, + 138, + 142, + 258, + 262, + 266, + 270, + 386, + 390, + 394, + 398, + 514, + 518, + 522, + 526, + 642, + 646, + 650, + 654, + 770, + 774, + 778, + 782, + 898, + 902, + 906, + 910, + ], + [ + 3, + 7, + 11, + 15, + 131, + 135, + 139, + 143, + 259, + 263, + 267, + 271, + 387, + 391, + 395, + 399, + 515, + 519, + 523, + 527, + 643, + 647, + 651, + 655, + 771, + 775, + 779, + 783, + 899, + 903, + 907, + 911, + ], + [ + 16, + 20, + 24, + 28, + 144, + 148, + 152, + 156, + 272, + 276, + 280, + 284, + 400, + 404, + 408, + 412, + 528, + 532, + 536, + 540, + 656, + 660, + 664, + 668, + 784, + 788, + 792, + 796, + 912, + 916, + 920, + 924, + ], + [ + 17, + 21, + 25, + 29, + 145, + 149, + 153, + 157, + 273, + 277, + 281, + 285, + 401, + 405, + 409, + 413, + 529, + 533, + 537, + 541, + 657, + 661, + 665, + 669, + 785, + 789, + 793, + 797, + 913, + 917, + 921, + 925, + ], + [ + 18, + 22, + 26, + 30, + 146, + 150, + 154, + 158, + 274, + 278, + 282, + 286, + 402, + 406, + 410, + 414, + 530, + 534, + 538, + 542, + 658, + 662, + 666, + 670, + 786, + 790, + 794, + 798, + 914, + 918, + 922, + 926, + ], + [ + 19, + 23, + 27, + 31, + 147, + 151, + 155, + 159, + 275, + 279, + 283, + 287, + 403, + 407, + 411, + 415, + 531, + 535, + 539, + 543, + 659, + 663, + 667, + 671, + 787, + 791, + 795, + 799, + 915, + 919, + 923, + 927, + ], + [ + 32, + 36, + 40, + 44, + 160, + 164, + 168, + 172, + 288, + 292, + 296, + 300, + 416, + 420, + 424, + 428, + 544, + 548, + 552, + 556, + 672, + 676, + 680, + 684, + 800, + 804, + 808, + 812, + 928, + 932, + 936, + 940, + ], + [ + 33, + 37, + 41, + 45, + 161, + 165, + 169, + 173, + 289, + 293, + 297, + 301, + 417, + 421, + 425, + 429, + 545, + 549, + 553, + 557, + 673, + 677, + 681, + 685, + 801, + 805, + 809, + 813, + 929, + 933, + 937, + 941, + ], + [ + 34, + 38, + 42, + 46, + 162, + 166, + 170, + 174, + 290, + 294, + 298, + 302, + 418, + 422, + 426, + 430, + 546, + 550, + 554, + 558, + 674, + 678, + 682, + 686, + 802, + 806, + 810, + 814, + 930, + 934, + 938, + 942, + ], + [ + 35, + 39, + 43, + 47, + 163, + 167, + 171, + 175, + 291, + 295, + 299, + 303, + 419, + 423, + 427, + 431, + 547, + 551, + 555, + 559, + 675, + 679, + 683, + 687, + 803, + 807, + 811, + 815, + 931, + 935, + 939, + 943, + ], + [ + 48, + 52, + 56, + 60, + 176, + 180, + 184, + 188, + 304, + 308, + 312, + 316, + 432, + 436, + 440, + 444, + 560, + 564, + 568, + 572, + 688, + 692, + 696, + 700, + 816, + 820, + 824, + 828, + 944, + 948, + 952, + 956, + ], + [ + 49, + 53, + 57, + 61, + 177, + 181, + 185, + 189, + 305, + 309, + 313, + 317, + 433, + 437, + 441, + 445, + 561, + 565, + 569, + 573, + 689, + 693, + 697, + 701, + 817, + 821, + 825, + 829, + 945, + 949, + 953, + 957, + ], + [ + 50, + 54, + 58, + 62, + 178, + 182, + 186, + 190, + 306, + 310, + 314, + 318, + 434, + 438, + 442, + 446, + 562, + 566, + 570, + 574, + 690, + 694, + 698, + 702, + 818, + 822, + 826, + 830, + 946, + 950, + 954, + 958, + ], + [ + 51, + 55, + 59, + 63, + 179, + 183, + 187, + 191, + 307, + 311, + 315, + 319, + 435, + 439, + 443, + 447, + 563, + 567, + 571, + 575, + 691, + 695, + 699, + 703, + 819, + 823, + 827, + 831, + 947, + 951, + 955, + 959, + ], + [ + 64, + 68, + 72, + 76, + 192, + 196, + 200, + 204, + 320, + 324, + 328, + 332, + 448, + 452, + 456, + 460, + 576, + 580, + 584, + 588, + 704, + 708, + 712, + 716, + 832, + 836, + 840, + 844, + 960, + 964, + 968, + 972, + ], + [ + 65, + 69, + 73, + 77, + 193, + 197, + 201, + 205, + 321, + 325, + 329, + 333, + 449, + 453, + 457, + 461, + 577, + 581, + 585, + 589, + 705, + 709, + 713, + 717, + 833, + 837, + 841, + 845, + 961, + 965, + 969, + 973, + ], + [ + 66, + 70, + 74, + 78, + 194, + 198, + 202, + 206, + 322, + 326, + 330, + 334, + 450, + 454, + 458, + 462, + 578, + 582, + 586, + 590, + 706, + 710, + 714, + 718, + 834, + 838, + 842, + 846, + 962, + 966, + 970, + 974, + ], + [ + 67, + 71, + 75, + 79, + 195, + 199, + 203, + 207, + 323, + 327, + 331, + 335, + 451, + 455, + 459, + 463, + 579, + 583, + 587, + 591, + 707, + 711, + 715, + 719, + 835, + 839, + 843, + 847, + 963, + 967, + 971, + 975, + ], + [ + 80, + 84, + 88, + 92, + 208, + 212, + 216, + 220, + 336, + 340, + 344, + 348, + 464, + 468, + 472, + 476, + 592, + 596, + 600, + 604, + 720, + 724, + 728, + 732, + 848, + 852, + 856, + 860, + 976, + 980, + 984, + 988, + ], + [ + 81, + 85, + 89, + 93, + 209, + 213, + 217, + 221, + 337, + 341, + 345, + 349, + 465, + 469, + 473, + 477, + 593, + 597, + 601, + 605, + 721, + 725, + 729, + 733, + 849, + 853, + 857, + 861, + 977, + 981, + 985, + 989, + ], + [ + 82, + 86, + 90, + 94, + 210, + 214, + 218, + 222, + 338, + 342, + 346, + 350, + 466, + 470, + 474, + 478, + 594, + 598, + 602, + 606, + 722, + 726, + 730, + 734, + 850, + 854, + 858, + 862, + 978, + 982, + 986, + 990, + ], + [ + 83, + 87, + 91, + 95, + 211, + 215, + 219, + 223, + 339, + 343, + 347, + 351, + 467, + 471, + 475, + 479, + 595, + 599, + 603, + 607, + 723, + 727, + 731, + 735, + 851, + 855, + 859, + 863, + 979, + 983, + 987, + 991, + ], + [ + 96, + 100, + 104, + 108, + 224, + 228, + 232, + 236, + 352, + 356, + 360, + 364, + 480, + 484, + 488, + 492, + 608, + 612, + 616, + 620, + 736, + 740, + 744, + 748, + 864, + 868, + 872, + 876, + 992, + 996, + 1000, + 1004, + ], + [ + 97, + 101, + 105, + 109, + 225, + 229, + 233, + 237, + 353, + 357, + 361, + 365, + 481, + 485, + 489, + 493, + 609, + 613, + 617, + 621, + 737, + 741, + 745, + 749, + 865, + 869, + 873, + 877, + 993, + 997, + 1001, + 1005, + ], + [ + 98, + 102, + 106, + 110, + 226, + 230, + 234, + 238, + 354, + 358, + 362, + 366, + 482, + 486, + 490, + 494, + 610, + 614, + 618, + 622, + 738, + 742, + 746, + 750, + 866, + 870, + 874, + 878, + 994, + 998, + 1002, + 1006, + ], + [ + 99, + 103, + 107, + 111, + 227, + 231, + 235, + 239, + 355, + 359, + 363, + 367, + 483, + 487, + 491, + 495, + 611, + 615, + 619, + 623, + 739, + 743, + 747, + 751, + 867, + 871, + 875, + 879, + 995, + 999, + 1003, + 1007, + ], + [ + 112, + 116, + 120, + 124, + 240, + 244, + 248, + 252, + 368, + 372, + 376, + 380, + 496, + 500, + 504, + 508, + 624, + 628, + 632, + 636, + 752, + 756, + 760, + 764, + 880, + 884, + 888, + 892, + 1008, + 1012, + 1016, + 1020, + ], + [ + 113, + 117, + 121, + 125, + 241, + 245, + 249, + 253, + 369, + 373, + 377, + 381, + 497, + 501, + 505, + 509, + 625, + 629, + 633, + 637, + 753, + 757, + 761, + 765, + 881, + 885, + 889, + 893, + 1009, + 1013, + 1017, + 1021, + ], + [ + 114, + 118, + 122, + 126, + 242, + 246, + 250, + 254, + 370, + 374, + 378, + 382, + 498, + 502, + 506, + 510, + 626, + 630, + 634, + 638, + 754, + 758, + 762, + 766, + 882, + 886, + 890, + 894, + 1010, + 1014, + 1018, + 1022, + ], + [ + 115, + 119, + 123, + 127, + 243, + 247, + 251, + 255, + 371, + 375, + 379, + 383, + 499, + 503, + 507, + 511, + 627, + 631, + 635, + 639, + 755, + 759, + 763, + 767, + 883, + 887, + 891, + 895, + 1011, + 1015, + 1019, + 1023, + ], + ], + dtype=TensorTiler2D.DTYPE, + ) + assert (reference_access == access_order).all() + + tile1_reference_order = np.array( + [ + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + 0, + 4, + 8, + 12, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + 1, + 5, + 9, + 13, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + 2, + 6, + 10, + 14, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + 3, + 7, + 11, + 15, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + ], + dtype=TensorTiler2D.DTYPE, + ) + + tile_count = 0 + for t in tiler.tile_iter(): + if tile_count == 7: + tile_access_order = t.access_order() + assert (tile_access_order == tile1_reference_order).all() + tile_count += 1 + assert tile_count == (32 // 4) * (32 // 4) + + # CHECK: Pass! + print("Pass!") diff --git a/test/python/tensortiler2d/template.py b/test/python/tensortiler2d/template.py new file mode 100644 index 0000000000..76885ef5d8 --- /dev/null +++ b/test/python/tensortiler2d/template.py @@ -0,0 +1,34 @@ +import numpy as np + +from aie.helpers.tensortiler.tensortiler2D import TensorTiler2D +from util import construct_test + +# RUN: %python %s | FileCheck %s + + +# CHECK-LABEL: square_tiler +@construct_test +def square_tiler(): + tiler = TensorTiler2D(32, 32, 4, 4) + access_order = tiler.access_order() + reference_access = np.array( + [0], # TODOD: fill this in + dtype=TensorTiler2D.DTYPE, + ) + assert (reference_access == access_order).all() + + tile1_reference_order = np.array( + [0], # TODO: fill this in + dtype=TensorTiler2D.DTYPE, + ) + + tile_count = 0 + for t in tiler.tile_iter(): + if tile_count == 1: + tile_access_order = t.access_order() + assert (tile_access_order == tile1_reference_order).all() + tile_count += 1 + assert tile_count == 64 + + # CHECK: Pass! + print("Pass!") diff --git a/test/python/tensortiler2d/tensortiler2d.py b/test/python/tensortiler2d/tensortiler2d.py new file mode 100644 index 0000000000..84bf6f97ca --- /dev/null +++ b/test/python/tensortiler2d/tensortiler2d.py @@ -0,0 +1,396 @@ +import numpy as np + +from aie.helpers.tensortiler.tensortiler2D import TensorTiler2D +from util import construct_test + +# RUN: %python %s | FileCheck %s + + +# CHECK-LABEL: tensortiler_simple +@construct_test +def tensortiler_simple(): + TENSOR_HEIGHT = 2 + TENSOR_WIDTH = 3 + + tiler = TensorTiler2D(TENSOR_HEIGHT, TENSOR_WIDTH, TENSOR_HEIGHT, TENSOR_WIDTH) + access_map = tiler.access_order() + + expected = np.array([[0, 1, 2], [3, 4, 5]]) + assert expected.shape == access_map.shape + assert (expected == access_map).all() + + iter = tiler.tile_iter() + t = next(iter) + + assert ( + t.tensor_height == TENSOR_HEIGHT + ), f"Expected tensor height {TENSOR_HEIGHT} but got {t.tensor_height}" + assert ( + t.tensor_width == TENSOR_WIDTH + ), f"Expected tensor width {TENSOR_WIDTH} but got {t.tensor_width}" + assert t.offset == 0, f"Expected offset 0 but got {t.offset}" + + expected_sizes = [1, 1, TENSOR_HEIGHT, TENSOR_WIDTH] + assert ( + t.sizes == expected_sizes + ), f"Expected sizes {expected_sizes} but got {t.sizes}" + expected_strides = [1, 3, 3, 1] + assert ( + t.strides == expected_strides + ), f"Expected strides {expected_strides} but got {t.strides}" + + assert ( + expected == t.access_order() + ).all(), f"Expected {expected} but got {t.access_order()}" + + try: + next(iter) + assert False, "Iterator should only have one step" + except StopIteration: + pass + + # CHECK: Pass! + print("Pass!") + + +# CHECK-LABEL: tensortiler_tensor_row_major_tile_col_major +@construct_test +def tensortiler_tensor_row_major_tile_col_major(): + TENSOR_HEIGHT = 12 + TENSOR_WIDTH = 12 + TILE_HEIGHT = 3 + TILE_WIDTH = 4 + + tiler = TensorTiler2D( + TENSOR_HEIGHT, + TENSOR_WIDTH, + TILE_HEIGHT, + TILE_WIDTH, + tensor_col_major=False, + tile_col_major=True, + ) + access_map = tiler.access_order() + + expected_tile = np.array([[0, 3, 6, 9], [1, 4, 7, 10], [2, 5, 8, 11]]) + assert (TENSOR_HEIGHT, TENSOR_WIDTH) == access_map.shape + assert (expected_tile == access_map[0:TILE_HEIGHT, 0:TILE_WIDTH]).all() + + expected_tile = expected_tile + expected_tile2 = np.array([[12, 15, 18, 21], [13, 16, 19, 22], [14, 17, 20, 23]]) + assert ( + expected_tile2 == access_map[0:TILE_HEIGHT, TILE_WIDTH : 2 * TILE_WIDTH] + ).all() + + iter = tiler.tile_iter() + tiles = list(iter) + expected_num_tiles = (TENSOR_HEIGHT // TILE_HEIGHT) * (TENSOR_WIDTH // TILE_WIDTH) + assert ( + len(tiles) == expected_num_tiles + ), f"Expected {expected_num_tiles} tiles but got {len(tiles)}" + + t = tiles[0] + assert ( + t.tensor_height == TENSOR_HEIGHT + ), f"Expected tensor height {TENSOR_HEIGHT} but got {t.tensor_height}" + assert ( + t.tensor_width == TENSOR_WIDTH + ), f"Expected tensor width {TENSOR_WIDTH} but got {t.tensor_width}" + assert t.offset == 0, f"Expected offset 0 but got {t.offset}" + + expected_sizes = [1, 1, TILE_WIDTH, TILE_HEIGHT] + assert ( + t.sizes == expected_sizes + ), f"Expected sizes {expected_sizes} but got {t.sizes}" + expected_strides = [1, 36, 1, 12] + assert ( + t.strides == expected_strides + ), f"Expected strides {expected_strides} but got {t.strides}" + + assert ( + expected_tile == t.access_order()[0:TILE_HEIGHT, 0:TILE_WIDTH] + ).all(), f"Expected {expected_tile} but got {t.access_order()[0:TILE_HEIGHT, 0:TILE_WIDTH]}" + + # CHECK: Pass! + print("Pass!") + + +# CHECK-LABEL: tensortiler_tensor_col_major_tile_col_major +@construct_test +def tensortiler_tensor_col_major_tile_col_major(): + TENSOR_HEIGHT = 12 + TENSOR_WIDTH = 12 + TILE_HEIGHT = 3 + TILE_WIDTH = 4 + + tiler = TensorTiler2D( + TENSOR_HEIGHT, + TENSOR_WIDTH, + TILE_HEIGHT, + TILE_WIDTH, + tensor_col_major=True, + tile_col_major=True, + ) + access_map = tiler.access_order() + + expected_tile = np.array([[0, 3, 6, 9], [1, 4, 7, 10], [2, 5, 8, 11]]) + assert (TENSOR_HEIGHT, TENSOR_WIDTH) == access_map.shape + assert (expected_tile == access_map[0:TILE_HEIGHT, 0:TILE_WIDTH]).all() + + expected_tile = expected_tile + expected_tile2 = np.array([[12, 15, 18, 21], [13, 16, 19, 22], [14, 17, 20, 23]]) + assert ( + expected_tile2 == access_map[TILE_HEIGHT : 2 * TILE_HEIGHT, 0:TILE_WIDTH] + ).all() + + iter = tiler.tile_iter() + tiles = list(iter) + expected_num_tiles = (TENSOR_HEIGHT // TILE_HEIGHT) * (TENSOR_WIDTH // TILE_WIDTH) + assert ( + len(tiles) == expected_num_tiles + ), f"Expected {expected_num_tiles} tiles but got {len(tiles)}" + + t = tiles[0] + assert ( + t.tensor_height == TENSOR_HEIGHT + ), f"Expected tensor height {TENSOR_HEIGHT} but got {t.tensor_height}" + assert ( + t.tensor_width == TENSOR_WIDTH + ), f"Expected tensor width {TENSOR_WIDTH} but got {t.tensor_width}" + assert t.offset == 0, f"Expected offset 0 but got {t.offset}" + + expected_sizes = [1, 1, TILE_WIDTH, TILE_HEIGHT] + assert ( + t.sizes == expected_sizes + ), f"Expected sizes {expected_sizes} but got {t.sizes}" + expected_strides = [1, 36, 1, 12] + assert ( + t.strides == expected_strides + ), f"Expected strides {expected_strides} but got {t.strides}" + + assert ( + expected_tile == t.access_order()[0:TILE_HEIGHT, 0:TILE_WIDTH] + ).all(), f"Expected {expected_tile} but got {t.access_order()[0:TILE_HEIGHT, 0:TILE_WIDTH]}" + + # CHECK: Pass! + print("Pass!") + + +# CHECK-LABEL: tensortiler_tensor_col_major_tile_row_major +@construct_test +def tensortiler_tensor_col_major_tile_row_major(): + TENSOR_HEIGHT = 12 + TENSOR_WIDTH = 12 + TILE_HEIGHT = 3 + TILE_WIDTH = 4 + + tiler = TensorTiler2D( + TENSOR_HEIGHT, + TENSOR_WIDTH, + TILE_HEIGHT, + TILE_WIDTH, + tensor_col_major=True, + tile_col_major=False, + ) + access_map = tiler.access_order() + + expected_tile = np.array([[0, 1, 2, 3], [4, 5, 6, 7], [8, 9, 10, 11]]) + assert (TENSOR_HEIGHT, TENSOR_WIDTH) == access_map.shape + assert (expected_tile == access_map[0:TILE_HEIGHT, 0:TILE_WIDTH]).all() + + expected_tile = expected_tile + expected_tile2 = np.array([[12, 13, 14, 15], [16, 17, 18, 19], [20, 21, 22, 23]]) + assert ( + expected_tile2 == access_map[TILE_HEIGHT : 2 * TILE_HEIGHT, 0:TILE_WIDTH] + ).all() + + iter = tiler.tile_iter() + tiles = list(iter) + expected_num_tiles = (TENSOR_HEIGHT // TILE_HEIGHT) * (TENSOR_WIDTH // TILE_WIDTH) + assert ( + len(tiles) == expected_num_tiles + ), f"Expected {expected_num_tiles} tiles but got {len(tiles)}" + + t = tiles[0] + assert ( + t.tensor_height == TENSOR_HEIGHT + ), f"Expected tensor height {TENSOR_HEIGHT} but got {t.tensor_height}" + assert ( + t.tensor_width == TENSOR_WIDTH + ), f"Expected tensor width {TENSOR_WIDTH} but got {t.tensor_width}" + assert t.offset == 0, f"Expected offset 0 but got {t.offset}" + + expected_sizes = [1, 1, TILE_HEIGHT, TILE_WIDTH] + assert ( + t.sizes == expected_sizes + ), f"Expected sizes {expected_sizes} but got {t.sizes}" + expected_strides = [1, 4, 12, 1] + assert ( + t.strides == expected_strides + ), f"Expected strides {expected_strides} but got {t.strides}" + + assert ( + expected_tile == t.access_order()[0:TILE_HEIGHT, 0:TILE_WIDTH] + ).all(), f"Expected {expected_tile} but got {t.access_order()[0:TILE_HEIGHT, 0:TILE_WIDTH]}" + + # CHECK: Pass! + print("Pass!") + + +# CHECK-LABEL: tensortiler_tensor_iter_chunk_row_major +@construct_test +def tensortiler_tensor_iter_chunk_row_major(): + TENSOR_HEIGHT = 12 + TENSOR_WIDTH = 12 + TILE_HEIGHT = 3 + TILE_WIDTH = 2 + + tiler = TensorTiler2D( + TENSOR_HEIGHT, + TENSOR_WIDTH, + TILE_HEIGHT, + TILE_WIDTH, + ) + + expected_tile = np.array([[0, 1], [2, 3], [4, 5]]) + + CHUNK_HEIGHT = 2 + CHUNK_WIDTH = 2 + iter = tiler.tile_iter(chunk_height=2, chunk_width=2) + tiles = list(iter) + expected_num_tiles = (TENSOR_HEIGHT // (TILE_HEIGHT * CHUNK_HEIGHT)) * ( + TENSOR_WIDTH // (TILE_WIDTH * CHUNK_WIDTH) + ) + assert ( + len(tiles) == expected_num_tiles + ), f"Expected {expected_num_tiles} tiles but got {len(tiles)}" + + t = tiles[0] + assert ( + t.tensor_height == TENSOR_HEIGHT + ), f"Expected tensor height {TENSOR_HEIGHT} but got {t.tensor_height}" + assert ( + t.tensor_width == TENSOR_WIDTH + ), f"Expected tensor width {TENSOR_WIDTH} but got {t.tensor_width}" + assert t.offset == 0, f"Expected offset 0 but got {t.offset}" + + expected_sizes = [CHUNK_HEIGHT, CHUNK_WIDTH, TILE_HEIGHT, TILE_WIDTH] + assert ( + t.sizes == expected_sizes + ), f"Expected sizes {expected_sizes} but got {t.sizes}" + expected_strides = [36, 2, 12, 1] + assert ( + t.strides == expected_strides + ), f"Expected strides {expected_strides} but got {t.strides}" + + assert ( + expected_tile == t.access_order()[0:TILE_HEIGHT, 0:TILE_WIDTH] + ).all(), f"Expected {expected_tile} but got {t.access_order()[0:TILE_HEIGHT, 0:TILE_WIDTH]}" + + t = tiles[1] + assert ( + t.tensor_height == TENSOR_HEIGHT + ), f"Expected tensor height {TENSOR_HEIGHT} but got {t.tensor_height}" + assert ( + t.tensor_width == TENSOR_WIDTH + ), f"Expected tensor width {TENSOR_WIDTH} but got {t.tensor_width}" + assert ( + t.offset == CHUNK_WIDTH * TILE_WIDTH + ), f"Expected offset {CHUNK_WIDTH * TILE_WIDTH} but got {t.offset}" + + expected_sizes = [CHUNK_HEIGHT, CHUNK_WIDTH, TILE_HEIGHT, TILE_WIDTH] + assert ( + t.sizes == expected_sizes + ), f"Expected sizes {expected_sizes} but got {t.sizes}" + expected_strides = [36, 2, 12, 1] + assert ( + t.strides == expected_strides + ), f"Expected strides {expected_strides} but got {t.strides}" + + assert ( + expected_tile + == t.access_order()[ + 0:TILE_HEIGHT, CHUNK_WIDTH * TILE_WIDTH : CHUNK_WIDTH * (TILE_WIDTH + 1) + ] + ).all(), f"Expected {expected_tile} but got {t.access_order()[0:TILE_HEIGHT, CHUNK_WIDTH*TILE_WIDTH:CHUNK_WIDTH*(TILE_WIDTH+1)]}" + + # CHECK: Pass! + print("Pass!") + + +# CHECK-LABEL: tensortiler_tensor_iter_chunk_col_major +@construct_test +def tensortiler_tensor_iter_chunk_col_major(): + TENSOR_HEIGHT = 12 + TENSOR_WIDTH = 8 + TILE_HEIGHT = 3 + TILE_WIDTH = 2 + + expected_tile = np.array([[0, 1], [2, 3], [4, 5]]) + + tiler = TensorTiler2D( + TENSOR_HEIGHT, + TENSOR_WIDTH, + TILE_HEIGHT, + TILE_WIDTH, + ) + + CHUNK_HEIGHT = 2 + CHUNK_WIDTH = 2 + iter = tiler.tile_iter(chunk_height=2, chunk_width=2, col_major=True) + tiles = list(iter) + expected_num_tiles = (TENSOR_HEIGHT // (TILE_HEIGHT * CHUNK_HEIGHT)) * ( + TENSOR_WIDTH // (TILE_WIDTH * CHUNK_WIDTH) + ) + assert ( + len(tiles) == expected_num_tiles + ), f"Expected {expected_num_tiles} tiles but got {len(tiles)}" + + t = tiles[0] + assert ( + t.tensor_height == TENSOR_HEIGHT + ), f"Expected tensor height {TENSOR_HEIGHT} but got {t.tensor_height}" + assert ( + t.tensor_width == TENSOR_WIDTH + ), f"Expected tensor width {TENSOR_WIDTH} but got {t.tensor_width}" + assert t.offset == 0, f"Expected offset 0 but got {t.offset}" + + expected_sizes = [CHUNK_HEIGHT, CHUNK_WIDTH, TILE_HEIGHT, TILE_WIDTH] + assert ( + t.sizes == expected_sizes + ), f"Expected sizes {expected_sizes} but got {t.sizes}" + expected_strides = [24, 2, 8, 1] + assert ( + t.strides == expected_strides + ), f"Expected strides {expected_strides} but got {t.strides}" + + assert ( + expected_tile == t.access_order()[0:TILE_HEIGHT, 0:TILE_WIDTH] + ).all(), f"Expected {expected_tile} but got {t.access_order()[0:TILE_HEIGHT, 0:TILE_WIDTH]}" + + t = tiles[1] + assert ( + t.tensor_height == TENSOR_HEIGHT + ), f"Expected tensor height {TENSOR_HEIGHT} but got {t.tensor_height}" + assert ( + t.tensor_width == TENSOR_WIDTH + ), f"Expected tensor width {TENSOR_WIDTH} but got {t.tensor_width}" + assert t.offset == 48, f"Expected offset 48 but got {t.offset}" + + expected_sizes = [CHUNK_HEIGHT, CHUNK_WIDTH, TILE_HEIGHT, TILE_WIDTH] + assert ( + t.sizes == expected_sizes + ), f"Expected sizes {expected_sizes} but got {t.sizes}" + expected_strides = [24, 2, 8, 1] + assert ( + t.strides == expected_strides + ), f"Expected strides {expected_strides} but got {t.strides}" + + assert ( + expected_tile + == t.access_order()[ + CHUNK_HEIGHT * TILE_HEIGHT : (CHUNK_HEIGHT + 1) * TILE_HEIGHT, 0:TILE_WIDTH + ] + ).all(), f"Expected {expected_tile} but got {t.access_order()[CHUNK_HEIGHT*TILE_HEIGHT:(CHUNK_HEIGHT+1)*TILE_HEIGHT, 0:TILE_WIDTH]}" + + # CHECK: Pass! + print("Pass!") diff --git a/test/python/tensortiler2d/util.py b/test/python/tensortiler2d/util.py new file mode 100644 index 0000000000..2267760a46 --- /dev/null +++ b/test/python/tensortiler2d/util.py @@ -0,0 +1,4 @@ +# Run test +def construct_test(f): + print("\nTEST:", f.__name__) + f() diff --git a/test/python/util.py b/test/python/util.py index 60ed1735c1..f9cea831db 100644 --- a/test/python/util.py +++ b/test/python/util.py @@ -2,12 +2,6 @@ from aie.ir import Context, Location, Module, InsertionPoint -# Run test -def construct_test(f): - print("\nTEST:", f.__name__) - f() - - # Create and print ModuleOp. def construct_and_print_module(f): print("\nTEST:", f.__name__) From a47df3a482d9d247f0a2d6cf18a3a212f8ecdaa1 Mon Sep 17 00:00:00 2001 From: Erika Hunhoff Date: Tue, 22 Oct 2024 14:42:00 -0600 Subject: [PATCH 10/35] a couple more tests --- ...col_major_tensor_and_tile_tile_chunking.py | 2212 +++++++++++++++++ ...e_chunking_rectangular_col_major_chunks.py | 187 ++ .../square_tiler_tile_chunking.py | 2212 +++++++++++++++++ ...re_tiler_tile_chunking_col_major_chunks.py | 2212 +++++++++++++++++ 4 files changed, 6823 insertions(+) create mode 100644 test/python/tensortiler2d/square_tiler_col_major_tensor_and_tile_tile_chunking.py create mode 100644 test/python/tensortiler2d/square_tiler_col_major_tensor_tile_chunking_rectangular_col_major_chunks.py create mode 100644 test/python/tensortiler2d/square_tiler_tile_chunking.py create mode 100644 test/python/tensortiler2d/square_tiler_tile_chunking_col_major_chunks.py diff --git a/test/python/tensortiler2d/square_tiler_col_major_tensor_and_tile_tile_chunking.py b/test/python/tensortiler2d/square_tiler_col_major_tensor_and_tile_tile_chunking.py new file mode 100644 index 0000000000..5c56936056 --- /dev/null +++ b/test/python/tensortiler2d/square_tiler_col_major_tensor_and_tile_tile_chunking.py @@ -0,0 +1,2212 @@ +import numpy as np + +from aie.helpers.tensortiler.tensortiler2D import TensorTiler2D +from util import construct_test + +# RUN: %python %s | FileCheck %s + + +# CHECK-LABEL: square_tiler_col_major_tensor_and_tile_tile_chunking +@construct_test +def square_tiler_col_major_tensor_and_tile_tile_chunking(): + tiler = TensorTiler2D(32, 32, 4, 4, tensor_col_major=True, tile_col_major=True) + access_order = tiler.access_order() + reference_access = np.array( + [ + [ + 0, + 4, + 8, + 12, + 128, + 132, + 136, + 140, + 256, + 260, + 264, + 268, + 384, + 388, + 392, + 396, + 512, + 516, + 520, + 524, + 640, + 644, + 648, + 652, + 768, + 772, + 776, + 780, + 896, + 900, + 904, + 908, + ], + [ + 1, + 5, + 9, + 13, + 129, + 133, + 137, + 141, + 257, + 261, + 265, + 269, + 385, + 389, + 393, + 397, + 513, + 517, + 521, + 525, + 641, + 645, + 649, + 653, + 769, + 773, + 777, + 781, + 897, + 901, + 905, + 909, + ], + [ + 2, + 6, + 10, + 14, + 130, + 134, + 138, + 142, + 258, + 262, + 266, + 270, + 386, + 390, + 394, + 398, + 514, + 518, + 522, + 526, + 642, + 646, + 650, + 654, + 770, + 774, + 778, + 782, + 898, + 902, + 906, + 910, + ], + [ + 3, + 7, + 11, + 15, + 131, + 135, + 139, + 143, + 259, + 263, + 267, + 271, + 387, + 391, + 395, + 399, + 515, + 519, + 523, + 527, + 643, + 647, + 651, + 655, + 771, + 775, + 779, + 783, + 899, + 903, + 907, + 911, + ], + [ + 16, + 20, + 24, + 28, + 144, + 148, + 152, + 156, + 272, + 276, + 280, + 284, + 400, + 404, + 408, + 412, + 528, + 532, + 536, + 540, + 656, + 660, + 664, + 668, + 784, + 788, + 792, + 796, + 912, + 916, + 920, + 924, + ], + [ + 17, + 21, + 25, + 29, + 145, + 149, + 153, + 157, + 273, + 277, + 281, + 285, + 401, + 405, + 409, + 413, + 529, + 533, + 537, + 541, + 657, + 661, + 665, + 669, + 785, + 789, + 793, + 797, + 913, + 917, + 921, + 925, + ], + [ + 18, + 22, + 26, + 30, + 146, + 150, + 154, + 158, + 274, + 278, + 282, + 286, + 402, + 406, + 410, + 414, + 530, + 534, + 538, + 542, + 658, + 662, + 666, + 670, + 786, + 790, + 794, + 798, + 914, + 918, + 922, + 926, + ], + [ + 19, + 23, + 27, + 31, + 147, + 151, + 155, + 159, + 275, + 279, + 283, + 287, + 403, + 407, + 411, + 415, + 531, + 535, + 539, + 543, + 659, + 663, + 667, + 671, + 787, + 791, + 795, + 799, + 915, + 919, + 923, + 927, + ], + [ + 32, + 36, + 40, + 44, + 160, + 164, + 168, + 172, + 288, + 292, + 296, + 300, + 416, + 420, + 424, + 428, + 544, + 548, + 552, + 556, + 672, + 676, + 680, + 684, + 800, + 804, + 808, + 812, + 928, + 932, + 936, + 940, + ], + [ + 33, + 37, + 41, + 45, + 161, + 165, + 169, + 173, + 289, + 293, + 297, + 301, + 417, + 421, + 425, + 429, + 545, + 549, + 553, + 557, + 673, + 677, + 681, + 685, + 801, + 805, + 809, + 813, + 929, + 933, + 937, + 941, + ], + [ + 34, + 38, + 42, + 46, + 162, + 166, + 170, + 174, + 290, + 294, + 298, + 302, + 418, + 422, + 426, + 430, + 546, + 550, + 554, + 558, + 674, + 678, + 682, + 686, + 802, + 806, + 810, + 814, + 930, + 934, + 938, + 942, + ], + [ + 35, + 39, + 43, + 47, + 163, + 167, + 171, + 175, + 291, + 295, + 299, + 303, + 419, + 423, + 427, + 431, + 547, + 551, + 555, + 559, + 675, + 679, + 683, + 687, + 803, + 807, + 811, + 815, + 931, + 935, + 939, + 943, + ], + [ + 48, + 52, + 56, + 60, + 176, + 180, + 184, + 188, + 304, + 308, + 312, + 316, + 432, + 436, + 440, + 444, + 560, + 564, + 568, + 572, + 688, + 692, + 696, + 700, + 816, + 820, + 824, + 828, + 944, + 948, + 952, + 956, + ], + [ + 49, + 53, + 57, + 61, + 177, + 181, + 185, + 189, + 305, + 309, + 313, + 317, + 433, + 437, + 441, + 445, + 561, + 565, + 569, + 573, + 689, + 693, + 697, + 701, + 817, + 821, + 825, + 829, + 945, + 949, + 953, + 957, + ], + [ + 50, + 54, + 58, + 62, + 178, + 182, + 186, + 190, + 306, + 310, + 314, + 318, + 434, + 438, + 442, + 446, + 562, + 566, + 570, + 574, + 690, + 694, + 698, + 702, + 818, + 822, + 826, + 830, + 946, + 950, + 954, + 958, + ], + [ + 51, + 55, + 59, + 63, + 179, + 183, + 187, + 191, + 307, + 311, + 315, + 319, + 435, + 439, + 443, + 447, + 563, + 567, + 571, + 575, + 691, + 695, + 699, + 703, + 819, + 823, + 827, + 831, + 947, + 951, + 955, + 959, + ], + [ + 64, + 68, + 72, + 76, + 192, + 196, + 200, + 204, + 320, + 324, + 328, + 332, + 448, + 452, + 456, + 460, + 576, + 580, + 584, + 588, + 704, + 708, + 712, + 716, + 832, + 836, + 840, + 844, + 960, + 964, + 968, + 972, + ], + [ + 65, + 69, + 73, + 77, + 193, + 197, + 201, + 205, + 321, + 325, + 329, + 333, + 449, + 453, + 457, + 461, + 577, + 581, + 585, + 589, + 705, + 709, + 713, + 717, + 833, + 837, + 841, + 845, + 961, + 965, + 969, + 973, + ], + [ + 66, + 70, + 74, + 78, + 194, + 198, + 202, + 206, + 322, + 326, + 330, + 334, + 450, + 454, + 458, + 462, + 578, + 582, + 586, + 590, + 706, + 710, + 714, + 718, + 834, + 838, + 842, + 846, + 962, + 966, + 970, + 974, + ], + [ + 67, + 71, + 75, + 79, + 195, + 199, + 203, + 207, + 323, + 327, + 331, + 335, + 451, + 455, + 459, + 463, + 579, + 583, + 587, + 591, + 707, + 711, + 715, + 719, + 835, + 839, + 843, + 847, + 963, + 967, + 971, + 975, + ], + [ + 80, + 84, + 88, + 92, + 208, + 212, + 216, + 220, + 336, + 340, + 344, + 348, + 464, + 468, + 472, + 476, + 592, + 596, + 600, + 604, + 720, + 724, + 728, + 732, + 848, + 852, + 856, + 860, + 976, + 980, + 984, + 988, + ], + [ + 81, + 85, + 89, + 93, + 209, + 213, + 217, + 221, + 337, + 341, + 345, + 349, + 465, + 469, + 473, + 477, + 593, + 597, + 601, + 605, + 721, + 725, + 729, + 733, + 849, + 853, + 857, + 861, + 977, + 981, + 985, + 989, + ], + [ + 82, + 86, + 90, + 94, + 210, + 214, + 218, + 222, + 338, + 342, + 346, + 350, + 466, + 470, + 474, + 478, + 594, + 598, + 602, + 606, + 722, + 726, + 730, + 734, + 850, + 854, + 858, + 862, + 978, + 982, + 986, + 990, + ], + [ + 83, + 87, + 91, + 95, + 211, + 215, + 219, + 223, + 339, + 343, + 347, + 351, + 467, + 471, + 475, + 479, + 595, + 599, + 603, + 607, + 723, + 727, + 731, + 735, + 851, + 855, + 859, + 863, + 979, + 983, + 987, + 991, + ], + [ + 96, + 100, + 104, + 108, + 224, + 228, + 232, + 236, + 352, + 356, + 360, + 364, + 480, + 484, + 488, + 492, + 608, + 612, + 616, + 620, + 736, + 740, + 744, + 748, + 864, + 868, + 872, + 876, + 992, + 996, + 1000, + 1004, + ], + [ + 97, + 101, + 105, + 109, + 225, + 229, + 233, + 237, + 353, + 357, + 361, + 365, + 481, + 485, + 489, + 493, + 609, + 613, + 617, + 621, + 737, + 741, + 745, + 749, + 865, + 869, + 873, + 877, + 993, + 997, + 1001, + 1005, + ], + [ + 98, + 102, + 106, + 110, + 226, + 230, + 234, + 238, + 354, + 358, + 362, + 366, + 482, + 486, + 490, + 494, + 610, + 614, + 618, + 622, + 738, + 742, + 746, + 750, + 866, + 870, + 874, + 878, + 994, + 998, + 1002, + 1006, + ], + [ + 99, + 103, + 107, + 111, + 227, + 231, + 235, + 239, + 355, + 359, + 363, + 367, + 483, + 487, + 491, + 495, + 611, + 615, + 619, + 623, + 739, + 743, + 747, + 751, + 867, + 871, + 875, + 879, + 995, + 999, + 1003, + 1007, + ], + [ + 112, + 116, + 120, + 124, + 240, + 244, + 248, + 252, + 368, + 372, + 376, + 380, + 496, + 500, + 504, + 508, + 624, + 628, + 632, + 636, + 752, + 756, + 760, + 764, + 880, + 884, + 888, + 892, + 1008, + 1012, + 1016, + 1020, + ], + [ + 113, + 117, + 121, + 125, + 241, + 245, + 249, + 253, + 369, + 373, + 377, + 381, + 497, + 501, + 505, + 509, + 625, + 629, + 633, + 637, + 753, + 757, + 761, + 765, + 881, + 885, + 889, + 893, + 1009, + 1013, + 1017, + 1021, + ], + [ + 114, + 118, + 122, + 126, + 242, + 246, + 250, + 254, + 370, + 374, + 378, + 382, + 498, + 502, + 506, + 510, + 626, + 630, + 634, + 638, + 754, + 758, + 762, + 766, + 882, + 886, + 890, + 894, + 1010, + 1014, + 1018, + 1022, + ], + [ + 115, + 119, + 123, + 127, + 243, + 247, + 251, + 255, + 371, + 375, + 379, + 383, + 499, + 503, + 507, + 511, + 627, + 631, + 635, + 639, + 755, + 759, + 763, + 767, + 883, + 887, + 891, + 895, + 1011, + 1015, + 1019, + 1023, + ], + ], + dtype=TensorTiler2D.DTYPE, + ) + assert (reference_access == access_order).all() + + tile1_reference_order = np.array( + [ + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + 0, + 4, + 8, + 12, + 32, + 36, + 40, + 44, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + 1, + 5, + 9, + 13, + 33, + 37, + 41, + 45, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + 2, + 6, + 10, + 14, + 34, + 38, + 42, + 46, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + 3, + 7, + 11, + 15, + 35, + 39, + 43, + 47, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + 16, + 20, + 24, + 28, + 48, + 52, + 56, + 60, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + 17, + 21, + 25, + 29, + 49, + 53, + 57, + 61, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + 18, + 22, + 26, + 30, + 50, + 54, + 58, + 62, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + 19, + 23, + 27, + 31, + 51, + 55, + 59, + 63, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + ], + dtype=TensorTiler2D.DTYPE, + ) + + tile_count = 0 + for t in tiler.tile_iter(2, 2): + if tile_count == 2: + tile_access_order = t.access_order() + assert (tile_access_order == tile1_reference_order).all() + tile_count += 1 + assert tile_count == (32 // (4 * 2)) * (32 // (4 * 2)) + + # CHECK: Pass! + print("Pass!") diff --git a/test/python/tensortiler2d/square_tiler_col_major_tensor_tile_chunking_rectangular_col_major_chunks.py b/test/python/tensortiler2d/square_tiler_col_major_tensor_tile_chunking_rectangular_col_major_chunks.py new file mode 100644 index 0000000000..e60ed3b43f --- /dev/null +++ b/test/python/tensortiler2d/square_tiler_col_major_tensor_tile_chunking_rectangular_col_major_chunks.py @@ -0,0 +1,187 @@ +import numpy as np + +from aie.helpers.tensortiler.tensortiler2D import TensorTiler2D +from util import construct_test + +# RUN: %python %s | FileCheck %s + + +# CHECK-LABEL: square_tiler_col_major_tensor_tile_chunking_rectangular_col_major_chunks +@construct_test +def square_tiler_col_major_tensor_tile_chunking_rectangular_col_major_chunks(): + tiler = TensorTiler2D(16, 16, 4, 4, tensor_col_major=True) + access_order = tiler.access_order() + reference_access = np.array( + [ + [0, 1, 2, 3, 64, 65, 66, 67, 128, 129, 130, 131, 192, 193, 194, 195], + [4, 5, 6, 7, 68, 69, 70, 71, 132, 133, 134, 135, 196, 197, 198, 199], + [8, 9, 10, 11, 72, 73, 74, 75, 136, 137, 138, 139, 200, 201, 202, 203], + [12, 13, 14, 15, 76, 77, 78, 79, 140, 141, 142, 143, 204, 205, 206, 207], + [16, 17, 18, 19, 80, 81, 82, 83, 144, 145, 146, 147, 208, 209, 210, 211], + [20, 21, 22, 23, 84, 85, 86, 87, 148, 149, 150, 151, 212, 213, 214, 215], + [24, 25, 26, 27, 88, 89, 90, 91, 152, 153, 154, 155, 216, 217, 218, 219], + [28, 29, 30, 31, 92, 93, 94, 95, 156, 157, 158, 159, 220, 221, 222, 223], + [32, 33, 34, 35, 96, 97, 98, 99, 160, 161, 162, 163, 224, 225, 226, 227], + [ + 36, + 37, + 38, + 39, + 100, + 101, + 102, + 103, + 164, + 165, + 166, + 167, + 228, + 229, + 230, + 231, + ], + [ + 40, + 41, + 42, + 43, + 104, + 105, + 106, + 107, + 168, + 169, + 170, + 171, + 232, + 233, + 234, + 235, + ], + [ + 44, + 45, + 46, + 47, + 108, + 109, + 110, + 111, + 172, + 173, + 174, + 175, + 236, + 237, + 238, + 239, + ], + [ + 48, + 49, + 50, + 51, + 112, + 113, + 114, + 115, + 176, + 177, + 178, + 179, + 240, + 241, + 242, + 243, + ], + [ + 52, + 53, + 54, + 55, + 116, + 117, + 118, + 119, + 180, + 181, + 182, + 183, + 244, + 245, + 246, + 247, + ], + [ + 56, + 57, + 58, + 59, + 120, + 121, + 122, + 123, + 184, + 185, + 186, + 187, + 248, + 249, + 250, + 251, + ], + [ + 60, + 61, + 62, + 63, + 124, + 125, + 126, + 127, + 188, + 189, + 190, + 191, + 252, + 253, + 254, + 255, + ], + ], + dtype=TensorTiler2D.DTYPE, + ) + assert (reference_access == access_order).all() + + tile1_reference_order = np.array( + [ + [0, 1, 2, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], + [4, 5, 6, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], + [8, 9, 10, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], + [12, 13, 14, 15, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], + [16, 17, 18, 19, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], + [20, 21, 22, 23, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], + [24, 25, 26, 27, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], + [28, 29, 30, 31, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], + [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], + [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], + [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], + [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], + [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], + [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], + [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], + [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], + ], + dtype=TensorTiler2D.DTYPE, + ) + + tile_count = 0 + for t in tiler.tile_iter(2, 1, col_major=True): + if tile_count == 0: + tile_access_order = t.access_order() + assert (tile_access_order == tile1_reference_order).all() + tile_count += 1 + assert tile_count == (16 // (2 * 4)) * (16 // (1 * 4)) + + # CHECK: Pass! + print("Pass!") diff --git a/test/python/tensortiler2d/square_tiler_tile_chunking.py b/test/python/tensortiler2d/square_tiler_tile_chunking.py new file mode 100644 index 0000000000..6d16df3979 --- /dev/null +++ b/test/python/tensortiler2d/square_tiler_tile_chunking.py @@ -0,0 +1,2212 @@ +import numpy as np + +from aie.helpers.tensortiler.tensortiler2D import TensorTiler2D +from util import construct_test + +# RUN: %python %s | FileCheck %s + + +# CHECK-LABEL: square_tiler_tile_chunking +@construct_test +def square_tiler_tile_chunking(): + tiler = TensorTiler2D(32, 32, 8, 8) + access_order = tiler.access_order() + reference_access = np.array( + [ + [ + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 64, + 65, + 66, + 67, + 68, + 69, + 70, + 71, + 128, + 129, + 130, + 131, + 132, + 133, + 134, + 135, + 192, + 193, + 194, + 195, + 196, + 197, + 198, + 199, + ], + [ + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 72, + 73, + 74, + 75, + 76, + 77, + 78, + 79, + 136, + 137, + 138, + 139, + 140, + 141, + 142, + 143, + 200, + 201, + 202, + 203, + 204, + 205, + 206, + 207, + ], + [ + 16, + 17, + 18, + 19, + 20, + 21, + 22, + 23, + 80, + 81, + 82, + 83, + 84, + 85, + 86, + 87, + 144, + 145, + 146, + 147, + 148, + 149, + 150, + 151, + 208, + 209, + 210, + 211, + 212, + 213, + 214, + 215, + ], + [ + 24, + 25, + 26, + 27, + 28, + 29, + 30, + 31, + 88, + 89, + 90, + 91, + 92, + 93, + 94, + 95, + 152, + 153, + 154, + 155, + 156, + 157, + 158, + 159, + 216, + 217, + 218, + 219, + 220, + 221, + 222, + 223, + ], + [ + 32, + 33, + 34, + 35, + 36, + 37, + 38, + 39, + 96, + 97, + 98, + 99, + 100, + 101, + 102, + 103, + 160, + 161, + 162, + 163, + 164, + 165, + 166, + 167, + 224, + 225, + 226, + 227, + 228, + 229, + 230, + 231, + ], + [ + 40, + 41, + 42, + 43, + 44, + 45, + 46, + 47, + 104, + 105, + 106, + 107, + 108, + 109, + 110, + 111, + 168, + 169, + 170, + 171, + 172, + 173, + 174, + 175, + 232, + 233, + 234, + 235, + 236, + 237, + 238, + 239, + ], + [ + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 112, + 113, + 114, + 115, + 116, + 117, + 118, + 119, + 176, + 177, + 178, + 179, + 180, + 181, + 182, + 183, + 240, + 241, + 242, + 243, + 244, + 245, + 246, + 247, + ], + [ + 56, + 57, + 58, + 59, + 60, + 61, + 62, + 63, + 120, + 121, + 122, + 123, + 124, + 125, + 126, + 127, + 184, + 185, + 186, + 187, + 188, + 189, + 190, + 191, + 248, + 249, + 250, + 251, + 252, + 253, + 254, + 255, + ], + [ + 256, + 257, + 258, + 259, + 260, + 261, + 262, + 263, + 320, + 321, + 322, + 323, + 324, + 325, + 326, + 327, + 384, + 385, + 386, + 387, + 388, + 389, + 390, + 391, + 448, + 449, + 450, + 451, + 452, + 453, + 454, + 455, + ], + [ + 264, + 265, + 266, + 267, + 268, + 269, + 270, + 271, + 328, + 329, + 330, + 331, + 332, + 333, + 334, + 335, + 392, + 393, + 394, + 395, + 396, + 397, + 398, + 399, + 456, + 457, + 458, + 459, + 460, + 461, + 462, + 463, + ], + [ + 272, + 273, + 274, + 275, + 276, + 277, + 278, + 279, + 336, + 337, + 338, + 339, + 340, + 341, + 342, + 343, + 400, + 401, + 402, + 403, + 404, + 405, + 406, + 407, + 464, + 465, + 466, + 467, + 468, + 469, + 470, + 471, + ], + [ + 280, + 281, + 282, + 283, + 284, + 285, + 286, + 287, + 344, + 345, + 346, + 347, + 348, + 349, + 350, + 351, + 408, + 409, + 410, + 411, + 412, + 413, + 414, + 415, + 472, + 473, + 474, + 475, + 476, + 477, + 478, + 479, + ], + [ + 288, + 289, + 290, + 291, + 292, + 293, + 294, + 295, + 352, + 353, + 354, + 355, + 356, + 357, + 358, + 359, + 416, + 417, + 418, + 419, + 420, + 421, + 422, + 423, + 480, + 481, + 482, + 483, + 484, + 485, + 486, + 487, + ], + [ + 296, + 297, + 298, + 299, + 300, + 301, + 302, + 303, + 360, + 361, + 362, + 363, + 364, + 365, + 366, + 367, + 424, + 425, + 426, + 427, + 428, + 429, + 430, + 431, + 488, + 489, + 490, + 491, + 492, + 493, + 494, + 495, + ], + [ + 304, + 305, + 306, + 307, + 308, + 309, + 310, + 311, + 368, + 369, + 370, + 371, + 372, + 373, + 374, + 375, + 432, + 433, + 434, + 435, + 436, + 437, + 438, + 439, + 496, + 497, + 498, + 499, + 500, + 501, + 502, + 503, + ], + [ + 312, + 313, + 314, + 315, + 316, + 317, + 318, + 319, + 376, + 377, + 378, + 379, + 380, + 381, + 382, + 383, + 440, + 441, + 442, + 443, + 444, + 445, + 446, + 447, + 504, + 505, + 506, + 507, + 508, + 509, + 510, + 511, + ], + [ + 512, + 513, + 514, + 515, + 516, + 517, + 518, + 519, + 576, + 577, + 578, + 579, + 580, + 581, + 582, + 583, + 640, + 641, + 642, + 643, + 644, + 645, + 646, + 647, + 704, + 705, + 706, + 707, + 708, + 709, + 710, + 711, + ], + [ + 520, + 521, + 522, + 523, + 524, + 525, + 526, + 527, + 584, + 585, + 586, + 587, + 588, + 589, + 590, + 591, + 648, + 649, + 650, + 651, + 652, + 653, + 654, + 655, + 712, + 713, + 714, + 715, + 716, + 717, + 718, + 719, + ], + [ + 528, + 529, + 530, + 531, + 532, + 533, + 534, + 535, + 592, + 593, + 594, + 595, + 596, + 597, + 598, + 599, + 656, + 657, + 658, + 659, + 660, + 661, + 662, + 663, + 720, + 721, + 722, + 723, + 724, + 725, + 726, + 727, + ], + [ + 536, + 537, + 538, + 539, + 540, + 541, + 542, + 543, + 600, + 601, + 602, + 603, + 604, + 605, + 606, + 607, + 664, + 665, + 666, + 667, + 668, + 669, + 670, + 671, + 728, + 729, + 730, + 731, + 732, + 733, + 734, + 735, + ], + [ + 544, + 545, + 546, + 547, + 548, + 549, + 550, + 551, + 608, + 609, + 610, + 611, + 612, + 613, + 614, + 615, + 672, + 673, + 674, + 675, + 676, + 677, + 678, + 679, + 736, + 737, + 738, + 739, + 740, + 741, + 742, + 743, + ], + [ + 552, + 553, + 554, + 555, + 556, + 557, + 558, + 559, + 616, + 617, + 618, + 619, + 620, + 621, + 622, + 623, + 680, + 681, + 682, + 683, + 684, + 685, + 686, + 687, + 744, + 745, + 746, + 747, + 748, + 749, + 750, + 751, + ], + [ + 560, + 561, + 562, + 563, + 564, + 565, + 566, + 567, + 624, + 625, + 626, + 627, + 628, + 629, + 630, + 631, + 688, + 689, + 690, + 691, + 692, + 693, + 694, + 695, + 752, + 753, + 754, + 755, + 756, + 757, + 758, + 759, + ], + [ + 568, + 569, + 570, + 571, + 572, + 573, + 574, + 575, + 632, + 633, + 634, + 635, + 636, + 637, + 638, + 639, + 696, + 697, + 698, + 699, + 700, + 701, + 702, + 703, + 760, + 761, + 762, + 763, + 764, + 765, + 766, + 767, + ], + [ + 768, + 769, + 770, + 771, + 772, + 773, + 774, + 775, + 832, + 833, + 834, + 835, + 836, + 837, + 838, + 839, + 896, + 897, + 898, + 899, + 900, + 901, + 902, + 903, + 960, + 961, + 962, + 963, + 964, + 965, + 966, + 967, + ], + [ + 776, + 777, + 778, + 779, + 780, + 781, + 782, + 783, + 840, + 841, + 842, + 843, + 844, + 845, + 846, + 847, + 904, + 905, + 906, + 907, + 908, + 909, + 910, + 911, + 968, + 969, + 970, + 971, + 972, + 973, + 974, + 975, + ], + [ + 784, + 785, + 786, + 787, + 788, + 789, + 790, + 791, + 848, + 849, + 850, + 851, + 852, + 853, + 854, + 855, + 912, + 913, + 914, + 915, + 916, + 917, + 918, + 919, + 976, + 977, + 978, + 979, + 980, + 981, + 982, + 983, + ], + [ + 792, + 793, + 794, + 795, + 796, + 797, + 798, + 799, + 856, + 857, + 858, + 859, + 860, + 861, + 862, + 863, + 920, + 921, + 922, + 923, + 924, + 925, + 926, + 927, + 984, + 985, + 986, + 987, + 988, + 989, + 990, + 991, + ], + [ + 800, + 801, + 802, + 803, + 804, + 805, + 806, + 807, + 864, + 865, + 866, + 867, + 868, + 869, + 870, + 871, + 928, + 929, + 930, + 931, + 932, + 933, + 934, + 935, + 992, + 993, + 994, + 995, + 996, + 997, + 998, + 999, + ], + [ + 808, + 809, + 810, + 811, + 812, + 813, + 814, + 815, + 872, + 873, + 874, + 875, + 876, + 877, + 878, + 879, + 936, + 937, + 938, + 939, + 940, + 941, + 942, + 943, + 1000, + 1001, + 1002, + 1003, + 1004, + 1005, + 1006, + 1007, + ], + [ + 816, + 817, + 818, + 819, + 820, + 821, + 822, + 823, + 880, + 881, + 882, + 883, + 884, + 885, + 886, + 887, + 944, + 945, + 946, + 947, + 948, + 949, + 950, + 951, + 1008, + 1009, + 1010, + 1011, + 1012, + 1013, + 1014, + 1015, + ], + [ + 824, + 825, + 826, + 827, + 828, + 829, + 830, + 831, + 888, + 889, + 890, + 891, + 892, + 893, + 894, + 895, + 952, + 953, + 954, + 955, + 956, + 957, + 958, + 959, + 1016, + 1017, + 1018, + 1019, + 1020, + 1021, + 1022, + 1023, + ], + ], + dtype=TensorTiler2D.DTYPE, + ) + assert (reference_access == access_order).all() + + tile1_reference_order = np.array( + [ + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 64, + 65, + 66, + 67, + 68, + 69, + 70, + 71, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 72, + 73, + 74, + 75, + 76, + 77, + 78, + 79, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + 16, + 17, + 18, + 19, + 20, + 21, + 22, + 23, + 80, + 81, + 82, + 83, + 84, + 85, + 86, + 87, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + 24, + 25, + 26, + 27, + 28, + 29, + 30, + 31, + 88, + 89, + 90, + 91, + 92, + 93, + 94, + 95, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + 32, + 33, + 34, + 35, + 36, + 37, + 38, + 39, + 96, + 97, + 98, + 99, + 100, + 101, + 102, + 103, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + 40, + 41, + 42, + 43, + 44, + 45, + 46, + 47, + 104, + 105, + 106, + 107, + 108, + 109, + 110, + 111, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 112, + 113, + 114, + 115, + 116, + 117, + 118, + 119, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + 56, + 57, + 58, + 59, + 60, + 61, + 62, + 63, + 120, + 121, + 122, + 123, + 124, + 125, + 126, + 127, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + 128, + 129, + 130, + 131, + 132, + 133, + 134, + 135, + 192, + 193, + 194, + 195, + 196, + 197, + 198, + 199, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + 136, + 137, + 138, + 139, + 140, + 141, + 142, + 143, + 200, + 201, + 202, + 203, + 204, + 205, + 206, + 207, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + 144, + 145, + 146, + 147, + 148, + 149, + 150, + 151, + 208, + 209, + 210, + 211, + 212, + 213, + 214, + 215, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + 152, + 153, + 154, + 155, + 156, + 157, + 158, + 159, + 216, + 217, + 218, + 219, + 220, + 221, + 222, + 223, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + 160, + 161, + 162, + 163, + 164, + 165, + 166, + 167, + 224, + 225, + 226, + 227, + 228, + 229, + 230, + 231, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + 168, + 169, + 170, + 171, + 172, + 173, + 174, + 175, + 232, + 233, + 234, + 235, + 236, + 237, + 238, + 239, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + 176, + 177, + 178, + 179, + 180, + 181, + 182, + 183, + 240, + 241, + 242, + 243, + 244, + 245, + 246, + 247, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + 184, + 185, + 186, + 187, + 188, + 189, + 190, + 191, + 248, + 249, + 250, + 251, + 252, + 253, + 254, + 255, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + ], + dtype=TensorTiler2D.DTYPE, + ) + + tile_count = 0 + for t in tiler.tile_iter(2, 2): + if tile_count == 2: + tile_access_order = t.access_order() + assert (tile_access_order == tile1_reference_order).all() + tile_count += 1 + assert tile_count == (32 // (8 * 2)) * (32 // (8 * 2)) + + # CHECK: Pass! + print("Pass!") diff --git a/test/python/tensortiler2d/square_tiler_tile_chunking_col_major_chunks.py b/test/python/tensortiler2d/square_tiler_tile_chunking_col_major_chunks.py new file mode 100644 index 0000000000..9195174b5a --- /dev/null +++ b/test/python/tensortiler2d/square_tiler_tile_chunking_col_major_chunks.py @@ -0,0 +1,2212 @@ +import numpy as np + +from aie.helpers.tensortiler.tensortiler2D import TensorTiler2D +from util import construct_test + +# RUN: %python %s | FileCheck %s + + +# CHECK-LABEL: square_tiler_tile_chunking_col_major_chunks +@construct_test +def square_tiler_tile_chunking_col_major_chunks(): + tiler = TensorTiler2D(32, 32, 8, 8) + access_order = tiler.access_order() + reference_access = np.array( + [ + [ + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 64, + 65, + 66, + 67, + 68, + 69, + 70, + 71, + 128, + 129, + 130, + 131, + 132, + 133, + 134, + 135, + 192, + 193, + 194, + 195, + 196, + 197, + 198, + 199, + ], + [ + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 72, + 73, + 74, + 75, + 76, + 77, + 78, + 79, + 136, + 137, + 138, + 139, + 140, + 141, + 142, + 143, + 200, + 201, + 202, + 203, + 204, + 205, + 206, + 207, + ], + [ + 16, + 17, + 18, + 19, + 20, + 21, + 22, + 23, + 80, + 81, + 82, + 83, + 84, + 85, + 86, + 87, + 144, + 145, + 146, + 147, + 148, + 149, + 150, + 151, + 208, + 209, + 210, + 211, + 212, + 213, + 214, + 215, + ], + [ + 24, + 25, + 26, + 27, + 28, + 29, + 30, + 31, + 88, + 89, + 90, + 91, + 92, + 93, + 94, + 95, + 152, + 153, + 154, + 155, + 156, + 157, + 158, + 159, + 216, + 217, + 218, + 219, + 220, + 221, + 222, + 223, + ], + [ + 32, + 33, + 34, + 35, + 36, + 37, + 38, + 39, + 96, + 97, + 98, + 99, + 100, + 101, + 102, + 103, + 160, + 161, + 162, + 163, + 164, + 165, + 166, + 167, + 224, + 225, + 226, + 227, + 228, + 229, + 230, + 231, + ], + [ + 40, + 41, + 42, + 43, + 44, + 45, + 46, + 47, + 104, + 105, + 106, + 107, + 108, + 109, + 110, + 111, + 168, + 169, + 170, + 171, + 172, + 173, + 174, + 175, + 232, + 233, + 234, + 235, + 236, + 237, + 238, + 239, + ], + [ + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 112, + 113, + 114, + 115, + 116, + 117, + 118, + 119, + 176, + 177, + 178, + 179, + 180, + 181, + 182, + 183, + 240, + 241, + 242, + 243, + 244, + 245, + 246, + 247, + ], + [ + 56, + 57, + 58, + 59, + 60, + 61, + 62, + 63, + 120, + 121, + 122, + 123, + 124, + 125, + 126, + 127, + 184, + 185, + 186, + 187, + 188, + 189, + 190, + 191, + 248, + 249, + 250, + 251, + 252, + 253, + 254, + 255, + ], + [ + 256, + 257, + 258, + 259, + 260, + 261, + 262, + 263, + 320, + 321, + 322, + 323, + 324, + 325, + 326, + 327, + 384, + 385, + 386, + 387, + 388, + 389, + 390, + 391, + 448, + 449, + 450, + 451, + 452, + 453, + 454, + 455, + ], + [ + 264, + 265, + 266, + 267, + 268, + 269, + 270, + 271, + 328, + 329, + 330, + 331, + 332, + 333, + 334, + 335, + 392, + 393, + 394, + 395, + 396, + 397, + 398, + 399, + 456, + 457, + 458, + 459, + 460, + 461, + 462, + 463, + ], + [ + 272, + 273, + 274, + 275, + 276, + 277, + 278, + 279, + 336, + 337, + 338, + 339, + 340, + 341, + 342, + 343, + 400, + 401, + 402, + 403, + 404, + 405, + 406, + 407, + 464, + 465, + 466, + 467, + 468, + 469, + 470, + 471, + ], + [ + 280, + 281, + 282, + 283, + 284, + 285, + 286, + 287, + 344, + 345, + 346, + 347, + 348, + 349, + 350, + 351, + 408, + 409, + 410, + 411, + 412, + 413, + 414, + 415, + 472, + 473, + 474, + 475, + 476, + 477, + 478, + 479, + ], + [ + 288, + 289, + 290, + 291, + 292, + 293, + 294, + 295, + 352, + 353, + 354, + 355, + 356, + 357, + 358, + 359, + 416, + 417, + 418, + 419, + 420, + 421, + 422, + 423, + 480, + 481, + 482, + 483, + 484, + 485, + 486, + 487, + ], + [ + 296, + 297, + 298, + 299, + 300, + 301, + 302, + 303, + 360, + 361, + 362, + 363, + 364, + 365, + 366, + 367, + 424, + 425, + 426, + 427, + 428, + 429, + 430, + 431, + 488, + 489, + 490, + 491, + 492, + 493, + 494, + 495, + ], + [ + 304, + 305, + 306, + 307, + 308, + 309, + 310, + 311, + 368, + 369, + 370, + 371, + 372, + 373, + 374, + 375, + 432, + 433, + 434, + 435, + 436, + 437, + 438, + 439, + 496, + 497, + 498, + 499, + 500, + 501, + 502, + 503, + ], + [ + 312, + 313, + 314, + 315, + 316, + 317, + 318, + 319, + 376, + 377, + 378, + 379, + 380, + 381, + 382, + 383, + 440, + 441, + 442, + 443, + 444, + 445, + 446, + 447, + 504, + 505, + 506, + 507, + 508, + 509, + 510, + 511, + ], + [ + 512, + 513, + 514, + 515, + 516, + 517, + 518, + 519, + 576, + 577, + 578, + 579, + 580, + 581, + 582, + 583, + 640, + 641, + 642, + 643, + 644, + 645, + 646, + 647, + 704, + 705, + 706, + 707, + 708, + 709, + 710, + 711, + ], + [ + 520, + 521, + 522, + 523, + 524, + 525, + 526, + 527, + 584, + 585, + 586, + 587, + 588, + 589, + 590, + 591, + 648, + 649, + 650, + 651, + 652, + 653, + 654, + 655, + 712, + 713, + 714, + 715, + 716, + 717, + 718, + 719, + ], + [ + 528, + 529, + 530, + 531, + 532, + 533, + 534, + 535, + 592, + 593, + 594, + 595, + 596, + 597, + 598, + 599, + 656, + 657, + 658, + 659, + 660, + 661, + 662, + 663, + 720, + 721, + 722, + 723, + 724, + 725, + 726, + 727, + ], + [ + 536, + 537, + 538, + 539, + 540, + 541, + 542, + 543, + 600, + 601, + 602, + 603, + 604, + 605, + 606, + 607, + 664, + 665, + 666, + 667, + 668, + 669, + 670, + 671, + 728, + 729, + 730, + 731, + 732, + 733, + 734, + 735, + ], + [ + 544, + 545, + 546, + 547, + 548, + 549, + 550, + 551, + 608, + 609, + 610, + 611, + 612, + 613, + 614, + 615, + 672, + 673, + 674, + 675, + 676, + 677, + 678, + 679, + 736, + 737, + 738, + 739, + 740, + 741, + 742, + 743, + ], + [ + 552, + 553, + 554, + 555, + 556, + 557, + 558, + 559, + 616, + 617, + 618, + 619, + 620, + 621, + 622, + 623, + 680, + 681, + 682, + 683, + 684, + 685, + 686, + 687, + 744, + 745, + 746, + 747, + 748, + 749, + 750, + 751, + ], + [ + 560, + 561, + 562, + 563, + 564, + 565, + 566, + 567, + 624, + 625, + 626, + 627, + 628, + 629, + 630, + 631, + 688, + 689, + 690, + 691, + 692, + 693, + 694, + 695, + 752, + 753, + 754, + 755, + 756, + 757, + 758, + 759, + ], + [ + 568, + 569, + 570, + 571, + 572, + 573, + 574, + 575, + 632, + 633, + 634, + 635, + 636, + 637, + 638, + 639, + 696, + 697, + 698, + 699, + 700, + 701, + 702, + 703, + 760, + 761, + 762, + 763, + 764, + 765, + 766, + 767, + ], + [ + 768, + 769, + 770, + 771, + 772, + 773, + 774, + 775, + 832, + 833, + 834, + 835, + 836, + 837, + 838, + 839, + 896, + 897, + 898, + 899, + 900, + 901, + 902, + 903, + 960, + 961, + 962, + 963, + 964, + 965, + 966, + 967, + ], + [ + 776, + 777, + 778, + 779, + 780, + 781, + 782, + 783, + 840, + 841, + 842, + 843, + 844, + 845, + 846, + 847, + 904, + 905, + 906, + 907, + 908, + 909, + 910, + 911, + 968, + 969, + 970, + 971, + 972, + 973, + 974, + 975, + ], + [ + 784, + 785, + 786, + 787, + 788, + 789, + 790, + 791, + 848, + 849, + 850, + 851, + 852, + 853, + 854, + 855, + 912, + 913, + 914, + 915, + 916, + 917, + 918, + 919, + 976, + 977, + 978, + 979, + 980, + 981, + 982, + 983, + ], + [ + 792, + 793, + 794, + 795, + 796, + 797, + 798, + 799, + 856, + 857, + 858, + 859, + 860, + 861, + 862, + 863, + 920, + 921, + 922, + 923, + 924, + 925, + 926, + 927, + 984, + 985, + 986, + 987, + 988, + 989, + 990, + 991, + ], + [ + 800, + 801, + 802, + 803, + 804, + 805, + 806, + 807, + 864, + 865, + 866, + 867, + 868, + 869, + 870, + 871, + 928, + 929, + 930, + 931, + 932, + 933, + 934, + 935, + 992, + 993, + 994, + 995, + 996, + 997, + 998, + 999, + ], + [ + 808, + 809, + 810, + 811, + 812, + 813, + 814, + 815, + 872, + 873, + 874, + 875, + 876, + 877, + 878, + 879, + 936, + 937, + 938, + 939, + 940, + 941, + 942, + 943, + 1000, + 1001, + 1002, + 1003, + 1004, + 1005, + 1006, + 1007, + ], + [ + 816, + 817, + 818, + 819, + 820, + 821, + 822, + 823, + 880, + 881, + 882, + 883, + 884, + 885, + 886, + 887, + 944, + 945, + 946, + 947, + 948, + 949, + 950, + 951, + 1008, + 1009, + 1010, + 1011, + 1012, + 1013, + 1014, + 1015, + ], + [ + 824, + 825, + 826, + 827, + 828, + 829, + 830, + 831, + 888, + 889, + 890, + 891, + 892, + 893, + 894, + 895, + 952, + 953, + 954, + 955, + 956, + 957, + 958, + 959, + 1016, + 1017, + 1018, + 1019, + 1020, + 1021, + 1022, + 1023, + ], + ], + dtype=TensorTiler2D.DTYPE, + ) + assert (reference_access == access_order).all() + + tile1_reference_order = np.array( + [ + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 64, + 65, + 66, + 67, + 68, + 69, + 70, + 71, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 72, + 73, + 74, + 75, + 76, + 77, + 78, + 79, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + 16, + 17, + 18, + 19, + 20, + 21, + 22, + 23, + 80, + 81, + 82, + 83, + 84, + 85, + 86, + 87, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + 24, + 25, + 26, + 27, + 28, + 29, + 30, + 31, + 88, + 89, + 90, + 91, + 92, + 93, + 94, + 95, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + 32, + 33, + 34, + 35, + 36, + 37, + 38, + 39, + 96, + 97, + 98, + 99, + 100, + 101, + 102, + 103, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + 40, + 41, + 42, + 43, + 44, + 45, + 46, + 47, + 104, + 105, + 106, + 107, + 108, + 109, + 110, + 111, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 112, + 113, + 114, + 115, + 116, + 117, + 118, + 119, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + 56, + 57, + 58, + 59, + 60, + 61, + 62, + 63, + 120, + 121, + 122, + 123, + 124, + 125, + 126, + 127, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + 128, + 129, + 130, + 131, + 132, + 133, + 134, + 135, + 192, + 193, + 194, + 195, + 196, + 197, + 198, + 199, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + 136, + 137, + 138, + 139, + 140, + 141, + 142, + 143, + 200, + 201, + 202, + 203, + 204, + 205, + 206, + 207, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + 144, + 145, + 146, + 147, + 148, + 149, + 150, + 151, + 208, + 209, + 210, + 211, + 212, + 213, + 214, + 215, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + 152, + 153, + 154, + 155, + 156, + 157, + 158, + 159, + 216, + 217, + 218, + 219, + 220, + 221, + 222, + 223, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + 160, + 161, + 162, + 163, + 164, + 165, + 166, + 167, + 224, + 225, + 226, + 227, + 228, + 229, + 230, + 231, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + 168, + 169, + 170, + 171, + 172, + 173, + 174, + 175, + 232, + 233, + 234, + 235, + 236, + 237, + 238, + 239, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + 176, + 177, + 178, + 179, + 180, + 181, + 182, + 183, + 240, + 241, + 242, + 243, + 244, + 245, + 246, + 247, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + [ + 184, + 185, + 186, + 187, + 188, + 189, + 190, + 191, + 248, + 249, + 250, + 251, + 252, + 253, + 254, + 255, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + ], + ], + dtype=TensorTiler2D.DTYPE, + ) + + tile_count = 0 + for t in tiler.tile_iter(2, 2, col_major=True): + if tile_count == 1: + tile_access_order = t.access_order() + assert (tile_access_order == tile1_reference_order).all() + tile_count += 1 + assert tile_count == (32 // (8 * 2)) * (32 // (8 * 2)) + + # CHECK: Pass! + print("Pass!") From babf9e7f0c7e61e104186737897d41e081375134 Mon Sep 17 00:00:00 2001 From: Erika Hunhoff Date: Tue, 22 Oct 2024 14:52:00 -0600 Subject: [PATCH 11/35] Add a few more tests, remove template --- .../python/tensortiler2d/rectangular_tiler.py | 68 +++++++++++++++++++ .../tensortiler2d/rectangular_tiler2.py | 60 ++++++++++++++++ test/python/tensortiler2d/template.py | 34 ---------- 3 files changed, 128 insertions(+), 34 deletions(-) create mode 100644 test/python/tensortiler2d/rectangular_tiler.py create mode 100644 test/python/tensortiler2d/rectangular_tiler2.py delete mode 100644 test/python/tensortiler2d/template.py diff --git a/test/python/tensortiler2d/rectangular_tiler.py b/test/python/tensortiler2d/rectangular_tiler.py new file mode 100644 index 0000000000..07f6384d10 --- /dev/null +++ b/test/python/tensortiler2d/rectangular_tiler.py @@ -0,0 +1,68 @@ +import numpy as np + +from aie.helpers.tensortiler.tensortiler2D import TensorTiler2D +from util import construct_test + +# RUN: %python %s | FileCheck %s + + +# CHECK-LABEL: rectangular_tiler +@construct_test +def rectangular_tiler(): + tiler = TensorTiler2D(16, 8, 4, 4) + access_order = tiler.access_order() + reference_access = np.array( + [ + [0, 1, 2, 3, 16, 17, 18, 19], + [4, 5, 6, 7, 20, 21, 22, 23], + [8, 9, 10, 11, 24, 25, 26, 27], + [12, 13, 14, 15, 28, 29, 30, 31], + [32, 33, 34, 35, 48, 49, 50, 51], + [36, 37, 38, 39, 52, 53, 54, 55], + [40, 41, 42, 43, 56, 57, 58, 59], + [44, 45, 46, 47, 60, 61, 62, 63], + [64, 65, 66, 67, 80, 81, 82, 83], + [68, 69, 70, 71, 84, 85, 86, 87], + [72, 73, 74, 75, 88, 89, 90, 91], + [76, 77, 78, 79, 92, 93, 94, 95], + [96, 97, 98, 99, 112, 113, 114, 115], + [100, 101, 102, 103, 116, 117, 118, 119], + [104, 105, 106, 107, 120, 121, 122, 123], + [108, 109, 110, 111, 124, 125, 126, 127], + ], + dtype=TensorTiler2D.DTYPE, + ) + assert (reference_access == access_order).all() + + tile1_reference_order = np.array( + [ + [-1, -1, -1, -1, -1, -1, -1, -1], + [-1, -1, -1, -1, -1, -1, -1, -1], + [-1, -1, -1, -1, -1, -1, -1, -1], + [-1, -1, -1, -1, -1, -1, -1, -1], + [-1, -1, -1, -1, -1, -1, -1, -1], + [-1, -1, -1, -1, -1, -1, -1, -1], + [-1, -1, -1, -1, -1, -1, -1, -1], + [-1, -1, -1, -1, -1, -1, -1, -1], + [-1, -1, -1, -1, -1, -1, -1, -1], + [-1, -1, -1, -1, -1, -1, -1, -1], + [-1, -1, -1, -1, -1, -1, -1, -1], + [-1, -1, -1, -1, -1, -1, -1, -1], + [0, 1, 2, 3, -1, -1, -1, -1], + [4, 5, 6, 7, -1, -1, -1, -1], + [8, 9, 10, 11, -1, -1, -1, -1], + [12, 13, 14, 15, -1, -1, -1, -1], + ], + dtype=TensorTiler2D.DTYPE, + ) + + tile_count = 0 + for t in tiler.tile_iter(): + if tile_count == 6: + tile_access_order = t.access_order() + assert (tile_access_order == tile1_reference_order).all() + tile_count += 1 + assert tile_count == (16 // 4) * (8 // 4) + + # CHECK: Pass! + print("Pass!") diff --git a/test/python/tensortiler2d/rectangular_tiler2.py b/test/python/tensortiler2d/rectangular_tiler2.py new file mode 100644 index 0000000000..20dd1aa5b3 --- /dev/null +++ b/test/python/tensortiler2d/rectangular_tiler2.py @@ -0,0 +1,60 @@ +import numpy as np + +from aie.helpers.tensortiler.tensortiler2D import TensorTiler2D +from util import construct_test + +# RUN: %python %s | FileCheck %s + + +# CHECK-LABEL: rectangular_tiler2 +@construct_test +def rectangular_tiler2(): + tiler = TensorTiler2D(12, 8, 3, 2) + access_order = tiler.access_order() + reference_access = np.array( + [ + [0, 1, 6, 7, 12, 13, 18, 19], + [2, 3, 8, 9, 14, 15, 20, 21], + [4, 5, 10, 11, 16, 17, 22, 23], + [24, 25, 30, 31, 36, 37, 42, 43], + [26, 27, 32, 33, 38, 39, 44, 45], + [28, 29, 34, 35, 40, 41, 46, 47], + [48, 49, 54, 55, 60, 61, 66, 67], + [50, 51, 56, 57, 62, 63, 68, 69], + [52, 53, 58, 59, 64, 65, 70, 71], + [72, 73, 78, 79, 84, 85, 90, 91], + [74, 75, 80, 81, 86, 87, 92, 93], + [76, 77, 82, 83, 88, 89, 94, 95], + ], + dtype=TensorTiler2D.DTYPE, + ) + assert (reference_access == access_order).all() + + tile1_reference_order = np.array( + [ + [-1, -1, -1, -1, -1, -1, -1, -1], + [-1, -1, -1, -1, -1, -1, -1, -1], + [-1, -1, -1, -1, -1, -1, -1, -1], + [-1, -1, -1, -1, -1, -1, -1, -1], + [-1, -1, -1, -1, -1, -1, -1, -1], + [-1, -1, -1, -1, -1, -1, -1, -1], + [-1, -1, -1, -1, -1, -1, -1, -1], + [-1, -1, -1, -1, -1, -1, -1, -1], + [-1, -1, -1, -1, -1, -1, -1, -1], + [0, 1, -1, -1, -1, -1, -1, -1], + [2, 3, -1, -1, -1, -1, -1, -1], + [4, 5, -1, -1, -1, -1, -1, -1], + ], + dtype=TensorTiler2D.DTYPE, + ) + + tile_count = 0 + for t in tiler.tile_iter(): + if tile_count == 12: + tile_access_order = t.access_order() + assert (tile_access_order == tile1_reference_order).all() + tile_count += 1 + assert tile_count == (12 // 3) * (8 // 2) + + # CHECK: Pass! + print("Pass!") diff --git a/test/python/tensortiler2d/template.py b/test/python/tensortiler2d/template.py deleted file mode 100644 index 76885ef5d8..0000000000 --- a/test/python/tensortiler2d/template.py +++ /dev/null @@ -1,34 +0,0 @@ -import numpy as np - -from aie.helpers.tensortiler.tensortiler2D import TensorTiler2D -from util import construct_test - -# RUN: %python %s | FileCheck %s - - -# CHECK-LABEL: square_tiler -@construct_test -def square_tiler(): - tiler = TensorTiler2D(32, 32, 4, 4) - access_order = tiler.access_order() - reference_access = np.array( - [0], # TODOD: fill this in - dtype=TensorTiler2D.DTYPE, - ) - assert (reference_access == access_order).all() - - tile1_reference_order = np.array( - [0], # TODO: fill this in - dtype=TensorTiler2D.DTYPE, - ) - - tile_count = 0 - for t in tiler.tile_iter(): - if tile_count == 1: - tile_access_order = t.access_order() - assert (tile_access_order == tile1_reference_order).all() - tile_count += 1 - assert tile_count == 64 - - # CHECK: Pass! - print("Pass!") From 46a487c6af0be38d415c70a4c746b1060ea5a0b8 Mon Sep 17 00:00:00 2001 From: Erika Hunhoff Date: Tue, 22 Oct 2024 14:56:01 -0600 Subject: [PATCH 12/35] Add one more test --- .../rectangular_tiler_col_major_tensor.py | 52 +++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 test/python/tensortiler2d/rectangular_tiler_col_major_tensor.py diff --git a/test/python/tensortiler2d/rectangular_tiler_col_major_tensor.py b/test/python/tensortiler2d/rectangular_tiler_col_major_tensor.py new file mode 100644 index 0000000000..c7b8b22f3c --- /dev/null +++ b/test/python/tensortiler2d/rectangular_tiler_col_major_tensor.py @@ -0,0 +1,52 @@ +import numpy as np + +from aie.helpers.tensortiler.tensortiler2D import TensorTiler2D +from util import construct_test + +# RUN: %python %s | FileCheck %s + + +# CHECK-LABEL: rectangular_tiler_col_major_tensor +@construct_test +def rectangular_tiler_col_major_tensor(): + tiler = TensorTiler2D(8, 16, 4, 2, tensor_col_major=True) + access_order = tiler.access_order() + reference_access = np.array( + [ + [0, 1, 16, 17, 32, 33, 48, 49, 64, 65, 80, 81, 96, 97, 112, 113], + [2, 3, 18, 19, 34, 35, 50, 51, 66, 67, 82, 83, 98, 99, 114, 115], + [4, 5, 20, 21, 36, 37, 52, 53, 68, 69, 84, 85, 100, 101, 116, 117], + [6, 7, 22, 23, 38, 39, 54, 55, 70, 71, 86, 87, 102, 103, 118, 119], + [8, 9, 24, 25, 40, 41, 56, 57, 72, 73, 88, 89, 104, 105, 120, 121], + [10, 11, 26, 27, 42, 43, 58, 59, 74, 75, 90, 91, 106, 107, 122, 123], + [12, 13, 28, 29, 44, 45, 60, 61, 76, 77, 92, 93, 108, 109, 124, 125], + [14, 15, 30, 31, 46, 47, 62, 63, 78, 79, 94, 95, 110, 111, 126, 127], + ], + dtype=TensorTiler2D.DTYPE, + ) + assert (reference_access == access_order).all() + + tile1_reference_order = np.array( + [ + [-1, -1, -1, -1, 0, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], + [-1, -1, -1, -1, 2, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], + [-1, -1, -1, -1, 4, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], + [-1, -1, -1, -1, 6, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], + [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], + [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], + [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], + [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], + ], + dtype=TensorTiler2D.DTYPE, + ) + + tile_count = 0 + for t in tiler.tile_iter(): + if tile_count == 2: + tile_access_order = t.access_order() + assert (tile_access_order == tile1_reference_order).all() + tile_count += 1 + assert tile_count == (8 // 4) * (16 // 2) + + # CHECK: Pass! + print("Pass!") From 1071ee0235d295d493c2b52f2eb78d76d880cd1e Mon Sep 17 00:00:00 2001 From: Erika Hunhoff Date: Tue, 22 Oct 2024 16:37:08 -0600 Subject: [PATCH 13/35] make tensortile test formatting a bit more sane --- .../python/tensortiler2d/rectangular_tiler.py | 36 +- .../tensortiler2d/rectangular_tiler2.py | 16 +- .../rectangular_tiler_col_major_tensor.py | 28 +- test/python/tensortiler2d/square_tiler.py | 2244 +---------------- test/python/tensortiler2d/square_tiler2.py | 2244 +---------------- .../square_tiler_col_major_tensor.py | 2244 +---------------- ...col_major_tensor_and_tile_tile_chunking.py | 2244 +---------------- ...e_chunking_rectangular_col_major_chunks.py | 161 +- .../square_tiler_col_major_tile.py | 2244 +---------------- .../square_tiler_col_major_tile_and_tensor.py | 2244 +---------------- .../square_tiler_tile_chunking.py | 2244 +---------------- ...re_tiler_tile_chunking_col_major_chunks.py | 2244 +---------------- test/python/tensortiler2d/util.py | 12 + 13 files changed, 625 insertions(+), 17580 deletions(-) diff --git a/test/python/tensortiler2d/rectangular_tiler.py b/test/python/tensortiler2d/rectangular_tiler.py index 07f6384d10..22875d38fd 100644 --- a/test/python/tensortiler2d/rectangular_tiler.py +++ b/test/python/tensortiler2d/rectangular_tiler.py @@ -12,29 +12,32 @@ def rectangular_tiler(): tiler = TensorTiler2D(16, 8, 4, 4) access_order = tiler.access_order() reference_access = np.array( + #fmt: off [ - [0, 1, 2, 3, 16, 17, 18, 19], - [4, 5, 6, 7, 20, 21, 22, 23], - [8, 9, 10, 11, 24, 25, 26, 27], - [12, 13, 14, 15, 28, 29, 30, 31], - [32, 33, 34, 35, 48, 49, 50, 51], - [36, 37, 38, 39, 52, 53, 54, 55], - [40, 41, 42, 43, 56, 57, 58, 59], - [44, 45, 46, 47, 60, 61, 62, 63], - [64, 65, 66, 67, 80, 81, 82, 83], - [68, 69, 70, 71, 84, 85, 86, 87], - [72, 73, 74, 75, 88, 89, 90, 91], - [76, 77, 78, 79, 92, 93, 94, 95], - [96, 97, 98, 99, 112, 113, 114, 115], + [ 0, 1, 2, 3, 16, 17, 18, 19], + [ 4, 5, 6, 7, 20, 21, 22, 23], + [ 8, 9, 10, 11, 24, 25, 26, 27], + [ 12, 13, 14, 15, 28, 29, 30, 31], + [ 32, 33, 34, 35, 48, 49, 50, 51], + [ 36, 37, 38, 39, 52, 53, 54, 55], + [ 40, 41, 42, 43, 56, 57, 58, 59], + [ 44, 45, 46, 47, 60, 61, 62, 63], + [ 64, 65, 66, 67, 80, 81, 82, 83], + [ 68, 69, 70, 71, 84, 85, 86, 87], + [ 72, 73, 74, 75, 88, 89, 90, 91], + [ 76, 77, 78, 79, 92, 93, 94, 95], + [ 96, 97, 98, 99, 112, 113, 114, 115], [100, 101, 102, 103, 116, 117, 118, 119], [104, 105, 106, 107, 120, 121, 122, 123], [108, 109, 110, 111, 124, 125, 126, 127], ], + #fmt: on dtype=TensorTiler2D.DTYPE, ) assert (reference_access == access_order).all() tile1_reference_order = np.array( + #fmt: off [ [-1, -1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1, -1], @@ -48,11 +51,12 @@ def rectangular_tiler(): [-1, -1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1, -1], - [0, 1, 2, 3, -1, -1, -1, -1], - [4, 5, 6, 7, -1, -1, -1, -1], - [8, 9, 10, 11, -1, -1, -1, -1], + [ 0, 1, 2, 3, -1, -1, -1, -1], + [ 4, 5, 6, 7, -1, -1, -1, -1], + [ 8, 9, 10, 11, -1, -1, -1, -1], [12, 13, 14, 15, -1, -1, -1, -1], ], + #fmt: on dtype=TensorTiler2D.DTYPE, ) diff --git a/test/python/tensortiler2d/rectangular_tiler2.py b/test/python/tensortiler2d/rectangular_tiler2.py index 20dd1aa5b3..92aa1fad13 100644 --- a/test/python/tensortiler2d/rectangular_tiler2.py +++ b/test/python/tensortiler2d/rectangular_tiler2.py @@ -12,10 +12,11 @@ def rectangular_tiler2(): tiler = TensorTiler2D(12, 8, 3, 2) access_order = tiler.access_order() reference_access = np.array( + #fmt: off [ - [0, 1, 6, 7, 12, 13, 18, 19], - [2, 3, 8, 9, 14, 15, 20, 21], - [4, 5, 10, 11, 16, 17, 22, 23], + [ 0, 1, 6, 7, 12, 13, 18, 19], + [ 2, 3, 8, 9, 14, 15, 20, 21], + [ 4, 5, 10, 11, 16, 17, 22, 23], [24, 25, 30, 31, 36, 37, 42, 43], [26, 27, 32, 33, 38, 39, 44, 45], [28, 29, 34, 35, 40, 41, 46, 47], @@ -26,11 +27,13 @@ def rectangular_tiler2(): [74, 75, 80, 81, 86, 87, 92, 93], [76, 77, 82, 83, 88, 89, 94, 95], ], + #fmt: on dtype=TensorTiler2D.DTYPE, ) assert (reference_access == access_order).all() tile1_reference_order = np.array( + #fmt: off [ [-1, -1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1, -1], @@ -41,10 +44,11 @@ def rectangular_tiler2(): [-1, -1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1, -1], - [0, 1, -1, -1, -1, -1, -1, -1], - [2, 3, -1, -1, -1, -1, -1, -1], - [4, 5, -1, -1, -1, -1, -1, -1], + [ 0, 1, -1, -1, -1, -1, -1, -1], + [ 2, 3, -1, -1, -1, -1, -1, -1], + [ 4, 5, -1, -1, -1, -1, -1, -1], ], + #fmt: on dtype=TensorTiler2D.DTYPE, ) diff --git a/test/python/tensortiler2d/rectangular_tiler_col_major_tensor.py b/test/python/tensortiler2d/rectangular_tiler_col_major_tensor.py index c7b8b22f3c..aa6e0c0f15 100644 --- a/test/python/tensortiler2d/rectangular_tiler_col_major_tensor.py +++ b/test/python/tensortiler2d/rectangular_tiler_col_major_tensor.py @@ -12,31 +12,35 @@ def rectangular_tiler_col_major_tensor(): tiler = TensorTiler2D(8, 16, 4, 2, tensor_col_major=True) access_order = tiler.access_order() reference_access = np.array( + #fmt: off [ - [0, 1, 16, 17, 32, 33, 48, 49, 64, 65, 80, 81, 96, 97, 112, 113], - [2, 3, 18, 19, 34, 35, 50, 51, 66, 67, 82, 83, 98, 99, 114, 115], - [4, 5, 20, 21, 36, 37, 52, 53, 68, 69, 84, 85, 100, 101, 116, 117], - [6, 7, 22, 23, 38, 39, 54, 55, 70, 71, 86, 87, 102, 103, 118, 119], - [8, 9, 24, 25, 40, 41, 56, 57, 72, 73, 88, 89, 104, 105, 120, 121], - [10, 11, 26, 27, 42, 43, 58, 59, 74, 75, 90, 91, 106, 107, 122, 123], - [12, 13, 28, 29, 44, 45, 60, 61, 76, 77, 92, 93, 108, 109, 124, 125], - [14, 15, 30, 31, 46, 47, 62, 63, 78, 79, 94, 95, 110, 111, 126, 127], + [ 0, 1, 16, 17, 32, 33, 48, 49, 64, 65, 80, 81, 96, 97, 112, 113], + [ 2, 3, 18, 19, 34, 35, 50, 51, 66, 67, 82, 83, 98, 99, 114, 115], + [ 4, 5, 20, 21, 36, 37, 52, 53, 68, 69, 84, 85, 100, 101, 116, 117], + [ 6, 7, 22, 23, 38, 39, 54, 55, 70, 71, 86, 87, 102, 103, 118, 119], + [ 8, 9, 24, 25, 40, 41, 56, 57, 72, 73, 88, 89, 104, 105, 120, 121], + [ 10, 11, 26, 27, 42, 43, 58, 59, 74, 75, 90, 91, 106, 107, 122, 123], + [ 12, 13, 28, 29, 44, 45, 60, 61, 76, 77, 92, 93, 108, 109, 124, 125], + [ 14, 15, 30, 31, 46, 47, 62, 63, 78, 79, 94, 95, 110, 111, 126, 127], ], + #fmt: on dtype=TensorTiler2D.DTYPE, ) assert (reference_access == access_order).all() tile1_reference_order = np.array( + #fmt: off [ - [-1, -1, -1, -1, 0, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], - [-1, -1, -1, -1, 2, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], - [-1, -1, -1, -1, 4, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], - [-1, -1, -1, -1, 6, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], + [-1, -1, -1, -1, 0, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], + [-1, -1, -1, -1, 2, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], + [-1, -1, -1, -1, 4, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], + [-1, -1, -1, -1, 6, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], ], + #fmt: on dtype=TensorTiler2D.DTYPE, ) diff --git a/test/python/tensortiler2d/square_tiler.py b/test/python/tensortiler2d/square_tiler.py index dd9b8ee141..099caa1527 100644 --- a/test/python/tensortiler2d/square_tiler.py +++ b/test/python/tensortiler2d/square_tiler.py @@ -12,2191 +12,83 @@ def square_tiler(): tiler = TensorTiler2D(32, 32, 4, 4) access_order = tiler.access_order() reference_access = np.array( + #fmt: off [ - [ - 0, - 1, - 2, - 3, - 16, - 17, - 18, - 19, - 32, - 33, - 34, - 35, - 48, - 49, - 50, - 51, - 64, - 65, - 66, - 67, - 80, - 81, - 82, - 83, - 96, - 97, - 98, - 99, - 112, - 113, - 114, - 115, - ], - [ - 4, - 5, - 6, - 7, - 20, - 21, - 22, - 23, - 36, - 37, - 38, - 39, - 52, - 53, - 54, - 55, - 68, - 69, - 70, - 71, - 84, - 85, - 86, - 87, - 100, - 101, - 102, - 103, - 116, - 117, - 118, - 119, - ], - [ - 8, - 9, - 10, - 11, - 24, - 25, - 26, - 27, - 40, - 41, - 42, - 43, - 56, - 57, - 58, - 59, - 72, - 73, - 74, - 75, - 88, - 89, - 90, - 91, - 104, - 105, - 106, - 107, - 120, - 121, - 122, - 123, - ], - [ - 12, - 13, - 14, - 15, - 28, - 29, - 30, - 31, - 44, - 45, - 46, - 47, - 60, - 61, - 62, - 63, - 76, - 77, - 78, - 79, - 92, - 93, - 94, - 95, - 108, - 109, - 110, - 111, - 124, - 125, - 126, - 127, - ], - [ - 128, - 129, - 130, - 131, - 144, - 145, - 146, - 147, - 160, - 161, - 162, - 163, - 176, - 177, - 178, - 179, - 192, - 193, - 194, - 195, - 208, - 209, - 210, - 211, - 224, - 225, - 226, - 227, - 240, - 241, - 242, - 243, - ], - [ - 132, - 133, - 134, - 135, - 148, - 149, - 150, - 151, - 164, - 165, - 166, - 167, - 180, - 181, - 182, - 183, - 196, - 197, - 198, - 199, - 212, - 213, - 214, - 215, - 228, - 229, - 230, - 231, - 244, - 245, - 246, - 247, - ], - [ - 136, - 137, - 138, - 139, - 152, - 153, - 154, - 155, - 168, - 169, - 170, - 171, - 184, - 185, - 186, - 187, - 200, - 201, - 202, - 203, - 216, - 217, - 218, - 219, - 232, - 233, - 234, - 235, - 248, - 249, - 250, - 251, - ], - [ - 140, - 141, - 142, - 143, - 156, - 157, - 158, - 159, - 172, - 173, - 174, - 175, - 188, - 189, - 190, - 191, - 204, - 205, - 206, - 207, - 220, - 221, - 222, - 223, - 236, - 237, - 238, - 239, - 252, - 253, - 254, - 255, - ], - [ - 256, - 257, - 258, - 259, - 272, - 273, - 274, - 275, - 288, - 289, - 290, - 291, - 304, - 305, - 306, - 307, - 320, - 321, - 322, - 323, - 336, - 337, - 338, - 339, - 352, - 353, - 354, - 355, - 368, - 369, - 370, - 371, - ], - [ - 260, - 261, - 262, - 263, - 276, - 277, - 278, - 279, - 292, - 293, - 294, - 295, - 308, - 309, - 310, - 311, - 324, - 325, - 326, - 327, - 340, - 341, - 342, - 343, - 356, - 357, - 358, - 359, - 372, - 373, - 374, - 375, - ], - [ - 264, - 265, - 266, - 267, - 280, - 281, - 282, - 283, - 296, - 297, - 298, - 299, - 312, - 313, - 314, - 315, - 328, - 329, - 330, - 331, - 344, - 345, - 346, - 347, - 360, - 361, - 362, - 363, - 376, - 377, - 378, - 379, - ], - [ - 268, - 269, - 270, - 271, - 284, - 285, - 286, - 287, - 300, - 301, - 302, - 303, - 316, - 317, - 318, - 319, - 332, - 333, - 334, - 335, - 348, - 349, - 350, - 351, - 364, - 365, - 366, - 367, - 380, - 381, - 382, - 383, - ], - [ - 384, - 385, - 386, - 387, - 400, - 401, - 402, - 403, - 416, - 417, - 418, - 419, - 432, - 433, - 434, - 435, - 448, - 449, - 450, - 451, - 464, - 465, - 466, - 467, - 480, - 481, - 482, - 483, - 496, - 497, - 498, - 499, - ], - [ - 388, - 389, - 390, - 391, - 404, - 405, - 406, - 407, - 420, - 421, - 422, - 423, - 436, - 437, - 438, - 439, - 452, - 453, - 454, - 455, - 468, - 469, - 470, - 471, - 484, - 485, - 486, - 487, - 500, - 501, - 502, - 503, - ], - [ - 392, - 393, - 394, - 395, - 408, - 409, - 410, - 411, - 424, - 425, - 426, - 427, - 440, - 441, - 442, - 443, - 456, - 457, - 458, - 459, - 472, - 473, - 474, - 475, - 488, - 489, - 490, - 491, - 504, - 505, - 506, - 507, - ], - [ - 396, - 397, - 398, - 399, - 412, - 413, - 414, - 415, - 428, - 429, - 430, - 431, - 444, - 445, - 446, - 447, - 460, - 461, - 462, - 463, - 476, - 477, - 478, - 479, - 492, - 493, - 494, - 495, - 508, - 509, - 510, - 511, - ], - [ - 512, - 513, - 514, - 515, - 528, - 529, - 530, - 531, - 544, - 545, - 546, - 547, - 560, - 561, - 562, - 563, - 576, - 577, - 578, - 579, - 592, - 593, - 594, - 595, - 608, - 609, - 610, - 611, - 624, - 625, - 626, - 627, - ], - [ - 516, - 517, - 518, - 519, - 532, - 533, - 534, - 535, - 548, - 549, - 550, - 551, - 564, - 565, - 566, - 567, - 580, - 581, - 582, - 583, - 596, - 597, - 598, - 599, - 612, - 613, - 614, - 615, - 628, - 629, - 630, - 631, - ], - [ - 520, - 521, - 522, - 523, - 536, - 537, - 538, - 539, - 552, - 553, - 554, - 555, - 568, - 569, - 570, - 571, - 584, - 585, - 586, - 587, - 600, - 601, - 602, - 603, - 616, - 617, - 618, - 619, - 632, - 633, - 634, - 635, - ], - [ - 524, - 525, - 526, - 527, - 540, - 541, - 542, - 543, - 556, - 557, - 558, - 559, - 572, - 573, - 574, - 575, - 588, - 589, - 590, - 591, - 604, - 605, - 606, - 607, - 620, - 621, - 622, - 623, - 636, - 637, - 638, - 639, - ], - [ - 640, - 641, - 642, - 643, - 656, - 657, - 658, - 659, - 672, - 673, - 674, - 675, - 688, - 689, - 690, - 691, - 704, - 705, - 706, - 707, - 720, - 721, - 722, - 723, - 736, - 737, - 738, - 739, - 752, - 753, - 754, - 755, - ], - [ - 644, - 645, - 646, - 647, - 660, - 661, - 662, - 663, - 676, - 677, - 678, - 679, - 692, - 693, - 694, - 695, - 708, - 709, - 710, - 711, - 724, - 725, - 726, - 727, - 740, - 741, - 742, - 743, - 756, - 757, - 758, - 759, - ], - [ - 648, - 649, - 650, - 651, - 664, - 665, - 666, - 667, - 680, - 681, - 682, - 683, - 696, - 697, - 698, - 699, - 712, - 713, - 714, - 715, - 728, - 729, - 730, - 731, - 744, - 745, - 746, - 747, - 760, - 761, - 762, - 763, - ], - [ - 652, - 653, - 654, - 655, - 668, - 669, - 670, - 671, - 684, - 685, - 686, - 687, - 700, - 701, - 702, - 703, - 716, - 717, - 718, - 719, - 732, - 733, - 734, - 735, - 748, - 749, - 750, - 751, - 764, - 765, - 766, - 767, - ], - [ - 768, - 769, - 770, - 771, - 784, - 785, - 786, - 787, - 800, - 801, - 802, - 803, - 816, - 817, - 818, - 819, - 832, - 833, - 834, - 835, - 848, - 849, - 850, - 851, - 864, - 865, - 866, - 867, - 880, - 881, - 882, - 883, - ], - [ - 772, - 773, - 774, - 775, - 788, - 789, - 790, - 791, - 804, - 805, - 806, - 807, - 820, - 821, - 822, - 823, - 836, - 837, - 838, - 839, - 852, - 853, - 854, - 855, - 868, - 869, - 870, - 871, - 884, - 885, - 886, - 887, - ], - [ - 776, - 777, - 778, - 779, - 792, - 793, - 794, - 795, - 808, - 809, - 810, - 811, - 824, - 825, - 826, - 827, - 840, - 841, - 842, - 843, - 856, - 857, - 858, - 859, - 872, - 873, - 874, - 875, - 888, - 889, - 890, - 891, - ], - [ - 780, - 781, - 782, - 783, - 796, - 797, - 798, - 799, - 812, - 813, - 814, - 815, - 828, - 829, - 830, - 831, - 844, - 845, - 846, - 847, - 860, - 861, - 862, - 863, - 876, - 877, - 878, - 879, - 892, - 893, - 894, - 895, - ], - [ - 896, - 897, - 898, - 899, - 912, - 913, - 914, - 915, - 928, - 929, - 930, - 931, - 944, - 945, - 946, - 947, - 960, - 961, - 962, - 963, - 976, - 977, - 978, - 979, - 992, - 993, - 994, - 995, - 1008, - 1009, - 1010, - 1011, - ], - [ - 900, - 901, - 902, - 903, - 916, - 917, - 918, - 919, - 932, - 933, - 934, - 935, - 948, - 949, - 950, - 951, - 964, - 965, - 966, - 967, - 980, - 981, - 982, - 983, - 996, - 997, - 998, - 999, - 1012, - 1013, - 1014, - 1015, - ], - [ - 904, - 905, - 906, - 907, - 920, - 921, - 922, - 923, - 936, - 937, - 938, - 939, - 952, - 953, - 954, - 955, - 968, - 969, - 970, - 971, - 984, - 985, - 986, - 987, - 1000, - 1001, - 1002, - 1003, - 1016, - 1017, - 1018, - 1019, - ], - [ - 908, - 909, - 910, - 911, - 924, - 925, - 926, - 927, - 940, - 941, - 942, - 943, - 956, - 957, - 958, - 959, - 972, - 973, - 974, - 975, - 988, - 989, - 990, - 991, - 1004, - 1005, - 1006, - 1007, - 1020, - 1021, - 1022, - 1023, - ], + [ 0, 1, 2, 3, 16, 17, 18, 19, 32, 33, 34, 35, 48, 49, 50, 51, 64, 65, 66, 67, 80, 81, 82, 83, 96, 97, 98, 99, 112, 113, 114, 115,], + [ 4, 5, 6, 7, 20, 21, 22, 23, 36, 37, 38, 39, 52, 53, 54, 55, 68, 69, 70, 71, 84, 85, 86, 87, 100, 101, 102, 103, 116, 117, 118, 119,], + [ 8, 9, 10, 11, 24, 25, 26, 27, 40, 41, 42, 43, 56, 57, 58, 59, 72, 73, 74, 75, 88, 89, 90, 91, 104, 105, 106, 107, 120, 121, 122, 123,], + [ 12, 13, 14, 15, 28, 29, 30, 31, 44, 45, 46, 47, 60, 61, 62, 63, 76, 77, 78, 79, 92, 93, 94, 95, 108, 109, 110, 111, 124, 125, 126, 127,], + [ 128, 129, 130, 131, 144, 145, 146, 147, 160, 161, 162, 163, 176, 177, 178, 179, 192, 193, 194, 195, 208, 209, 210, 211, 224, 225, 226, 227, 240, 241, 242, 243,], + [ 132, 133, 134, 135, 148, 149, 150, 151, 164, 165, 166, 167, 180, 181, 182, 183, 196, 197, 198, 199, 212, 213, 214, 215, 228, 229, 230, 231, 244, 245, 246, 247,], + [ 136, 137, 138, 139, 152, 153, 154, 155, 168, 169, 170, 171, 184, 185, 186, 187, 200, 201, 202, 203, 216, 217, 218, 219, 232, 233, 234, 235, 248, 249, 250, 251,], + [ 140, 141, 142, 143, 156, 157, 158, 159, 172, 173, 174, 175, 188, 189, 190, 191, 204, 205, 206, 207, 220, 221, 222, 223, 236, 237, 238, 239, 252, 253, 254, 255,], + [ 256, 257, 258, 259, 272, 273, 274, 275, 288, 289, 290, 291, 304, 305, 306, 307, 320, 321, 322, 323, 336, 337, 338, 339, 352, 353, 354, 355, 368, 369, 370, 371,], + [ 260, 261, 262, 263, 276, 277, 278, 279, 292, 293, 294, 295, 308, 309, 310, 311, 324, 325, 326, 327, 340, 341, 342, 343, 356, 357, 358, 359, 372, 373, 374, 375,], + [ 264, 265, 266, 267, 280, 281, 282, 283, 296, 297, 298, 299, 312, 313, 314, 315, 328, 329, 330, 331, 344, 345, 346, 347, 360, 361, 362, 363, 376, 377, 378, 379,], + [ 268, 269, 270, 271, 284, 285, 286, 287, 300, 301, 302, 303, 316, 317, 318, 319, 332, 333, 334, 335, 348, 349, 350, 351, 364, 365, 366, 367, 380, 381, 382, 383,], + [ 384, 385, 386, 387, 400, 401, 402, 403, 416, 417, 418, 419, 432, 433, 434, 435, 448, 449, 450, 451, 464, 465, 466, 467, 480, 481, 482, 483, 496, 497, 498, 499,], + [ 388, 389, 390, 391, 404, 405, 406, 407, 420, 421, 422, 423, 436, 437, 438, 439, 452, 453, 454, 455, 468, 469, 470, 471, 484, 485, 486, 487, 500, 501, 502, 503,], + [ 392, 393, 394, 395, 408, 409, 410, 411, 424, 425, 426, 427, 440, 441, 442, 443, 456, 457, 458, 459, 472, 473, 474, 475, 488, 489, 490, 491, 504, 505, 506, 507,], + [ 396, 397, 398, 399, 412, 413, 414, 415, 428, 429, 430, 431, 444, 445, 446, 447, 460, 461, 462, 463, 476, 477, 478, 479, 492, 493, 494, 495, 508, 509, 510, 511,], + [ 512, 513, 514, 515, 528, 529, 530, 531, 544, 545, 546, 547, 560, 561, 562, 563, 576, 577, 578, 579, 592, 593, 594, 595, 608, 609, 610, 611, 624, 625, 626, 627,], + [ 516, 517, 518, 519, 532, 533, 534, 535, 548, 549, 550, 551, 564, 565, 566, 567, 580, 581, 582, 583, 596, 597, 598, 599, 612, 613, 614, 615, 628, 629, 630, 631,], + [ 520, 521, 522, 523, 536, 537, 538, 539, 552, 553, 554, 555, 568, 569, 570, 571, 584, 585, 586, 587, 600, 601, 602, 603, 616, 617, 618, 619, 632, 633, 634, 635,], + [ 524, 525, 526, 527, 540, 541, 542, 543, 556, 557, 558, 559, 572, 573, 574, 575, 588, 589, 590, 591, 604, 605, 606, 607, 620, 621, 622, 623, 636, 637, 638, 639,], + [ 640, 641, 642, 643, 656, 657, 658, 659, 672, 673, 674, 675, 688, 689, 690, 691, 704, 705, 706, 707, 720, 721, 722, 723, 736, 737, 738, 739, 752, 753, 754, 755,], + [ 644, 645, 646, 647, 660, 661, 662, 663, 676, 677, 678, 679, 692, 693, 694, 695, 708, 709, 710, 711, 724, 725, 726, 727, 740, 741, 742, 743, 756, 757, 758, 759,], + [ 648, 649, 650, 651, 664, 665, 666, 667, 680, 681, 682, 683, 696, 697, 698, 699, 712, 713, 714, 715, 728, 729, 730, 731, 744, 745, 746, 747, 760, 761, 762, 763,], + [ 652, 653, 654, 655, 668, 669, 670, 671, 684, 685, 686, 687, 700, 701, 702, 703, 716, 717, 718, 719, 732, 733, 734, 735, 748, 749, 750, 751, 764, 765, 766, 767,], + [ 768, 769, 770, 771, 784, 785, 786, 787, 800, 801, 802, 803, 816, 817, 818, 819, 832, 833, 834, 835, 848, 849, 850, 851, 864, 865, 866, 867, 880, 881, 882, 883,], + [ 772, 773, 774, 775, 788, 789, 790, 791, 804, 805, 806, 807, 820, 821, 822, 823, 836, 837, 838, 839, 852, 853, 854, 855, 868, 869, 870, 871, 884, 885, 886, 887,], + [ 776, 777, 778, 779, 792, 793, 794, 795, 808, 809, 810, 811, 824, 825, 826, 827, 840, 841, 842, 843, 856, 857, 858, 859, 872, 873, 874, 875, 888, 889, 890, 891,], + [ 780, 781, 782, 783, 796, 797, 798, 799, 812, 813, 814, 815, 828, 829, 830, 831, 844, 845, 846, 847, 860, 861, 862, 863, 876, 877, 878, 879, 892, 893, 894, 895,], + [ 896, 897, 898, 899, 912, 913, 914, 915, 928, 929, 930, 931, 944, 945, 946, 947, 960, 961, 962, 963, 976, 977, 978, 979, 992, 993, 994, 995,1008,1009,1010,1011,], + [ 900, 901, 902, 903, 916, 917, 918, 919, 932, 933, 934, 935, 948, 949, 950, 951, 964, 965, 966, 967, 980, 981, 982, 983, 996, 997, 998, 999,1012,1013,1014,1015,], + [ 904, 905, 906, 907, 920, 921, 922, 923, 936, 937, 938, 939, 952, 953, 954, 955, 968, 969, 970, 971, 984, 985, 986, 987,1000,1001,1002,1003,1016,1017,1018,1019,], + [ 908, 909, 910, 911, 924, 925, 926, 927, 940, 941, 942, 943, 956, 957, 958, 959, 972, 973, 974, 975, 988, 989, 990, 991,1004,1005,1006,1007,1020,1021,1022,1023,], ], + #fmt: on dtype=TensorTiler2D.DTYPE, ) assert (reference_access == access_order).all() tile1_reference_order = np.array( + #fmt: off [ - [ - -1, - -1, - -1, - -1, - 0, - 1, - 2, - 3, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - 4, - 5, - 6, - 7, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - 8, - 9, - 10, - 11, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - 12, - 13, - 14, - 15, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], + [ -1, -1, -1, -1, 0, 1, 2, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, 4, 5, 6, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, 8, 9, 10, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, 12, 13, 14, 15, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], ], + #fmt: on dtype=TensorTiler2D.DTYPE, ) diff --git a/test/python/tensortiler2d/square_tiler2.py b/test/python/tensortiler2d/square_tiler2.py index bbc3e57d79..e6baa3fde7 100644 --- a/test/python/tensortiler2d/square_tiler2.py +++ b/test/python/tensortiler2d/square_tiler2.py @@ -12,2191 +12,83 @@ def square_tiler2(): tiler = TensorTiler2D(32, 32, 8, 8) access_order = tiler.access_order() reference_access = np.array( + #fmt: off [ - [ - 0, - 1, - 2, - 3, - 4, - 5, - 6, - 7, - 64, - 65, - 66, - 67, - 68, - 69, - 70, - 71, - 128, - 129, - 130, - 131, - 132, - 133, - 134, - 135, - 192, - 193, - 194, - 195, - 196, - 197, - 198, - 199, - ], - [ - 8, - 9, - 10, - 11, - 12, - 13, - 14, - 15, - 72, - 73, - 74, - 75, - 76, - 77, - 78, - 79, - 136, - 137, - 138, - 139, - 140, - 141, - 142, - 143, - 200, - 201, - 202, - 203, - 204, - 205, - 206, - 207, - ], - [ - 16, - 17, - 18, - 19, - 20, - 21, - 22, - 23, - 80, - 81, - 82, - 83, - 84, - 85, - 86, - 87, - 144, - 145, - 146, - 147, - 148, - 149, - 150, - 151, - 208, - 209, - 210, - 211, - 212, - 213, - 214, - 215, - ], - [ - 24, - 25, - 26, - 27, - 28, - 29, - 30, - 31, - 88, - 89, - 90, - 91, - 92, - 93, - 94, - 95, - 152, - 153, - 154, - 155, - 156, - 157, - 158, - 159, - 216, - 217, - 218, - 219, - 220, - 221, - 222, - 223, - ], - [ - 32, - 33, - 34, - 35, - 36, - 37, - 38, - 39, - 96, - 97, - 98, - 99, - 100, - 101, - 102, - 103, - 160, - 161, - 162, - 163, - 164, - 165, - 166, - 167, - 224, - 225, - 226, - 227, - 228, - 229, - 230, - 231, - ], - [ - 40, - 41, - 42, - 43, - 44, - 45, - 46, - 47, - 104, - 105, - 106, - 107, - 108, - 109, - 110, - 111, - 168, - 169, - 170, - 171, - 172, - 173, - 174, - 175, - 232, - 233, - 234, - 235, - 236, - 237, - 238, - 239, - ], - [ - 48, - 49, - 50, - 51, - 52, - 53, - 54, - 55, - 112, - 113, - 114, - 115, - 116, - 117, - 118, - 119, - 176, - 177, - 178, - 179, - 180, - 181, - 182, - 183, - 240, - 241, - 242, - 243, - 244, - 245, - 246, - 247, - ], - [ - 56, - 57, - 58, - 59, - 60, - 61, - 62, - 63, - 120, - 121, - 122, - 123, - 124, - 125, - 126, - 127, - 184, - 185, - 186, - 187, - 188, - 189, - 190, - 191, - 248, - 249, - 250, - 251, - 252, - 253, - 254, - 255, - ], - [ - 256, - 257, - 258, - 259, - 260, - 261, - 262, - 263, - 320, - 321, - 322, - 323, - 324, - 325, - 326, - 327, - 384, - 385, - 386, - 387, - 388, - 389, - 390, - 391, - 448, - 449, - 450, - 451, - 452, - 453, - 454, - 455, - ], - [ - 264, - 265, - 266, - 267, - 268, - 269, - 270, - 271, - 328, - 329, - 330, - 331, - 332, - 333, - 334, - 335, - 392, - 393, - 394, - 395, - 396, - 397, - 398, - 399, - 456, - 457, - 458, - 459, - 460, - 461, - 462, - 463, - ], - [ - 272, - 273, - 274, - 275, - 276, - 277, - 278, - 279, - 336, - 337, - 338, - 339, - 340, - 341, - 342, - 343, - 400, - 401, - 402, - 403, - 404, - 405, - 406, - 407, - 464, - 465, - 466, - 467, - 468, - 469, - 470, - 471, - ], - [ - 280, - 281, - 282, - 283, - 284, - 285, - 286, - 287, - 344, - 345, - 346, - 347, - 348, - 349, - 350, - 351, - 408, - 409, - 410, - 411, - 412, - 413, - 414, - 415, - 472, - 473, - 474, - 475, - 476, - 477, - 478, - 479, - ], - [ - 288, - 289, - 290, - 291, - 292, - 293, - 294, - 295, - 352, - 353, - 354, - 355, - 356, - 357, - 358, - 359, - 416, - 417, - 418, - 419, - 420, - 421, - 422, - 423, - 480, - 481, - 482, - 483, - 484, - 485, - 486, - 487, - ], - [ - 296, - 297, - 298, - 299, - 300, - 301, - 302, - 303, - 360, - 361, - 362, - 363, - 364, - 365, - 366, - 367, - 424, - 425, - 426, - 427, - 428, - 429, - 430, - 431, - 488, - 489, - 490, - 491, - 492, - 493, - 494, - 495, - ], - [ - 304, - 305, - 306, - 307, - 308, - 309, - 310, - 311, - 368, - 369, - 370, - 371, - 372, - 373, - 374, - 375, - 432, - 433, - 434, - 435, - 436, - 437, - 438, - 439, - 496, - 497, - 498, - 499, - 500, - 501, - 502, - 503, - ], - [ - 312, - 313, - 314, - 315, - 316, - 317, - 318, - 319, - 376, - 377, - 378, - 379, - 380, - 381, - 382, - 383, - 440, - 441, - 442, - 443, - 444, - 445, - 446, - 447, - 504, - 505, - 506, - 507, - 508, - 509, - 510, - 511, - ], - [ - 512, - 513, - 514, - 515, - 516, - 517, - 518, - 519, - 576, - 577, - 578, - 579, - 580, - 581, - 582, - 583, - 640, - 641, - 642, - 643, - 644, - 645, - 646, - 647, - 704, - 705, - 706, - 707, - 708, - 709, - 710, - 711, - ], - [ - 520, - 521, - 522, - 523, - 524, - 525, - 526, - 527, - 584, - 585, - 586, - 587, - 588, - 589, - 590, - 591, - 648, - 649, - 650, - 651, - 652, - 653, - 654, - 655, - 712, - 713, - 714, - 715, - 716, - 717, - 718, - 719, - ], - [ - 528, - 529, - 530, - 531, - 532, - 533, - 534, - 535, - 592, - 593, - 594, - 595, - 596, - 597, - 598, - 599, - 656, - 657, - 658, - 659, - 660, - 661, - 662, - 663, - 720, - 721, - 722, - 723, - 724, - 725, - 726, - 727, - ], - [ - 536, - 537, - 538, - 539, - 540, - 541, - 542, - 543, - 600, - 601, - 602, - 603, - 604, - 605, - 606, - 607, - 664, - 665, - 666, - 667, - 668, - 669, - 670, - 671, - 728, - 729, - 730, - 731, - 732, - 733, - 734, - 735, - ], - [ - 544, - 545, - 546, - 547, - 548, - 549, - 550, - 551, - 608, - 609, - 610, - 611, - 612, - 613, - 614, - 615, - 672, - 673, - 674, - 675, - 676, - 677, - 678, - 679, - 736, - 737, - 738, - 739, - 740, - 741, - 742, - 743, - ], - [ - 552, - 553, - 554, - 555, - 556, - 557, - 558, - 559, - 616, - 617, - 618, - 619, - 620, - 621, - 622, - 623, - 680, - 681, - 682, - 683, - 684, - 685, - 686, - 687, - 744, - 745, - 746, - 747, - 748, - 749, - 750, - 751, - ], - [ - 560, - 561, - 562, - 563, - 564, - 565, - 566, - 567, - 624, - 625, - 626, - 627, - 628, - 629, - 630, - 631, - 688, - 689, - 690, - 691, - 692, - 693, - 694, - 695, - 752, - 753, - 754, - 755, - 756, - 757, - 758, - 759, - ], - [ - 568, - 569, - 570, - 571, - 572, - 573, - 574, - 575, - 632, - 633, - 634, - 635, - 636, - 637, - 638, - 639, - 696, - 697, - 698, - 699, - 700, - 701, - 702, - 703, - 760, - 761, - 762, - 763, - 764, - 765, - 766, - 767, - ], - [ - 768, - 769, - 770, - 771, - 772, - 773, - 774, - 775, - 832, - 833, - 834, - 835, - 836, - 837, - 838, - 839, - 896, - 897, - 898, - 899, - 900, - 901, - 902, - 903, - 960, - 961, - 962, - 963, - 964, - 965, - 966, - 967, - ], - [ - 776, - 777, - 778, - 779, - 780, - 781, - 782, - 783, - 840, - 841, - 842, - 843, - 844, - 845, - 846, - 847, - 904, - 905, - 906, - 907, - 908, - 909, - 910, - 911, - 968, - 969, - 970, - 971, - 972, - 973, - 974, - 975, - ], - [ - 784, - 785, - 786, - 787, - 788, - 789, - 790, - 791, - 848, - 849, - 850, - 851, - 852, - 853, - 854, - 855, - 912, - 913, - 914, - 915, - 916, - 917, - 918, - 919, - 976, - 977, - 978, - 979, - 980, - 981, - 982, - 983, - ], - [ - 792, - 793, - 794, - 795, - 796, - 797, - 798, - 799, - 856, - 857, - 858, - 859, - 860, - 861, - 862, - 863, - 920, - 921, - 922, - 923, - 924, - 925, - 926, - 927, - 984, - 985, - 986, - 987, - 988, - 989, - 990, - 991, - ], - [ - 800, - 801, - 802, - 803, - 804, - 805, - 806, - 807, - 864, - 865, - 866, - 867, - 868, - 869, - 870, - 871, - 928, - 929, - 930, - 931, - 932, - 933, - 934, - 935, - 992, - 993, - 994, - 995, - 996, - 997, - 998, - 999, - ], - [ - 808, - 809, - 810, - 811, - 812, - 813, - 814, - 815, - 872, - 873, - 874, - 875, - 876, - 877, - 878, - 879, - 936, - 937, - 938, - 939, - 940, - 941, - 942, - 943, - 1000, - 1001, - 1002, - 1003, - 1004, - 1005, - 1006, - 1007, - ], - [ - 816, - 817, - 818, - 819, - 820, - 821, - 822, - 823, - 880, - 881, - 882, - 883, - 884, - 885, - 886, - 887, - 944, - 945, - 946, - 947, - 948, - 949, - 950, - 951, - 1008, - 1009, - 1010, - 1011, - 1012, - 1013, - 1014, - 1015, - ], - [ - 824, - 825, - 826, - 827, - 828, - 829, - 830, - 831, - 888, - 889, - 890, - 891, - 892, - 893, - 894, - 895, - 952, - 953, - 954, - 955, - 956, - 957, - 958, - 959, - 1016, - 1017, - 1018, - 1019, - 1020, - 1021, - 1022, - 1023, - ], + [ 0, 1, 2, 3, 4, 5, 6, 7, 64, 65, 66, 67, 68, 69, 70, 71, 128, 129, 130, 131, 132, 133, 134, 135, 192, 193, 194, 195, 196, 197, 198, 199,], + [ 8, 9, 10, 11, 12, 13, 14, 15, 72, 73, 74, 75, 76, 77, 78, 79, 136, 137, 138, 139, 140, 141, 142, 143, 200, 201, 202, 203, 204, 205, 206, 207,], + [ 16, 17, 18, 19, 20, 21, 22, 23, 80, 81, 82, 83, 84, 85, 86, 87, 144, 145, 146, 147, 148, 149, 150, 151, 208, 209, 210, 211, 212, 213, 214, 215,], + [ 24, 25, 26, 27, 28, 29, 30, 31, 88, 89, 90, 91, 92, 93, 94, 95, 152, 153, 154, 155, 156, 157, 158, 159, 216, 217, 218, 219, 220, 221, 222, 223,], + [ 32, 33, 34, 35, 36, 37, 38, 39, 96, 97, 98, 99, 100, 101, 102, 103, 160, 161, 162, 163, 164, 165, 166, 167, 224, 225, 226, 227, 228, 229, 230, 231,], + [ 40, 41, 42, 43, 44, 45, 46, 47, 104, 105, 106, 107, 108, 109, 110, 111, 168, 169, 170, 171, 172, 173, 174, 175, 232, 233, 234, 235, 236, 237, 238, 239,], + [ 48, 49, 50, 51, 52, 53, 54, 55, 112, 113, 114, 115, 116, 117, 118, 119, 176, 177, 178, 179, 180, 181, 182, 183, 240, 241, 242, 243, 244, 245, 246, 247,], + [ 56, 57, 58, 59, 60, 61, 62, 63, 120, 121, 122, 123, 124, 125, 126, 127, 184, 185, 186, 187, 188, 189, 190, 191, 248, 249, 250, 251, 252, 253, 254, 255,], + [ 256, 257, 258, 259, 260, 261, 262, 263, 320, 321, 322, 323, 324, 325, 326, 327, 384, 385, 386, 387, 388, 389, 390, 391, 448, 449, 450, 451, 452, 453, 454, 455,], + [ 264, 265, 266, 267, 268, 269, 270, 271, 328, 329, 330, 331, 332, 333, 334, 335, 392, 393, 394, 395, 396, 397, 398, 399, 456, 457, 458, 459, 460, 461, 462, 463,], + [ 272, 273, 274, 275, 276, 277, 278, 279, 336, 337, 338, 339, 340, 341, 342, 343, 400, 401, 402, 403, 404, 405, 406, 407, 464, 465, 466, 467, 468, 469, 470, 471,], + [ 280, 281, 282, 283, 284, 285, 286, 287, 344, 345, 346, 347, 348, 349, 350, 351, 408, 409, 410, 411, 412, 413, 414, 415, 472, 473, 474, 475, 476, 477, 478, 479,], + [ 288, 289, 290, 291, 292, 293, 294, 295, 352, 353, 354, 355, 356, 357, 358, 359, 416, 417, 418, 419, 420, 421, 422, 423, 480, 481, 482, 483, 484, 485, 486, 487,], + [ 296, 297, 298, 299, 300, 301, 302, 303, 360, 361, 362, 363, 364, 365, 366, 367, 424, 425, 426, 427, 428, 429, 430, 431, 488, 489, 490, 491, 492, 493, 494, 495,], + [ 304, 305, 306, 307, 308, 309, 310, 311, 368, 369, 370, 371, 372, 373, 374, 375, 432, 433, 434, 435, 436, 437, 438, 439, 496, 497, 498, 499, 500, 501, 502, 503,], + [ 312, 313, 314, 315, 316, 317, 318, 319, 376, 377, 378, 379, 380, 381, 382, 383, 440, 441, 442, 443, 444, 445, 446, 447, 504, 505, 506, 507, 508, 509, 510, 511,], + [ 512, 513, 514, 515, 516, 517, 518, 519, 576, 577, 578, 579, 580, 581, 582, 583, 640, 641, 642, 643, 644, 645, 646, 647, 704, 705, 706, 707, 708, 709, 710, 711,], + [ 520, 521, 522, 523, 524, 525, 526, 527, 584, 585, 586, 587, 588, 589, 590, 591, 648, 649, 650, 651, 652, 653, 654, 655, 712, 713, 714, 715, 716, 717, 718, 719,], + [ 528, 529, 530, 531, 532, 533, 534, 535, 592, 593, 594, 595, 596, 597, 598, 599, 656, 657, 658, 659, 660, 661, 662, 663, 720, 721, 722, 723, 724, 725, 726, 727,], + [ 536, 537, 538, 539, 540, 541, 542, 543, 600, 601, 602, 603, 604, 605, 606, 607, 664, 665, 666, 667, 668, 669, 670, 671, 728, 729, 730, 731, 732, 733, 734, 735,], + [ 544, 545, 546, 547, 548, 549, 550, 551, 608, 609, 610, 611, 612, 613, 614, 615, 672, 673, 674, 675, 676, 677, 678, 679, 736, 737, 738, 739, 740, 741, 742, 743,], + [ 552, 553, 554, 555, 556, 557, 558, 559, 616, 617, 618, 619, 620, 621, 622, 623, 680, 681, 682, 683, 684, 685, 686, 687, 744, 745, 746, 747, 748, 749, 750, 751,], + [ 560, 561, 562, 563, 564, 565, 566, 567, 624, 625, 626, 627, 628, 629, 630, 631, 688, 689, 690, 691, 692, 693, 694, 695, 752, 753, 754, 755, 756, 757, 758, 759,], + [ 568, 569, 570, 571, 572, 573, 574, 575, 632, 633, 634, 635, 636, 637, 638, 639, 696, 697, 698, 699, 700, 701, 702, 703, 760, 761, 762, 763, 764, 765, 766, 767,], + [ 768, 769, 770, 771, 772, 773, 774, 775, 832, 833, 834, 835, 836, 837, 838, 839, 896, 897, 898, 899, 900, 901, 902, 903, 960, 961, 962, 963, 964, 965, 966, 967,], + [ 776, 777, 778, 779, 780, 781, 782, 783, 840, 841, 842, 843, 844, 845, 846, 847, 904, 905, 906, 907, 908, 909, 910, 911, 968, 969, 970, 971, 972, 973, 974, 975,], + [ 784, 785, 786, 787, 788, 789, 790, 791, 848, 849, 850, 851, 852, 853, 854, 855, 912, 913, 914, 915, 916, 917, 918, 919, 976, 977, 978, 979, 980, 981, 982, 983,], + [ 792, 793, 794, 795, 796, 797, 798, 799, 856, 857, 858, 859, 860, 861, 862, 863, 920, 921, 922, 923, 924, 925, 926, 927, 984, 985, 986, 987, 988, 989, 990, 991,], + [ 800, 801, 802, 803, 804, 805, 806, 807, 864, 865, 866, 867, 868, 869, 870, 871, 928, 929, 930, 931, 932, 933, 934, 935, 992, 993, 994, 995, 996, 997, 998, 999,], + [ 808, 809, 810, 811, 812, 813, 814, 815, 872, 873, 874, 875, 876, 877, 878, 879, 936, 937, 938, 939, 940, 941, 942, 943,1000,1001,1002,1003,1004,1005,1006,1007,], + [ 816, 817, 818, 819, 820, 821, 822, 823, 880, 881, 882, 883, 884, 885, 886, 887, 944, 945, 946, 947, 948, 949, 950, 951,1008,1009,1010,1011,1012,1013,1014,1015,], + [ 824, 825, 826, 827, 828, 829, 830, 831, 888, 889, 890, 891, 892, 893, 894, 895, 952, 953, 954, 955, 956, 957, 958, 959,1016,1017,1018,1019,1020,1021,1022,1023,], ], + #fmt: on dtype=TensorTiler2D.DTYPE, ) assert (reference_access == access_order).all() tile1_reference_order = np.array( + #fmt: off [ - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - 0, - 1, - 2, - 3, - 4, - 5, - 6, - 7, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - 8, - 9, - 10, - 11, - 12, - 13, - 14, - 15, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - 16, - 17, - 18, - 19, - 20, - 21, - 22, - 23, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - 24, - 25, - 26, - 27, - 28, - 29, - 30, - 31, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - 32, - 33, - 34, - 35, - 36, - 37, - 38, - 39, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - 40, - 41, - 42, - 43, - 44, - 45, - 46, - 47, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - 48, - 49, - 50, - 51, - 52, - 53, - 54, - 55, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - 56, - 57, - 58, - 59, - 60, - 61, - 62, - 63, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 1, 2, 3, 4, 5, 6, 7,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 8, 9, 10, 11, 12, 13, 14, 15,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 16, 17, 18, 19, 20, 21, 22, 23,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 24, 25, 26, 27, 28, 29, 30, 31,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 32, 33, 34, 35, 36, 37, 38, 39,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 40, 41, 42, 43, 44, 45, 46, 47,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 48, 49, 50, 51, 52, 53, 54, 55,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 56, 57, 58, 59, 60, 61, 62, 63,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], ], + #fmt: on dtype=TensorTiler2D.DTYPE, ) diff --git a/test/python/tensortiler2d/square_tiler_col_major_tensor.py b/test/python/tensortiler2d/square_tiler_col_major_tensor.py index 430fbc5311..0a4cda8fc8 100644 --- a/test/python/tensortiler2d/square_tiler_col_major_tensor.py +++ b/test/python/tensortiler2d/square_tiler_col_major_tensor.py @@ -12,2191 +12,83 @@ def square_tiler_col_major_tensor(): tiler = TensorTiler2D(32, 32, 4, 4, tensor_col_major=True) access_order = tiler.access_order() reference_access = np.array( + #fmt: off [ - [ - 0, - 1, - 2, - 3, - 128, - 129, - 130, - 131, - 256, - 257, - 258, - 259, - 384, - 385, - 386, - 387, - 512, - 513, - 514, - 515, - 640, - 641, - 642, - 643, - 768, - 769, - 770, - 771, - 896, - 897, - 898, - 899, - ], - [ - 4, - 5, - 6, - 7, - 132, - 133, - 134, - 135, - 260, - 261, - 262, - 263, - 388, - 389, - 390, - 391, - 516, - 517, - 518, - 519, - 644, - 645, - 646, - 647, - 772, - 773, - 774, - 775, - 900, - 901, - 902, - 903, - ], - [ - 8, - 9, - 10, - 11, - 136, - 137, - 138, - 139, - 264, - 265, - 266, - 267, - 392, - 393, - 394, - 395, - 520, - 521, - 522, - 523, - 648, - 649, - 650, - 651, - 776, - 777, - 778, - 779, - 904, - 905, - 906, - 907, - ], - [ - 12, - 13, - 14, - 15, - 140, - 141, - 142, - 143, - 268, - 269, - 270, - 271, - 396, - 397, - 398, - 399, - 524, - 525, - 526, - 527, - 652, - 653, - 654, - 655, - 780, - 781, - 782, - 783, - 908, - 909, - 910, - 911, - ], - [ - 16, - 17, - 18, - 19, - 144, - 145, - 146, - 147, - 272, - 273, - 274, - 275, - 400, - 401, - 402, - 403, - 528, - 529, - 530, - 531, - 656, - 657, - 658, - 659, - 784, - 785, - 786, - 787, - 912, - 913, - 914, - 915, - ], - [ - 20, - 21, - 22, - 23, - 148, - 149, - 150, - 151, - 276, - 277, - 278, - 279, - 404, - 405, - 406, - 407, - 532, - 533, - 534, - 535, - 660, - 661, - 662, - 663, - 788, - 789, - 790, - 791, - 916, - 917, - 918, - 919, - ], - [ - 24, - 25, - 26, - 27, - 152, - 153, - 154, - 155, - 280, - 281, - 282, - 283, - 408, - 409, - 410, - 411, - 536, - 537, - 538, - 539, - 664, - 665, - 666, - 667, - 792, - 793, - 794, - 795, - 920, - 921, - 922, - 923, - ], - [ - 28, - 29, - 30, - 31, - 156, - 157, - 158, - 159, - 284, - 285, - 286, - 287, - 412, - 413, - 414, - 415, - 540, - 541, - 542, - 543, - 668, - 669, - 670, - 671, - 796, - 797, - 798, - 799, - 924, - 925, - 926, - 927, - ], - [ - 32, - 33, - 34, - 35, - 160, - 161, - 162, - 163, - 288, - 289, - 290, - 291, - 416, - 417, - 418, - 419, - 544, - 545, - 546, - 547, - 672, - 673, - 674, - 675, - 800, - 801, - 802, - 803, - 928, - 929, - 930, - 931, - ], - [ - 36, - 37, - 38, - 39, - 164, - 165, - 166, - 167, - 292, - 293, - 294, - 295, - 420, - 421, - 422, - 423, - 548, - 549, - 550, - 551, - 676, - 677, - 678, - 679, - 804, - 805, - 806, - 807, - 932, - 933, - 934, - 935, - ], - [ - 40, - 41, - 42, - 43, - 168, - 169, - 170, - 171, - 296, - 297, - 298, - 299, - 424, - 425, - 426, - 427, - 552, - 553, - 554, - 555, - 680, - 681, - 682, - 683, - 808, - 809, - 810, - 811, - 936, - 937, - 938, - 939, - ], - [ - 44, - 45, - 46, - 47, - 172, - 173, - 174, - 175, - 300, - 301, - 302, - 303, - 428, - 429, - 430, - 431, - 556, - 557, - 558, - 559, - 684, - 685, - 686, - 687, - 812, - 813, - 814, - 815, - 940, - 941, - 942, - 943, - ], - [ - 48, - 49, - 50, - 51, - 176, - 177, - 178, - 179, - 304, - 305, - 306, - 307, - 432, - 433, - 434, - 435, - 560, - 561, - 562, - 563, - 688, - 689, - 690, - 691, - 816, - 817, - 818, - 819, - 944, - 945, - 946, - 947, - ], - [ - 52, - 53, - 54, - 55, - 180, - 181, - 182, - 183, - 308, - 309, - 310, - 311, - 436, - 437, - 438, - 439, - 564, - 565, - 566, - 567, - 692, - 693, - 694, - 695, - 820, - 821, - 822, - 823, - 948, - 949, - 950, - 951, - ], - [ - 56, - 57, - 58, - 59, - 184, - 185, - 186, - 187, - 312, - 313, - 314, - 315, - 440, - 441, - 442, - 443, - 568, - 569, - 570, - 571, - 696, - 697, - 698, - 699, - 824, - 825, - 826, - 827, - 952, - 953, - 954, - 955, - ], - [ - 60, - 61, - 62, - 63, - 188, - 189, - 190, - 191, - 316, - 317, - 318, - 319, - 444, - 445, - 446, - 447, - 572, - 573, - 574, - 575, - 700, - 701, - 702, - 703, - 828, - 829, - 830, - 831, - 956, - 957, - 958, - 959, - ], - [ - 64, - 65, - 66, - 67, - 192, - 193, - 194, - 195, - 320, - 321, - 322, - 323, - 448, - 449, - 450, - 451, - 576, - 577, - 578, - 579, - 704, - 705, - 706, - 707, - 832, - 833, - 834, - 835, - 960, - 961, - 962, - 963, - ], - [ - 68, - 69, - 70, - 71, - 196, - 197, - 198, - 199, - 324, - 325, - 326, - 327, - 452, - 453, - 454, - 455, - 580, - 581, - 582, - 583, - 708, - 709, - 710, - 711, - 836, - 837, - 838, - 839, - 964, - 965, - 966, - 967, - ], - [ - 72, - 73, - 74, - 75, - 200, - 201, - 202, - 203, - 328, - 329, - 330, - 331, - 456, - 457, - 458, - 459, - 584, - 585, - 586, - 587, - 712, - 713, - 714, - 715, - 840, - 841, - 842, - 843, - 968, - 969, - 970, - 971, - ], - [ - 76, - 77, - 78, - 79, - 204, - 205, - 206, - 207, - 332, - 333, - 334, - 335, - 460, - 461, - 462, - 463, - 588, - 589, - 590, - 591, - 716, - 717, - 718, - 719, - 844, - 845, - 846, - 847, - 972, - 973, - 974, - 975, - ], - [ - 80, - 81, - 82, - 83, - 208, - 209, - 210, - 211, - 336, - 337, - 338, - 339, - 464, - 465, - 466, - 467, - 592, - 593, - 594, - 595, - 720, - 721, - 722, - 723, - 848, - 849, - 850, - 851, - 976, - 977, - 978, - 979, - ], - [ - 84, - 85, - 86, - 87, - 212, - 213, - 214, - 215, - 340, - 341, - 342, - 343, - 468, - 469, - 470, - 471, - 596, - 597, - 598, - 599, - 724, - 725, - 726, - 727, - 852, - 853, - 854, - 855, - 980, - 981, - 982, - 983, - ], - [ - 88, - 89, - 90, - 91, - 216, - 217, - 218, - 219, - 344, - 345, - 346, - 347, - 472, - 473, - 474, - 475, - 600, - 601, - 602, - 603, - 728, - 729, - 730, - 731, - 856, - 857, - 858, - 859, - 984, - 985, - 986, - 987, - ], - [ - 92, - 93, - 94, - 95, - 220, - 221, - 222, - 223, - 348, - 349, - 350, - 351, - 476, - 477, - 478, - 479, - 604, - 605, - 606, - 607, - 732, - 733, - 734, - 735, - 860, - 861, - 862, - 863, - 988, - 989, - 990, - 991, - ], - [ - 96, - 97, - 98, - 99, - 224, - 225, - 226, - 227, - 352, - 353, - 354, - 355, - 480, - 481, - 482, - 483, - 608, - 609, - 610, - 611, - 736, - 737, - 738, - 739, - 864, - 865, - 866, - 867, - 992, - 993, - 994, - 995, - ], - [ - 100, - 101, - 102, - 103, - 228, - 229, - 230, - 231, - 356, - 357, - 358, - 359, - 484, - 485, - 486, - 487, - 612, - 613, - 614, - 615, - 740, - 741, - 742, - 743, - 868, - 869, - 870, - 871, - 996, - 997, - 998, - 999, - ], - [ - 104, - 105, - 106, - 107, - 232, - 233, - 234, - 235, - 360, - 361, - 362, - 363, - 488, - 489, - 490, - 491, - 616, - 617, - 618, - 619, - 744, - 745, - 746, - 747, - 872, - 873, - 874, - 875, - 1000, - 1001, - 1002, - 1003, - ], - [ - 108, - 109, - 110, - 111, - 236, - 237, - 238, - 239, - 364, - 365, - 366, - 367, - 492, - 493, - 494, - 495, - 620, - 621, - 622, - 623, - 748, - 749, - 750, - 751, - 876, - 877, - 878, - 879, - 1004, - 1005, - 1006, - 1007, - ], - [ - 112, - 113, - 114, - 115, - 240, - 241, - 242, - 243, - 368, - 369, - 370, - 371, - 496, - 497, - 498, - 499, - 624, - 625, - 626, - 627, - 752, - 753, - 754, - 755, - 880, - 881, - 882, - 883, - 1008, - 1009, - 1010, - 1011, - ], - [ - 116, - 117, - 118, - 119, - 244, - 245, - 246, - 247, - 372, - 373, - 374, - 375, - 500, - 501, - 502, - 503, - 628, - 629, - 630, - 631, - 756, - 757, - 758, - 759, - 884, - 885, - 886, - 887, - 1012, - 1013, - 1014, - 1015, - ], - [ - 120, - 121, - 122, - 123, - 248, - 249, - 250, - 251, - 376, - 377, - 378, - 379, - 504, - 505, - 506, - 507, - 632, - 633, - 634, - 635, - 760, - 761, - 762, - 763, - 888, - 889, - 890, - 891, - 1016, - 1017, - 1018, - 1019, - ], - [ - 124, - 125, - 126, - 127, - 252, - 253, - 254, - 255, - 380, - 381, - 382, - 383, - 508, - 509, - 510, - 511, - 636, - 637, - 638, - 639, - 764, - 765, - 766, - 767, - 892, - 893, - 894, - 895, - 1020, - 1021, - 1022, - 1023, - ], + [ 0, 1, 2, 3, 128, 129, 130, 131, 256, 257, 258, 259, 384, 385, 386, 387, 512, 513, 514, 515, 640, 641, 642, 643, 768, 769, 770, 771, 896, 897, 898, 899,], + [ 4, 5, 6, 7, 132, 133, 134, 135, 260, 261, 262, 263, 388, 389, 390, 391, 516, 517, 518, 519, 644, 645, 646, 647, 772, 773, 774, 775, 900, 901, 902, 903,], + [ 8, 9, 10, 11, 136, 137, 138, 139, 264, 265, 266, 267, 392, 393, 394, 395, 520, 521, 522, 523, 648, 649, 650, 651, 776, 777, 778, 779, 904, 905, 906, 907,], + [ 12, 13, 14, 15, 140, 141, 142, 143, 268, 269, 270, 271, 396, 397, 398, 399, 524, 525, 526, 527, 652, 653, 654, 655, 780, 781, 782, 783, 908, 909, 910, 911,], + [ 16, 17, 18, 19, 144, 145, 146, 147, 272, 273, 274, 275, 400, 401, 402, 403, 528, 529, 530, 531, 656, 657, 658, 659, 784, 785, 786, 787, 912, 913, 914, 915,], + [ 20, 21, 22, 23, 148, 149, 150, 151, 276, 277, 278, 279, 404, 405, 406, 407, 532, 533, 534, 535, 660, 661, 662, 663, 788, 789, 790, 791, 916, 917, 918, 919,], + [ 24, 25, 26, 27, 152, 153, 154, 155, 280, 281, 282, 283, 408, 409, 410, 411, 536, 537, 538, 539, 664, 665, 666, 667, 792, 793, 794, 795, 920, 921, 922, 923,], + [ 28, 29, 30, 31, 156, 157, 158, 159, 284, 285, 286, 287, 412, 413, 414, 415, 540, 541, 542, 543, 668, 669, 670, 671, 796, 797, 798, 799, 924, 925, 926, 927,], + [ 32, 33, 34, 35, 160, 161, 162, 163, 288, 289, 290, 291, 416, 417, 418, 419, 544, 545, 546, 547, 672, 673, 674, 675, 800, 801, 802, 803, 928, 929, 930, 931,], + [ 36, 37, 38, 39, 164, 165, 166, 167, 292, 293, 294, 295, 420, 421, 422, 423, 548, 549, 550, 551, 676, 677, 678, 679, 804, 805, 806, 807, 932, 933, 934, 935,], + [ 40, 41, 42, 43, 168, 169, 170, 171, 296, 297, 298, 299, 424, 425, 426, 427, 552, 553, 554, 555, 680, 681, 682, 683, 808, 809, 810, 811, 936, 937, 938, 939,], + [ 44, 45, 46, 47, 172, 173, 174, 175, 300, 301, 302, 303, 428, 429, 430, 431, 556, 557, 558, 559, 684, 685, 686, 687, 812, 813, 814, 815, 940, 941, 942, 943,], + [ 48, 49, 50, 51, 176, 177, 178, 179, 304, 305, 306, 307, 432, 433, 434, 435, 560, 561, 562, 563, 688, 689, 690, 691, 816, 817, 818, 819, 944, 945, 946, 947,], + [ 52, 53, 54, 55, 180, 181, 182, 183, 308, 309, 310, 311, 436, 437, 438, 439, 564, 565, 566, 567, 692, 693, 694, 695, 820, 821, 822, 823, 948, 949, 950, 951,], + [ 56, 57, 58, 59, 184, 185, 186, 187, 312, 313, 314, 315, 440, 441, 442, 443, 568, 569, 570, 571, 696, 697, 698, 699, 824, 825, 826, 827, 952, 953, 954, 955,], + [ 60, 61, 62, 63, 188, 189, 190, 191, 316, 317, 318, 319, 444, 445, 446, 447, 572, 573, 574, 575, 700, 701, 702, 703, 828, 829, 830, 831, 956, 957, 958, 959,], + [ 64, 65, 66, 67, 192, 193, 194, 195, 320, 321, 322, 323, 448, 449, 450, 451, 576, 577, 578, 579, 704, 705, 706, 707, 832, 833, 834, 835, 960, 961, 962, 963,], + [ 68, 69, 70, 71, 196, 197, 198, 199, 324, 325, 326, 327, 452, 453, 454, 455, 580, 581, 582, 583, 708, 709, 710, 711, 836, 837, 838, 839, 964, 965, 966, 967,], + [ 72, 73, 74, 75, 200, 201, 202, 203, 328, 329, 330, 331, 456, 457, 458, 459, 584, 585, 586, 587, 712, 713, 714, 715, 840, 841, 842, 843, 968, 969, 970, 971,], + [ 76, 77, 78, 79, 204, 205, 206, 207, 332, 333, 334, 335, 460, 461, 462, 463, 588, 589, 590, 591, 716, 717, 718, 719, 844, 845, 846, 847, 972, 973, 974, 975,], + [ 80, 81, 82, 83, 208, 209, 210, 211, 336, 337, 338, 339, 464, 465, 466, 467, 592, 593, 594, 595, 720, 721, 722, 723, 848, 849, 850, 851, 976, 977, 978, 979,], + [ 84, 85, 86, 87, 212, 213, 214, 215, 340, 341, 342, 343, 468, 469, 470, 471, 596, 597, 598, 599, 724, 725, 726, 727, 852, 853, 854, 855, 980, 981, 982, 983,], + [ 88, 89, 90, 91, 216, 217, 218, 219, 344, 345, 346, 347, 472, 473, 474, 475, 600, 601, 602, 603, 728, 729, 730, 731, 856, 857, 858, 859, 984, 985, 986, 987,], + [ 92, 93, 94, 95, 220, 221, 222, 223, 348, 349, 350, 351, 476, 477, 478, 479, 604, 605, 606, 607, 732, 733, 734, 735, 860, 861, 862, 863, 988, 989, 990, 991,], + [ 96, 97, 98, 99, 224, 225, 226, 227, 352, 353, 354, 355, 480, 481, 482, 483, 608, 609, 610, 611, 736, 737, 738, 739, 864, 865, 866, 867, 992, 993, 994, 995,], + [ 100, 101, 102, 103, 228, 229, 230, 231, 356, 357, 358, 359, 484, 485, 486, 487, 612, 613, 614, 615, 740, 741, 742, 743, 868, 869, 870, 871, 996, 997, 998, 999,], + [ 104, 105, 106, 107, 232, 233, 234, 235, 360, 361, 362, 363, 488, 489, 490, 491, 616, 617, 618, 619, 744, 745, 746, 747, 872, 873, 874, 875,1000,1001,1002,1003,], + [ 108, 109, 110, 111, 236, 237, 238, 239, 364, 365, 366, 367, 492, 493, 494, 495, 620, 621, 622, 623, 748, 749, 750, 751, 876, 877, 878, 879,1004,1005,1006,1007,], + [ 112, 113, 114, 115, 240, 241, 242, 243, 368, 369, 370, 371, 496, 497, 498, 499, 624, 625, 626, 627, 752, 753, 754, 755, 880, 881, 882, 883,1008,1009,1010,1011,], + [ 116, 117, 118, 119, 244, 245, 246, 247, 372, 373, 374, 375, 500, 501, 502, 503, 628, 629, 630, 631, 756, 757, 758, 759, 884, 885, 886, 887,1012,1013,1014,1015,], + [ 120, 121, 122, 123, 248, 249, 250, 251, 376, 377, 378, 379, 504, 505, 506, 507, 632, 633, 634, 635, 760, 761, 762, 763, 888, 889, 890, 891,1016,1017,1018,1019,], + [ 124, 125, 126, 127, 252, 253, 254, 255, 380, 381, 382, 383, 508, 509, 510, 511, 636, 637, 638, 639, 764, 765, 766, 767, 892, 893, 894, 895,1020,1021,1022,1023,], ], + #fmt: on dtype=TensorTiler2D.DTYPE, ) assert (reference_access == access_order).all() tile1_reference_order = np.array( + #fmt: off [ - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - 0, - 1, - 2, - 3, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - 4, - 5, - 6, - 7, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - 8, - 9, - 10, - 11, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - 12, - 13, - 14, - 15, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 1, 2, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 4, 5, 6, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 8, 9, 10, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 12, 13, 14, 15, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], ], + #fmt: on dtype=TensorTiler2D.DTYPE, ) diff --git a/test/python/tensortiler2d/square_tiler_col_major_tensor_and_tile_tile_chunking.py b/test/python/tensortiler2d/square_tiler_col_major_tensor_and_tile_tile_chunking.py index 5c56936056..89f8b5fca7 100644 --- a/test/python/tensortiler2d/square_tiler_col_major_tensor_and_tile_tile_chunking.py +++ b/test/python/tensortiler2d/square_tiler_col_major_tensor_and_tile_tile_chunking.py @@ -12,2191 +12,83 @@ def square_tiler_col_major_tensor_and_tile_tile_chunking(): tiler = TensorTiler2D(32, 32, 4, 4, tensor_col_major=True, tile_col_major=True) access_order = tiler.access_order() reference_access = np.array( + #fmt: off [ - [ - 0, - 4, - 8, - 12, - 128, - 132, - 136, - 140, - 256, - 260, - 264, - 268, - 384, - 388, - 392, - 396, - 512, - 516, - 520, - 524, - 640, - 644, - 648, - 652, - 768, - 772, - 776, - 780, - 896, - 900, - 904, - 908, - ], - [ - 1, - 5, - 9, - 13, - 129, - 133, - 137, - 141, - 257, - 261, - 265, - 269, - 385, - 389, - 393, - 397, - 513, - 517, - 521, - 525, - 641, - 645, - 649, - 653, - 769, - 773, - 777, - 781, - 897, - 901, - 905, - 909, - ], - [ - 2, - 6, - 10, - 14, - 130, - 134, - 138, - 142, - 258, - 262, - 266, - 270, - 386, - 390, - 394, - 398, - 514, - 518, - 522, - 526, - 642, - 646, - 650, - 654, - 770, - 774, - 778, - 782, - 898, - 902, - 906, - 910, - ], - [ - 3, - 7, - 11, - 15, - 131, - 135, - 139, - 143, - 259, - 263, - 267, - 271, - 387, - 391, - 395, - 399, - 515, - 519, - 523, - 527, - 643, - 647, - 651, - 655, - 771, - 775, - 779, - 783, - 899, - 903, - 907, - 911, - ], - [ - 16, - 20, - 24, - 28, - 144, - 148, - 152, - 156, - 272, - 276, - 280, - 284, - 400, - 404, - 408, - 412, - 528, - 532, - 536, - 540, - 656, - 660, - 664, - 668, - 784, - 788, - 792, - 796, - 912, - 916, - 920, - 924, - ], - [ - 17, - 21, - 25, - 29, - 145, - 149, - 153, - 157, - 273, - 277, - 281, - 285, - 401, - 405, - 409, - 413, - 529, - 533, - 537, - 541, - 657, - 661, - 665, - 669, - 785, - 789, - 793, - 797, - 913, - 917, - 921, - 925, - ], - [ - 18, - 22, - 26, - 30, - 146, - 150, - 154, - 158, - 274, - 278, - 282, - 286, - 402, - 406, - 410, - 414, - 530, - 534, - 538, - 542, - 658, - 662, - 666, - 670, - 786, - 790, - 794, - 798, - 914, - 918, - 922, - 926, - ], - [ - 19, - 23, - 27, - 31, - 147, - 151, - 155, - 159, - 275, - 279, - 283, - 287, - 403, - 407, - 411, - 415, - 531, - 535, - 539, - 543, - 659, - 663, - 667, - 671, - 787, - 791, - 795, - 799, - 915, - 919, - 923, - 927, - ], - [ - 32, - 36, - 40, - 44, - 160, - 164, - 168, - 172, - 288, - 292, - 296, - 300, - 416, - 420, - 424, - 428, - 544, - 548, - 552, - 556, - 672, - 676, - 680, - 684, - 800, - 804, - 808, - 812, - 928, - 932, - 936, - 940, - ], - [ - 33, - 37, - 41, - 45, - 161, - 165, - 169, - 173, - 289, - 293, - 297, - 301, - 417, - 421, - 425, - 429, - 545, - 549, - 553, - 557, - 673, - 677, - 681, - 685, - 801, - 805, - 809, - 813, - 929, - 933, - 937, - 941, - ], - [ - 34, - 38, - 42, - 46, - 162, - 166, - 170, - 174, - 290, - 294, - 298, - 302, - 418, - 422, - 426, - 430, - 546, - 550, - 554, - 558, - 674, - 678, - 682, - 686, - 802, - 806, - 810, - 814, - 930, - 934, - 938, - 942, - ], - [ - 35, - 39, - 43, - 47, - 163, - 167, - 171, - 175, - 291, - 295, - 299, - 303, - 419, - 423, - 427, - 431, - 547, - 551, - 555, - 559, - 675, - 679, - 683, - 687, - 803, - 807, - 811, - 815, - 931, - 935, - 939, - 943, - ], - [ - 48, - 52, - 56, - 60, - 176, - 180, - 184, - 188, - 304, - 308, - 312, - 316, - 432, - 436, - 440, - 444, - 560, - 564, - 568, - 572, - 688, - 692, - 696, - 700, - 816, - 820, - 824, - 828, - 944, - 948, - 952, - 956, - ], - [ - 49, - 53, - 57, - 61, - 177, - 181, - 185, - 189, - 305, - 309, - 313, - 317, - 433, - 437, - 441, - 445, - 561, - 565, - 569, - 573, - 689, - 693, - 697, - 701, - 817, - 821, - 825, - 829, - 945, - 949, - 953, - 957, - ], - [ - 50, - 54, - 58, - 62, - 178, - 182, - 186, - 190, - 306, - 310, - 314, - 318, - 434, - 438, - 442, - 446, - 562, - 566, - 570, - 574, - 690, - 694, - 698, - 702, - 818, - 822, - 826, - 830, - 946, - 950, - 954, - 958, - ], - [ - 51, - 55, - 59, - 63, - 179, - 183, - 187, - 191, - 307, - 311, - 315, - 319, - 435, - 439, - 443, - 447, - 563, - 567, - 571, - 575, - 691, - 695, - 699, - 703, - 819, - 823, - 827, - 831, - 947, - 951, - 955, - 959, - ], - [ - 64, - 68, - 72, - 76, - 192, - 196, - 200, - 204, - 320, - 324, - 328, - 332, - 448, - 452, - 456, - 460, - 576, - 580, - 584, - 588, - 704, - 708, - 712, - 716, - 832, - 836, - 840, - 844, - 960, - 964, - 968, - 972, - ], - [ - 65, - 69, - 73, - 77, - 193, - 197, - 201, - 205, - 321, - 325, - 329, - 333, - 449, - 453, - 457, - 461, - 577, - 581, - 585, - 589, - 705, - 709, - 713, - 717, - 833, - 837, - 841, - 845, - 961, - 965, - 969, - 973, - ], - [ - 66, - 70, - 74, - 78, - 194, - 198, - 202, - 206, - 322, - 326, - 330, - 334, - 450, - 454, - 458, - 462, - 578, - 582, - 586, - 590, - 706, - 710, - 714, - 718, - 834, - 838, - 842, - 846, - 962, - 966, - 970, - 974, - ], - [ - 67, - 71, - 75, - 79, - 195, - 199, - 203, - 207, - 323, - 327, - 331, - 335, - 451, - 455, - 459, - 463, - 579, - 583, - 587, - 591, - 707, - 711, - 715, - 719, - 835, - 839, - 843, - 847, - 963, - 967, - 971, - 975, - ], - [ - 80, - 84, - 88, - 92, - 208, - 212, - 216, - 220, - 336, - 340, - 344, - 348, - 464, - 468, - 472, - 476, - 592, - 596, - 600, - 604, - 720, - 724, - 728, - 732, - 848, - 852, - 856, - 860, - 976, - 980, - 984, - 988, - ], - [ - 81, - 85, - 89, - 93, - 209, - 213, - 217, - 221, - 337, - 341, - 345, - 349, - 465, - 469, - 473, - 477, - 593, - 597, - 601, - 605, - 721, - 725, - 729, - 733, - 849, - 853, - 857, - 861, - 977, - 981, - 985, - 989, - ], - [ - 82, - 86, - 90, - 94, - 210, - 214, - 218, - 222, - 338, - 342, - 346, - 350, - 466, - 470, - 474, - 478, - 594, - 598, - 602, - 606, - 722, - 726, - 730, - 734, - 850, - 854, - 858, - 862, - 978, - 982, - 986, - 990, - ], - [ - 83, - 87, - 91, - 95, - 211, - 215, - 219, - 223, - 339, - 343, - 347, - 351, - 467, - 471, - 475, - 479, - 595, - 599, - 603, - 607, - 723, - 727, - 731, - 735, - 851, - 855, - 859, - 863, - 979, - 983, - 987, - 991, - ], - [ - 96, - 100, - 104, - 108, - 224, - 228, - 232, - 236, - 352, - 356, - 360, - 364, - 480, - 484, - 488, - 492, - 608, - 612, - 616, - 620, - 736, - 740, - 744, - 748, - 864, - 868, - 872, - 876, - 992, - 996, - 1000, - 1004, - ], - [ - 97, - 101, - 105, - 109, - 225, - 229, - 233, - 237, - 353, - 357, - 361, - 365, - 481, - 485, - 489, - 493, - 609, - 613, - 617, - 621, - 737, - 741, - 745, - 749, - 865, - 869, - 873, - 877, - 993, - 997, - 1001, - 1005, - ], - [ - 98, - 102, - 106, - 110, - 226, - 230, - 234, - 238, - 354, - 358, - 362, - 366, - 482, - 486, - 490, - 494, - 610, - 614, - 618, - 622, - 738, - 742, - 746, - 750, - 866, - 870, - 874, - 878, - 994, - 998, - 1002, - 1006, - ], - [ - 99, - 103, - 107, - 111, - 227, - 231, - 235, - 239, - 355, - 359, - 363, - 367, - 483, - 487, - 491, - 495, - 611, - 615, - 619, - 623, - 739, - 743, - 747, - 751, - 867, - 871, - 875, - 879, - 995, - 999, - 1003, - 1007, - ], - [ - 112, - 116, - 120, - 124, - 240, - 244, - 248, - 252, - 368, - 372, - 376, - 380, - 496, - 500, - 504, - 508, - 624, - 628, - 632, - 636, - 752, - 756, - 760, - 764, - 880, - 884, - 888, - 892, - 1008, - 1012, - 1016, - 1020, - ], - [ - 113, - 117, - 121, - 125, - 241, - 245, - 249, - 253, - 369, - 373, - 377, - 381, - 497, - 501, - 505, - 509, - 625, - 629, - 633, - 637, - 753, - 757, - 761, - 765, - 881, - 885, - 889, - 893, - 1009, - 1013, - 1017, - 1021, - ], - [ - 114, - 118, - 122, - 126, - 242, - 246, - 250, - 254, - 370, - 374, - 378, - 382, - 498, - 502, - 506, - 510, - 626, - 630, - 634, - 638, - 754, - 758, - 762, - 766, - 882, - 886, - 890, - 894, - 1010, - 1014, - 1018, - 1022, - ], - [ - 115, - 119, - 123, - 127, - 243, - 247, - 251, - 255, - 371, - 375, - 379, - 383, - 499, - 503, - 507, - 511, - 627, - 631, - 635, - 639, - 755, - 759, - 763, - 767, - 883, - 887, - 891, - 895, - 1011, - 1015, - 1019, - 1023, - ], + [ 0, 4, 8, 12, 128, 132, 136, 140, 256, 260, 264, 268, 384, 388, 392, 396, 512, 516, 520, 524, 640, 644, 648, 652, 768, 772, 776, 780, 896, 900, 904, 908, ], + [ 1, 5, 9, 13, 129, 133, 137, 141, 257, 261, 265, 269, 385, 389, 393, 397, 513, 517, 521, 525, 641, 645, 649, 653, 769, 773, 777, 781, 897, 901, 905, 909, ], + [ 2, 6, 10, 14, 130, 134, 138, 142, 258, 262, 266, 270, 386, 390, 394, 398, 514, 518, 522, 526, 642, 646, 650, 654, 770, 774, 778, 782, 898, 902, 906, 910, ], + [ 3, 7, 11, 15, 131, 135, 139, 143, 259, 263, 267, 271, 387, 391, 395, 399, 515, 519, 523, 527, 643, 647, 651, 655, 771, 775, 779, 783, 899, 903, 907, 911, ], + [ 16, 20, 24, 28, 144, 148, 152, 156, 272, 276, 280, 284, 400, 404, 408, 412, 528, 532, 536, 540, 656, 660, 664, 668, 784, 788, 792, 796, 912, 916, 920, 924, ], + [ 17, 21, 25, 29, 145, 149, 153, 157, 273, 277, 281, 285, 401, 405, 409, 413, 529, 533, 537, 541, 657, 661, 665, 669, 785, 789, 793, 797, 913, 917, 921, 925, ], + [ 18, 22, 26, 30, 146, 150, 154, 158, 274, 278, 282, 286, 402, 406, 410, 414, 530, 534, 538, 542, 658, 662, 666, 670, 786, 790, 794, 798, 914, 918, 922, 926, ], + [ 19, 23, 27, 31, 147, 151, 155, 159, 275, 279, 283, 287, 403, 407, 411, 415, 531, 535, 539, 543, 659, 663, 667, 671, 787, 791, 795, 799, 915, 919, 923, 927, ], + [ 32, 36, 40, 44, 160, 164, 168, 172, 288, 292, 296, 300, 416, 420, 424, 428, 544, 548, 552, 556, 672, 676, 680, 684, 800, 804, 808, 812, 928, 932, 936, 940, ], + [ 33, 37, 41, 45, 161, 165, 169, 173, 289, 293, 297, 301, 417, 421, 425, 429, 545, 549, 553, 557, 673, 677, 681, 685, 801, 805, 809, 813, 929, 933, 937, 941, ], + [ 34, 38, 42, 46, 162, 166, 170, 174, 290, 294, 298, 302, 418, 422, 426, 430, 546, 550, 554, 558, 674, 678, 682, 686, 802, 806, 810, 814, 930, 934, 938, 942, ], + [ 35, 39, 43, 47, 163, 167, 171, 175, 291, 295, 299, 303, 419, 423, 427, 431, 547, 551, 555, 559, 675, 679, 683, 687, 803, 807, 811, 815, 931, 935, 939, 943, ], + [ 48, 52, 56, 60, 176, 180, 184, 188, 304, 308, 312, 316, 432, 436, 440, 444, 560, 564, 568, 572, 688, 692, 696, 700, 816, 820, 824, 828, 944, 948, 952, 956, ], + [ 49, 53, 57, 61, 177, 181, 185, 189, 305, 309, 313, 317, 433, 437, 441, 445, 561, 565, 569, 573, 689, 693, 697, 701, 817, 821, 825, 829, 945, 949, 953, 957, ], + [ 50, 54, 58, 62, 178, 182, 186, 190, 306, 310, 314, 318, 434, 438, 442, 446, 562, 566, 570, 574, 690, 694, 698, 702, 818, 822, 826, 830, 946, 950, 954, 958, ], + [ 51, 55, 59, 63, 179, 183, 187, 191, 307, 311, 315, 319, 435, 439, 443, 447, 563, 567, 571, 575, 691, 695, 699, 703, 819, 823, 827, 831, 947, 951, 955, 959, ], + [ 64, 68, 72, 76, 192, 196, 200, 204, 320, 324, 328, 332, 448, 452, 456, 460, 576, 580, 584, 588, 704, 708, 712, 716, 832, 836, 840, 844, 960, 964, 968, 972, ], + [ 65, 69, 73, 77, 193, 197, 201, 205, 321, 325, 329, 333, 449, 453, 457, 461, 577, 581, 585, 589, 705, 709, 713, 717, 833, 837, 841, 845, 961, 965, 969, 973, ], + [ 66, 70, 74, 78, 194, 198, 202, 206, 322, 326, 330, 334, 450, 454, 458, 462, 578, 582, 586, 590, 706, 710, 714, 718, 834, 838, 842, 846, 962, 966, 970, 974, ], + [ 67, 71, 75, 79, 195, 199, 203, 207, 323, 327, 331, 335, 451, 455, 459, 463, 579, 583, 587, 591, 707, 711, 715, 719, 835, 839, 843, 847, 963, 967, 971, 975, ], + [ 80, 84, 88, 92, 208, 212, 216, 220, 336, 340, 344, 348, 464, 468, 472, 476, 592, 596, 600, 604, 720, 724, 728, 732, 848, 852, 856, 860, 976, 980, 984, 988, ], + [ 81, 85, 89, 93, 209, 213, 217, 221, 337, 341, 345, 349, 465, 469, 473, 477, 593, 597, 601, 605, 721, 725, 729, 733, 849, 853, 857, 861, 977, 981, 985, 989, ], + [ 82, 86, 90, 94, 210, 214, 218, 222, 338, 342, 346, 350, 466, 470, 474, 478, 594, 598, 602, 606, 722, 726, 730, 734, 850, 854, 858, 862, 978, 982, 986, 990, ], + [ 83, 87, 91, 95, 211, 215, 219, 223, 339, 343, 347, 351, 467, 471, 475, 479, 595, 599, 603, 607, 723, 727, 731, 735, 851, 855, 859, 863, 979, 983, 987, 991, ], + [ 96, 100, 104, 108, 224, 228, 232, 236, 352, 356, 360, 364, 480, 484, 488, 492, 608, 612, 616, 620, 736, 740, 744, 748, 864, 868, 872, 876, 992, 996, 1000, 1004, ], + [ 97, 101, 105, 109, 225, 229, 233, 237, 353, 357, 361, 365, 481, 485, 489, 493, 609, 613, 617, 621, 737, 741, 745, 749, 865, 869, 873, 877, 993, 997, 1001, 1005, ], + [ 98, 102, 106, 110, 226, 230, 234, 238, 354, 358, 362, 366, 482, 486, 490, 494, 610, 614, 618, 622, 738, 742, 746, 750, 866, 870, 874, 878, 994, 998, 1002, 1006, ], + [ 99, 103, 107, 111, 227, 231, 235, 239, 355, 359, 363, 367, 483, 487, 491, 495, 611, 615, 619, 623, 739, 743, 747, 751, 867, 871, 875, 879, 995, 999, 1003, 1007, ], + [ 112, 116, 120, 124, 240, 244, 248, 252, 368, 372, 376, 380, 496, 500, 504, 508, 624, 628, 632, 636, 752, 756, 760, 764, 880, 884, 888, 892, 1008, 1012, 1016, 1020, ], + [ 113, 117, 121, 125, 241, 245, 249, 253, 369, 373, 377, 381, 497, 501, 505, 509, 625, 629, 633, 637, 753, 757, 761, 765, 881, 885, 889, 893, 1009, 1013, 1017, 1021, ], + [ 114, 118, 122, 126, 242, 246, 250, 254, 370, 374, 378, 382, 498, 502, 506, 510, 626, 630, 634, 638, 754, 758, 762, 766, 882, 886, 890, 894, 1010, 1014, 1018, 1022, ], + [ 115, 119, 123, 127, 243, 247, 251, 255, 371, 375, 379, 383, 499, 503, 507, 511, 627, 631, 635, 639, 755, 759, 763, 767, 883, 887, 891, 895, 1011, 1015, 1019, 1023, ], ], + #fmt: on dtype=TensorTiler2D.DTYPE, ) assert (reference_access == access_order).all() tile1_reference_order = np.array( + #fmt: off [ - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - 0, - 4, - 8, - 12, - 32, - 36, - 40, - 44, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - 1, - 5, - 9, - 13, - 33, - 37, - 41, - 45, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - 2, - 6, - 10, - 14, - 34, - 38, - 42, - 46, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - 3, - 7, - 11, - 15, - 35, - 39, - 43, - 47, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - 16, - 20, - 24, - 28, - 48, - 52, - 56, - 60, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - 17, - 21, - 25, - 29, - 49, - 53, - 57, - 61, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - 18, - 22, - 26, - 30, - 50, - 54, - 58, - 62, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - 19, - 23, - 27, - 31, - 51, - 55, - 59, - 63, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 4, 8, 12, 32, 36, 40, 44, -1, -1, -1, -1, -1, -1, -1, -1, ], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 5, 9, 13, 33, 37, 41, 45, -1, -1, -1, -1, -1, -1, -1, -1, ], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 2, 6, 10, 14, 34, 38, 42, 46, -1, -1, -1, -1, -1, -1, -1, -1, ], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 3, 7, 11, 15, 35, 39, 43, 47, -1, -1, -1, -1, -1, -1, -1, -1, ], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 16, 20, 24, 28, 48, 52, 56, 60, -1, -1, -1, -1, -1, -1, -1, -1, ], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 17, 21, 25, 29, 49, 53, 57, 61, -1, -1, -1, -1, -1, -1, -1, -1, ], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 18, 22, 26, 30, 50, 54, 58, 62, -1, -1, -1, -1, -1, -1, -1, -1, ], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 19, 23, 27, 31, 51, 55, 59, 63, -1, -1, -1, -1, -1, -1, -1, -1, ], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, ], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, ], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, ], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, ], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, ], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, ], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, ], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, ], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, ], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, ], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, ], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, ], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, ], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, ], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, ], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, ], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, ], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, ], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, ], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, ], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, ], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, ], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, ], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, ], ], + #fmt: on dtype=TensorTiler2D.DTYPE, ) diff --git a/test/python/tensortiler2d/square_tiler_col_major_tensor_tile_chunking_rectangular_col_major_chunks.py b/test/python/tensortiler2d/square_tiler_col_major_tensor_tile_chunking_rectangular_col_major_chunks.py index e60ed3b43f..35a14e7560 100644 --- a/test/python/tensortiler2d/square_tiler_col_major_tensor_tile_chunking_rectangular_col_major_chunks.py +++ b/test/python/tensortiler2d/square_tiler_col_major_tensor_tile_chunking_rectangular_col_major_chunks.py @@ -12,152 +12,36 @@ def square_tiler_col_major_tensor_tile_chunking_rectangular_col_major_chunks(): tiler = TensorTiler2D(16, 16, 4, 4, tensor_col_major=True) access_order = tiler.access_order() reference_access = np.array( + #fmt: off [ - [0, 1, 2, 3, 64, 65, 66, 67, 128, 129, 130, 131, 192, 193, 194, 195], - [4, 5, 6, 7, 68, 69, 70, 71, 132, 133, 134, 135, 196, 197, 198, 199], - [8, 9, 10, 11, 72, 73, 74, 75, 136, 137, 138, 139, 200, 201, 202, 203], - [12, 13, 14, 15, 76, 77, 78, 79, 140, 141, 142, 143, 204, 205, 206, 207], - [16, 17, 18, 19, 80, 81, 82, 83, 144, 145, 146, 147, 208, 209, 210, 211], - [20, 21, 22, 23, 84, 85, 86, 87, 148, 149, 150, 151, 212, 213, 214, 215], - [24, 25, 26, 27, 88, 89, 90, 91, 152, 153, 154, 155, 216, 217, 218, 219], - [28, 29, 30, 31, 92, 93, 94, 95, 156, 157, 158, 159, 220, 221, 222, 223], - [32, 33, 34, 35, 96, 97, 98, 99, 160, 161, 162, 163, 224, 225, 226, 227], - [ - 36, - 37, - 38, - 39, - 100, - 101, - 102, - 103, - 164, - 165, - 166, - 167, - 228, - 229, - 230, - 231, - ], - [ - 40, - 41, - 42, - 43, - 104, - 105, - 106, - 107, - 168, - 169, - 170, - 171, - 232, - 233, - 234, - 235, - ], - [ - 44, - 45, - 46, - 47, - 108, - 109, - 110, - 111, - 172, - 173, - 174, - 175, - 236, - 237, - 238, - 239, - ], - [ - 48, - 49, - 50, - 51, - 112, - 113, - 114, - 115, - 176, - 177, - 178, - 179, - 240, - 241, - 242, - 243, - ], - [ - 52, - 53, - 54, - 55, - 116, - 117, - 118, - 119, - 180, - 181, - 182, - 183, - 244, - 245, - 246, - 247, - ], - [ - 56, - 57, - 58, - 59, - 120, - 121, - 122, - 123, - 184, - 185, - 186, - 187, - 248, - 249, - 250, - 251, - ], - [ - 60, - 61, - 62, - 63, - 124, - 125, - 126, - 127, - 188, - 189, - 190, - 191, - 252, - 253, - 254, - 255, - ], + [ 0, 1, 2, 3, 64, 65, 66, 67,128,129,130,131,192,193,194,195,], + [ 4, 5, 6, 7, 68, 69, 70, 71,132,133,134,135,196,197,198,199,], + [ 8, 9, 10, 11, 72, 73, 74, 75,136,137,138,139,200,201,202,203,], + [ 12, 13, 14, 15, 76, 77, 78, 79,140,141,142,143,204,205,206,207,], + [ 16, 17, 18, 19, 80, 81, 82, 83,144,145,146,147,208,209,210,211,], + [ 20, 21, 22, 23, 84, 85, 86, 87,148,149,150,151,212,213,214,215,], + [ 24, 25, 26, 27, 88, 89, 90, 91,152,153,154,155,216,217,218,219,], + [ 28, 29, 30, 31, 92, 93, 94, 95,156,157,158,159,220,221,222,223,], + [ 32, 33, 34, 35, 96, 97, 98, 99,160,161,162,163,224,225,226,227,], + [ 36, 37, 38, 39,100,101,102,103,164,165,166,167,228,229,230,231,], + [ 40, 41, 42, 43,104,105,106,107,168,169,170,171,232,233,234,235,], + [ 44, 45, 46, 47,108,109,110,111,172,173,174,175,236,237,238,239,], + [ 48, 49, 50, 51,112,113,114,115,176,177,178,179,240,241,242,243,], + [ 52, 53, 54, 55,116,117,118,119,180,181,182,183,244,245,246,247,], + [ 56, 57, 58, 59,120,121,122,123,184,185,186,187,248,249,250,251,], + [ 60, 61, 62, 63,124,125,126,127,188,189,190,191,252,253,254,255,], ], + #fmt: on dtype=TensorTiler2D.DTYPE, ) assert (reference_access == access_order).all() tile1_reference_order = np.array( + #fmt: off [ - [0, 1, 2, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], - [4, 5, 6, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], - [8, 9, 10, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], + [ 0, 1, 2, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], + [ 4, 5, 6, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], + [ 8, 9, 10, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], [12, 13, 14, 15, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], [16, 17, 18, 19, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], [20, 21, 22, 23, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], @@ -172,6 +56,7 @@ def square_tiler_col_major_tensor_tile_chunking_rectangular_col_major_chunks(): [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], ], + #fmt: on dtype=TensorTiler2D.DTYPE, ) diff --git a/test/python/tensortiler2d/square_tiler_col_major_tile.py b/test/python/tensortiler2d/square_tiler_col_major_tile.py index 0eee1e592a..6e79aa18b2 100644 --- a/test/python/tensortiler2d/square_tiler_col_major_tile.py +++ b/test/python/tensortiler2d/square_tiler_col_major_tile.py @@ -12,2191 +12,83 @@ def square_tiler_col_major_tile(): tiler = TensorTiler2D(32, 32, 4, 4, tile_col_major=True) access_order = tiler.access_order() reference_access = np.array( + #fmt: off [ - [ - 0, - 4, - 8, - 12, - 16, - 20, - 24, - 28, - 32, - 36, - 40, - 44, - 48, - 52, - 56, - 60, - 64, - 68, - 72, - 76, - 80, - 84, - 88, - 92, - 96, - 100, - 104, - 108, - 112, - 116, - 120, - 124, - ], - [ - 1, - 5, - 9, - 13, - 17, - 21, - 25, - 29, - 33, - 37, - 41, - 45, - 49, - 53, - 57, - 61, - 65, - 69, - 73, - 77, - 81, - 85, - 89, - 93, - 97, - 101, - 105, - 109, - 113, - 117, - 121, - 125, - ], - [ - 2, - 6, - 10, - 14, - 18, - 22, - 26, - 30, - 34, - 38, - 42, - 46, - 50, - 54, - 58, - 62, - 66, - 70, - 74, - 78, - 82, - 86, - 90, - 94, - 98, - 102, - 106, - 110, - 114, - 118, - 122, - 126, - ], - [ - 3, - 7, - 11, - 15, - 19, - 23, - 27, - 31, - 35, - 39, - 43, - 47, - 51, - 55, - 59, - 63, - 67, - 71, - 75, - 79, - 83, - 87, - 91, - 95, - 99, - 103, - 107, - 111, - 115, - 119, - 123, - 127, - ], - [ - 128, - 132, - 136, - 140, - 144, - 148, - 152, - 156, - 160, - 164, - 168, - 172, - 176, - 180, - 184, - 188, - 192, - 196, - 200, - 204, - 208, - 212, - 216, - 220, - 224, - 228, - 232, - 236, - 240, - 244, - 248, - 252, - ], - [ - 129, - 133, - 137, - 141, - 145, - 149, - 153, - 157, - 161, - 165, - 169, - 173, - 177, - 181, - 185, - 189, - 193, - 197, - 201, - 205, - 209, - 213, - 217, - 221, - 225, - 229, - 233, - 237, - 241, - 245, - 249, - 253, - ], - [ - 130, - 134, - 138, - 142, - 146, - 150, - 154, - 158, - 162, - 166, - 170, - 174, - 178, - 182, - 186, - 190, - 194, - 198, - 202, - 206, - 210, - 214, - 218, - 222, - 226, - 230, - 234, - 238, - 242, - 246, - 250, - 254, - ], - [ - 131, - 135, - 139, - 143, - 147, - 151, - 155, - 159, - 163, - 167, - 171, - 175, - 179, - 183, - 187, - 191, - 195, - 199, - 203, - 207, - 211, - 215, - 219, - 223, - 227, - 231, - 235, - 239, - 243, - 247, - 251, - 255, - ], - [ - 256, - 260, - 264, - 268, - 272, - 276, - 280, - 284, - 288, - 292, - 296, - 300, - 304, - 308, - 312, - 316, - 320, - 324, - 328, - 332, - 336, - 340, - 344, - 348, - 352, - 356, - 360, - 364, - 368, - 372, - 376, - 380, - ], - [ - 257, - 261, - 265, - 269, - 273, - 277, - 281, - 285, - 289, - 293, - 297, - 301, - 305, - 309, - 313, - 317, - 321, - 325, - 329, - 333, - 337, - 341, - 345, - 349, - 353, - 357, - 361, - 365, - 369, - 373, - 377, - 381, - ], - [ - 258, - 262, - 266, - 270, - 274, - 278, - 282, - 286, - 290, - 294, - 298, - 302, - 306, - 310, - 314, - 318, - 322, - 326, - 330, - 334, - 338, - 342, - 346, - 350, - 354, - 358, - 362, - 366, - 370, - 374, - 378, - 382, - ], - [ - 259, - 263, - 267, - 271, - 275, - 279, - 283, - 287, - 291, - 295, - 299, - 303, - 307, - 311, - 315, - 319, - 323, - 327, - 331, - 335, - 339, - 343, - 347, - 351, - 355, - 359, - 363, - 367, - 371, - 375, - 379, - 383, - ], - [ - 384, - 388, - 392, - 396, - 400, - 404, - 408, - 412, - 416, - 420, - 424, - 428, - 432, - 436, - 440, - 444, - 448, - 452, - 456, - 460, - 464, - 468, - 472, - 476, - 480, - 484, - 488, - 492, - 496, - 500, - 504, - 508, - ], - [ - 385, - 389, - 393, - 397, - 401, - 405, - 409, - 413, - 417, - 421, - 425, - 429, - 433, - 437, - 441, - 445, - 449, - 453, - 457, - 461, - 465, - 469, - 473, - 477, - 481, - 485, - 489, - 493, - 497, - 501, - 505, - 509, - ], - [ - 386, - 390, - 394, - 398, - 402, - 406, - 410, - 414, - 418, - 422, - 426, - 430, - 434, - 438, - 442, - 446, - 450, - 454, - 458, - 462, - 466, - 470, - 474, - 478, - 482, - 486, - 490, - 494, - 498, - 502, - 506, - 510, - ], - [ - 387, - 391, - 395, - 399, - 403, - 407, - 411, - 415, - 419, - 423, - 427, - 431, - 435, - 439, - 443, - 447, - 451, - 455, - 459, - 463, - 467, - 471, - 475, - 479, - 483, - 487, - 491, - 495, - 499, - 503, - 507, - 511, - ], - [ - 512, - 516, - 520, - 524, - 528, - 532, - 536, - 540, - 544, - 548, - 552, - 556, - 560, - 564, - 568, - 572, - 576, - 580, - 584, - 588, - 592, - 596, - 600, - 604, - 608, - 612, - 616, - 620, - 624, - 628, - 632, - 636, - ], - [ - 513, - 517, - 521, - 525, - 529, - 533, - 537, - 541, - 545, - 549, - 553, - 557, - 561, - 565, - 569, - 573, - 577, - 581, - 585, - 589, - 593, - 597, - 601, - 605, - 609, - 613, - 617, - 621, - 625, - 629, - 633, - 637, - ], - [ - 514, - 518, - 522, - 526, - 530, - 534, - 538, - 542, - 546, - 550, - 554, - 558, - 562, - 566, - 570, - 574, - 578, - 582, - 586, - 590, - 594, - 598, - 602, - 606, - 610, - 614, - 618, - 622, - 626, - 630, - 634, - 638, - ], - [ - 515, - 519, - 523, - 527, - 531, - 535, - 539, - 543, - 547, - 551, - 555, - 559, - 563, - 567, - 571, - 575, - 579, - 583, - 587, - 591, - 595, - 599, - 603, - 607, - 611, - 615, - 619, - 623, - 627, - 631, - 635, - 639, - ], - [ - 640, - 644, - 648, - 652, - 656, - 660, - 664, - 668, - 672, - 676, - 680, - 684, - 688, - 692, - 696, - 700, - 704, - 708, - 712, - 716, - 720, - 724, - 728, - 732, - 736, - 740, - 744, - 748, - 752, - 756, - 760, - 764, - ], - [ - 641, - 645, - 649, - 653, - 657, - 661, - 665, - 669, - 673, - 677, - 681, - 685, - 689, - 693, - 697, - 701, - 705, - 709, - 713, - 717, - 721, - 725, - 729, - 733, - 737, - 741, - 745, - 749, - 753, - 757, - 761, - 765, - ], - [ - 642, - 646, - 650, - 654, - 658, - 662, - 666, - 670, - 674, - 678, - 682, - 686, - 690, - 694, - 698, - 702, - 706, - 710, - 714, - 718, - 722, - 726, - 730, - 734, - 738, - 742, - 746, - 750, - 754, - 758, - 762, - 766, - ], - [ - 643, - 647, - 651, - 655, - 659, - 663, - 667, - 671, - 675, - 679, - 683, - 687, - 691, - 695, - 699, - 703, - 707, - 711, - 715, - 719, - 723, - 727, - 731, - 735, - 739, - 743, - 747, - 751, - 755, - 759, - 763, - 767, - ], - [ - 768, - 772, - 776, - 780, - 784, - 788, - 792, - 796, - 800, - 804, - 808, - 812, - 816, - 820, - 824, - 828, - 832, - 836, - 840, - 844, - 848, - 852, - 856, - 860, - 864, - 868, - 872, - 876, - 880, - 884, - 888, - 892, - ], - [ - 769, - 773, - 777, - 781, - 785, - 789, - 793, - 797, - 801, - 805, - 809, - 813, - 817, - 821, - 825, - 829, - 833, - 837, - 841, - 845, - 849, - 853, - 857, - 861, - 865, - 869, - 873, - 877, - 881, - 885, - 889, - 893, - ], - [ - 770, - 774, - 778, - 782, - 786, - 790, - 794, - 798, - 802, - 806, - 810, - 814, - 818, - 822, - 826, - 830, - 834, - 838, - 842, - 846, - 850, - 854, - 858, - 862, - 866, - 870, - 874, - 878, - 882, - 886, - 890, - 894, - ], - [ - 771, - 775, - 779, - 783, - 787, - 791, - 795, - 799, - 803, - 807, - 811, - 815, - 819, - 823, - 827, - 831, - 835, - 839, - 843, - 847, - 851, - 855, - 859, - 863, - 867, - 871, - 875, - 879, - 883, - 887, - 891, - 895, - ], - [ - 896, - 900, - 904, - 908, - 912, - 916, - 920, - 924, - 928, - 932, - 936, - 940, - 944, - 948, - 952, - 956, - 960, - 964, - 968, - 972, - 976, - 980, - 984, - 988, - 992, - 996, - 1000, - 1004, - 1008, - 1012, - 1016, - 1020, - ], - [ - 897, - 901, - 905, - 909, - 913, - 917, - 921, - 925, - 929, - 933, - 937, - 941, - 945, - 949, - 953, - 957, - 961, - 965, - 969, - 973, - 977, - 981, - 985, - 989, - 993, - 997, - 1001, - 1005, - 1009, - 1013, - 1017, - 1021, - ], - [ - 898, - 902, - 906, - 910, - 914, - 918, - 922, - 926, - 930, - 934, - 938, - 942, - 946, - 950, - 954, - 958, - 962, - 966, - 970, - 974, - 978, - 982, - 986, - 990, - 994, - 998, - 1002, - 1006, - 1010, - 1014, - 1018, - 1022, - ], - [ - 899, - 903, - 907, - 911, - 915, - 919, - 923, - 927, - 931, - 935, - 939, - 943, - 947, - 951, - 955, - 959, - 963, - 967, - 971, - 975, - 979, - 983, - 987, - 991, - 995, - 999, - 1003, - 1007, - 1011, - 1015, - 1019, - 1023, - ], + [ 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60, 64, 68, 72, 76, 80, 84, 88, 92, 96, 100, 104, 108, 112, 116, 120, 124,], + [ 1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 97, 101, 105, 109, 113, 117, 121, 125,], + [ 2, 6, 10, 14, 18, 22, 26, 30, 34, 38, 42, 46, 50, 54, 58, 62, 66, 70, 74, 78, 82, 86, 90, 94, 98, 102, 106, 110, 114, 118, 122, 126,], + [ 3, 7, 11, 15, 19, 23, 27, 31, 35, 39, 43, 47, 51, 55, 59, 63, 67, 71, 75, 79, 83, 87, 91, 95, 99, 103, 107, 111, 115, 119, 123, 127,], + [ 128, 132, 136, 140, 144, 148, 152, 156, 160, 164, 168, 172, 176, 180, 184, 188, 192, 196, 200, 204, 208, 212, 216, 220, 224, 228, 232, 236, 240, 244, 248, 252,], + [ 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, 237, 241, 245, 249, 253,], + [ 130, 134, 138, 142, 146, 150, 154, 158, 162, 166, 170, 174, 178, 182, 186, 190, 194, 198, 202, 206, 210, 214, 218, 222, 226, 230, 234, 238, 242, 246, 250, 254,], + [ 131, 135, 139, 143, 147, 151, 155, 159, 163, 167, 171, 175, 179, 183, 187, 191, 195, 199, 203, 207, 211, 215, 219, 223, 227, 231, 235, 239, 243, 247, 251, 255,], + [ 256, 260, 264, 268, 272, 276, 280, 284, 288, 292, 296, 300, 304, 308, 312, 316, 320, 324, 328, 332, 336, 340, 344, 348, 352, 356, 360, 364, 368, 372, 376, 380,], + [ 257, 261, 265, 269, 273, 277, 281, 285, 289, 293, 297, 301, 305, 309, 313, 317, 321, 325, 329, 333, 337, 341, 345, 349, 353, 357, 361, 365, 369, 373, 377, 381,], + [ 258, 262, 266, 270, 274, 278, 282, 286, 290, 294, 298, 302, 306, 310, 314, 318, 322, 326, 330, 334, 338, 342, 346, 350, 354, 358, 362, 366, 370, 374, 378, 382,], + [ 259, 263, 267, 271, 275, 279, 283, 287, 291, 295, 299, 303, 307, 311, 315, 319, 323, 327, 331, 335, 339, 343, 347, 351, 355, 359, 363, 367, 371, 375, 379, 383,], + [ 384, 388, 392, 396, 400, 404, 408, 412, 416, 420, 424, 428, 432, 436, 440, 444, 448, 452, 456, 460, 464, 468, 472, 476, 480, 484, 488, 492, 496, 500, 504, 508,], + [ 385, 389, 393, 397, 401, 405, 409, 413, 417, 421, 425, 429, 433, 437, 441, 445, 449, 453, 457, 461, 465, 469, 473, 477, 481, 485, 489, 493, 497, 501, 505, 509,], + [ 386, 390, 394, 398, 402, 406, 410, 414, 418, 422, 426, 430, 434, 438, 442, 446, 450, 454, 458, 462, 466, 470, 474, 478, 482, 486, 490, 494, 498, 502, 506, 510,], + [ 387, 391, 395, 399, 403, 407, 411, 415, 419, 423, 427, 431, 435, 439, 443, 447, 451, 455, 459, 463, 467, 471, 475, 479, 483, 487, 491, 495, 499, 503, 507, 511,], + [ 512, 516, 520, 524, 528, 532, 536, 540, 544, 548, 552, 556, 560, 564, 568, 572, 576, 580, 584, 588, 592, 596, 600, 604, 608, 612, 616, 620, 624, 628, 632, 636,], + [ 513, 517, 521, 525, 529, 533, 537, 541, 545, 549, 553, 557, 561, 565, 569, 573, 577, 581, 585, 589, 593, 597, 601, 605, 609, 613, 617, 621, 625, 629, 633, 637,], + [ 514, 518, 522, 526, 530, 534, 538, 542, 546, 550, 554, 558, 562, 566, 570, 574, 578, 582, 586, 590, 594, 598, 602, 606, 610, 614, 618, 622, 626, 630, 634, 638,], + [ 515, 519, 523, 527, 531, 535, 539, 543, 547, 551, 555, 559, 563, 567, 571, 575, 579, 583, 587, 591, 595, 599, 603, 607, 611, 615, 619, 623, 627, 631, 635, 639,], + [ 640, 644, 648, 652, 656, 660, 664, 668, 672, 676, 680, 684, 688, 692, 696, 700, 704, 708, 712, 716, 720, 724, 728, 732, 736, 740, 744, 748, 752, 756, 760, 764,], + [ 641, 645, 649, 653, 657, 661, 665, 669, 673, 677, 681, 685, 689, 693, 697, 701, 705, 709, 713, 717, 721, 725, 729, 733, 737, 741, 745, 749, 753, 757, 761, 765,], + [ 642, 646, 650, 654, 658, 662, 666, 670, 674, 678, 682, 686, 690, 694, 698, 702, 706, 710, 714, 718, 722, 726, 730, 734, 738, 742, 746, 750, 754, 758, 762, 766,], + [ 643, 647, 651, 655, 659, 663, 667, 671, 675, 679, 683, 687, 691, 695, 699, 703, 707, 711, 715, 719, 723, 727, 731, 735, 739, 743, 747, 751, 755, 759, 763, 767,], + [ 768, 772, 776, 780, 784, 788, 792, 796, 800, 804, 808, 812, 816, 820, 824, 828, 832, 836, 840, 844, 848, 852, 856, 860, 864, 868, 872, 876, 880, 884, 888, 892,], + [ 769, 773, 777, 781, 785, 789, 793, 797, 801, 805, 809, 813, 817, 821, 825, 829, 833, 837, 841, 845, 849, 853, 857, 861, 865, 869, 873, 877, 881, 885, 889, 893,], + [ 770, 774, 778, 782, 786, 790, 794, 798, 802, 806, 810, 814, 818, 822, 826, 830, 834, 838, 842, 846, 850, 854, 858, 862, 866, 870, 874, 878, 882, 886, 890, 894,], + [ 771, 775, 779, 783, 787, 791, 795, 799, 803, 807, 811, 815, 819, 823, 827, 831, 835, 839, 843, 847, 851, 855, 859, 863, 867, 871, 875, 879, 883, 887, 891, 895,], + [ 896, 900, 904, 908, 912, 916, 920, 924, 928, 932, 936, 940, 944, 948, 952, 956, 960, 964, 968, 972, 976, 980, 984, 988, 992, 996,1000,1004,1008,1012,1016,1020,], + [ 897, 901, 905, 909, 913, 917, 921, 925, 929, 933, 937, 941, 945, 949, 953, 957, 961, 965, 969, 973, 977, 981, 985, 989, 993, 997,1001,1005,1009,1013,1017,1021,], + [ 898, 902, 906, 910, 914, 918, 922, 926, 930, 934, 938, 942, 946, 950, 954, 958, 962, 966, 970, 974, 978, 982, 986, 990, 994, 998,1002,1006,1010,1014,1018,1022,], + [ 899, 903, 907, 911, 915, 919, 923, 927, 931, 935, 939, 943, 947, 951, 955, 959, 963, 967, 971, 975, 979, 983, 987, 991, 995, 999,1003,1007,1011,1015,1019,1023,], ], + #fmt: on dtype=TensorTiler2D.DTYPE, ) assert (reference_access == access_order).all() tile1_reference_order = np.array( + #fmt: off [ - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - 0, - 4, - 8, - 12, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - 1, - 5, - 9, - 13, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - 2, - 6, - 10, - 14, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - 3, - 7, - 11, - 15, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 4, 8, 12, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 5, 9, 13, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 2, 6, 10, 14, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 3, 7, 11, 15, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], ], + #fmt: on dtype=TensorTiler2D.DTYPE, ) diff --git a/test/python/tensortiler2d/square_tiler_col_major_tile_and_tensor.py b/test/python/tensortiler2d/square_tiler_col_major_tile_and_tensor.py index 08a2ba78ae..77afaefd71 100644 --- a/test/python/tensortiler2d/square_tiler_col_major_tile_and_tensor.py +++ b/test/python/tensortiler2d/square_tiler_col_major_tile_and_tensor.py @@ -12,2191 +12,83 @@ def square_tiler_col_major_tile_and_tensor(): tiler = TensorTiler2D(32, 32, 4, 4, tensor_col_major=True, tile_col_major=True) access_order = tiler.access_order() reference_access = np.array( + #fmt: off [ - [ - 0, - 4, - 8, - 12, - 128, - 132, - 136, - 140, - 256, - 260, - 264, - 268, - 384, - 388, - 392, - 396, - 512, - 516, - 520, - 524, - 640, - 644, - 648, - 652, - 768, - 772, - 776, - 780, - 896, - 900, - 904, - 908, - ], - [ - 1, - 5, - 9, - 13, - 129, - 133, - 137, - 141, - 257, - 261, - 265, - 269, - 385, - 389, - 393, - 397, - 513, - 517, - 521, - 525, - 641, - 645, - 649, - 653, - 769, - 773, - 777, - 781, - 897, - 901, - 905, - 909, - ], - [ - 2, - 6, - 10, - 14, - 130, - 134, - 138, - 142, - 258, - 262, - 266, - 270, - 386, - 390, - 394, - 398, - 514, - 518, - 522, - 526, - 642, - 646, - 650, - 654, - 770, - 774, - 778, - 782, - 898, - 902, - 906, - 910, - ], - [ - 3, - 7, - 11, - 15, - 131, - 135, - 139, - 143, - 259, - 263, - 267, - 271, - 387, - 391, - 395, - 399, - 515, - 519, - 523, - 527, - 643, - 647, - 651, - 655, - 771, - 775, - 779, - 783, - 899, - 903, - 907, - 911, - ], - [ - 16, - 20, - 24, - 28, - 144, - 148, - 152, - 156, - 272, - 276, - 280, - 284, - 400, - 404, - 408, - 412, - 528, - 532, - 536, - 540, - 656, - 660, - 664, - 668, - 784, - 788, - 792, - 796, - 912, - 916, - 920, - 924, - ], - [ - 17, - 21, - 25, - 29, - 145, - 149, - 153, - 157, - 273, - 277, - 281, - 285, - 401, - 405, - 409, - 413, - 529, - 533, - 537, - 541, - 657, - 661, - 665, - 669, - 785, - 789, - 793, - 797, - 913, - 917, - 921, - 925, - ], - [ - 18, - 22, - 26, - 30, - 146, - 150, - 154, - 158, - 274, - 278, - 282, - 286, - 402, - 406, - 410, - 414, - 530, - 534, - 538, - 542, - 658, - 662, - 666, - 670, - 786, - 790, - 794, - 798, - 914, - 918, - 922, - 926, - ], - [ - 19, - 23, - 27, - 31, - 147, - 151, - 155, - 159, - 275, - 279, - 283, - 287, - 403, - 407, - 411, - 415, - 531, - 535, - 539, - 543, - 659, - 663, - 667, - 671, - 787, - 791, - 795, - 799, - 915, - 919, - 923, - 927, - ], - [ - 32, - 36, - 40, - 44, - 160, - 164, - 168, - 172, - 288, - 292, - 296, - 300, - 416, - 420, - 424, - 428, - 544, - 548, - 552, - 556, - 672, - 676, - 680, - 684, - 800, - 804, - 808, - 812, - 928, - 932, - 936, - 940, - ], - [ - 33, - 37, - 41, - 45, - 161, - 165, - 169, - 173, - 289, - 293, - 297, - 301, - 417, - 421, - 425, - 429, - 545, - 549, - 553, - 557, - 673, - 677, - 681, - 685, - 801, - 805, - 809, - 813, - 929, - 933, - 937, - 941, - ], - [ - 34, - 38, - 42, - 46, - 162, - 166, - 170, - 174, - 290, - 294, - 298, - 302, - 418, - 422, - 426, - 430, - 546, - 550, - 554, - 558, - 674, - 678, - 682, - 686, - 802, - 806, - 810, - 814, - 930, - 934, - 938, - 942, - ], - [ - 35, - 39, - 43, - 47, - 163, - 167, - 171, - 175, - 291, - 295, - 299, - 303, - 419, - 423, - 427, - 431, - 547, - 551, - 555, - 559, - 675, - 679, - 683, - 687, - 803, - 807, - 811, - 815, - 931, - 935, - 939, - 943, - ], - [ - 48, - 52, - 56, - 60, - 176, - 180, - 184, - 188, - 304, - 308, - 312, - 316, - 432, - 436, - 440, - 444, - 560, - 564, - 568, - 572, - 688, - 692, - 696, - 700, - 816, - 820, - 824, - 828, - 944, - 948, - 952, - 956, - ], - [ - 49, - 53, - 57, - 61, - 177, - 181, - 185, - 189, - 305, - 309, - 313, - 317, - 433, - 437, - 441, - 445, - 561, - 565, - 569, - 573, - 689, - 693, - 697, - 701, - 817, - 821, - 825, - 829, - 945, - 949, - 953, - 957, - ], - [ - 50, - 54, - 58, - 62, - 178, - 182, - 186, - 190, - 306, - 310, - 314, - 318, - 434, - 438, - 442, - 446, - 562, - 566, - 570, - 574, - 690, - 694, - 698, - 702, - 818, - 822, - 826, - 830, - 946, - 950, - 954, - 958, - ], - [ - 51, - 55, - 59, - 63, - 179, - 183, - 187, - 191, - 307, - 311, - 315, - 319, - 435, - 439, - 443, - 447, - 563, - 567, - 571, - 575, - 691, - 695, - 699, - 703, - 819, - 823, - 827, - 831, - 947, - 951, - 955, - 959, - ], - [ - 64, - 68, - 72, - 76, - 192, - 196, - 200, - 204, - 320, - 324, - 328, - 332, - 448, - 452, - 456, - 460, - 576, - 580, - 584, - 588, - 704, - 708, - 712, - 716, - 832, - 836, - 840, - 844, - 960, - 964, - 968, - 972, - ], - [ - 65, - 69, - 73, - 77, - 193, - 197, - 201, - 205, - 321, - 325, - 329, - 333, - 449, - 453, - 457, - 461, - 577, - 581, - 585, - 589, - 705, - 709, - 713, - 717, - 833, - 837, - 841, - 845, - 961, - 965, - 969, - 973, - ], - [ - 66, - 70, - 74, - 78, - 194, - 198, - 202, - 206, - 322, - 326, - 330, - 334, - 450, - 454, - 458, - 462, - 578, - 582, - 586, - 590, - 706, - 710, - 714, - 718, - 834, - 838, - 842, - 846, - 962, - 966, - 970, - 974, - ], - [ - 67, - 71, - 75, - 79, - 195, - 199, - 203, - 207, - 323, - 327, - 331, - 335, - 451, - 455, - 459, - 463, - 579, - 583, - 587, - 591, - 707, - 711, - 715, - 719, - 835, - 839, - 843, - 847, - 963, - 967, - 971, - 975, - ], - [ - 80, - 84, - 88, - 92, - 208, - 212, - 216, - 220, - 336, - 340, - 344, - 348, - 464, - 468, - 472, - 476, - 592, - 596, - 600, - 604, - 720, - 724, - 728, - 732, - 848, - 852, - 856, - 860, - 976, - 980, - 984, - 988, - ], - [ - 81, - 85, - 89, - 93, - 209, - 213, - 217, - 221, - 337, - 341, - 345, - 349, - 465, - 469, - 473, - 477, - 593, - 597, - 601, - 605, - 721, - 725, - 729, - 733, - 849, - 853, - 857, - 861, - 977, - 981, - 985, - 989, - ], - [ - 82, - 86, - 90, - 94, - 210, - 214, - 218, - 222, - 338, - 342, - 346, - 350, - 466, - 470, - 474, - 478, - 594, - 598, - 602, - 606, - 722, - 726, - 730, - 734, - 850, - 854, - 858, - 862, - 978, - 982, - 986, - 990, - ], - [ - 83, - 87, - 91, - 95, - 211, - 215, - 219, - 223, - 339, - 343, - 347, - 351, - 467, - 471, - 475, - 479, - 595, - 599, - 603, - 607, - 723, - 727, - 731, - 735, - 851, - 855, - 859, - 863, - 979, - 983, - 987, - 991, - ], - [ - 96, - 100, - 104, - 108, - 224, - 228, - 232, - 236, - 352, - 356, - 360, - 364, - 480, - 484, - 488, - 492, - 608, - 612, - 616, - 620, - 736, - 740, - 744, - 748, - 864, - 868, - 872, - 876, - 992, - 996, - 1000, - 1004, - ], - [ - 97, - 101, - 105, - 109, - 225, - 229, - 233, - 237, - 353, - 357, - 361, - 365, - 481, - 485, - 489, - 493, - 609, - 613, - 617, - 621, - 737, - 741, - 745, - 749, - 865, - 869, - 873, - 877, - 993, - 997, - 1001, - 1005, - ], - [ - 98, - 102, - 106, - 110, - 226, - 230, - 234, - 238, - 354, - 358, - 362, - 366, - 482, - 486, - 490, - 494, - 610, - 614, - 618, - 622, - 738, - 742, - 746, - 750, - 866, - 870, - 874, - 878, - 994, - 998, - 1002, - 1006, - ], - [ - 99, - 103, - 107, - 111, - 227, - 231, - 235, - 239, - 355, - 359, - 363, - 367, - 483, - 487, - 491, - 495, - 611, - 615, - 619, - 623, - 739, - 743, - 747, - 751, - 867, - 871, - 875, - 879, - 995, - 999, - 1003, - 1007, - ], - [ - 112, - 116, - 120, - 124, - 240, - 244, - 248, - 252, - 368, - 372, - 376, - 380, - 496, - 500, - 504, - 508, - 624, - 628, - 632, - 636, - 752, - 756, - 760, - 764, - 880, - 884, - 888, - 892, - 1008, - 1012, - 1016, - 1020, - ], - [ - 113, - 117, - 121, - 125, - 241, - 245, - 249, - 253, - 369, - 373, - 377, - 381, - 497, - 501, - 505, - 509, - 625, - 629, - 633, - 637, - 753, - 757, - 761, - 765, - 881, - 885, - 889, - 893, - 1009, - 1013, - 1017, - 1021, - ], - [ - 114, - 118, - 122, - 126, - 242, - 246, - 250, - 254, - 370, - 374, - 378, - 382, - 498, - 502, - 506, - 510, - 626, - 630, - 634, - 638, - 754, - 758, - 762, - 766, - 882, - 886, - 890, - 894, - 1010, - 1014, - 1018, - 1022, - ], - [ - 115, - 119, - 123, - 127, - 243, - 247, - 251, - 255, - 371, - 375, - 379, - 383, - 499, - 503, - 507, - 511, - 627, - 631, - 635, - 639, - 755, - 759, - 763, - 767, - 883, - 887, - 891, - 895, - 1011, - 1015, - 1019, - 1023, - ], + [ 0, 4, 8, 12, 128, 132, 136, 140, 256, 260, 264, 268, 384, 388, 392, 396, 512, 516, 520, 524, 640, 644, 648, 652, 768, 772, 776, 780, 896, 900, 904, 908,], + [ 1, 5, 9, 13, 129, 133, 137, 141, 257, 261, 265, 269, 385, 389, 393, 397, 513, 517, 521, 525, 641, 645, 649, 653, 769, 773, 777, 781, 897, 901, 905, 909,], + [ 2, 6, 10, 14, 130, 134, 138, 142, 258, 262, 266, 270, 386, 390, 394, 398, 514, 518, 522, 526, 642, 646, 650, 654, 770, 774, 778, 782, 898, 902, 906, 910,], + [ 3, 7, 11, 15, 131, 135, 139, 143, 259, 263, 267, 271, 387, 391, 395, 399, 515, 519, 523, 527, 643, 647, 651, 655, 771, 775, 779, 783, 899, 903, 907, 911,], + [ 16, 20, 24, 28, 144, 148, 152, 156, 272, 276, 280, 284, 400, 404, 408, 412, 528, 532, 536, 540, 656, 660, 664, 668, 784, 788, 792, 796, 912, 916, 920, 924,], + [ 17, 21, 25, 29, 145, 149, 153, 157, 273, 277, 281, 285, 401, 405, 409, 413, 529, 533, 537, 541, 657, 661, 665, 669, 785, 789, 793, 797, 913, 917, 921, 925,], + [ 18, 22, 26, 30, 146, 150, 154, 158, 274, 278, 282, 286, 402, 406, 410, 414, 530, 534, 538, 542, 658, 662, 666, 670, 786, 790, 794, 798, 914, 918, 922, 926,], + [ 19, 23, 27, 31, 147, 151, 155, 159, 275, 279, 283, 287, 403, 407, 411, 415, 531, 535, 539, 543, 659, 663, 667, 671, 787, 791, 795, 799, 915, 919, 923, 927,], + [ 32, 36, 40, 44, 160, 164, 168, 172, 288, 292, 296, 300, 416, 420, 424, 428, 544, 548, 552, 556, 672, 676, 680, 684, 800, 804, 808, 812, 928, 932, 936, 940,], + [ 33, 37, 41, 45, 161, 165, 169, 173, 289, 293, 297, 301, 417, 421, 425, 429, 545, 549, 553, 557, 673, 677, 681, 685, 801, 805, 809, 813, 929, 933, 937, 941,], + [ 34, 38, 42, 46, 162, 166, 170, 174, 290, 294, 298, 302, 418, 422, 426, 430, 546, 550, 554, 558, 674, 678, 682, 686, 802, 806, 810, 814, 930, 934, 938, 942,], + [ 35, 39, 43, 47, 163, 167, 171, 175, 291, 295, 299, 303, 419, 423, 427, 431, 547, 551, 555, 559, 675, 679, 683, 687, 803, 807, 811, 815, 931, 935, 939, 943,], + [ 48, 52, 56, 60, 176, 180, 184, 188, 304, 308, 312, 316, 432, 436, 440, 444, 560, 564, 568, 572, 688, 692, 696, 700, 816, 820, 824, 828, 944, 948, 952, 956,], + [ 49, 53, 57, 61, 177, 181, 185, 189, 305, 309, 313, 317, 433, 437, 441, 445, 561, 565, 569, 573, 689, 693, 697, 701, 817, 821, 825, 829, 945, 949, 953, 957,], + [ 50, 54, 58, 62, 178, 182, 186, 190, 306, 310, 314, 318, 434, 438, 442, 446, 562, 566, 570, 574, 690, 694, 698, 702, 818, 822, 826, 830, 946, 950, 954, 958,], + [ 51, 55, 59, 63, 179, 183, 187, 191, 307, 311, 315, 319, 435, 439, 443, 447, 563, 567, 571, 575, 691, 695, 699, 703, 819, 823, 827, 831, 947, 951, 955, 959,], + [ 64, 68, 72, 76, 192, 196, 200, 204, 320, 324, 328, 332, 448, 452, 456, 460, 576, 580, 584, 588, 704, 708, 712, 716, 832, 836, 840, 844, 960, 964, 968, 972,], + [ 65, 69, 73, 77, 193, 197, 201, 205, 321, 325, 329, 333, 449, 453, 457, 461, 577, 581, 585, 589, 705, 709, 713, 717, 833, 837, 841, 845, 961, 965, 969, 973,], + [ 66, 70, 74, 78, 194, 198, 202, 206, 322, 326, 330, 334, 450, 454, 458, 462, 578, 582, 586, 590, 706, 710, 714, 718, 834, 838, 842, 846, 962, 966, 970, 974,], + [ 67, 71, 75, 79, 195, 199, 203, 207, 323, 327, 331, 335, 451, 455, 459, 463, 579, 583, 587, 591, 707, 711, 715, 719, 835, 839, 843, 847, 963, 967, 971, 975,], + [ 80, 84, 88, 92, 208, 212, 216, 220, 336, 340, 344, 348, 464, 468, 472, 476, 592, 596, 600, 604, 720, 724, 728, 732, 848, 852, 856, 860, 976, 980, 984, 988,], + [ 81, 85, 89, 93, 209, 213, 217, 221, 337, 341, 345, 349, 465, 469, 473, 477, 593, 597, 601, 605, 721, 725, 729, 733, 849, 853, 857, 861, 977, 981, 985, 989,], + [ 82, 86, 90, 94, 210, 214, 218, 222, 338, 342, 346, 350, 466, 470, 474, 478, 594, 598, 602, 606, 722, 726, 730, 734, 850, 854, 858, 862, 978, 982, 986, 990,], + [ 83, 87, 91, 95, 211, 215, 219, 223, 339, 343, 347, 351, 467, 471, 475, 479, 595, 599, 603, 607, 723, 727, 731, 735, 851, 855, 859, 863, 979, 983, 987, 991,], + [ 96, 100, 104, 108, 224, 228, 232, 236, 352, 356, 360, 364, 480, 484, 488, 492, 608, 612, 616, 620, 736, 740, 744, 748, 864, 868, 872, 876, 992, 996,1000,1004,], + [ 97, 101, 105, 109, 225, 229, 233, 237, 353, 357, 361, 365, 481, 485, 489, 493, 609, 613, 617, 621, 737, 741, 745, 749, 865, 869, 873, 877, 993, 997,1001,1005,], + [ 98, 102, 106, 110, 226, 230, 234, 238, 354, 358, 362, 366, 482, 486, 490, 494, 610, 614, 618, 622, 738, 742, 746, 750, 866, 870, 874, 878, 994, 998,1002,1006,], + [ 99, 103, 107, 111, 227, 231, 235, 239, 355, 359, 363, 367, 483, 487, 491, 495, 611, 615, 619, 623, 739, 743, 747, 751, 867, 871, 875, 879, 995, 999,1003,1007,], + [ 112, 116, 120, 124, 240, 244, 248, 252, 368, 372, 376, 380, 496, 500, 504, 508, 624, 628, 632, 636, 752, 756, 760, 764, 880, 884, 888, 892,1008,1012,1016,1020,], + [ 113, 117, 121, 125, 241, 245, 249, 253, 369, 373, 377, 381, 497, 501, 505, 509, 625, 629, 633, 637, 753, 757, 761, 765, 881, 885, 889, 893,1009,1013,1017,1021,], + [ 114, 118, 122, 126, 242, 246, 250, 254, 370, 374, 378, 382, 498, 502, 506, 510, 626, 630, 634, 638, 754, 758, 762, 766, 882, 886, 890, 894,1010,1014,1018,1022,], + [ 115, 119, 123, 127, 243, 247, 251, 255, 371, 375, 379, 383, 499, 503, 507, 511, 627, 631, 635, 639, 755, 759, 763, 767, 883, 887, 891, 895,1011,1015,1019,1023,], ], + #fmt: on dtype=TensorTiler2D.DTYPE, ) assert (reference_access == access_order).all() tile1_reference_order = np.array( + #fmt: off [ - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - 0, - 4, - 8, - 12, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - 1, - 5, - 9, - 13, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - 2, - 6, - 10, - 14, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - 3, - 7, - 11, - 15, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 4, 8, 12,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 5, 9, 13,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 2, 6, 10, 14,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 3, 7, 11, 15,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], ], + #fmt: on dtype=TensorTiler2D.DTYPE, ) diff --git a/test/python/tensortiler2d/square_tiler_tile_chunking.py b/test/python/tensortiler2d/square_tiler_tile_chunking.py index 6d16df3979..95f0793e24 100644 --- a/test/python/tensortiler2d/square_tiler_tile_chunking.py +++ b/test/python/tensortiler2d/square_tiler_tile_chunking.py @@ -12,2191 +12,83 @@ def square_tiler_tile_chunking(): tiler = TensorTiler2D(32, 32, 8, 8) access_order = tiler.access_order() reference_access = np.array( + #fmt: off [ - [ - 0, - 1, - 2, - 3, - 4, - 5, - 6, - 7, - 64, - 65, - 66, - 67, - 68, - 69, - 70, - 71, - 128, - 129, - 130, - 131, - 132, - 133, - 134, - 135, - 192, - 193, - 194, - 195, - 196, - 197, - 198, - 199, - ], - [ - 8, - 9, - 10, - 11, - 12, - 13, - 14, - 15, - 72, - 73, - 74, - 75, - 76, - 77, - 78, - 79, - 136, - 137, - 138, - 139, - 140, - 141, - 142, - 143, - 200, - 201, - 202, - 203, - 204, - 205, - 206, - 207, - ], - [ - 16, - 17, - 18, - 19, - 20, - 21, - 22, - 23, - 80, - 81, - 82, - 83, - 84, - 85, - 86, - 87, - 144, - 145, - 146, - 147, - 148, - 149, - 150, - 151, - 208, - 209, - 210, - 211, - 212, - 213, - 214, - 215, - ], - [ - 24, - 25, - 26, - 27, - 28, - 29, - 30, - 31, - 88, - 89, - 90, - 91, - 92, - 93, - 94, - 95, - 152, - 153, - 154, - 155, - 156, - 157, - 158, - 159, - 216, - 217, - 218, - 219, - 220, - 221, - 222, - 223, - ], - [ - 32, - 33, - 34, - 35, - 36, - 37, - 38, - 39, - 96, - 97, - 98, - 99, - 100, - 101, - 102, - 103, - 160, - 161, - 162, - 163, - 164, - 165, - 166, - 167, - 224, - 225, - 226, - 227, - 228, - 229, - 230, - 231, - ], - [ - 40, - 41, - 42, - 43, - 44, - 45, - 46, - 47, - 104, - 105, - 106, - 107, - 108, - 109, - 110, - 111, - 168, - 169, - 170, - 171, - 172, - 173, - 174, - 175, - 232, - 233, - 234, - 235, - 236, - 237, - 238, - 239, - ], - [ - 48, - 49, - 50, - 51, - 52, - 53, - 54, - 55, - 112, - 113, - 114, - 115, - 116, - 117, - 118, - 119, - 176, - 177, - 178, - 179, - 180, - 181, - 182, - 183, - 240, - 241, - 242, - 243, - 244, - 245, - 246, - 247, - ], - [ - 56, - 57, - 58, - 59, - 60, - 61, - 62, - 63, - 120, - 121, - 122, - 123, - 124, - 125, - 126, - 127, - 184, - 185, - 186, - 187, - 188, - 189, - 190, - 191, - 248, - 249, - 250, - 251, - 252, - 253, - 254, - 255, - ], - [ - 256, - 257, - 258, - 259, - 260, - 261, - 262, - 263, - 320, - 321, - 322, - 323, - 324, - 325, - 326, - 327, - 384, - 385, - 386, - 387, - 388, - 389, - 390, - 391, - 448, - 449, - 450, - 451, - 452, - 453, - 454, - 455, - ], - [ - 264, - 265, - 266, - 267, - 268, - 269, - 270, - 271, - 328, - 329, - 330, - 331, - 332, - 333, - 334, - 335, - 392, - 393, - 394, - 395, - 396, - 397, - 398, - 399, - 456, - 457, - 458, - 459, - 460, - 461, - 462, - 463, - ], - [ - 272, - 273, - 274, - 275, - 276, - 277, - 278, - 279, - 336, - 337, - 338, - 339, - 340, - 341, - 342, - 343, - 400, - 401, - 402, - 403, - 404, - 405, - 406, - 407, - 464, - 465, - 466, - 467, - 468, - 469, - 470, - 471, - ], - [ - 280, - 281, - 282, - 283, - 284, - 285, - 286, - 287, - 344, - 345, - 346, - 347, - 348, - 349, - 350, - 351, - 408, - 409, - 410, - 411, - 412, - 413, - 414, - 415, - 472, - 473, - 474, - 475, - 476, - 477, - 478, - 479, - ], - [ - 288, - 289, - 290, - 291, - 292, - 293, - 294, - 295, - 352, - 353, - 354, - 355, - 356, - 357, - 358, - 359, - 416, - 417, - 418, - 419, - 420, - 421, - 422, - 423, - 480, - 481, - 482, - 483, - 484, - 485, - 486, - 487, - ], - [ - 296, - 297, - 298, - 299, - 300, - 301, - 302, - 303, - 360, - 361, - 362, - 363, - 364, - 365, - 366, - 367, - 424, - 425, - 426, - 427, - 428, - 429, - 430, - 431, - 488, - 489, - 490, - 491, - 492, - 493, - 494, - 495, - ], - [ - 304, - 305, - 306, - 307, - 308, - 309, - 310, - 311, - 368, - 369, - 370, - 371, - 372, - 373, - 374, - 375, - 432, - 433, - 434, - 435, - 436, - 437, - 438, - 439, - 496, - 497, - 498, - 499, - 500, - 501, - 502, - 503, - ], - [ - 312, - 313, - 314, - 315, - 316, - 317, - 318, - 319, - 376, - 377, - 378, - 379, - 380, - 381, - 382, - 383, - 440, - 441, - 442, - 443, - 444, - 445, - 446, - 447, - 504, - 505, - 506, - 507, - 508, - 509, - 510, - 511, - ], - [ - 512, - 513, - 514, - 515, - 516, - 517, - 518, - 519, - 576, - 577, - 578, - 579, - 580, - 581, - 582, - 583, - 640, - 641, - 642, - 643, - 644, - 645, - 646, - 647, - 704, - 705, - 706, - 707, - 708, - 709, - 710, - 711, - ], - [ - 520, - 521, - 522, - 523, - 524, - 525, - 526, - 527, - 584, - 585, - 586, - 587, - 588, - 589, - 590, - 591, - 648, - 649, - 650, - 651, - 652, - 653, - 654, - 655, - 712, - 713, - 714, - 715, - 716, - 717, - 718, - 719, - ], - [ - 528, - 529, - 530, - 531, - 532, - 533, - 534, - 535, - 592, - 593, - 594, - 595, - 596, - 597, - 598, - 599, - 656, - 657, - 658, - 659, - 660, - 661, - 662, - 663, - 720, - 721, - 722, - 723, - 724, - 725, - 726, - 727, - ], - [ - 536, - 537, - 538, - 539, - 540, - 541, - 542, - 543, - 600, - 601, - 602, - 603, - 604, - 605, - 606, - 607, - 664, - 665, - 666, - 667, - 668, - 669, - 670, - 671, - 728, - 729, - 730, - 731, - 732, - 733, - 734, - 735, - ], - [ - 544, - 545, - 546, - 547, - 548, - 549, - 550, - 551, - 608, - 609, - 610, - 611, - 612, - 613, - 614, - 615, - 672, - 673, - 674, - 675, - 676, - 677, - 678, - 679, - 736, - 737, - 738, - 739, - 740, - 741, - 742, - 743, - ], - [ - 552, - 553, - 554, - 555, - 556, - 557, - 558, - 559, - 616, - 617, - 618, - 619, - 620, - 621, - 622, - 623, - 680, - 681, - 682, - 683, - 684, - 685, - 686, - 687, - 744, - 745, - 746, - 747, - 748, - 749, - 750, - 751, - ], - [ - 560, - 561, - 562, - 563, - 564, - 565, - 566, - 567, - 624, - 625, - 626, - 627, - 628, - 629, - 630, - 631, - 688, - 689, - 690, - 691, - 692, - 693, - 694, - 695, - 752, - 753, - 754, - 755, - 756, - 757, - 758, - 759, - ], - [ - 568, - 569, - 570, - 571, - 572, - 573, - 574, - 575, - 632, - 633, - 634, - 635, - 636, - 637, - 638, - 639, - 696, - 697, - 698, - 699, - 700, - 701, - 702, - 703, - 760, - 761, - 762, - 763, - 764, - 765, - 766, - 767, - ], - [ - 768, - 769, - 770, - 771, - 772, - 773, - 774, - 775, - 832, - 833, - 834, - 835, - 836, - 837, - 838, - 839, - 896, - 897, - 898, - 899, - 900, - 901, - 902, - 903, - 960, - 961, - 962, - 963, - 964, - 965, - 966, - 967, - ], - [ - 776, - 777, - 778, - 779, - 780, - 781, - 782, - 783, - 840, - 841, - 842, - 843, - 844, - 845, - 846, - 847, - 904, - 905, - 906, - 907, - 908, - 909, - 910, - 911, - 968, - 969, - 970, - 971, - 972, - 973, - 974, - 975, - ], - [ - 784, - 785, - 786, - 787, - 788, - 789, - 790, - 791, - 848, - 849, - 850, - 851, - 852, - 853, - 854, - 855, - 912, - 913, - 914, - 915, - 916, - 917, - 918, - 919, - 976, - 977, - 978, - 979, - 980, - 981, - 982, - 983, - ], - [ - 792, - 793, - 794, - 795, - 796, - 797, - 798, - 799, - 856, - 857, - 858, - 859, - 860, - 861, - 862, - 863, - 920, - 921, - 922, - 923, - 924, - 925, - 926, - 927, - 984, - 985, - 986, - 987, - 988, - 989, - 990, - 991, - ], - [ - 800, - 801, - 802, - 803, - 804, - 805, - 806, - 807, - 864, - 865, - 866, - 867, - 868, - 869, - 870, - 871, - 928, - 929, - 930, - 931, - 932, - 933, - 934, - 935, - 992, - 993, - 994, - 995, - 996, - 997, - 998, - 999, - ], - [ - 808, - 809, - 810, - 811, - 812, - 813, - 814, - 815, - 872, - 873, - 874, - 875, - 876, - 877, - 878, - 879, - 936, - 937, - 938, - 939, - 940, - 941, - 942, - 943, - 1000, - 1001, - 1002, - 1003, - 1004, - 1005, - 1006, - 1007, - ], - [ - 816, - 817, - 818, - 819, - 820, - 821, - 822, - 823, - 880, - 881, - 882, - 883, - 884, - 885, - 886, - 887, - 944, - 945, - 946, - 947, - 948, - 949, - 950, - 951, - 1008, - 1009, - 1010, - 1011, - 1012, - 1013, - 1014, - 1015, - ], - [ - 824, - 825, - 826, - 827, - 828, - 829, - 830, - 831, - 888, - 889, - 890, - 891, - 892, - 893, - 894, - 895, - 952, - 953, - 954, - 955, - 956, - 957, - 958, - 959, - 1016, - 1017, - 1018, - 1019, - 1020, - 1021, - 1022, - 1023, - ], + [ 0, 1, 2, 3, 4, 5, 6, 7, 64, 65, 66, 67, 68, 69, 70, 71, 128, 129, 130, 131, 132, 133, 134, 135, 192, 193, 194, 195, 196, 197, 198, 199,], + [ 8, 9, 10, 11, 12, 13, 14, 15, 72, 73, 74, 75, 76, 77, 78, 79, 136, 137, 138, 139, 140, 141, 142, 143, 200, 201, 202, 203, 204, 205, 206, 207,], + [ 16, 17, 18, 19, 20, 21, 22, 23, 80, 81, 82, 83, 84, 85, 86, 87, 144, 145, 146, 147, 148, 149, 150, 151, 208, 209, 210, 211, 212, 213, 214, 215,], + [ 24, 25, 26, 27, 28, 29, 30, 31, 88, 89, 90, 91, 92, 93, 94, 95, 152, 153, 154, 155, 156, 157, 158, 159, 216, 217, 218, 219, 220, 221, 222, 223,], + [ 32, 33, 34, 35, 36, 37, 38, 39, 96, 97, 98, 99, 100, 101, 102, 103, 160, 161, 162, 163, 164, 165, 166, 167, 224, 225, 226, 227, 228, 229, 230, 231,], + [ 40, 41, 42, 43, 44, 45, 46, 47, 104, 105, 106, 107, 108, 109, 110, 111, 168, 169, 170, 171, 172, 173, 174, 175, 232, 233, 234, 235, 236, 237, 238, 239,], + [ 48, 49, 50, 51, 52, 53, 54, 55, 112, 113, 114, 115, 116, 117, 118, 119, 176, 177, 178, 179, 180, 181, 182, 183, 240, 241, 242, 243, 244, 245, 246, 247,], + [ 56, 57, 58, 59, 60, 61, 62, 63, 120, 121, 122, 123, 124, 125, 126, 127, 184, 185, 186, 187, 188, 189, 190, 191, 248, 249, 250, 251, 252, 253, 254, 255,], + [ 256, 257, 258, 259, 260, 261, 262, 263, 320, 321, 322, 323, 324, 325, 326, 327, 384, 385, 386, 387, 388, 389, 390, 391, 448, 449, 450, 451, 452, 453, 454, 455,], + [ 264, 265, 266, 267, 268, 269, 270, 271, 328, 329, 330, 331, 332, 333, 334, 335, 392, 393, 394, 395, 396, 397, 398, 399, 456, 457, 458, 459, 460, 461, 462, 463,], + [ 272, 273, 274, 275, 276, 277, 278, 279, 336, 337, 338, 339, 340, 341, 342, 343, 400, 401, 402, 403, 404, 405, 406, 407, 464, 465, 466, 467, 468, 469, 470, 471,], + [ 280, 281, 282, 283, 284, 285, 286, 287, 344, 345, 346, 347, 348, 349, 350, 351, 408, 409, 410, 411, 412, 413, 414, 415, 472, 473, 474, 475, 476, 477, 478, 479,], + [ 288, 289, 290, 291, 292, 293, 294, 295, 352, 353, 354, 355, 356, 357, 358, 359, 416, 417, 418, 419, 420, 421, 422, 423, 480, 481, 482, 483, 484, 485, 486, 487,], + [ 296, 297, 298, 299, 300, 301, 302, 303, 360, 361, 362, 363, 364, 365, 366, 367, 424, 425, 426, 427, 428, 429, 430, 431, 488, 489, 490, 491, 492, 493, 494, 495,], + [ 304, 305, 306, 307, 308, 309, 310, 311, 368, 369, 370, 371, 372, 373, 374, 375, 432, 433, 434, 435, 436, 437, 438, 439, 496, 497, 498, 499, 500, 501, 502, 503,], + [ 312, 313, 314, 315, 316, 317, 318, 319, 376, 377, 378, 379, 380, 381, 382, 383, 440, 441, 442, 443, 444, 445, 446, 447, 504, 505, 506, 507, 508, 509, 510, 511,], + [ 512, 513, 514, 515, 516, 517, 518, 519, 576, 577, 578, 579, 580, 581, 582, 583, 640, 641, 642, 643, 644, 645, 646, 647, 704, 705, 706, 707, 708, 709, 710, 711,], + [ 520, 521, 522, 523, 524, 525, 526, 527, 584, 585, 586, 587, 588, 589, 590, 591, 648, 649, 650, 651, 652, 653, 654, 655, 712, 713, 714, 715, 716, 717, 718, 719,], + [ 528, 529, 530, 531, 532, 533, 534, 535, 592, 593, 594, 595, 596, 597, 598, 599, 656, 657, 658, 659, 660, 661, 662, 663, 720, 721, 722, 723, 724, 725, 726, 727,], + [ 536, 537, 538, 539, 540, 541, 542, 543, 600, 601, 602, 603, 604, 605, 606, 607, 664, 665, 666, 667, 668, 669, 670, 671, 728, 729, 730, 731, 732, 733, 734, 735,], + [ 544, 545, 546, 547, 548, 549, 550, 551, 608, 609, 610, 611, 612, 613, 614, 615, 672, 673, 674, 675, 676, 677, 678, 679, 736, 737, 738, 739, 740, 741, 742, 743,], + [ 552, 553, 554, 555, 556, 557, 558, 559, 616, 617, 618, 619, 620, 621, 622, 623, 680, 681, 682, 683, 684, 685, 686, 687, 744, 745, 746, 747, 748, 749, 750, 751,], + [ 560, 561, 562, 563, 564, 565, 566, 567, 624, 625, 626, 627, 628, 629, 630, 631, 688, 689, 690, 691, 692, 693, 694, 695, 752, 753, 754, 755, 756, 757, 758, 759,], + [ 568, 569, 570, 571, 572, 573, 574, 575, 632, 633, 634, 635, 636, 637, 638, 639, 696, 697, 698, 699, 700, 701, 702, 703, 760, 761, 762, 763, 764, 765, 766, 767,], + [ 768, 769, 770, 771, 772, 773, 774, 775, 832, 833, 834, 835, 836, 837, 838, 839, 896, 897, 898, 899, 900, 901, 902, 903, 960, 961, 962, 963, 964, 965, 966, 967,], + [ 776, 777, 778, 779, 780, 781, 782, 783, 840, 841, 842, 843, 844, 845, 846, 847, 904, 905, 906, 907, 908, 909, 910, 911, 968, 969, 970, 971, 972, 973, 974, 975,], + [ 784, 785, 786, 787, 788, 789, 790, 791, 848, 849, 850, 851, 852, 853, 854, 855, 912, 913, 914, 915, 916, 917, 918, 919, 976, 977, 978, 979, 980, 981, 982, 983,], + [ 792, 793, 794, 795, 796, 797, 798, 799, 856, 857, 858, 859, 860, 861, 862, 863, 920, 921, 922, 923, 924, 925, 926, 927, 984, 985, 986, 987, 988, 989, 990, 991,], + [ 800, 801, 802, 803, 804, 805, 806, 807, 864, 865, 866, 867, 868, 869, 870, 871, 928, 929, 930, 931, 932, 933, 934, 935, 992, 993, 994, 995, 996, 997, 998, 999,], + [ 808, 809, 810, 811, 812, 813, 814, 815, 872, 873, 874, 875, 876, 877, 878, 879, 936, 937, 938, 939, 940, 941, 942, 943,1000,1001,1002,1003,1004,1005,1006,1007,], + [ 816, 817, 818, 819, 820, 821, 822, 823, 880, 881, 882, 883, 884, 885, 886, 887, 944, 945, 946, 947, 948, 949, 950, 951,1008,1009,1010,1011,1012,1013,1014,1015,], + [ 824, 825, 826, 827, 828, 829, 830, 831, 888, 889, 890, 891, 892, 893, 894, 895, 952, 953, 954, 955, 956, 957, 958, 959,1016,1017,1018,1019,1020,1021,1022,1023,], ], + #fmt: on dtype=TensorTiler2D.DTYPE, ) assert (reference_access == access_order).all() tile1_reference_order = np.array( + #fmt: off [ - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - 0, - 1, - 2, - 3, - 4, - 5, - 6, - 7, - 64, - 65, - 66, - 67, - 68, - 69, - 70, - 71, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - 8, - 9, - 10, - 11, - 12, - 13, - 14, - 15, - 72, - 73, - 74, - 75, - 76, - 77, - 78, - 79, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - 16, - 17, - 18, - 19, - 20, - 21, - 22, - 23, - 80, - 81, - 82, - 83, - 84, - 85, - 86, - 87, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - 24, - 25, - 26, - 27, - 28, - 29, - 30, - 31, - 88, - 89, - 90, - 91, - 92, - 93, - 94, - 95, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - 32, - 33, - 34, - 35, - 36, - 37, - 38, - 39, - 96, - 97, - 98, - 99, - 100, - 101, - 102, - 103, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - 40, - 41, - 42, - 43, - 44, - 45, - 46, - 47, - 104, - 105, - 106, - 107, - 108, - 109, - 110, - 111, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - 48, - 49, - 50, - 51, - 52, - 53, - 54, - 55, - 112, - 113, - 114, - 115, - 116, - 117, - 118, - 119, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - 56, - 57, - 58, - 59, - 60, - 61, - 62, - 63, - 120, - 121, - 122, - 123, - 124, - 125, - 126, - 127, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - 128, - 129, - 130, - 131, - 132, - 133, - 134, - 135, - 192, - 193, - 194, - 195, - 196, - 197, - 198, - 199, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - 136, - 137, - 138, - 139, - 140, - 141, - 142, - 143, - 200, - 201, - 202, - 203, - 204, - 205, - 206, - 207, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - 144, - 145, - 146, - 147, - 148, - 149, - 150, - 151, - 208, - 209, - 210, - 211, - 212, - 213, - 214, - 215, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - 152, - 153, - 154, - 155, - 156, - 157, - 158, - 159, - 216, - 217, - 218, - 219, - 220, - 221, - 222, - 223, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - 160, - 161, - 162, - 163, - 164, - 165, - 166, - 167, - 224, - 225, - 226, - 227, - 228, - 229, - 230, - 231, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - 168, - 169, - 170, - 171, - 172, - 173, - 174, - 175, - 232, - 233, - 234, - 235, - 236, - 237, - 238, - 239, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - 176, - 177, - 178, - 179, - 180, - 181, - 182, - 183, - 240, - 241, - 242, - 243, - 244, - 245, - 246, - 247, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - 184, - 185, - 186, - 187, - 188, - 189, - 190, - 191, - 248, - 249, - 250, - 251, - 252, - 253, - 254, - 255, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ 0, 1, 2, 3, 4, 5, 6, 7, 64, 65, 66, 67, 68, 69, 70, 71, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ 8, 9, 10, 11, 12, 13, 14, 15, 72, 73, 74, 75, 76, 77, 78, 79, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ 16, 17, 18, 19, 20, 21, 22, 23, 80, 81, 82, 83, 84, 85, 86, 87, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ 24, 25, 26, 27, 28, 29, 30, 31, 88, 89, 90, 91, 92, 93, 94, 95, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ 32, 33, 34, 35, 36, 37, 38, 39, 96, 97, 98, 99, 100, 101, 102, 103, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ 40, 41, 42, 43, 44, 45, 46, 47, 104, 105, 106, 107, 108, 109, 110, 111, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ 48, 49, 50, 51, 52, 53, 54, 55, 112, 113, 114, 115, 116, 117, 118, 119, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ 56, 57, 58, 59, 60, 61, 62, 63, 120, 121, 122, 123, 124, 125, 126, 127, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ 128, 129, 130, 131, 132, 133, 134, 135, 192, 193, 194, 195, 196, 197, 198, 199, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ 136, 137, 138, 139, 140, 141, 142, 143, 200, 201, 202, 203, 204, 205, 206, 207, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ 144, 145, 146, 147, 148, 149, 150, 151, 208, 209, 210, 211, 212, 213, 214, 215, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ 152, 153, 154, 155, 156, 157, 158, 159, 216, 217, 218, 219, 220, 221, 222, 223, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ 160, 161, 162, 163, 164, 165, 166, 167, 224, 225, 226, 227, 228, 229, 230, 231, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ 168, 169, 170, 171, 172, 173, 174, 175, 232, 233, 234, 235, 236, 237, 238, 239, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ 176, 177, 178, 179, 180, 181, 182, 183, 240, 241, 242, 243, 244, 245, 246, 247, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ 184, 185, 186, 187, 188, 189, 190, 191, 248, 249, 250, 251, 252, 253, 254, 255, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], ], + #fmt: on dtype=TensorTiler2D.DTYPE, ) diff --git a/test/python/tensortiler2d/square_tiler_tile_chunking_col_major_chunks.py b/test/python/tensortiler2d/square_tiler_tile_chunking_col_major_chunks.py index 9195174b5a..9e50a06529 100644 --- a/test/python/tensortiler2d/square_tiler_tile_chunking_col_major_chunks.py +++ b/test/python/tensortiler2d/square_tiler_tile_chunking_col_major_chunks.py @@ -12,2191 +12,83 @@ def square_tiler_tile_chunking_col_major_chunks(): tiler = TensorTiler2D(32, 32, 8, 8) access_order = tiler.access_order() reference_access = np.array( + #fmt: off [ - [ - 0, - 1, - 2, - 3, - 4, - 5, - 6, - 7, - 64, - 65, - 66, - 67, - 68, - 69, - 70, - 71, - 128, - 129, - 130, - 131, - 132, - 133, - 134, - 135, - 192, - 193, - 194, - 195, - 196, - 197, - 198, - 199, - ], - [ - 8, - 9, - 10, - 11, - 12, - 13, - 14, - 15, - 72, - 73, - 74, - 75, - 76, - 77, - 78, - 79, - 136, - 137, - 138, - 139, - 140, - 141, - 142, - 143, - 200, - 201, - 202, - 203, - 204, - 205, - 206, - 207, - ], - [ - 16, - 17, - 18, - 19, - 20, - 21, - 22, - 23, - 80, - 81, - 82, - 83, - 84, - 85, - 86, - 87, - 144, - 145, - 146, - 147, - 148, - 149, - 150, - 151, - 208, - 209, - 210, - 211, - 212, - 213, - 214, - 215, - ], - [ - 24, - 25, - 26, - 27, - 28, - 29, - 30, - 31, - 88, - 89, - 90, - 91, - 92, - 93, - 94, - 95, - 152, - 153, - 154, - 155, - 156, - 157, - 158, - 159, - 216, - 217, - 218, - 219, - 220, - 221, - 222, - 223, - ], - [ - 32, - 33, - 34, - 35, - 36, - 37, - 38, - 39, - 96, - 97, - 98, - 99, - 100, - 101, - 102, - 103, - 160, - 161, - 162, - 163, - 164, - 165, - 166, - 167, - 224, - 225, - 226, - 227, - 228, - 229, - 230, - 231, - ], - [ - 40, - 41, - 42, - 43, - 44, - 45, - 46, - 47, - 104, - 105, - 106, - 107, - 108, - 109, - 110, - 111, - 168, - 169, - 170, - 171, - 172, - 173, - 174, - 175, - 232, - 233, - 234, - 235, - 236, - 237, - 238, - 239, - ], - [ - 48, - 49, - 50, - 51, - 52, - 53, - 54, - 55, - 112, - 113, - 114, - 115, - 116, - 117, - 118, - 119, - 176, - 177, - 178, - 179, - 180, - 181, - 182, - 183, - 240, - 241, - 242, - 243, - 244, - 245, - 246, - 247, - ], - [ - 56, - 57, - 58, - 59, - 60, - 61, - 62, - 63, - 120, - 121, - 122, - 123, - 124, - 125, - 126, - 127, - 184, - 185, - 186, - 187, - 188, - 189, - 190, - 191, - 248, - 249, - 250, - 251, - 252, - 253, - 254, - 255, - ], - [ - 256, - 257, - 258, - 259, - 260, - 261, - 262, - 263, - 320, - 321, - 322, - 323, - 324, - 325, - 326, - 327, - 384, - 385, - 386, - 387, - 388, - 389, - 390, - 391, - 448, - 449, - 450, - 451, - 452, - 453, - 454, - 455, - ], - [ - 264, - 265, - 266, - 267, - 268, - 269, - 270, - 271, - 328, - 329, - 330, - 331, - 332, - 333, - 334, - 335, - 392, - 393, - 394, - 395, - 396, - 397, - 398, - 399, - 456, - 457, - 458, - 459, - 460, - 461, - 462, - 463, - ], - [ - 272, - 273, - 274, - 275, - 276, - 277, - 278, - 279, - 336, - 337, - 338, - 339, - 340, - 341, - 342, - 343, - 400, - 401, - 402, - 403, - 404, - 405, - 406, - 407, - 464, - 465, - 466, - 467, - 468, - 469, - 470, - 471, - ], - [ - 280, - 281, - 282, - 283, - 284, - 285, - 286, - 287, - 344, - 345, - 346, - 347, - 348, - 349, - 350, - 351, - 408, - 409, - 410, - 411, - 412, - 413, - 414, - 415, - 472, - 473, - 474, - 475, - 476, - 477, - 478, - 479, - ], - [ - 288, - 289, - 290, - 291, - 292, - 293, - 294, - 295, - 352, - 353, - 354, - 355, - 356, - 357, - 358, - 359, - 416, - 417, - 418, - 419, - 420, - 421, - 422, - 423, - 480, - 481, - 482, - 483, - 484, - 485, - 486, - 487, - ], - [ - 296, - 297, - 298, - 299, - 300, - 301, - 302, - 303, - 360, - 361, - 362, - 363, - 364, - 365, - 366, - 367, - 424, - 425, - 426, - 427, - 428, - 429, - 430, - 431, - 488, - 489, - 490, - 491, - 492, - 493, - 494, - 495, - ], - [ - 304, - 305, - 306, - 307, - 308, - 309, - 310, - 311, - 368, - 369, - 370, - 371, - 372, - 373, - 374, - 375, - 432, - 433, - 434, - 435, - 436, - 437, - 438, - 439, - 496, - 497, - 498, - 499, - 500, - 501, - 502, - 503, - ], - [ - 312, - 313, - 314, - 315, - 316, - 317, - 318, - 319, - 376, - 377, - 378, - 379, - 380, - 381, - 382, - 383, - 440, - 441, - 442, - 443, - 444, - 445, - 446, - 447, - 504, - 505, - 506, - 507, - 508, - 509, - 510, - 511, - ], - [ - 512, - 513, - 514, - 515, - 516, - 517, - 518, - 519, - 576, - 577, - 578, - 579, - 580, - 581, - 582, - 583, - 640, - 641, - 642, - 643, - 644, - 645, - 646, - 647, - 704, - 705, - 706, - 707, - 708, - 709, - 710, - 711, - ], - [ - 520, - 521, - 522, - 523, - 524, - 525, - 526, - 527, - 584, - 585, - 586, - 587, - 588, - 589, - 590, - 591, - 648, - 649, - 650, - 651, - 652, - 653, - 654, - 655, - 712, - 713, - 714, - 715, - 716, - 717, - 718, - 719, - ], - [ - 528, - 529, - 530, - 531, - 532, - 533, - 534, - 535, - 592, - 593, - 594, - 595, - 596, - 597, - 598, - 599, - 656, - 657, - 658, - 659, - 660, - 661, - 662, - 663, - 720, - 721, - 722, - 723, - 724, - 725, - 726, - 727, - ], - [ - 536, - 537, - 538, - 539, - 540, - 541, - 542, - 543, - 600, - 601, - 602, - 603, - 604, - 605, - 606, - 607, - 664, - 665, - 666, - 667, - 668, - 669, - 670, - 671, - 728, - 729, - 730, - 731, - 732, - 733, - 734, - 735, - ], - [ - 544, - 545, - 546, - 547, - 548, - 549, - 550, - 551, - 608, - 609, - 610, - 611, - 612, - 613, - 614, - 615, - 672, - 673, - 674, - 675, - 676, - 677, - 678, - 679, - 736, - 737, - 738, - 739, - 740, - 741, - 742, - 743, - ], - [ - 552, - 553, - 554, - 555, - 556, - 557, - 558, - 559, - 616, - 617, - 618, - 619, - 620, - 621, - 622, - 623, - 680, - 681, - 682, - 683, - 684, - 685, - 686, - 687, - 744, - 745, - 746, - 747, - 748, - 749, - 750, - 751, - ], - [ - 560, - 561, - 562, - 563, - 564, - 565, - 566, - 567, - 624, - 625, - 626, - 627, - 628, - 629, - 630, - 631, - 688, - 689, - 690, - 691, - 692, - 693, - 694, - 695, - 752, - 753, - 754, - 755, - 756, - 757, - 758, - 759, - ], - [ - 568, - 569, - 570, - 571, - 572, - 573, - 574, - 575, - 632, - 633, - 634, - 635, - 636, - 637, - 638, - 639, - 696, - 697, - 698, - 699, - 700, - 701, - 702, - 703, - 760, - 761, - 762, - 763, - 764, - 765, - 766, - 767, - ], - [ - 768, - 769, - 770, - 771, - 772, - 773, - 774, - 775, - 832, - 833, - 834, - 835, - 836, - 837, - 838, - 839, - 896, - 897, - 898, - 899, - 900, - 901, - 902, - 903, - 960, - 961, - 962, - 963, - 964, - 965, - 966, - 967, - ], - [ - 776, - 777, - 778, - 779, - 780, - 781, - 782, - 783, - 840, - 841, - 842, - 843, - 844, - 845, - 846, - 847, - 904, - 905, - 906, - 907, - 908, - 909, - 910, - 911, - 968, - 969, - 970, - 971, - 972, - 973, - 974, - 975, - ], - [ - 784, - 785, - 786, - 787, - 788, - 789, - 790, - 791, - 848, - 849, - 850, - 851, - 852, - 853, - 854, - 855, - 912, - 913, - 914, - 915, - 916, - 917, - 918, - 919, - 976, - 977, - 978, - 979, - 980, - 981, - 982, - 983, - ], - [ - 792, - 793, - 794, - 795, - 796, - 797, - 798, - 799, - 856, - 857, - 858, - 859, - 860, - 861, - 862, - 863, - 920, - 921, - 922, - 923, - 924, - 925, - 926, - 927, - 984, - 985, - 986, - 987, - 988, - 989, - 990, - 991, - ], - [ - 800, - 801, - 802, - 803, - 804, - 805, - 806, - 807, - 864, - 865, - 866, - 867, - 868, - 869, - 870, - 871, - 928, - 929, - 930, - 931, - 932, - 933, - 934, - 935, - 992, - 993, - 994, - 995, - 996, - 997, - 998, - 999, - ], - [ - 808, - 809, - 810, - 811, - 812, - 813, - 814, - 815, - 872, - 873, - 874, - 875, - 876, - 877, - 878, - 879, - 936, - 937, - 938, - 939, - 940, - 941, - 942, - 943, - 1000, - 1001, - 1002, - 1003, - 1004, - 1005, - 1006, - 1007, - ], - [ - 816, - 817, - 818, - 819, - 820, - 821, - 822, - 823, - 880, - 881, - 882, - 883, - 884, - 885, - 886, - 887, - 944, - 945, - 946, - 947, - 948, - 949, - 950, - 951, - 1008, - 1009, - 1010, - 1011, - 1012, - 1013, - 1014, - 1015, - ], - [ - 824, - 825, - 826, - 827, - 828, - 829, - 830, - 831, - 888, - 889, - 890, - 891, - 892, - 893, - 894, - 895, - 952, - 953, - 954, - 955, - 956, - 957, - 958, - 959, - 1016, - 1017, - 1018, - 1019, - 1020, - 1021, - 1022, - 1023, - ], + [ 0, 1, 2, 3, 4, 5, 6, 7, 64, 65, 66, 67, 68, 69, 70, 71, 128, 129, 130, 131, 132, 133, 134, 135, 192, 193, 194, 195, 196, 197, 198, 199,], + [ 8, 9, 10, 11, 12, 13, 14, 15, 72, 73, 74, 75, 76, 77, 78, 79, 136, 137, 138, 139, 140, 141, 142, 143, 200, 201, 202, 203, 204, 205, 206, 207,], + [ 16, 17, 18, 19, 20, 21, 22, 23, 80, 81, 82, 83, 84, 85, 86, 87, 144, 145, 146, 147, 148, 149, 150, 151, 208, 209, 210, 211, 212, 213, 214, 215,], + [ 24, 25, 26, 27, 28, 29, 30, 31, 88, 89, 90, 91, 92, 93, 94, 95, 152, 153, 154, 155, 156, 157, 158, 159, 216, 217, 218, 219, 220, 221, 222, 223,], + [ 32, 33, 34, 35, 36, 37, 38, 39, 96, 97, 98, 99, 100, 101, 102, 103, 160, 161, 162, 163, 164, 165, 166, 167, 224, 225, 226, 227, 228, 229, 230, 231,], + [ 40, 41, 42, 43, 44, 45, 46, 47, 104, 105, 106, 107, 108, 109, 110, 111, 168, 169, 170, 171, 172, 173, 174, 175, 232, 233, 234, 235, 236, 237, 238, 239,], + [ 48, 49, 50, 51, 52, 53, 54, 55, 112, 113, 114, 115, 116, 117, 118, 119, 176, 177, 178, 179, 180, 181, 182, 183, 240, 241, 242, 243, 244, 245, 246, 247,], + [ 56, 57, 58, 59, 60, 61, 62, 63, 120, 121, 122, 123, 124, 125, 126, 127, 184, 185, 186, 187, 188, 189, 190, 191, 248, 249, 250, 251, 252, 253, 254, 255,], + [ 256, 257, 258, 259, 260, 261, 262, 263, 320, 321, 322, 323, 324, 325, 326, 327, 384, 385, 386, 387, 388, 389, 390, 391, 448, 449, 450, 451, 452, 453, 454, 455,], + [ 264, 265, 266, 267, 268, 269, 270, 271, 328, 329, 330, 331, 332, 333, 334, 335, 392, 393, 394, 395, 396, 397, 398, 399, 456, 457, 458, 459, 460, 461, 462, 463,], + [ 272, 273, 274, 275, 276, 277, 278, 279, 336, 337, 338, 339, 340, 341, 342, 343, 400, 401, 402, 403, 404, 405, 406, 407, 464, 465, 466, 467, 468, 469, 470, 471,], + [ 280, 281, 282, 283, 284, 285, 286, 287, 344, 345, 346, 347, 348, 349, 350, 351, 408, 409, 410, 411, 412, 413, 414, 415, 472, 473, 474, 475, 476, 477, 478, 479,], + [ 288, 289, 290, 291, 292, 293, 294, 295, 352, 353, 354, 355, 356, 357, 358, 359, 416, 417, 418, 419, 420, 421, 422, 423, 480, 481, 482, 483, 484, 485, 486, 487,], + [ 296, 297, 298, 299, 300, 301, 302, 303, 360, 361, 362, 363, 364, 365, 366, 367, 424, 425, 426, 427, 428, 429, 430, 431, 488, 489, 490, 491, 492, 493, 494, 495,], + [ 304, 305, 306, 307, 308, 309, 310, 311, 368, 369, 370, 371, 372, 373, 374, 375, 432, 433, 434, 435, 436, 437, 438, 439, 496, 497, 498, 499, 500, 501, 502, 503,], + [ 312, 313, 314, 315, 316, 317, 318, 319, 376, 377, 378, 379, 380, 381, 382, 383, 440, 441, 442, 443, 444, 445, 446, 447, 504, 505, 506, 507, 508, 509, 510, 511,], + [ 512, 513, 514, 515, 516, 517, 518, 519, 576, 577, 578, 579, 580, 581, 582, 583, 640, 641, 642, 643, 644, 645, 646, 647, 704, 705, 706, 707, 708, 709, 710, 711,], + [ 520, 521, 522, 523, 524, 525, 526, 527, 584, 585, 586, 587, 588, 589, 590, 591, 648, 649, 650, 651, 652, 653, 654, 655, 712, 713, 714, 715, 716, 717, 718, 719,], + [ 528, 529, 530, 531, 532, 533, 534, 535, 592, 593, 594, 595, 596, 597, 598, 599, 656, 657, 658, 659, 660, 661, 662, 663, 720, 721, 722, 723, 724, 725, 726, 727,], + [ 536, 537, 538, 539, 540, 541, 542, 543, 600, 601, 602, 603, 604, 605, 606, 607, 664, 665, 666, 667, 668, 669, 670, 671, 728, 729, 730, 731, 732, 733, 734, 735,], + [ 544, 545, 546, 547, 548, 549, 550, 551, 608, 609, 610, 611, 612, 613, 614, 615, 672, 673, 674, 675, 676, 677, 678, 679, 736, 737, 738, 739, 740, 741, 742, 743,], + [ 552, 553, 554, 555, 556, 557, 558, 559, 616, 617, 618, 619, 620, 621, 622, 623, 680, 681, 682, 683, 684, 685, 686, 687, 744, 745, 746, 747, 748, 749, 750, 751,], + [ 560, 561, 562, 563, 564, 565, 566, 567, 624, 625, 626, 627, 628, 629, 630, 631, 688, 689, 690, 691, 692, 693, 694, 695, 752, 753, 754, 755, 756, 757, 758, 759,], + [ 568, 569, 570, 571, 572, 573, 574, 575, 632, 633, 634, 635, 636, 637, 638, 639, 696, 697, 698, 699, 700, 701, 702, 703, 760, 761, 762, 763, 764, 765, 766, 767,], + [ 768, 769, 770, 771, 772, 773, 774, 775, 832, 833, 834, 835, 836, 837, 838, 839, 896, 897, 898, 899, 900, 901, 902, 903, 960, 961, 962, 963, 964, 965, 966, 967,], + [ 776, 777, 778, 779, 780, 781, 782, 783, 840, 841, 842, 843, 844, 845, 846, 847, 904, 905, 906, 907, 908, 909, 910, 911, 968, 969, 970, 971, 972, 973, 974, 975,], + [ 784, 785, 786, 787, 788, 789, 790, 791, 848, 849, 850, 851, 852, 853, 854, 855, 912, 913, 914, 915, 916, 917, 918, 919, 976, 977, 978, 979, 980, 981, 982, 983,], + [ 792, 793, 794, 795, 796, 797, 798, 799, 856, 857, 858, 859, 860, 861, 862, 863, 920, 921, 922, 923, 924, 925, 926, 927, 984, 985, 986, 987, 988, 989, 990, 991,], + [ 800, 801, 802, 803, 804, 805, 806, 807, 864, 865, 866, 867, 868, 869, 870, 871, 928, 929, 930, 931, 932, 933, 934, 935, 992, 993, 994, 995, 996, 997, 998, 999,], + [ 808, 809, 810, 811, 812, 813, 814, 815, 872, 873, 874, 875, 876, 877, 878, 879, 936, 937, 938, 939, 940, 941, 942, 943,1000,1001,1002,1003,1004,1005,1006,1007,], + [ 816, 817, 818, 819, 820, 821, 822, 823, 880, 881, 882, 883, 884, 885, 886, 887, 944, 945, 946, 947, 948, 949, 950, 951,1008,1009,1010,1011,1012,1013,1014,1015,], + [ 824, 825, 826, 827, 828, 829, 830, 831, 888, 889, 890, 891, 892, 893, 894, 895, 952, 953, 954, 955, 956, 957, 958, 959,1016,1017,1018,1019,1020,1021,1022,1023,], ], + #fmt: on dtype=TensorTiler2D.DTYPE, ) assert (reference_access == access_order).all() tile1_reference_order = np.array( + #fmt: off [ - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - 0, - 1, - 2, - 3, - 4, - 5, - 6, - 7, - 64, - 65, - 66, - 67, - 68, - 69, - 70, - 71, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - 8, - 9, - 10, - 11, - 12, - 13, - 14, - 15, - 72, - 73, - 74, - 75, - 76, - 77, - 78, - 79, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - 16, - 17, - 18, - 19, - 20, - 21, - 22, - 23, - 80, - 81, - 82, - 83, - 84, - 85, - 86, - 87, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - 24, - 25, - 26, - 27, - 28, - 29, - 30, - 31, - 88, - 89, - 90, - 91, - 92, - 93, - 94, - 95, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - 32, - 33, - 34, - 35, - 36, - 37, - 38, - 39, - 96, - 97, - 98, - 99, - 100, - 101, - 102, - 103, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - 40, - 41, - 42, - 43, - 44, - 45, - 46, - 47, - 104, - 105, - 106, - 107, - 108, - 109, - 110, - 111, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - 48, - 49, - 50, - 51, - 52, - 53, - 54, - 55, - 112, - 113, - 114, - 115, - 116, - 117, - 118, - 119, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - 56, - 57, - 58, - 59, - 60, - 61, - 62, - 63, - 120, - 121, - 122, - 123, - 124, - 125, - 126, - 127, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - 128, - 129, - 130, - 131, - 132, - 133, - 134, - 135, - 192, - 193, - 194, - 195, - 196, - 197, - 198, - 199, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - 136, - 137, - 138, - 139, - 140, - 141, - 142, - 143, - 200, - 201, - 202, - 203, - 204, - 205, - 206, - 207, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - 144, - 145, - 146, - 147, - 148, - 149, - 150, - 151, - 208, - 209, - 210, - 211, - 212, - 213, - 214, - 215, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - 152, - 153, - 154, - 155, - 156, - 157, - 158, - 159, - 216, - 217, - 218, - 219, - 220, - 221, - 222, - 223, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - 160, - 161, - 162, - 163, - 164, - 165, - 166, - 167, - 224, - 225, - 226, - 227, - 228, - 229, - 230, - 231, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - 168, - 169, - 170, - 171, - 172, - 173, - 174, - 175, - 232, - 233, - 234, - 235, - 236, - 237, - 238, - 239, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - 176, - 177, - 178, - 179, - 180, - 181, - 182, - 183, - 240, - 241, - 242, - 243, - 244, - 245, - 246, - 247, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], - [ - 184, - 185, - 186, - 187, - 188, - 189, - 190, - 191, - 248, - 249, - 250, - 251, - 252, - 253, - 254, - 255, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - ], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ 0, 1, 2, 3, 4, 5, 6, 7, 64, 65, 66, 67, 68, 69, 70, 71, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ 8, 9, 10, 11, 12, 13, 14, 15, 72, 73, 74, 75, 76, 77, 78, 79, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ 16, 17, 18, 19, 20, 21, 22, 23, 80, 81, 82, 83, 84, 85, 86, 87, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ 24, 25, 26, 27, 28, 29, 30, 31, 88, 89, 90, 91, 92, 93, 94, 95, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ 32, 33, 34, 35, 36, 37, 38, 39, 96, 97, 98, 99, 100, 101, 102, 103, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ 40, 41, 42, 43, 44, 45, 46, 47, 104, 105, 106, 107, 108, 109, 110, 111, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ 48, 49, 50, 51, 52, 53, 54, 55, 112, 113, 114, 115, 116, 117, 118, 119, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ 56, 57, 58, 59, 60, 61, 62, 63, 120, 121, 122, 123, 124, 125, 126, 127, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ 128, 129, 130, 131, 132, 133, 134, 135, 192, 193, 194, 195, 196, 197, 198, 199, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ 136, 137, 138, 139, 140, 141, 142, 143, 200, 201, 202, 203, 204, 205, 206, 207, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ 144, 145, 146, 147, 148, 149, 150, 151, 208, 209, 210, 211, 212, 213, 214, 215, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ 152, 153, 154, 155, 156, 157, 158, 159, 216, 217, 218, 219, 220, 221, 222, 223, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ 160, 161, 162, 163, 164, 165, 166, 167, 224, 225, 226, 227, 228, 229, 230, 231, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ 168, 169, 170, 171, 172, 173, 174, 175, 232, 233, 234, 235, 236, 237, 238, 239, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ 176, 177, 178, 179, 180, 181, 182, 183, 240, 241, 242, 243, 244, 245, 246, 247, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], + [ 184, 185, 186, 187, 188, 189, 190, 191, 248, 249, 250, 251, 252, 253, 254, 255, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], ], + #fmt: on dtype=TensorTiler2D.DTYPE, ) diff --git a/test/python/tensortiler2d/util.py b/test/python/tensortiler2d/util.py index 2267760a46..206e1fd90d 100644 --- a/test/python/tensortiler2d/util.py +++ b/test/python/tensortiler2d/util.py @@ -2,3 +2,15 @@ def construct_test(f): print("\nTEST:", f.__name__) f() + + +# This is a utility function used in creating tests to pretty print arrays in a way that's easy to see tiles +def array_printer(arr): + pad = len(str(len(arr) * len(arr[0]))) + print("[") + for i in range(len(arr)): + print("\t[", end="") + for j in range(len(arr[0])): + print(f"{arr[i][j]:{pad}},", end="") + print("],") + print("]") From 192194d6aa382cc3d0f30a664411bcc7bdbdf7d8 Mon Sep 17 00:00:00 2001 From: Erika Hunhoff Date: Tue, 22 Oct 2024 16:39:58 -0600 Subject: [PATCH 14/35] More python formatting --- test/python/tensortiler2d/rectangular_tiler.py | 8 ++++---- test/python/tensortiler2d/rectangular_tiler2.py | 8 ++++---- .../tensortiler2d/rectangular_tiler_col_major_tensor.py | 8 ++++---- test/python/tensortiler2d/square_tiler.py | 8 ++++---- test/python/tensortiler2d/square_tiler2.py | 8 ++++---- .../python/tensortiler2d/square_tiler_col_major_tensor.py | 8 ++++---- ...quare_tiler_col_major_tensor_and_tile_tile_chunking.py | 8 ++++---- ...r_tensor_tile_chunking_rectangular_col_major_chunks.py | 8 ++++---- test/python/tensortiler2d/square_tiler_col_major_tile.py | 8 ++++---- .../square_tiler_col_major_tile_and_tensor.py | 8 ++++---- test/python/tensortiler2d/square_tiler_tile_chunking.py | 8 ++++---- .../square_tiler_tile_chunking_col_major_chunks.py | 8 ++++---- 12 files changed, 48 insertions(+), 48 deletions(-) diff --git a/test/python/tensortiler2d/rectangular_tiler.py b/test/python/tensortiler2d/rectangular_tiler.py index 22875d38fd..a1e0c063a9 100644 --- a/test/python/tensortiler2d/rectangular_tiler.py +++ b/test/python/tensortiler2d/rectangular_tiler.py @@ -12,7 +12,7 @@ def rectangular_tiler(): tiler = TensorTiler2D(16, 8, 4, 4) access_order = tiler.access_order() reference_access = np.array( - #fmt: off + # fmt: off [ [ 0, 1, 2, 3, 16, 17, 18, 19], [ 4, 5, 6, 7, 20, 21, 22, 23], @@ -31,13 +31,13 @@ def rectangular_tiler(): [104, 105, 106, 107, 120, 121, 122, 123], [108, 109, 110, 111, 124, 125, 126, 127], ], - #fmt: on + # fmt: on dtype=TensorTiler2D.DTYPE, ) assert (reference_access == access_order).all() tile1_reference_order = np.array( - #fmt: off + # fmt: off [ [-1, -1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1, -1], @@ -56,7 +56,7 @@ def rectangular_tiler(): [ 8, 9, 10, 11, -1, -1, -1, -1], [12, 13, 14, 15, -1, -1, -1, -1], ], - #fmt: on + # fmt: on dtype=TensorTiler2D.DTYPE, ) diff --git a/test/python/tensortiler2d/rectangular_tiler2.py b/test/python/tensortiler2d/rectangular_tiler2.py index 92aa1fad13..7492fe15e9 100644 --- a/test/python/tensortiler2d/rectangular_tiler2.py +++ b/test/python/tensortiler2d/rectangular_tiler2.py @@ -12,7 +12,7 @@ def rectangular_tiler2(): tiler = TensorTiler2D(12, 8, 3, 2) access_order = tiler.access_order() reference_access = np.array( - #fmt: off + # fmt: off [ [ 0, 1, 6, 7, 12, 13, 18, 19], [ 2, 3, 8, 9, 14, 15, 20, 21], @@ -27,13 +27,13 @@ def rectangular_tiler2(): [74, 75, 80, 81, 86, 87, 92, 93], [76, 77, 82, 83, 88, 89, 94, 95], ], - #fmt: on + # fmt: on dtype=TensorTiler2D.DTYPE, ) assert (reference_access == access_order).all() tile1_reference_order = np.array( - #fmt: off + # fmt: off [ [-1, -1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1, -1], @@ -48,7 +48,7 @@ def rectangular_tiler2(): [ 2, 3, -1, -1, -1, -1, -1, -1], [ 4, 5, -1, -1, -1, -1, -1, -1], ], - #fmt: on + # fmt: on dtype=TensorTiler2D.DTYPE, ) diff --git a/test/python/tensortiler2d/rectangular_tiler_col_major_tensor.py b/test/python/tensortiler2d/rectangular_tiler_col_major_tensor.py index aa6e0c0f15..5a576d3827 100644 --- a/test/python/tensortiler2d/rectangular_tiler_col_major_tensor.py +++ b/test/python/tensortiler2d/rectangular_tiler_col_major_tensor.py @@ -12,7 +12,7 @@ def rectangular_tiler_col_major_tensor(): tiler = TensorTiler2D(8, 16, 4, 2, tensor_col_major=True) access_order = tiler.access_order() reference_access = np.array( - #fmt: off + # fmt: off [ [ 0, 1, 16, 17, 32, 33, 48, 49, 64, 65, 80, 81, 96, 97, 112, 113], [ 2, 3, 18, 19, 34, 35, 50, 51, 66, 67, 82, 83, 98, 99, 114, 115], @@ -23,13 +23,13 @@ def rectangular_tiler_col_major_tensor(): [ 12, 13, 28, 29, 44, 45, 60, 61, 76, 77, 92, 93, 108, 109, 124, 125], [ 14, 15, 30, 31, 46, 47, 62, 63, 78, 79, 94, 95, 110, 111, 126, 127], ], - #fmt: on + # fmt: on dtype=TensorTiler2D.DTYPE, ) assert (reference_access == access_order).all() tile1_reference_order = np.array( - #fmt: off + # fmt: off [ [-1, -1, -1, -1, 0, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, 2, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], @@ -40,7 +40,7 @@ def rectangular_tiler_col_major_tensor(): [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], ], - #fmt: on + # fmt: on dtype=TensorTiler2D.DTYPE, ) diff --git a/test/python/tensortiler2d/square_tiler.py b/test/python/tensortiler2d/square_tiler.py index 099caa1527..dce402c0bf 100644 --- a/test/python/tensortiler2d/square_tiler.py +++ b/test/python/tensortiler2d/square_tiler.py @@ -12,7 +12,7 @@ def square_tiler(): tiler = TensorTiler2D(32, 32, 4, 4) access_order = tiler.access_order() reference_access = np.array( - #fmt: off + # fmt: off [ [ 0, 1, 2, 3, 16, 17, 18, 19, 32, 33, 34, 35, 48, 49, 50, 51, 64, 65, 66, 67, 80, 81, 82, 83, 96, 97, 98, 99, 112, 113, 114, 115,], [ 4, 5, 6, 7, 20, 21, 22, 23, 36, 37, 38, 39, 52, 53, 54, 55, 68, 69, 70, 71, 84, 85, 86, 87, 100, 101, 102, 103, 116, 117, 118, 119,], @@ -47,13 +47,13 @@ def square_tiler(): [ 904, 905, 906, 907, 920, 921, 922, 923, 936, 937, 938, 939, 952, 953, 954, 955, 968, 969, 970, 971, 984, 985, 986, 987,1000,1001,1002,1003,1016,1017,1018,1019,], [ 908, 909, 910, 911, 924, 925, 926, 927, 940, 941, 942, 943, 956, 957, 958, 959, 972, 973, 974, 975, 988, 989, 990, 991,1004,1005,1006,1007,1020,1021,1022,1023,], ], - #fmt: on + # fmt: on dtype=TensorTiler2D.DTYPE, ) assert (reference_access == access_order).all() tile1_reference_order = np.array( - #fmt: off + # fmt: off [ [ -1, -1, -1, -1, 0, 1, 2, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], [ -1, -1, -1, -1, 4, 5, 6, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], @@ -88,7 +88,7 @@ def square_tiler(): [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], ], - #fmt: on + # fmt: on dtype=TensorTiler2D.DTYPE, ) diff --git a/test/python/tensortiler2d/square_tiler2.py b/test/python/tensortiler2d/square_tiler2.py index e6baa3fde7..1d54993e92 100644 --- a/test/python/tensortiler2d/square_tiler2.py +++ b/test/python/tensortiler2d/square_tiler2.py @@ -12,7 +12,7 @@ def square_tiler2(): tiler = TensorTiler2D(32, 32, 8, 8) access_order = tiler.access_order() reference_access = np.array( - #fmt: off + # fmt: off [ [ 0, 1, 2, 3, 4, 5, 6, 7, 64, 65, 66, 67, 68, 69, 70, 71, 128, 129, 130, 131, 132, 133, 134, 135, 192, 193, 194, 195, 196, 197, 198, 199,], [ 8, 9, 10, 11, 12, 13, 14, 15, 72, 73, 74, 75, 76, 77, 78, 79, 136, 137, 138, 139, 140, 141, 142, 143, 200, 201, 202, 203, 204, 205, 206, 207,], @@ -47,13 +47,13 @@ def square_tiler2(): [ 816, 817, 818, 819, 820, 821, 822, 823, 880, 881, 882, 883, 884, 885, 886, 887, 944, 945, 946, 947, 948, 949, 950, 951,1008,1009,1010,1011,1012,1013,1014,1015,], [ 824, 825, 826, 827, 828, 829, 830, 831, 888, 889, 890, 891, 892, 893, 894, 895, 952, 953, 954, 955, 956, 957, 958, 959,1016,1017,1018,1019,1020,1021,1022,1023,], ], - #fmt: on + # fmt: on dtype=TensorTiler2D.DTYPE, ) assert (reference_access == access_order).all() tile1_reference_order = np.array( - #fmt: off + # fmt: off [ [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 1, 2, 3, 4, 5, 6, 7,], [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 8, 9, 10, 11, 12, 13, 14, 15,], @@ -88,7 +88,7 @@ def square_tiler2(): [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], ], - #fmt: on + # fmt: on dtype=TensorTiler2D.DTYPE, ) diff --git a/test/python/tensortiler2d/square_tiler_col_major_tensor.py b/test/python/tensortiler2d/square_tiler_col_major_tensor.py index 0a4cda8fc8..0e9e3580bc 100644 --- a/test/python/tensortiler2d/square_tiler_col_major_tensor.py +++ b/test/python/tensortiler2d/square_tiler_col_major_tensor.py @@ -12,7 +12,7 @@ def square_tiler_col_major_tensor(): tiler = TensorTiler2D(32, 32, 4, 4, tensor_col_major=True) access_order = tiler.access_order() reference_access = np.array( - #fmt: off + # fmt: off [ [ 0, 1, 2, 3, 128, 129, 130, 131, 256, 257, 258, 259, 384, 385, 386, 387, 512, 513, 514, 515, 640, 641, 642, 643, 768, 769, 770, 771, 896, 897, 898, 899,], [ 4, 5, 6, 7, 132, 133, 134, 135, 260, 261, 262, 263, 388, 389, 390, 391, 516, 517, 518, 519, 644, 645, 646, 647, 772, 773, 774, 775, 900, 901, 902, 903,], @@ -47,13 +47,13 @@ def square_tiler_col_major_tensor(): [ 120, 121, 122, 123, 248, 249, 250, 251, 376, 377, 378, 379, 504, 505, 506, 507, 632, 633, 634, 635, 760, 761, 762, 763, 888, 889, 890, 891,1016,1017,1018,1019,], [ 124, 125, 126, 127, 252, 253, 254, 255, 380, 381, 382, 383, 508, 509, 510, 511, 636, 637, 638, 639, 764, 765, 766, 767, 892, 893, 894, 895,1020,1021,1022,1023,], ], - #fmt: on + # fmt: on dtype=TensorTiler2D.DTYPE, ) assert (reference_access == access_order).all() tile1_reference_order = np.array( - #fmt: off + # fmt: off [ [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], @@ -88,7 +88,7 @@ def square_tiler_col_major_tensor(): [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], ], - #fmt: on + # fmt: on dtype=TensorTiler2D.DTYPE, ) diff --git a/test/python/tensortiler2d/square_tiler_col_major_tensor_and_tile_tile_chunking.py b/test/python/tensortiler2d/square_tiler_col_major_tensor_and_tile_tile_chunking.py index 89f8b5fca7..84b4e92261 100644 --- a/test/python/tensortiler2d/square_tiler_col_major_tensor_and_tile_tile_chunking.py +++ b/test/python/tensortiler2d/square_tiler_col_major_tensor_and_tile_tile_chunking.py @@ -12,7 +12,7 @@ def square_tiler_col_major_tensor_and_tile_tile_chunking(): tiler = TensorTiler2D(32, 32, 4, 4, tensor_col_major=True, tile_col_major=True) access_order = tiler.access_order() reference_access = np.array( - #fmt: off + # fmt: off [ [ 0, 4, 8, 12, 128, 132, 136, 140, 256, 260, 264, 268, 384, 388, 392, 396, 512, 516, 520, 524, 640, 644, 648, 652, 768, 772, 776, 780, 896, 900, 904, 908, ], [ 1, 5, 9, 13, 129, 133, 137, 141, 257, 261, 265, 269, 385, 389, 393, 397, 513, 517, 521, 525, 641, 645, 649, 653, 769, 773, 777, 781, 897, 901, 905, 909, ], @@ -47,13 +47,13 @@ def square_tiler_col_major_tensor_and_tile_tile_chunking(): [ 114, 118, 122, 126, 242, 246, 250, 254, 370, 374, 378, 382, 498, 502, 506, 510, 626, 630, 634, 638, 754, 758, 762, 766, 882, 886, 890, 894, 1010, 1014, 1018, 1022, ], [ 115, 119, 123, 127, 243, 247, 251, 255, 371, 375, 379, 383, 499, 503, 507, 511, 627, 631, 635, 639, 755, 759, 763, 767, 883, 887, 891, 895, 1011, 1015, 1019, 1023, ], ], - #fmt: on + # fmt: on dtype=TensorTiler2D.DTYPE, ) assert (reference_access == access_order).all() tile1_reference_order = np.array( - #fmt: off + # fmt: off [ [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 4, 8, 12, 32, 36, 40, 44, -1, -1, -1, -1, -1, -1, -1, -1, ], [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 5, 9, 13, 33, 37, 41, 45, -1, -1, -1, -1, -1, -1, -1, -1, ], @@ -88,7 +88,7 @@ def square_tiler_col_major_tensor_and_tile_tile_chunking(): [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, ], [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, ], ], - #fmt: on + # fmt: on dtype=TensorTiler2D.DTYPE, ) diff --git a/test/python/tensortiler2d/square_tiler_col_major_tensor_tile_chunking_rectangular_col_major_chunks.py b/test/python/tensortiler2d/square_tiler_col_major_tensor_tile_chunking_rectangular_col_major_chunks.py index 35a14e7560..e1f4558d6e 100644 --- a/test/python/tensortiler2d/square_tiler_col_major_tensor_tile_chunking_rectangular_col_major_chunks.py +++ b/test/python/tensortiler2d/square_tiler_col_major_tensor_tile_chunking_rectangular_col_major_chunks.py @@ -12,7 +12,7 @@ def square_tiler_col_major_tensor_tile_chunking_rectangular_col_major_chunks(): tiler = TensorTiler2D(16, 16, 4, 4, tensor_col_major=True) access_order = tiler.access_order() reference_access = np.array( - #fmt: off + # fmt: off [ [ 0, 1, 2, 3, 64, 65, 66, 67,128,129,130,131,192,193,194,195,], [ 4, 5, 6, 7, 68, 69, 70, 71,132,133,134,135,196,197,198,199,], @@ -31,13 +31,13 @@ def square_tiler_col_major_tensor_tile_chunking_rectangular_col_major_chunks(): [ 56, 57, 58, 59,120,121,122,123,184,185,186,187,248,249,250,251,], [ 60, 61, 62, 63,124,125,126,127,188,189,190,191,252,253,254,255,], ], - #fmt: on + # fmt: on dtype=TensorTiler2D.DTYPE, ) assert (reference_access == access_order).all() tile1_reference_order = np.array( - #fmt: off + # fmt: off [ [ 0, 1, 2, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], [ 4, 5, 6, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], @@ -56,7 +56,7 @@ def square_tiler_col_major_tensor_tile_chunking_rectangular_col_major_chunks(): [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], ], - #fmt: on + # fmt: on dtype=TensorTiler2D.DTYPE, ) diff --git a/test/python/tensortiler2d/square_tiler_col_major_tile.py b/test/python/tensortiler2d/square_tiler_col_major_tile.py index 6e79aa18b2..fbd9507989 100644 --- a/test/python/tensortiler2d/square_tiler_col_major_tile.py +++ b/test/python/tensortiler2d/square_tiler_col_major_tile.py @@ -12,7 +12,7 @@ def square_tiler_col_major_tile(): tiler = TensorTiler2D(32, 32, 4, 4, tile_col_major=True) access_order = tiler.access_order() reference_access = np.array( - #fmt: off + # fmt: off [ [ 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60, 64, 68, 72, 76, 80, 84, 88, 92, 96, 100, 104, 108, 112, 116, 120, 124,], [ 1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 97, 101, 105, 109, 113, 117, 121, 125,], @@ -47,13 +47,13 @@ def square_tiler_col_major_tile(): [ 898, 902, 906, 910, 914, 918, 922, 926, 930, 934, 938, 942, 946, 950, 954, 958, 962, 966, 970, 974, 978, 982, 986, 990, 994, 998,1002,1006,1010,1014,1018,1022,], [ 899, 903, 907, 911, 915, 919, 923, 927, 931, 935, 939, 943, 947, 951, 955, 959, 963, 967, 971, 975, 979, 983, 987, 991, 995, 999,1003,1007,1011,1015,1019,1023,], ], - #fmt: on + # fmt: on dtype=TensorTiler2D.DTYPE, ) assert (reference_access == access_order).all() tile1_reference_order = np.array( - #fmt: off + # fmt: off [ [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 4, 8, 12, -1, -1, -1, -1, -1, -1, -1, -1,], [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 5, 9, 13, -1, -1, -1, -1, -1, -1, -1, -1,], @@ -88,7 +88,7 @@ def square_tiler_col_major_tile(): [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], ], - #fmt: on + # fmt: on dtype=TensorTiler2D.DTYPE, ) diff --git a/test/python/tensortiler2d/square_tiler_col_major_tile_and_tensor.py b/test/python/tensortiler2d/square_tiler_col_major_tile_and_tensor.py index 77afaefd71..e0294b8f9a 100644 --- a/test/python/tensortiler2d/square_tiler_col_major_tile_and_tensor.py +++ b/test/python/tensortiler2d/square_tiler_col_major_tile_and_tensor.py @@ -12,7 +12,7 @@ def square_tiler_col_major_tile_and_tensor(): tiler = TensorTiler2D(32, 32, 4, 4, tensor_col_major=True, tile_col_major=True) access_order = tiler.access_order() reference_access = np.array( - #fmt: off + # fmt: off [ [ 0, 4, 8, 12, 128, 132, 136, 140, 256, 260, 264, 268, 384, 388, 392, 396, 512, 516, 520, 524, 640, 644, 648, 652, 768, 772, 776, 780, 896, 900, 904, 908,], [ 1, 5, 9, 13, 129, 133, 137, 141, 257, 261, 265, 269, 385, 389, 393, 397, 513, 517, 521, 525, 641, 645, 649, 653, 769, 773, 777, 781, 897, 901, 905, 909,], @@ -47,13 +47,13 @@ def square_tiler_col_major_tile_and_tensor(): [ 114, 118, 122, 126, 242, 246, 250, 254, 370, 374, 378, 382, 498, 502, 506, 510, 626, 630, 634, 638, 754, 758, 762, 766, 882, 886, 890, 894,1010,1014,1018,1022,], [ 115, 119, 123, 127, 243, 247, 251, 255, 371, 375, 379, 383, 499, 503, 507, 511, 627, 631, 635, 639, 755, 759, 763, 767, 883, 887, 891, 895,1011,1015,1019,1023,], ], - #fmt: on + # fmt: on dtype=TensorTiler2D.DTYPE, ) assert (reference_access == access_order).all() tile1_reference_order = np.array( - #fmt: off + # fmt: off [ [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 4, 8, 12,], [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 5, 9, 13,], @@ -88,7 +88,7 @@ def square_tiler_col_major_tile_and_tensor(): [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], ], - #fmt: on + # fmt: on dtype=TensorTiler2D.DTYPE, ) diff --git a/test/python/tensortiler2d/square_tiler_tile_chunking.py b/test/python/tensortiler2d/square_tiler_tile_chunking.py index 95f0793e24..53f0f21ad5 100644 --- a/test/python/tensortiler2d/square_tiler_tile_chunking.py +++ b/test/python/tensortiler2d/square_tiler_tile_chunking.py @@ -12,7 +12,7 @@ def square_tiler_tile_chunking(): tiler = TensorTiler2D(32, 32, 8, 8) access_order = tiler.access_order() reference_access = np.array( - #fmt: off + # fmt: off [ [ 0, 1, 2, 3, 4, 5, 6, 7, 64, 65, 66, 67, 68, 69, 70, 71, 128, 129, 130, 131, 132, 133, 134, 135, 192, 193, 194, 195, 196, 197, 198, 199,], [ 8, 9, 10, 11, 12, 13, 14, 15, 72, 73, 74, 75, 76, 77, 78, 79, 136, 137, 138, 139, 140, 141, 142, 143, 200, 201, 202, 203, 204, 205, 206, 207,], @@ -47,13 +47,13 @@ def square_tiler_tile_chunking(): [ 816, 817, 818, 819, 820, 821, 822, 823, 880, 881, 882, 883, 884, 885, 886, 887, 944, 945, 946, 947, 948, 949, 950, 951,1008,1009,1010,1011,1012,1013,1014,1015,], [ 824, 825, 826, 827, 828, 829, 830, 831, 888, 889, 890, 891, 892, 893, 894, 895, 952, 953, 954, 955, 956, 957, 958, 959,1016,1017,1018,1019,1020,1021,1022,1023,], ], - #fmt: on + # fmt: on dtype=TensorTiler2D.DTYPE, ) assert (reference_access == access_order).all() tile1_reference_order = np.array( - #fmt: off + # fmt: off [ [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], @@ -88,7 +88,7 @@ def square_tiler_tile_chunking(): [ 176, 177, 178, 179, 180, 181, 182, 183, 240, 241, 242, 243, 244, 245, 246, 247, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], [ 184, 185, 186, 187, 188, 189, 190, 191, 248, 249, 250, 251, 252, 253, 254, 255, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], ], - #fmt: on + # fmt: on dtype=TensorTiler2D.DTYPE, ) diff --git a/test/python/tensortiler2d/square_tiler_tile_chunking_col_major_chunks.py b/test/python/tensortiler2d/square_tiler_tile_chunking_col_major_chunks.py index 9e50a06529..9de237f6dd 100644 --- a/test/python/tensortiler2d/square_tiler_tile_chunking_col_major_chunks.py +++ b/test/python/tensortiler2d/square_tiler_tile_chunking_col_major_chunks.py @@ -12,7 +12,7 @@ def square_tiler_tile_chunking_col_major_chunks(): tiler = TensorTiler2D(32, 32, 8, 8) access_order = tiler.access_order() reference_access = np.array( - #fmt: off + # fmt: off [ [ 0, 1, 2, 3, 4, 5, 6, 7, 64, 65, 66, 67, 68, 69, 70, 71, 128, 129, 130, 131, 132, 133, 134, 135, 192, 193, 194, 195, 196, 197, 198, 199,], [ 8, 9, 10, 11, 12, 13, 14, 15, 72, 73, 74, 75, 76, 77, 78, 79, 136, 137, 138, 139, 140, 141, 142, 143, 200, 201, 202, 203, 204, 205, 206, 207,], @@ -47,13 +47,13 @@ def square_tiler_tile_chunking_col_major_chunks(): [ 816, 817, 818, 819, 820, 821, 822, 823, 880, 881, 882, 883, 884, 885, 886, 887, 944, 945, 946, 947, 948, 949, 950, 951,1008,1009,1010,1011,1012,1013,1014,1015,], [ 824, 825, 826, 827, 828, 829, 830, 831, 888, 889, 890, 891, 892, 893, 894, 895, 952, 953, 954, 955, 956, 957, 958, 959,1016,1017,1018,1019,1020,1021,1022,1023,], ], - #fmt: on + # fmt: on dtype=TensorTiler2D.DTYPE, ) assert (reference_access == access_order).all() tile1_reference_order = np.array( - #fmt: off + # fmt: off [ [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], @@ -88,7 +88,7 @@ def square_tiler_tile_chunking_col_major_chunks(): [ 176, 177, 178, 179, 180, 181, 182, 183, 240, 241, 242, 243, 244, 245, 246, 247, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], [ 184, 185, 186, 187, 188, 189, 190, 191, 248, 249, 250, 251, 252, 253, 254, 255, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,], ], - #fmt: on + # fmt: on dtype=TensorTiler2D.DTYPE, ) From 4f9656a2f2d1cde35302d7712ef976067a462fe4 Mon Sep 17 00:00:00 2001 From: Erika Hunhoff Date: Tue, 22 Oct 2024 16:55:53 -0600 Subject: [PATCH 15/35] A few more tests --- ...ngular_tiler_col_major_tensor_and_tiler.py | 72 +++++++++++++++++++ .../tensortiler2d/tensor_tile_same_height.py | 64 +++++++++++++++++ test/python/tensortiler2d/tensortiler2d.py | 21 ++++++ 3 files changed, 157 insertions(+) create mode 100644 test/python/tensortiler2d/rectangular_tiler_col_major_tensor_and_tiler.py create mode 100644 test/python/tensortiler2d/tensor_tile_same_height.py diff --git a/test/python/tensortiler2d/rectangular_tiler_col_major_tensor_and_tiler.py b/test/python/tensortiler2d/rectangular_tiler_col_major_tensor_and_tiler.py new file mode 100644 index 0000000000..bd16bf39c3 --- /dev/null +++ b/test/python/tensortiler2d/rectangular_tiler_col_major_tensor_and_tiler.py @@ -0,0 +1,72 @@ +import numpy as np + +from aie.helpers.tensortiler.tensortiler2D import TensorTiler2D +from util import construct_test + +# RUN: %python %s | FileCheck %s + + +# CHECK-LABEL: rectangular_tiler_col_major_tensor_and_tile +@construct_test +def rectangular_tiler_col_major_tensor_and_tile(): + tiler = TensorTiler2D(16, 8, 4, 2, tensor_col_major=True, tile_col_major=True) + access_order = tiler.access_order() + reference_access = np.array( + # fmt: off + [ + [ 0, 4, 32, 36, 64, 68, 96, 100], + [ 1, 5, 33, 37, 65, 69, 97, 101], + [ 2, 6, 34, 38, 66, 70, 98, 102], + [ 3, 7, 35, 39, 67, 71, 99, 103], + [ 8, 12, 40, 44, 72, 76, 104, 108], + [ 9, 13, 41, 45, 73, 77, 105, 109], + [ 10, 14, 42, 46, 74, 78, 106, 110], + [ 11, 15, 43, 47, 75, 79, 107, 111], + [ 16, 20, 48, 52, 80, 84, 112, 116], + [ 17, 21, 49, 53, 81, 85, 113, 117], + [ 18, 22, 50, 54, 82, 86, 114, 118], + [ 19, 23, 51, 55, 83, 87, 115, 119], + [ 24, 28, 56, 60, 88, 92, 120, 124], + [ 25, 29, 57, 61, 89, 93, 121, 125], + [ 26, 30, 58, 62, 90, 94, 122, 126], + [ 27, 31, 59, 63, 91, 95, 123, 127] + ], + # fmt: on + dtype=TensorTiler2D.DTYPE, + ) + assert (reference_access == access_order).all() + + tile1_reference_order = np.array( + # fmt: off + [ + [-1, -1, -1, -1, -1, -1, -1, -1], + [-1, -1, -1, -1, -1, -1, -1, -1], + [-1, -1, -1, -1, -1, -1, -1, -1], + [-1, -1, -1, -1, -1, -1, -1, -1], + [-1, -1, -1, -1, -1, -1, -1, -1], + [-1, -1, -1, -1, -1, -1, -1, -1], + [-1, -1, -1, -1, -1, -1, -1, -1], + [-1, -1, -1, -1, -1, -1, -1, -1], + [ 0, 4, -1, -1, -1, -1, -1, -1], + [ 1, 5, -1, -1, -1, -1, -1, -1], + [ 2, 6, -1, -1, -1, -1, -1, -1], + [ 3, 7, -1, -1, -1, -1, -1, -1], + [-1, -1, -1, -1, -1, -1, -1, -1], + [-1, -1, -1, -1, -1, -1, -1, -1], + [-1, -1, -1, -1, -1, -1, -1, -1], + [-1, -1, -1, -1, -1, -1, -1, -1] + ], + # fmt: on + dtype=TensorTiler2D.DTYPE, + ) + + tile_count = 0 + for t in tiler.tile_iter(): + if tile_count == 8: + tile_access_order = t.access_order() + assert (tile_access_order == tile1_reference_order).all() + tile_count += 1 + assert tile_count == (16 // 4) * (8 // 2) + + # CHECK: Pass! + print("Pass!") diff --git a/test/python/tensortiler2d/tensor_tile_same_height.py b/test/python/tensortiler2d/tensor_tile_same_height.py new file mode 100644 index 0000000000..dc7022ba3e --- /dev/null +++ b/test/python/tensortiler2d/tensor_tile_same_height.py @@ -0,0 +1,64 @@ +import numpy as np + +from aie.helpers.tensortiler.tensortiler2D import TensorTiler2D +from util import construct_test + +# RUN: %python %s | FileCheck %s + + +# CHECK-LABEL: tensor_tile_same_height +@construct_test +def tensor_tile_same_height(): + tiler = TensorTiler2D(12, 8, 12, 2) + access_order = tiler.access_order() + reference_access = np.array( + # fmt: off + [ + [ 0, 1, 24, 25, 48, 49, 72, 73], + [ 2, 3, 26, 27, 50, 51, 74, 75], + [ 4, 5, 28, 29, 52, 53, 76, 77], + [ 6, 7, 30, 31, 54, 55, 78, 79], + [ 8, 9, 32, 33, 56, 57, 80, 81], + [10, 11, 34, 35, 58, 59, 82, 83], + [12, 13, 36, 37, 60, 61, 84, 85], + [14, 15, 38, 39, 62, 63, 86, 87], + [16, 17, 40, 41, 64, 65, 88, 89], + [18, 19, 42, 43, 66, 67, 90, 91], + [20, 21, 44, 45, 68, 69, 92, 93], + [22, 23, 46, 47, 70, 71, 94, 95] + ], + # fmt: on + dtype=TensorTiler2D.DTYPE, + ) + assert (reference_access == access_order).all() + + tile1_reference_order = np.array( + # fmt: off + [ + [-1, -1, -1, -1, 0, 1, -1, -1], + [-1, -1, -1, -1, 2, 3, -1, -1], + [-1, -1, -1, -1, 4, 5, -1, -1], + [-1, -1, -1, -1, 6, 7, -1, -1], + [-1, -1, -1, -1, 8, 9, -1, -1], + [-1, -1, -1, -1, 10, 11, -1, -1], + [-1, -1, -1, -1, 12, 13, -1, -1], + [-1, -1, -1, -1, 14, 15, -1, -1], + [-1, -1, -1, -1, 16, 17, -1, -1], + [-1, -1, -1, -1, 18, 19, -1, -1], + [-1, -1, -1, -1, 20, 21, -1, -1], + [-1, -1, -1, -1, 22, 23, -1, -1] + ], + # fmt: on + dtype=TensorTiler2D.DTYPE, + ) + + tile_count = 0 + for t in tiler.tile_iter(): + if tile_count == 2: + tile_access_order = t.access_order() + assert (tile_access_order == tile1_reference_order).all() + tile_count += 1 + assert tile_count == (12 // 12) * (8 // 2) + + # CHECK: Pass! + print("Pass!") diff --git a/test/python/tensortiler2d/tensortiler2d.py b/test/python/tensortiler2d/tensortiler2d.py index 84bf6f97ca..74f94452d3 100644 --- a/test/python/tensortiler2d/tensortiler2d.py +++ b/test/python/tensortiler2d/tensortiler2d.py @@ -394,3 +394,24 @@ def tensortiler_tensor_iter_chunk_col_major(): # CHECK: Pass! print("Pass!") + + +# CHECK-LABEL: access_order_from_sizes_strides +@construct_test +def access_order_from_sizes_strides(): + access_order = TensorTiler2D.get_access_order_tensor( + 8, 16, [1, 8, 8, 2], [0, 2, 16, 1] + ) + # fmt: off + reference_order = [ + [ 0, 1, 16, 17, 32, 33, 48, 49, 64, 65, 80, 81, 96, 97, 112, 113], + [ 2, 3, 18, 19, 34, 35, 50, 51, 66, 67, 82, 83, 98, 99, 114, 115], + [ 4, 5, 20, 21, 36, 37, 52, 53, 68, 69, 84, 85, 100, 101, 116, 117], + [ 6, 7, 22, 23, 38, 39, 54, 55, 70, 71, 86, 87, 102, 103, 118, 119], + [ 8, 9, 24, 25, 40, 41, 56, 57, 72, 73, 88, 89, 104, 105, 120, 121], + [ 10, 11, 26, 27, 42, 43, 58, 59, 74, 75, 90, 91, 106, 107, 122, 123], + [ 12, 13, 28, 29, 44, 45, 60, 61, 76, 77, 92, 93, 108, 109, 124, 125], + [ 14, 15, 30, 31, 46, 47, 62, 63, 78, 79, 94, 95, 110, 111, 126, 127] + ] + # fmt: on + np.equal(access_order, reference_order) From e4377765b2ffa71562ec2c509ddc83688a23c546 Mon Sep 17 00:00:00 2001 From: Erika Hunhoff Date: Tue, 22 Oct 2024 17:56:35 -0600 Subject: [PATCH 16/35] add visualization example --- .../basic/dma_transpose/Makefile | 4 ++ .../basic/dma_transpose/README.md | 15 +++++- .../basic/dma_transpose/aie2.py | 51 +++++++++++++----- .../basic/dma_transpose/transpose_data.png | Bin 0 -> 220233 bytes 4 files changed, 55 insertions(+), 15 deletions(-) create mode 100644 programming_examples/basic/dma_transpose/transpose_data.png diff --git a/programming_examples/basic/dma_transpose/Makefile b/programming_examples/basic/dma_transpose/Makefile index 76d3214afc..9cb2d0fe70 100644 --- a/programming_examples/basic/dma_transpose/Makefile +++ b/programming_examples/basic/dma_transpose/Makefile @@ -44,5 +44,9 @@ endif run: ${targetname}.exe build/final.xclbin build/insts.txt ${powershell} ./$< -x build/final.xclbin -i build/insts.txt -k MLIR_AIE --M ${M} --K ${K} +generate_access_map: ${srcdir}/aie2.py + mkdir -p ${@D} + python3 $< --generate-access-map ${M} ${K} + clean: rm -rf build _build inst ${targetname}.exe diff --git a/programming_examples/basic/dma_transpose/README.md b/programming_examples/basic/dma_transpose/README.md index 5a73dde0e3..1d7563cfb1 100644 --- a/programming_examples/basic/dma_transpose/README.md +++ b/programming_examples/basic/dma_transpose/README.md @@ -15,11 +15,24 @@ This reference design can be run on a Ryzenâ„¢ AI NPU. In the [design](./aie2.py), a 2-D array in a row-major layout is read from external memory to `ComputeTile2` with a transposed layout, by using an implicit copy via the compute tile's Data Movement Accelerator (DMA). The data is read from and written to external memory through the Shim tile (`col`, 0). +This data movement transformation can be visualized as a map which shows the order the data the data is streamed (e.g., in transposed layout): +

+ +

Visualization of the Transpose Data Transformation. +

+

+ The implicit copy is performed using the `object_fifo_link` operation that specifies how input data arriving via `of_in` should be sent further via `of_out` by specifically leveraging the compute tile's DMA. This operation and its functionality are described in more depth in [Section-2b](../../../programming_guide/section-2/section-2b/README.md/#object-fifo-link) of the programming guide. To compile and run the design for NPU: -``` +```bash make make run +``` + +To generate a data visualization of the transpose (like that above), run: +```bash +make generate_access_map ``` \ No newline at end of file diff --git a/programming_examples/basic/dma_transpose/aie2.py b/programming_examples/basic/dma_transpose/aie2.py index 07ffe2dd73..1a8759029c 100644 --- a/programming_examples/basic/dma_transpose/aie2.py +++ b/programming_examples/basic/dma_transpose/aie2.py @@ -5,6 +5,7 @@ # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception # # (c) Copyright 2024 Advanced Micro Devices, Inc. or its affiliates +import argparse import numpy as np import sys @@ -12,20 +13,22 @@ from aie.dialects.aiex import * from aie.extras.context import mlir_mod_ctx from aie.helpers.dialects.ext.scf import _for as range_ +from aie.helpers.tensortiler.tensortiler2D import TensorTile -N = 4096 -M = 64 -K = 64 -if len(sys.argv) == 3: - M = int(sys.argv[1]) - K = int(sys.argv[2]) - N = M * K +def my_passthrough(M, K, N, generate_acccess_map=False): + tensor_ty = np.ndarray[(M, K), np.dtype[np.int32]] + data_transform = TensorTile( + tensor_height=M, + tensor_width=K, + sizes=[1, K, M, 1], + strides=[1, 1, K, 1], + offset=0, + ) + if generate_acccess_map: + data_transform.visualize(file_path="transpose_data.png") + return -tensor_ty = np.ndarray[(M, K), np.dtype[np.int32]] - - -def my_passthrough(): with mlir_mod_ctx() as ctx: @device(AIEDevice.npu1_1col) @@ -56,8 +59,8 @@ def sequence(A, B, C): metadata=of_in, bd_id=1, mem=A, - sizes=[1, K, M, 1], - strides=[1, 1, K, 1], + sizes=data_transform.sizes, + strides=data_transform.strides, issue_token=True, ) npu_dma_memcpy_nd(metadata=of_out, bd_id=0, mem=C, sizes=[1, 1, 1, N]) @@ -66,4 +69,24 @@ def sequence(A, B, C): print(ctx.module) -my_passthrough() +if __name__ == "__main__": + p = argparse.ArgumentParser() + p.add_argument("dims", help="M K", type=int, nargs="*", default=[64, 64]) + p.add_argument( + "--generate-access-map", + action="store_true", + help="Produce a file showing data access order", + ) + args = p.parse_args() + + if len(args.dims) != 2: + print( + "ERROR: Must provide either no dimensions or both M and K", file=sys.stderr + ) + exit(-1) + my_passthrough( + M=args.dims[0], + K=args.dims[1], + N=args.dims[0] * args.dims[1], + generate_acccess_map=args.generate_access_map, + ) diff --git a/programming_examples/basic/dma_transpose/transpose_data.png b/programming_examples/basic/dma_transpose/transpose_data.png new file mode 100644 index 0000000000000000000000000000000000000000..33112790becb1922cf30e7c35fffaac43ca420e7 GIT binary patch literal 220233 zcmeFZg;$kr_b$2+0g+Thq>&B@5u{6yE~TVF1nKS;1Vkhxl}127y1P|MN$D=>?%s2~ z@Av)2-uwIkXPhyP0~fHK#k201_ngN5mvDk+j#v@c;Xz9Id{B z`0p>sXEAH2ZutG@YXt3MD%O90x#36te_llS|1VOF{C{N;-p4;QLMI88T;cd|#GyNommThdroZAn{Oj*lNdCh|E*uGntYynTCptjw(S1Mwr%u`(uyrS8Rz%4x~m z!QBy~@SS#=a04!q7+e*km2G1FX8`u^gM$r^HYb05euSZ~uMhY9>L~3pX%sH>b7#Iy zv(yBqE0%RWCoB17XEf9LNU=YWp6eS*pYxA+BInz&ThEl0MfLRb=$>M0YHG$DY9dEw zAot&UYgJeht9?_QeS<+^&>nF=lYW_riAnHi!r?jwh7rfT8`#*d_Luu;>F6{&7Zw&c zjDBK2dGf^8-u{bLxj8lo*Spf!JzAZgFE?0m&3*B!ON6Nn`vS9 zqs`FpaJ=sB?mq>(2@J`uUtWABWKr)eF_xQ{oZQ*oPBk0&>bcv&P&qN>b9E8-JAvns z$*+49p4-j0*IxgQe+qYU+p0fm@9svYdi?lqsAOvprFZ*8wL^|}B^$c`8>6-`lj~Vp39$Ryi}Q2L}6fyeePi@6*!DmZQ_PLOI_u_k-2j zTZWvU;c5n*T&%P&*X!=Y=UwM8z}r-;+7)>trwR#=3AGzcev@EE9Bxi(o3E>6DaHs2 z3TF8E`R&>i(aNA=;6@`>P7l^HV>RpD%dbnPc%SCL4et;T(4a&H1qDTa`t)M%0&F5< zZ>dK+mR!JDzJJBBKQxXO7Bf;YD{9JZDd}aQi05%p#_(DQ>()ed>2+x=BDT7GD+1&^ zJZR&qkna5n-vjLmY#$$=8t09hzLM#N$J?`cFN(j6P??Eboj)=(G!)$L6{nkO6^t3_ z5xM#R_TD47C!b@iUZ4}4mBk?BaY)O=)Uj(iT0&=SZGC>Sl!AyA=vW&rWDpUVHeZJW z`pU$l#A$74eC+T3z9Rxoh8(MrUR-Rfy5-4Cv;WS)LAf9gNvP#i-RC!`7`N}-d8Ij( z{fq_IIp=X$==W@9mqoJuoA@O53}7IlJc zY8Jml)2(%;1FL)Vy4&{eFJkaY;!mDj1A{G%hS5GqOG~TtY=q<8pDKpBf7JhmEB{p*|%W#jP0TER@lb7QPLM5xjIfO&Lu^iQEaSRR*YZ|e67 zxkw3^gPi3VcoLY2db%VI898~^1O+lI7rA`F`zHiP&%)`U5*AJdcT)87$NSrBao}(Z z_3AB8KhsBHiik8m$N2JSI%&w1D^IKZJ<_?r*kZuJ?0qLt+U}F0+}Ucpn)~}VFeQcZ z*|TTJ#SJCpDY2WEY`8qNkPN5zT{-QoZH^sE!u=A4O2+T_PBDpJlht9l_dbGz$6Cj- zy0mmJ$?`FkO)VJ3{Lj#3$C}$~lM@q`|8cZR5`Jt*uweWG9Idyvx98=_65UX~UVS{b z#ZZy$>=UGK0*56PMpnIeHkhv+2a6w(k`nIkFP>xUeRbi&@3^d7aJ|fGyaN8mx=gtR zEq28{vR{x^&wJ54Qf!0*?kU6P>T-W;nlh^6dxlKZ@mvVI>qhx-wnky{;L$p`AqZA4 zSNb#62^`b=+IJVba-L`2BCEU5W%oKEHoc%Zj$-$qw& z{1e3r@f9Y}VBKf$mXwylIpc<%F@jh@N1-Hg!L_oolBZpX8*!#5B_###6MuV)P9`!_ z9=ze+-`_0dzlsc7IY>h5E)K`(I`7=M6A>ACt?6KGn6>aB79Ji(5toCKq9R*`UhZIj zo@VJw<2mkUf2(jZ+xy3N2 zL6h(8H3fPC6ciNX!otymFfEqw*oxO}msUw|=Q=o{g|TuAm|a)^7SZjycLV!OGo->P zETerG<{D5BDDWAxAJVp`%`?_xo^ToLJbC7mz?H*VFLO&`j7v z2%s2s+bvi>rq+7X#LLVE&_zT)7MY%&4i-lnN-3iEK0KU#_)5&( zy@m@gOpZ(xeJn4WEGnLRM!LItn{;@%-8!nrGhv8~MRTVG9F8{_x5h{jq zkHhu*92^ng#Ge=H2?fy9JM{JSm6`TkOYh5eWK{pr)`pw}@;HIJ{{HUPuN0B#$ZQ5$ zTIG6or`k{vPR>X$o{zDyNWi6CX>GjRo3?!5E>BNjXJ>Z~a1!qIWJOu-U?nR>OZW18 zuV=4cj{O!sKB6g_Nrm}Qp8eW*B|G45)a2x3om%J62CuW*#KggX2Rb@Bz^N8FEGc?= zdBxzWRfYT~H29_3gU|myI2Z$2#N6!cGfQ19Es}JpaC!lO1c+5EcML~y!CQA7FeoO@ z01z!6zkXEQMllbT_bY)XJUaRg5+TBbz-(1>o(DjV0c#!D@#;ChYOed?x(uWs4u5~m zhOjrxL@5c+UY>2e-kJM>5Zw7rpwsA`1d)i5%xtAhiJsfAik# zL;%;|R{?En>G~XR8zNzby1F`@l)AT8K0tZ@aygYf`%p=vN=$c%vM(T;xpnInBGzOU zkoqe?BMVDQ;|JvXFd-y}1!p4R?JcaRs0d3h61%}?JA=RzKBkIe(|yj{->>kA;|;83 zk>|`GH>DC-`?e98$Jo?+f=#@w!X^L*G<$Ub-&D_IgS*CMOD_-a zw8Coq6Q2V;V9XCK&!)6s>Pja?r~0@LLpM7DLQ?Dl&6iHHaSx4tzI#R=aPqY?x#n-lU-NB*S#`?1>c^76&gNIbwo*5@M* z5frj%I`oxVy9GZPbf{v=$8 zm6_tVHmPAyRYo31n{>3aZvjNzQBqQZ)Jh^tF==~$e_=pLBoiXb`go<%3J1%=+>a3C zNtF$Ah{x4*=fr)%t)t=UD8qdo*v?7BK~nf8(bz-u;AbRV+kn`mfgH>Fg zL0aN{w!yQzx5wvo$^|eA>D!Q`1ccL%$;kzdpBB|2@WWb4)jDrH=%^;~?&*BFHJ&=W zCa2IXR&d=Nf-=iP>Ty{`MU%Pj!7%f2;3+y_QvkTWpY#dpwBH!x1|*Z=c&}xW9LX=y2!apxT~pd0#2dxTjam6Fl- zI*4g`7TfK4K2)f$9}gROhmx|;QMz&i=%ZLj7Bk_@$N`k?Umq={v$3%;`}^y2f9+NS z%gO1fY+>VNO}}C6H}C-caF8GLG@fk=Bu3;uU$L^$GFpYbQ57S!I;vy@=daG#DY;B|^uEO0c%UT4mbxl2n+7p*brBE~9hlq#(!k#3AdJu&+8po# zvTxO`r>3U*0mcCM3J=cC&VISplgLNICm_IbORIXK3J`%tUVBlGiap3UL?2u{3*-E#s>FgD>omEM0(t=J%Dh?6A2y_IS6_A z4?s0$sJbqGIh=kZ^Ze@ZyW^OwLn~#Eb3dyQpYl3`N?7b)%f-6^kE`}pQ(MOFNzFMF3yg!z-%G8 zlx<$_>=7I*QqTR-(SZr>xQpM##pSt*O3clC9j!|1-)j(6^Yn9Knf28?F(mY9K z0Vt%H$w`y~^9bfF`&P}`>vSJU5+WcI_^g(zPN;nauKXDQQMxC!R=BvhNHz^logIYU zpP{5}CB|JqcD(6Nn|v-R>T68)VIWJ%h>Ij7G{g?<6VjUKn}zZ)@>eZyF)hc+f`Ms@ z`bZ?47nOcbh&AS?OV))oXD z$tTzZ?f7v>kCA?qXWFwBvT|e~M*a#@Bjzyh9Xucj{aKLpmjmy+%bxTsB=4v*%@~xb z)Oq8#$;f_znIm}$1TrUp#4GjyvTw$ZTw^pmJUk5-huXkKh=o%KsScj!L0|*S+~41i z%%p)wigjA*NogA&*M>ztobuS}OB2W7ciEH&D?f&Fj70ko(dPipo}X4+us^m4$^@08+Q=_He}mv7hn(dj30+ zFY5T%_4H^f95QyGxjcagj)mz30$I*<&v5k5r3d=z|K{R~Z~(6oa(W)y2I5gF0>+V% zkwE~7J2NwrYWr$&5BQWR`|d$V>UWk>eAHh`R4%0jQOp4eVDKmV8QlAX6lK zmv>IDnE2ws=lX|y*GH=CjEWm34>y4V{t6y&eY#PfP-UfV=O^ippDgtsOuX*9{C_60|5i8t$!h%!F#emx{3pwWiwcW>{{kC;ZSUX! z$zfQI7wI1gk!&AQiStgCv&Y#&-pW`1dHkP)ZEIucZ|m`$%Fa(AGc$8`Wktr^oSA}x zLN>@j>Yp$~`KJ+w+I#VT?)87&v5KcctV#%c;lHCoKK|czr(PCvU*+n5Gr6kT+VnnC z%gakMGqWF;YBc}&VvPUo2;qTwl(!)t{~HG>H!mMcM@j%^GnlI(l}mVJz42z*|B}*S zrJv4xC@;tH-oJT1ym2tFI=AoL%XYkXZ4UR;C#<%%w*UT!s8l9uHWl2|Hl-g$HRAM0 ztO~v>f9gjW5&h&4+kanG`b95Vrg(OQZA=?pYN3#*# zEo;7SJh#gv4PQ&W813@aLzi?-k42TU;USq7gk_W33W8a}|5QqBkcnIrjgOh!7l+s4 zj~AQ$Ks6KjlK@xVDn|IWLY@?ZoAxphTUJWhjtv(cA6lDVaU&+wrt-$bCmYdBjwHiu zZIn-L-TzO%4YNB!|CpNF3nxGk5=wA>z$gVmWXTl&hw}f&R+yz}mznp#$aayb@lR44 z+nFYmmX?;~$yy#LXvhXR_biW=5+*0FTD5E}E=u$yJ4NHBKS9Ud{@E;6uaIv(^tQq( zChW`08oX!xe(y0Y(NS=s!{)lp4wTQtoOpDdY&QI+w114xWQY%pX{<0Z)0f@l{Z@67 zA42*^^=ONjdknF9A=HY0o$bD?)H4(k+x0?6e8N9BwpI9Vq}|Rr&byd~Is+Nf`@$e` zo8ZWf78#<-#Xdl0rtg0~26_(QnYr8LP8%hJR|+(m8lj8R^7%mxN;>K<_k)9(JWm$U z^*pSC`we3f)N>6FRt+6Db+BAqP<<|myN-9(_*^z?`qN^@=fg2LoXl}rS|;8FcbIf1 z%Kb_p%5r?M_;(9WpY=_5l2~DoRbwknxTt$g|HqhVBlgy&V&zhbM4@Z?zu&ToFq5mD z4BiMZq!hnURF1$1;%S--iV0giEc5Ak!;iOOo0~>wnDVimXScd;G6Q+rzMnB9QC_xK zE@@Pg(z`XPY;|#|jxQ>op4s!p+fv#(i1NGR4EPz@>OIA@A@e(*aYtY0#n#3{ zz84?K%p0kN1)VJfQFqf%%KMMRSK2!Zr!JH$iCnKgaVJYWMtgas%KvTm(H~zec7G3t z2wLfow~yFSR{4l#Imr_PeGBLpCM>5c~#205J9QGuWR z1W4>QzH-dY{Gi%A$(@B}UlbfWyS|U{@lV1joJ^+#MOTWfyP}!w?UN%SL^sB|KTzuH zu0&YNNnGFGz>+i~kuhu0c zTieI|_BWQ*xWZzl2uXy}+RAGJflxWuUdcZ2t=W9yadh;(K9eO_CU{xM=@|F$`7n+I zyA&6BuA%+lM^9E_D-|0qg}P|isfpq1e&>L8eVMIoQ#vI-7p!6&kVF}CeT@B#Sx)L3 z7q9imG}T*w`$qK98xN=KNrjbE>u?XbZOg9mX!+d_TG{=WW#;C(rii6BF%6X|3|xig z?TCJ{$*+o{_kx3mBWN{JF{qu+Z16oapGHPT0?B@Sc1EPVxwX|3!=jPbU;+r$)!ki- z!o>l1AL=gvmdu0Md3lcuykhfzCtut_MR%kU5=!#*MIdW?KrOp%a67$XxPO1@`*%UC zCa8Rx4&@Oea@BEKySgr=LWfNa2EYA$8&HiboI*xFQeupimR9hAEGNuFmz=+eeQlv} zyxc|!3NVO~GGa0{j#t&`D6x`$O5DK!ya}K%Woh|<{PanPqO6pLaDHHOs^;!Az`!|R zv&3`#gGIWgA9}pbz80Qr`?L9JE2IxHqP{xKLza=KdN`^@D5B*I^*dheSiUf1WWC9; zfZtE=u<-zEBcPDr)L5w3lv@yZfIr{Vun?0AUzMMtVQ@CRW0OAkMnFm`Cn}2Qies1h zwu+vVz)Y@ra;)b6tOwDXtHC~2Zo|&*bIfF`-285hgxt{^r(-Y$a4z!5`Ny{3Bq3dIXOA8Z9hVYwpN!|HJ|^XtrJ6aazp?XN5)>i z&jG3D!r#BwAlo(pXk$}jfJ(hRM<$d1Q-+n)xI|{A=HTEJs zZ#<`Zy;hfL?pIB|%%)rM)sdem*w9xjv}D+s;|$btn0>c-bQ=CgukK zSA=PQo5U5*KYw?*JwwmXA1Z@@B3ow(8<9?C}F5b>t}N zb&CQkhk1c4HAmxihwGXMNT?*$V+Du3Al%msYrSdq?#VRu4H7UkAI6XBka!+>t~*xm zQ7P!vUv!q*H<_DJ8N6C)jNn_Hui6^9T7E;Z6X+g$l_XMH zTG|(zWfQ*)IA(yoUBBNBd$zYE(p6?ggJjX6G|%$vFVt`!=<+8$wjyD|Hyj-+$9i>k z`0)6&2A_gL?fL z))U?+BI8$j%h2Etg>Z<^bOOKFb!(!%3&jKktnla6Ra%=^6*~Jf8iN}H@9i@|MEqb!A2YgOqUjjSXhuOSE0czM9S zHk4*I6L5IKab{UiIM`w&G}EBmaK0-i|26XBZBMcgmeOJ1s#<>C8}e*5yuh$@(XA#V zx%cwm%a4#WZ-V9L_DQ*-q9QrGugZb`^B5|p_Hy{sG&*8A+FaywLmg_0-#zp z?*eE9-z?w581hfb!4iH2)KHr$vmA{CR!1}TvphX8tCGM<-T5HzweL<2(EKI=11=&J zlnzzZ)iI1jPzEe5eWUOFSteiWa8RPu<7muslK&<MnUyNeBvVRt;<`3VFX!_slIVC~2J6105Sv*6=bR2-GKGCknu(p>~IH?4WGh7OXScz+nLy zqw=M_6^|&aig=&Qb!?a$ZA^4q3*+=B!t=tZL(IFrz8<*RRGVv?A;pb;Z{oPe(_vxw_|%MaV^^eacFFvSZjKLUVRyC5B1{m zb0G_Lmq1)A9j2X_Oj$yq#w!ZRqs^x-x2!3&XH9TOYl_^R2x>ojTlLevI874NsvQMx zNj4hm=FO7x`UQ*X!Wy9)H~fD1h+UA@%yV1o?4B74qa)&{F$%rZi2GuC#7p0wCMMwA z<4Bd@V`pba?1ypKaUYL&aEH1)!a=R%pVcc}zN&IqisZh*LqU2FxN3G0@3r4LxSZC# zPI4@w<0z$GI6P2h*3r<78{idmK*3M)3$FyG!!;|sY$BOz$8sv-wcjTt7yU>h5@8zj z=jp(>V*GnjGJ}59-n6-=iaFo8EV9Q?+!GO%QP^X7+}66~bh--z`+`@-kjqM-CWwR^l)*w(l5 zez>}RyX9_yZr4|@v-mO_{V1CT;`SdQX24L;1$@Eq@xiFDGz$z5M_n6caF`KA$H2{S zxb$Shz>6glg{psRna!5i*&#)l*?jYtr}qUfk7dxP**U%V>kj!PBwOBG07G{^QrY-w zRIfhOTgY^nVyrTV+agU@n{oZ`w|83iw@=hLNM^%RX1}AHJga{!pP*l7DJEPec&BAd zy!3GQd^xVWi5l(9(V~oF&cSq#G4T?Mjf~N~&aUd!iKbPm^;wG)hN}tcFKaB~ju^_? z&pxEAUh2f{GLcnflhV(lgEJTja3ohS-Kvh29M0Kjr0x>p_ezGqt7d!FWI`U=?FuY* zi<3y<9Q?gLH`NmG$LCQ8f2_ja9kPJC4*Iz^skXVH3F1myqKTFy%#%F&HcFB3 zXci{?dijBF$_*?-TRPH#&#D=vX40=!`Yzb9LmTCaOMY@MQPGntq%)h6sEG*_V}5;W znUPHkE2@KSZ@)Q@BGuFSgSN_*kd2}FLu3bGO1?ioigNAt!><^g)tJ%aXuWmhjw=|! zI}x_Tx7k}`x?;uV-j8nk>vXB7$4+R}Ur8Su3hR^$OIv5!?z~YfeAA7>wiU3pM3q_8 z=qAPD(s$*pq`2Tk;_LJ11}RS8w7T^#9xP8S>yl)<8=Oj_Loz4Ry^+HbWaOyUX){B2 zCgQ~|_-xlP+m-V6i&!1gW)5hii6i!~?vVNUwa$#7=zP7)ZXt+AY~v?>oww{-mQ=GV zZV3?+fdJL?4Jt1isDWfq~n$}>qV#+os=@{l;N;0aPb1OLnV4YMN) z3yF+=)&U~?;UkZYzUGnvwPh-wOD4SNFMXz_BOEt;u9$Ti@_s%2?C&3&E>-wEv(sbY z@7+e;Mm|1_ci}w-C%diS6z?F^zVSY*EGW6atFPPN-}L&#qOtp)b*ukJm-&f8LP4=v zl%TM$B8Eaj&9lt+$!o({o6gzl)wQjs2cUjXRu01tBM+FaZ1F?eb@1^yNu$L;{a}fk z!-G@1{Rew((dC?4MAUk2DwXeEA{Eb4L7*lxkInIg(Fd^DrzSGL~qpYCn`I zQ1}vP2wjg|zpIv`lVq@CBK`Y8!$fU#v5BHiBqbGInR@=sDn4=d!^zN6E_aM7PYPi- za{0ws_VpwhV|n2nel0-p zD?gs}DGnPeqO%yUMDfYcL+NuF@68zuejZ~2M_-E#(Hb*KUK}<}Mb0Nv?kD$&u6d~} zI7)xExVe3;0nJ3EVXP!Q0I$?MVC(+veUD)2-heAmCc5T!kv_&QsX3R7qy-)631`=& z!pR9eE?H3n&Z6CgJMP)xk5P^<<1V`y2O-TxMJ2U(_d@XrV+_|It##)otFVu&sJnf8 zAt7Hsf;_q2&Iro(MJ&+zrS2odO zWS=_ykvCQ9sW9x&y%eLnY|SZSOP{}PpV{%iH;U;o)>4>`LU}`-B%h>1H0?VUJ`VFt z=JufPH_s`IUw7isWybWAXuf*22wiw+Xar-3DYY}AI5FIZSGP$ z&6v8s6yagOkgb~<-hbEu*|On&u6PR-KB+D9dUG18Vzk?pws4yH^HAqbsd5taTZvsRg%p`%7&N zb*lAWTZEE|PdDr`Zk`>9o6vJvs2{FPOs1)^m`;+Y7rg!Ssg^RAo1Yvz30r2zmh1Lh z7hjp5I#xM}Xw(gkyG@cT{^#nk?&MV20fNWlKNuO?1Dfn8$wz-laR2_(P3_J3H?NqDKKOmx#9zmtC@9)1nqbh!)Kj~kL9A1K zLxW9Bk4^P}^~?!3Y=-j2pm|F*K}6o4CJK`5ajad=nK9z_2R39RwphO34i;|B7+qH7 zKAVb^qp`&c`jx&*W&2gfwm|=I&2e*P?1m1>lU>R7!louF!nqsWN`5=kcgPSbZf)GX zZwgR&xiC~n7B1X1((B6aic;BL;|&rt&?TppVUDNhV`fi9Q6@bmRCbj|Z#DsHd?FUA zil8^@0hRK@d)VK9{scLY45-J0OVTAnsTml8Kx+Xg2CkhS&xd>N{2;n1p|?;ueOP2R z-~n7?2$bug7|Qfbyraq0?%tRT3-WtV(!Jl^n}NbylcO{^Ep`U52QtSc`V01IpIZ}L3=!Mf4n){>NX!YZ z$*39dkZ(*oG!Bo)=! z8FNDqescdIuKe1~i_UBCi_^}2-E9$;sZ6jc@y%gqtf`|`#<6_H-VjFGA7?y?UFRnR zb7k%a{?p&CT9zglWWtM1pa$nQ}|QCIF#Qv5ZkyU;f+qL-^< zj~ijHK=Hu(*wszeZy`5ArPK6}q1FAe^2BJ5vo3~##>Y&b5>ch`EAeU?FbljR61>;m zOh2KFjoM{)TC80+i!(U;AR99DEpL8i63Z_cH3w1B?N2I-8V` zW&m%5;U>^*fn!?V^ofdLb!d6bcMZFj2P4QN)h?jUhw9*CC-%sD#u*fYn-Lg^XtJbr zu8h6-d=K#$A6)soTR5MhzU>$@TJ69<>A8&p+7t#5or3I(1L%3#&{?Rjy#_%qbQi>f z*c58f#E&gs1lt3}4;uD9ov+BY1`tdCFjd_Q!xL3k$Hf!mNSgM!ig@=<(s5Pw)T+{D zirC^rfR#0Bs$PGt_kMtsE?O*G=+7TN-k@PofPkEmgsW&OqZlX-$2IlwUC+z&`nuz} zq0XD7sv3oV2h!W_J8xoVS?j)bKg@e>K02(=PJ(l^yQov+6!N#9&X|C}_w%FXK|;M` zbcKXiz0DYn5RsHa&R+>GE=DZjSXqYlc#tHk9{8V~#^@au$Aw%9dt6W6#39barqb1< z#cZI&3+wJRp}k(oS;+L64EL;R*(M4z_Jdz`dCaZFe7g0A#dfA_UK*sfSbyg3zHl!r zHBll`Kyz~o`uLm1{vnefeoZvHo%`xjk_Xr=G%bWjf7QP-u&C};f2l@O;GQ(4V^i30w?$#}5hF;hIjJqCbaZTU|Ek*m6*l33F&eGN8eUa$cBy54H*eJ)P zZ}|9n?xT|a?=QQns2ex`GL1#s?hy3yznM1RLt$6wE&Y+w)*ZMoy=iW`_)_p@PHVFR z;qtlIaMpeaTNM1!G@cpFGw=7D1RPkl*T?Sn*s=8lzUV(Dy<|g7U6;*?z*m*q7t{C* z!e%Jj977d{Fw_WS*dNIF`Xen1HEUxf6`pkbiniFUaoSQ$@y63Sb+Q>P2>`v)Gv(yq zbQX}<-aVSW;_U0QFG)&CQCfR!MJ(ug13~)OGS&J5ABa2OFB#s`4Nm8yvsiVz4ojS&zEBA|2Cz8kJ zEugkUxB{(^P1NsO#amsi_4133Fui2j$;df>QQ*z z_ZbhwNlLuVaNWENpQkivtYFPi_lNPyrx5-YIzFhB!?aRYwHvRNBMKDaY}uVCJG=Rn zFKEHS+#}*MYRbjUU?#*XW8*%q2Z=Bh+$Lm=4ra#Z@b`m`FpGxb>O7%kyiaNSM$wr| z*8s6iqj=ZQQ^K28V-@o!MEcCkjaN1&o7MI0@)1!RWGAmkh=`=>BhaBIiUlG6nKK|T zG~V{YefG*t{kfr=z!=8TbWjFPY?e_6ba+)XKA~@ zMuJi*@p#*GF4HOD|zvu^kxjEC3qKBX$W%jw!ebZ6670Kst*$i&0a(YvCckp_w_nuSn0dS_EVe~#-VKizh zP$|=_;$G@m>aVZ$WDw%!hK2%)pW-}aH%9A>u|O@|+|d!2EQA-sA5;^W>~&X1XQrb# zA|dI=7xue%wHqCC63M*x@7L`FUPFn6ZN7q-7~(}rSzs^V#2Iv zdM7hUXsuu#P>i@Mf*m#VBwbHZaALysAWG@M8fe6j-W(w!h*}%VcxRbaXX54DQQPkF zK|Kv7riQD{VeOxMZ7$JXqL8~$(AKc2$>U8LE%zp={1un+XI{S9YdCR#TJC*PGL8EA z!N)u?^YJQ(3213`#F!&^&l=@2F0EdZBBZt147rwj6--+O-?DgCFJnQo3hSCk!V#Zj z`mNt@UdeAgWg34l5nuM;*pXb2CnDq5ozuhWlw09TQ4oDqRfc~%mIdF4c=t$j z)o7+V5d_%1E9V#0F_S$=oFTh z+o7ioStWyd4zfpObFwxnSW-1ZHsG#jx z9=72peSB`wsf%~qSkvtx+I(ULbG(Ls4d6n>nB*}@Efngrf zBp}?)rt0{h_#y5v7^3g~H^QiO2#eLv$m+<%cS=qwL>H&Zd4mM_zeOmGa9NE-15mE3 zujkvFqbs;Dsr_455k@I`B#vk6LIri>^K(x&ohng~XLhu=H!WJ?ekDGm>TzCrUY}pt zJdLGCDF)4J(9nWx&;-%nM<@bAz3-PUR#un5J9WN^0I#NyEp2oXd1+}Xs5YmjQk|T; z|7AR{xRx;Vc-)=TuU2dgGj^JNZ|n2PQRwfUF0US|L$~4z4|YT-h1Lc=0|N$#ce@k$ z{3|PYpkel7+i}${t4_Slcu(2E<0>CqMR6Hm$$hcvXR`mbusNUe?>&W^7rc_}wttcUJ z9h8`S6JrP`dX}%njnu5cq@kV_cho!-hx{9y$O*ze&kglPZ!cIbEMNK^hH-`^ z7yqA_GLhSRd!Pf+&jg!=g$7YSDw7xTZwT!d3$wBWDZO62xYrtp!y=zdWYD#sQ=~*K z*4UXpSzx!tF~3Um*Bp4l88 zj@zKxi|Fh*%O}0O8jeETH+=Ckn&U|AcYAv(6=nB$PcN47DYQL2@VNq&7~-5?Jk7v5 z%0(qVbL%8o=;_7Hc^Bf2iqZnKA>QMT7@EIqXv$^eG8WIHZ>)sn>DJz5JiSDGQcv+G zI}?e!y^Pa7|LxVQb}tK7ub%M9r0J{L+4OMXYYWq;d&gMk)p``JEmLl2+Lv5cVV`~Q zq>K0ByGeh2df2*KxmYvTqVx1+wN(v0bjRQ@)+DnqGDc**e3UcG8_|;q<+dbanZARA zo}1rkR3Cp#ot_8l0Ug*6iWoYEHbu#Y%;GOTO$?Xjx%F=7IyyQA8@nBPS7s@{_{4Jb z#3q4&K{5J;`jF%I!!O?VbgFE{Rya04Mb(}cYIO??Et7Gnha07P;Y>ecj>Bg_)RNjP zIBSk$EaWbT78rU-;+6A(uD2r~@+Px1qRu?$RPa?YCJ-`DM>&|E=(k0FBBIGzEOZZ_1+S*bN*R!v3y0~F z@H3J7DP+4*;xDHktA4F8XxPh>)oWH~u~2KBoyuN#c3}6b-cFZ!f)6BC@{*G1(2W{P zpd>Gk4L^Kq*vl;2-mdvpkjd2(^*P=gV{ddSEdrltt$dRC*~p^)!5>dCl}9=&H!Q_} zpEYHs%_f^-rvH7Ij^R0FGOUS#w3Hs`51?v%=v>(nhm3Lw@hg${kB zmK*e*D6ZgNkWL$^7jOBPqw(T}ZkI2Y`5pWjb?5tp%6m_Da7wGPo&P zqF1fQOI!OM22K+&Cy!B$h#Yo=2DBg9em(e}0D zC#lsskFtrR!cQC1rTdgBXW=4(bz`jF@4gEcNxq&x!op+sQl^>IJr>+M8+$KDTu-|$ zTeWxq47o}4LQefHvG0G%zQP_!&ytZMNCNe6qp|7#Zt@5WT#0v-ONF0TcV0t z>$=xDOV7E#Z)xQ3$8s=_VPrZVD2tzWHqW8lrUaQ*um$S ze94B;mg#vn+t~5!3fB(f-vub*@KM9V&tmx{_eW=(96xn)OL^nxKZZAjF{Q8-nqtJg zg=+5cE|x=fFJF&qse*(U^hvOwUSw-qp-e)suy1eH@)X>-p62&Q@P|gar0}=RBh9St z`iI<6@jmivA;SCbb4lE7&dGAYfY+Nr%M$~dJiaN^P-=3rKNsY?d6|yaAE&K)rCNOX z_XjG~5h2^hM9fi8K?Hd!Iy7_9a@w-z`Ca|iS51Mye78aQXXtUj&TrRh+_-)r; zfJoL(bo64fObaKJ^b8-kF7^Cx&@1qaj90nAs*yC=tAbxx*qxf@(e@Ghv|0P`@SArx zc&Mo-IyxRc^f;u8u34F?dMGG_hD+gF|8cjZJjh0lRpavE?OMfZzQXz% zkC~zVfM2bnuPD0E869w~^KKIsHs~pIp^L@E_u|jff$85u^Nk(T$&H3oYu&Sdrz)a7_JiWV{K67IszwRt8_8VXCHD1(2^cl!JjO%`4W~2VW@bsnh&8sE) zqMY+z?({C}X(YKo#q9jNf1l~Xa-WfeUR`mnxFCNu`q(h)Xl>DTNVQ&W?GY)b*romefOrFf<6sOViD*tLc z3g{&-_F|_ET|%Pj7TJSov*}WXBnqK0=Ga73G68gfiq?MP-E!(C`22%>dIn0Lo80E2 zt_~dcs6;5y@l@IPFrdPl)nm}??7GV81|Nh0Jt%n+n)RrjMe2&3UN>u7H_p)-T=OOR zWS#!nWDihKoP9MNg@U03w9UvylNT#1cINV+B~g?N%tUQ=(k&s-G;J-P319FC5Iobp zylrfN#ASu{CuXtUs zDaedgw)O$6^@CU-(zsTTahUlOt&=-B64P6|0QgR-=Fw2w>9t-kN#!fOVq!!54MDhID*mT4l8@B044As5akc8BC znU4}shU%E`@+Nf^2c4hJA2d4nrlCGc_?6M~E1U9?UNJ^Bk3F1lA~B0jR-ArLIu^&Q4r`L1YDNwNPKkB^)EUA>$u z2gk^on!EF3m11wj8`rPT^)RJnrKhjrvC9xcz`>%`J2d)$R3$feUvZ zg<%s=Ssd}@s7ot5r8-bAUtH7Tk0rBV9;6PLjq91Z#$`439-N+c>+o1)h&^V|l`^Z7 zlQC?xZZKusxqiZkHMx5%7)5NY#bqUYTK^Lr1>;Pq&!ts`t07$-T&EiBf*hvri z1%J#%uwu+kSMLNI#hJs-pM}T|GANS9ymVyz{6m;#XhyQtUg1!;m;swWK2<0I1u}sk zVKm6A;I-|wF|)JAA*9KAnRW?{CA89$zQ>Nv$EEE=N)6bCY}(qyof2VQAB6%6~E=YnJn&(I@g#Jku4&>skl&5*BrG z0kuZFJ&4Zy*`99!j0-xS>!YyO4H2KBGrXPb{vHv#@4YKIdas*_trN!5MCn(5HZl5Mxvx>^x6_trt|X)Ha0neP5-+%&r+!scpEQo zPF#IHuc4Q5*&M@a^3V8WKP@bD>M%%!w(o2(kH%Lg_d&WyPMBeDDo8?R^rdJ~`@nPx z8md7VBfb=uJ+mPcBec2XD# zBxLh_vvfL_5xNbYB>JMF+Z$sy{2`!BrNPU4{{i06RgWcj*6pO+kc!lS0}^g2OrlRo zUY4-Lt-MzM#_4ouEU{Em6!3sSXPcQ(6yuWp8=DXiPqt}jpnnpEhEFYU2hMfaa&@CG zscQqCq+lN16FFV%8xlo%H16PM5^0QEp-D|WpWU$UewlTRkN4*2W&Y+vIrHxinbv}< z?WRKuk|-&8x~FlTCGljMDY1?I__1`&L+9QCbF*(Tv%w9zw6k!@2XGq^!`+0IkdRP| z@Y-F{&?ku-z@E9LCiE~%i3Rp7{eU1KduoOcyYqX%dVrem9lRn+!Okxmxdg2uNS>pc zn47CMXmdx<3PP}#fS;c~Ig-CC^8rnZ3FqF$abE(Tqf>U5MqGWpw~7iU;Hbo+>2n&+ zIaiF0A5E3oPVoTxNm^DmTPiZ1-?{S=n^3z(u~C{UL4NE;aYxmniQM^~WBi(vJ`TOi zpJ_L@z3n>JnAkhA3fzBI^B9DMsZ$iY>OIo5{(!~L5MBg)0s>CU@;t(xR7>mXg0%~- zpPTHygfnKC;t?0O>->57JyH6zq?2f4E>mmy4hil)DKVaTh@65#M@L7n{?Fp7_B5vp zft|(!b~LHK%~$`#?WzM?;#!e7deQXQhkpKYcL#N<=l8S2#tM}&j71(%;4@V-Qx