Skip to content

Commit

Permalink
#13052: Addressing comments
Browse files Browse the repository at this point in the history
  • Loading branch information
miacim committed Oct 10, 2024
1 parent 2e11d23 commit e14293e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion tests/tt_metal/test_utils/df/float32.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<uint32_t*>(&float_num));
uint32_data = (*reinterpret_cast<uint32_t*>(&float_num) >> 16);
}

// store lower 16 as 16-bit uint
Expand Down
13 changes: 9 additions & 4 deletions tt_metal/hw/inc/debug/dprint_tensix.h
Original file line number Diff line number Diff line change
Expand Up @@ -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) << " "
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit e14293e

Please sign in to comment.