From 027bff19417f60ee023c8db80ac0657165930d42 Mon Sep 17 00:00:00 2001 From: Nikola Cvetkovic Date: Thu, 27 Feb 2025 14:46:51 +0100 Subject: [PATCH] #18064: Guard CSRRS by disabling branch prediction (#26) Due to a HW bug in CSR writes, we need to guard them by first disabling branch prediction, and then re-enabling it. This is a workaround for https://github.com/tenstorrent/tt-metal/issues/18064#issuecomment-2685621251 and is proposed as a fix by the HW team. --- tt_llk_blackhole/common/inc/ckernel.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tt_llk_blackhole/common/inc/ckernel.h b/tt_llk_blackhole/common/inc/ckernel.h index 7dfd1663..c1139cbe 100644 --- a/tt_llk_blackhole/common/inc/ckernel.h +++ b/tt_llk_blackhole/common/inc/ckernel.h @@ -589,9 +589,15 @@ inline void disable_gathering() { // Disable gathering: set bit 18 asm(R"ASM( .option push + li t1, 0x2 + csrrs zero, 0x7c0, t1 li t1, 0x1 slli t1, t1, 18 + fence csrrs zero, 0x7c0, t1 + li t1, 0x2 + csrrc zero, 0x7c0, t1 + fence .option pop )ASM" :::"t1");