yongwww commented on code in PR #17630:
URL: https://github.com/apache/tvm/pull/17630#discussion_r1974396154


##########
src/target/source/codegen_cuda.cc:
##########
@@ -71,6 +71,30 @@ std::string GetFP8Type(DataType type) {
   return stream.str();
 }
 
+std::string GetFP4Type(DataType type) {
+  std::stringstream stream;
+  int32_t lanes = type.lanes();
+  std::string vec;
+  if (type.is_scalar()) {
+    vec = "";
+  } else if (lanes == 2) {
+    vec = "x2";
+  } else if (lanes == 4) {
+    vec = "x4";
+  } else {
+    LOG(FATAL) << "Only support scalar and vector types of width (2, 4, 8) for 
FP8";
+  }
+  stream << "__nv_fp4";
+  std::string suffix;
+  if (type.code() == DataType::kE2M1Float) {
+    suffix = "_e2m1";
+  } else {
+    LOG(FATAL) << "Unsupported FP8 type in CUDA codegen";

Review Comment:
   ```suggestion
       LOG(FATAL) << "Unsupported FP4 type in CUDA codegen";
   ```



##########
src/target/source/codegen_cuda.cc:
##########
@@ -71,6 +71,30 @@ std::string GetFP8Type(DataType type) {
   return stream.str();
 }
 
+std::string GetFP4Type(DataType type) {
+  std::stringstream stream;
+  int32_t lanes = type.lanes();
+  std::string vec;
+  if (type.is_scalar()) {
+    vec = "";
+  } else if (lanes == 2) {
+    vec = "x2";
+  } else if (lanes == 4) {
+    vec = "x4";
+  } else {
+    LOG(FATAL) << "Only support scalar and vector types of width (2, 4, 8) for 
FP8";

Review Comment:
   ```suggestion
       LOG(FATAL) << "Only support scalar and vector types of width (2, 4) for 
FP4";
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to