|
MLIR-AIE
|
This file contains common libraries used for testing. More...
#include "test_library.h"#include "math.h"#include <assert.h>#include <fcntl.h>#include <stdio.h>#include <sys/mman.h>#include <vector>
Include dependency graph for test_library.cpp:Go to the source code of this file.
Macros | |
| #define | SYSFS_PATH_MAX 63 |
Functions | |
| void | mlir_aie_deinit_libxaie (aie_libxaie_ctx_t *ctx) |
| Release access to the libXAIE context. | |
| int | mlir_aie_init_device (aie_libxaie_ctx_t *ctx, uint32_t device_id) |
| Initialize the device represented by the context. | |
| int | mlir_aie_acquire_lock (aie_libxaie_ctx_t *ctx, int col, int row, int lockid, int lockval, int timeout) |
| Acquire a physical lock. | |
| int | mlir_aie_release_lock (aie_libxaie_ctx_t *ctx, int col, int row, int lockid, int lockval, int timeout) |
| Release a physical lock. | |
| u32 | mlir_aie_read32 (aie_libxaie_ctx_t *ctx, u64 addr) |
| Read the AIE configuration memory at the given physical address. | |
| void | mlir_aie_write32 (aie_libxaie_ctx_t *ctx, u64 addr, u32 val) |
| Write the AIE configuration memory at the given physical address. | |
| u32 | mlir_aie_data_mem_rd_word (aie_libxaie_ctx_t *ctx, int col, int row, u64 addr) |
| Read a value from the data memory of a particular tile memory. | |
| void | mlir_aie_data_mem_wr_word (aie_libxaie_ctx_t *ctx, int col, int row, u64 addr, u32 data) |
| Write a value to the data memory of a particular tile memory. | |
| u64 | mlir_aie_get_tile_addr (aie_libxaie_ctx_t *ctx, int col, int row) |
| Return the base address of the given tile. | |
| void | mlir_aie_dump_tile_memory (aie_libxaie_ctx_t *ctx, int col, int row) |
| Dump the tile memory of the given tile Values that are zero are not shown. | |
| void | mlir_aie_clear_tile_memory (aie_libxaie_ctx_t *ctx, int col, int row) |
| Fill the tile memory of the given tile with zeros. | |
| void | mlir_aie_print_dma_status (aie_libxaie_ctx_t *ctx, int col, int row) |
| Print a summary of the status of the given Tile DMA. | |
| void | print_aie2_lock_status (aie_libxaie_ctx_t *ctx, int col, int row, const char *type, int lockOffset, int locks) |
| void | mlir_aie_print_memtiledma_status (aie_libxaie_ctx_t *ctx, int col, int row) |
| Print a summary of the status of the given MemTile DMA. | |
| void | mlir_aie_print_shimdma_status (aie_libxaie_ctx_t *ctx, int col, int row) |
| Print a summary of the status of the given Shim DMA. | |
| void | mlir_aie_print_tile_status (aie_libxaie_ctx_t *ctx, int col, int row) |
| Print the status of a core represented by the given tile, at the given coordinates. | |
| void | mlir_aie_clear_config (aie_libxaie_ctx_t *ctx, int col, int row) |
| Clear the configuration of the given (non-shim) tile. | |
| void | mlir_aie_clear_shim_config (aie_libxaie_ctx_t *ctx, int col, int row) |
| Clear the configuration of the given shim tile. | |
| void | computeStats (u32 performance_counter[], int n) |
| Given an array of values, compute and print statistics about those values. | |
This file contains common libraries used for testing.
Many of these functions are relatively thin wrappers around underlying libXAIE call and are provided to expose a relatively consistent API. Others are more complex.
Definition in file test_library.cpp.
| #define SYSFS_PATH_MAX 63 |
Definition at line 25 of file test_library.cpp.
| void computeStats | ( | u32 | performance_counter[], |
| int | n | ||
| ) |
Given an array of values, compute and print statistics about those values.
| performance_counter | An array of values |
| n | The number of values |
Definition at line 1113 of file test_library.cpp.
| int mlir_aie_acquire_lock | ( | aie_libxaie_ctx_t * | ctx, |
| int | col, | ||
| int | row, | ||
| int | lockid, | ||
| int | lockval, | ||
| int | timeout | ||
| ) |
Acquire a physical lock.
| ctx | The context |
| col | The column of the lock |
| row | The row of the lock |
| lockid | The ID of the lock in the tile. |
| lockval | The value to acquire the lock with. |
| timeout | The number of microseconds to wait |
Definition at line 307 of file test_library.cpp.
References aie_libxaie_ctx_t::XAieDevInst.
| void mlir_aie_clear_config | ( | aie_libxaie_ctx_t * | ctx, |
| int | col, | ||
| int | row | ||
| ) |
Clear the configuration of the given (non-shim) tile.
Zero out the program and configuration memory of the tile.
This includes: clearing the program memory, data memory, DMA descriptors, and stream switch configuration.
Definition at line 1055 of file test_library.cpp.
References mlir_aie_get_tile_addr(), and aie_libxaie_ctx_t::XAieDevInst.
| void mlir_aie_clear_shim_config | ( | aie_libxaie_ctx_t * | ctx, |
| int | col, | ||
| int | row | ||
| ) |
Clear the configuration of the given shim tile.
Zero out the configuration memory of the shim tile.
This includes: clearing the program memory, data memory, DMA descriptors, and stream switch configuration.
Definition at line 1085 of file test_library.cpp.
References mlir_aie_get_tile_addr(), and aie_libxaie_ctx_t::XAieDevInst.
| void mlir_aie_clear_tile_memory | ( | aie_libxaie_ctx_t * | ctx, |
| int | col, | ||
| int | row | ||
| ) |
Fill the tile memory of the given tile with zeros.
Clear the contents of the memory associated with the given tile.
Values that are zero are not shown
Definition at line 387 of file test_library.cpp.
References aie_libxaie_ctx_t::XAieDevInst.
| u32 mlir_aie_data_mem_rd_word | ( | aie_libxaie_ctx_t * | ctx, |
| int | col, | ||
| int | row, | ||
| u64 | addr | ||
| ) |
Read a value from the data memory of a particular tile memory.
| ctx | The AIE context |
| col | The column coordinate of the tile |
| row | The row coordinate of the tile |
| addr | The address within the tile\'s data memory |
Definition at line 347 of file test_library.cpp.
References aie_libxaie_ctx_t::XAieDevInst.
| void mlir_aie_data_mem_wr_word | ( | aie_libxaie_ctx_t * | ctx, |
| int | col, | ||
| int | row, | ||
| u64 | addr, | ||
| u32 | data | ||
| ) |
Write a value to the data memory of a particular tile memory.
| ctx | The AIE context |
| col | The column coordinate of the tile |
| row | The row coordinate of the tile |
| addr | The address within the tile\'s data memory |
| data | The 32-bit data value to write |
Definition at line 360 of file test_library.cpp.
References aie_libxaie_ctx_t::XAieDevInst.
| void mlir_aie_deinit_libxaie | ( | aie_libxaie_ctx_t * | ctx | ) |
Release access to the libXAIE context.
| ctx | The context |
Definition at line 153 of file test_library.cpp.
References aie_libxaie_ctx_t::XAieConfig, and aie_libxaie_ctx_t::XAieDevInst.
| void mlir_aie_dump_tile_memory | ( | aie_libxaie_ctx_t * | ctx, |
| int | col, | ||
| int | row | ||
| ) |
Dump the tile memory of the given tile Values that are zero are not shown.
Dump the contents of the memory associated with the given tile.
Definition at line 375 of file test_library.cpp.
References aie_libxaie_ctx_t::XAieDevInst.
| u64 mlir_aie_get_tile_addr | ( | aie_libxaie_ctx_t * | ctx, |
| int | col, | ||
| int | row | ||
| ) |
Return the base address of the given tile.
The configuration address space of most tiles is very similar, relative to this base address.
Definition at line 368 of file test_library.cpp.
References aie_libxaie_ctx_t::XAieDevInst.
Referenced by mlir_aie_clear_config(), mlir_aie_clear_shim_config(), mlir_aie_print_dma_status(), mlir_aie_print_memtiledma_status(), mlir_aie_print_shimdma_status(), mlir_aie_print_tile_status(), and print_aie2_lock_status().
| int mlir_aie_init_device | ( | aie_libxaie_ctx_t * | ctx, |
| uint32_t | device_id | ||
| ) |
Initialize the device represented by the context.
| ctx | The AIE context |
| device_id | The device ID to initialize |
Definition at line 174 of file test_library.cpp.
References SYSFS_PATH_MAX, aie_libxaie_ctx_t::XAieConfig, and aie_libxaie_ctx_t::XAieDevInst.
| void mlir_aie_print_dma_status | ( | aie_libxaie_ctx_t * | ctx, |
| int | col, | ||
| int | row | ||
| ) |
Print a summary of the status of the given Tile DMA.
Print the status of a dma represented by the given tile.
Definition at line 517 of file test_library.cpp.
References mlir_aie_get_tile_addr(), aie_libxaie_ctx_t::XAieConfig, and aie_libxaie_ctx_t::XAieDevInst.
| void mlir_aie_print_memtiledma_status | ( | aie_libxaie_ctx_t * | ctx, |
| int | col, | ||
| int | row | ||
| ) |
Print a summary of the status of the given MemTile DMA.
Print the status of a memtiledma represented by the given location.
Definition at line 722 of file test_library.cpp.
References mlir_aie_get_tile_addr(), print_aie2_lock_status(), aie_libxaie_ctx_t::XAieConfig, and aie_libxaie_ctx_t::XAieDevInst.
| void mlir_aie_print_shimdma_status | ( | aie_libxaie_ctx_t * | ctx, |
| int | col, | ||
| int | row | ||
| ) |
Print a summary of the status of the given Shim DMA.
Print the status of a shimdma represented by the given location (row = 0).
Definition at line 784 of file test_library.cpp.
References mlir_aie_get_tile_addr(), print_aie2_lock_status(), aie_libxaie_ctx_t::XAieConfig, and aie_libxaie_ctx_t::XAieDevInst.
| void mlir_aie_print_tile_status | ( | aie_libxaie_ctx_t * | ctx, |
| int | col, | ||
| int | row | ||
| ) |
Print the status of a core represented by the given tile, at the given coordinates.
Print the status of a core represented by the given tile.
Definition at line 954 of file test_library.cpp.
References mlir_aie_get_tile_addr(), print_aie2_lock_status(), aie_libxaie_ctx_t::XAieConfig, and aie_libxaie_ctx_t::XAieDevInst.
| u32 mlir_aie_read32 | ( | aie_libxaie_ctx_t * | ctx, |
| u64 | addr | ||
| ) |
Read the AIE configuration memory at the given physical address.
Definition at line 328 of file test_library.cpp.
References aie_libxaie_ctx_t::XAieDevInst.
| int mlir_aie_release_lock | ( | aie_libxaie_ctx_t * | ctx, |
| int | col, | ||
| int | row, | ||
| int | lockid, | ||
| int | lockval, | ||
| int | timeout | ||
| ) |
Release a physical lock.
| ctx | The context |
| col | The column of the lock |
| row | The row of the lock |
| lockid | The ID of the lock in the tile. |
| lockval | The value to acquire the lock with. |
| timeout | The number of microseconds to wait |
Definition at line 321 of file test_library.cpp.
References aie_libxaie_ctx_t::XAieDevInst.
| void mlir_aie_write32 | ( | aie_libxaie_ctx_t * | ctx, |
| u64 | addr, | ||
| u32 | val | ||
| ) |
Write the AIE configuration memory at the given physical address.
It's almost always better to use some more indirect method of accessing configuration registers, but this is provided as a last resort.
Definition at line 337 of file test_library.cpp.
References aie_libxaie_ctx_t::XAieDevInst.
| void print_aie2_lock_status | ( | aie_libxaie_ctx_t * | ctx, |
| int | col, | ||
| int | row, | ||
| const char * | type, | ||
| int | lockOffset, | ||
| int | locks | ||
| ) |
Definition at line 707 of file test_library.cpp.
References mlir_aie_get_tile_addr(), and aie_libxaie_ctx_t::XAieDevInst.
Referenced by mlir_aie_print_memtiledma_status(), mlir_aie_print_shimdma_status(), and mlir_aie_print_tile_status().