This is an automated email from the ASF dual-hosted git repository.

tqchen pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tvm-ffi.git


The following commit(s) were added to refs/heads/main by this push:
     new 8dbd281  [TORCH] Fix precise version of f8e8m0 support (#282)
8dbd281 is described below

commit 8dbd28112cddbaeeffa26420b1dee98a582a7cd7
Author: Tianqi Chen <[email protected]>
AuthorDate: Fri Nov 21 20:01:22 2025 -0500

    [TORCH] Fix precise version of f8e8m0 support (#282)
    
    This PR updates the torch-c-dlpact-ext to enable f8e8m0 support 2.7.
---
 include/tvm/ffi/c_api.h                                | 2 +-
 python/tvm_ffi/utils/_build_optional_torch_c_dlpack.py | 8 ++++++--
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/include/tvm/ffi/c_api.h b/include/tvm/ffi/c_api.h
index 152046a..ac1ac8a 100644
--- a/include/tvm/ffi/c_api.h
+++ b/include/tvm/ffi/c_api.h
@@ -62,7 +62,7 @@
 /*! \brief TVM FFI minor version. */
 #define TVM_FFI_VERSION_MINOR 1
 /*! \brief TVM FFI patch version. */
-#define TVM_FFI_VERSION_PATCH 3
+#define TVM_FFI_VERSION_PATCH 4
 // NOLINTEND(modernize-macro-to-enum)
 
 #ifdef __cplusplus
diff --git a/python/tvm_ffi/utils/_build_optional_torch_c_dlpack.py 
b/python/tvm_ffi/utils/_build_optional_torch_c_dlpack.py
index 81762ef..99f76d4 100644
--- a/python/tvm_ffi/utils/_build_optional_torch_c_dlpack.py
+++ b/python/tvm_ffi/utils/_build_optional_torch_c_dlpack.py
@@ -125,10 +125,12 @@ DLDataType getDLDataTypeForDLPackv1(const Tensor& t) {
     case ScalarType::Float8_e4m3fnuz:
       dtype.code = DLDataTypeCode::kDLFloat8_e4m3fnuz;
       break;
-#if TORCH_VERSION_MAJOR >= 2 && TORCH_VERSION_MINOR >= 8
+#if (TORCH_VERSION_MAJOR > 2) || (TORCH_VERSION_MAJOR == 2 && 
TORCH_VERSION_MINOR >= 7)
     case ScalarType::Float8_e8m0fnu:
       dtype.code = DLDataTypeCode::kDLFloat8_e8m0fnu;
       break;
+#endif
+#if (TORCH_VERSION_MAJOR > 2) || (TORCH_VERSION_MAJOR == 2 && 
TORCH_VERSION_MINOR >= 8)
     case ScalarType::Float4_e2m1fn_x2:
       dtype.code = DLDataTypeCode::kDLFloat4_e2m1fn;
       dtype.lanes = 2;
@@ -389,7 +391,7 @@ ScalarType toScalarTypeForDLPackv1(const DLDataType& dtype) 
{
           TORCH_CHECK(false, "Unsupported kDLFloat8_e4m3fnuz bits ", 
std::to_string(dtype.bits));
       }
       break;
-#if TORCH_VERSION_MAJOR >= 2 && TORCH_VERSION_MINOR >= 8
+#if (TORCH_VERSION_MAJOR > 2) || (TORCH_VERSION_MAJOR == 2 && 
TORCH_VERSION_MINOR >= 7)
     case DLDataTypeCode::kDLFloat8_e8m0fnu:
       switch (dtype.bits) {
         case 8:
@@ -399,6 +401,8 @@ ScalarType toScalarTypeForDLPackv1(const DLDataType& dtype) 
{
           TORCH_CHECK(false, "Unsupported kDLFloat8_e8m0fnu bits ", 
std::to_string(dtype.bits));
       }
       break;
+#endif
+#if (TORCH_VERSION_MAJOR > 2) || (TORCH_VERSION_MAJOR == 2 && 
TORCH_VERSION_MINOR >= 8)
     case DLDataTypeCode::kDLFloat4_e2m1fn:
       switch (dtype.bits) {
         case 4:

Reply via email to