This is an automated email from the ASF dual-hosted git repository.
wuwei pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tvm.git
The following commit(s) were added to refs/heads/main by this push:
new 2d9c6c4b33 [Runtime] Fix dtype conversion for bf16 and fp8 (#16545)
2d9c6c4b33 is described below
commit 2d9c6c4b33b1b55e9c7e18688fc09d46f3788011
Author: Wuwei Lin <[email protected]>
AuthorDate: Sat Feb 10 14:32:03 2024 -0800
[Runtime] Fix dtype conversion for bf16 and fp8 (#16545)
Fix dtype conversion for bf16 and fp8
---
include/tvm/runtime/data_type.h | 3 +++
1 file changed, 3 insertions(+)
diff --git a/include/tvm/runtime/data_type.h b/include/tvm/runtime/data_type.h
index ac7e879a64..fcd35f1e2a 100644
--- a/include/tvm/runtime/data_type.h
+++ b/include/tvm/runtime/data_type.h
@@ -404,12 +404,15 @@ inline DLDataType String2DLDataType(std::string s) {
return t;
} else if (s.substr(0, 6) == "bfloat") {
t.code = DataType::kBFloat;
+ t.bits = 16;
scan = s.c_str() + 6;
} else if (s.substr(0, 10) == "e4m3_float") {
t.code = DataType::kE4M3Float;
+ t.bits = 8;
scan = s.c_str() + 10;
} else if (s.substr(0, 10) == "e5m2_float") {
t.code = DataType::kE5M2Float;
+ t.bits = 8;
scan = s.c_str() + 10;
} else if (s.substr(0, 6) == "custom") {
t.code = ParseCustomDatatype(s, &scan);