From e14293e758e3a3eeb525ada87028460757b3f3f0 Mon Sep 17 00:00:00 2001 From: Milos Acimovic Date: Thu, 10 Oct 2024 08:03:36 +0000 Subject: [PATCH] #13052: Addressing comments --- tests/tt_metal/test_utils/df/float32.hpp | 2 +- tt_metal/hw/inc/debug/dprint_tensix.h | 13 +++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/tests/tt_metal/test_utils/df/float32.hpp b/tests/tt_metal/test_utils/df/float32.hpp index df6c0235463..3223271ad90 100644 --- a/tests/tt_metal/test_utils/df/float32.hpp +++ b/tests/tt_metal/test_utils/df/float32.hpp @@ -26,7 +26,7 @@ class float32 { float32(float float_num) { static_assert(sizeof float_num == sizeof uint32_data, "Can only support 32bit fp"); // just move upper 16 to lower 16 (truncate) - uint32_data = (*reinterpret_cast(&float_num)); + uint32_data = (*reinterpret_cast(&float_num) >> 16); } // store lower 16 as 16-bit uint diff --git a/tt_metal/hw/inc/debug/dprint_tensix.h b/tt_metal/hw/inc/debug/dprint_tensix.h index de258bc455f..a76673779d0 100644 --- a/tt_metal/hw/inc/debug/dprint_tensix.h +++ b/tt_metal/hw/inc/debug/dprint_tensix.h @@ -31,6 +31,10 @@ constexpr int PRECISION = 4; constexpr int WIDTH = 8; +constexpr uint16_t NUM_FACES_PER_TILE = 4; +constexpr uint16_t NUM_ROWS_PER_FACE = 16; +constexpr uint16_t NUM_ROWS_PER_TILE = NUM_FACES_PER_TILE * NUM_ROWS_PER_FACE; + // Helper function to print array inline void dprint_array_with_data_type(uint32_t data_format, uint32_t* data, uint32_t count) { DPRINT << SETW(WIDTH) << " " @@ -63,10 +67,11 @@ inline uint16_t get_swizzled_row_id(uint16_t row_id) { } } -// calculates dest row address based on +// Calculates dest row address based on logical row identifiers (tile_id, face_id, row_id) +// and dest configuration. inline uint16_t get_dest_row_id( uint16_t tile_id, uint16_t face_id, uint16_t row_id, bool is_float32, bool is_remap, bool is_swizzle) { - uint16_t row = 64 * tile_id + 16 * face_id + row_id; + uint16_t row = NUM_ROWS_PER_TILE * tile_id + NUM_ROWS_PER_FACE * face_id + row_id; if (is_remap) { row = get_remapped_row_id(row); @@ -158,8 +163,8 @@ void dprint_tensix_dest_reg(int tile_id = 0) { DPRINT << FIXED() << SETPRECISION(PRECISION); DPRINT << "Tile ID = " << tile_id << ENDL(); - for (int face_id = 0; face_id < 4; ++face_id) { - for (int row_id = 0; row_id < 16; ++row_id) { + for (int face_id = 0; face_id < NUM_FACES_PER_TILE; ++face_id) { + for (int row_id = 0; row_id < NUM_ROWS_PER_FACE; ++row_id) { uint16_t row = get_dest_row_id(tile_id, face_id, row_id, is_float32, is_remapped, is_swizzled); if (is_float32) { dprint_tensix_dest_reg_row_float32(row);