From 971ace9d4ad9bdafefa9839bf50f8950ff764ce1 Mon Sep 17 00:00:00 2001 From: Milos Trajkovic Date: Tue, 26 Mar 2024 14:47:20 +0000 Subject: [PATCH] enable unpack_to_dest for metal by default, enhance to work with uint32 --- common/inc/cmath_common.h | 4 ++-- common/inc/cunpack_common.h | 4 ++-- llk_lib/llk_defs.h | 3 +++ llk_lib/llk_unpack_common.h | 4 ++++ 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/common/inc/cmath_common.h b/common/inc/cmath_common.h index e7d5246..7470385 100644 --- a/common/inc/cmath_common.h +++ b/common/inc/cmath_common.h @@ -222,8 +222,8 @@ inline void set_dest_section_base() } inline constexpr bool is_32bit_input(const std::uint32_t src_format, const std::uint32_t dst_format) { - const uint input_df = src_format; - const uint output_df = dst_format; + const uint input_df = src_format & 0xF; + const uint output_df = dst_format & 0xF; return ((input_df == (uint)DataFormat::Int32) || (input_df == (uint)DataFormat::Float32)) && ((output_df == (uint)DataFormat::Int32) || (output_df == (uint)DataFormat::Float32)); } diff --git a/common/inc/cunpack_common.h b/common/inc/cunpack_common.h index 834cbe2..b1484cb 100644 --- a/common/inc/cunpack_common.h +++ b/common/inc/cunpack_common.h @@ -412,8 +412,8 @@ namespace ckernel::unpacker } inline constexpr bool is_32bit_input(const std::uint32_t unpack_src_format, const std::uint32_t unpack_dst_format) { - const uint input_df = unpack_src_format; - const uint output_df = unpack_dst_format; + const uint input_df = unpack_src_format & 0xF; + const uint output_df = unpack_dst_format & 0xF; return ((input_df == (uint)DataFormat::Int32) || (input_df == (uint)DataFormat::Float32)) && ((output_df == (uint)DataFormat::Int32) || (output_df == (uint)DataFormat::Float32)); } diff --git a/llk_lib/llk_defs.h b/llk_lib/llk_defs.h index a71d040..f64ca20 100644 --- a/llk_lib/llk_defs.h +++ b/llk_lib/llk_defs.h @@ -97,6 +97,9 @@ enum ReluType { MAX_THRESHOLD_RELU, }; +constexpr bool UnpackToDestEn = true; +constexpr bool UnpackToDestDis = false; + /* Stochastic rounding modes: None: No stochastic rounding enabled, default rounding is round to nearest even. diff --git a/llk_lib/llk_unpack_common.h b/llk_lib/llk_unpack_common.h index fea1bf9..924c21e 100644 --- a/llk_lib/llk_unpack_common.h +++ b/llk_lib/llk_unpack_common.h @@ -99,6 +99,10 @@ inline void _llk_unpack_dbg_feature_disable_(){ // workaround for bug tenstorrent/budabackend#1372 } +inline void _llk_unpack_clear_dbg_feature_disable_(){ + reg_write(RISCV_DEBUG_REG_DBG_FEATURE_DISABLE, 0); // Unset debug feature disable +} + inline void _llk_enable_int8_fpu_math_() { enable_int8_fpu_math(); }