From 15c4e023c5f2b258046dbd37961d41d490b3e6ec Mon Sep 17 00:00:00 2001 From: Yota Toyama Date: Mon, 8 May 2023 20:05:13 +1000 Subject: [PATCH] Fix type name again (#111) --- macro/src/type_check_functions.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/macro/src/type_check_functions.rs b/macro/src/type_check_functions.rs index 8c12e7857e..040779566e 100644 --- a/macro/src/type_check_functions.rs +++ b/macro/src/type_check_functions.rs @@ -5,6 +5,7 @@ use quote::quote; use std::error::Error; const FLOAT_8E5M2_PATTERN: &str = "8_e_5_m_2"; +const FLOAT_8E4M3_FN_PATTERN: &str = "8_e_4_m_3"; pub fn generate(identifiers: &[Ident]) -> Result> { let mut stream = TokenStream::new(); @@ -35,6 +36,11 @@ pub fn generate(identifiers: &[Ident]) -> Result> { fn map_type_name(name: &str) -> String { match name { "bf_16" | "f_16" | "f_32" | "f_64" => name.replace('_', ""), - name => name.replace(FLOAT_8E5M2_PATTERN, &FLOAT_8E5M2_PATTERN.replace('_', "")), + name => name + .replace(FLOAT_8E5M2_PATTERN, &FLOAT_8E5M2_PATTERN.replace('_', "")) + .replace( + FLOAT_8E4M3_FN_PATTERN, + &FLOAT_8E4M3_FN_PATTERN.replace('_', ""), + ), } }