You are viewing a plain text version of this content. The canonical link for it is here.
Posted to discuss-archive@tvm.apache.org by "Kokoro2336 (via GitHub)" <gi...@apache.org> on 2026/04/23 11:36:39 UTC

[PR] fix: version mismatch of CUDA symbols. [tvm]

Kokoro2336 opened a new pull request, #19432:
URL: https://github.com/apache/tvm/pull/19432

   This pr closes issue #17771 
   
   `CUDA_R_8F_E4M3`, `CUBLASLT_MATMUL_DESC_A_SCALE_POINTER` and `CUBLASLT_MATMUL_DESC_B_SCALE_POINTER` are only available in CUDA 11.8 and above.
   
   The PR adds conditional compilation for the symbols.


-- 
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: discuss-archive-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: discuss-archive-unsubscribe@tvm.apache.org
For additional commands, e-mail: discuss-archive-help@tvm.apache.org


Re: [PR] fix: version mismatch of CUDA symbols [tvm]

Posted by "Kokoro2336 (via GitHub)" <gi...@apache.org>.
Kokoro2336 commented on PR #19432:
URL: https://github.com/apache/tvm/pull/19432#issuecomment-4304117203

   /gemini review


-- 
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: discuss-archive-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: discuss-archive-unsubscribe@tvm.apache.org
For additional commands, e-mail: discuss-archive-help@tvm.apache.org


Re: [PR] fix: version mismatch of CUDA symbols [tvm]

Posted by "gemini-code-assist[bot] (via GitHub)" <gi...@apache.org>.
gemini-code-assist[bot] commented on code in PR #19432:
URL: https://github.com/apache/tvm/pull/19432#discussion_r3130565546


##########
src/runtime/contrib/cublas/cublas.cc:
##########
@@ -170,8 +170,12 @@ void CallCublasLt(cublasLtHandle_t hdl, cudaStream_t stream,
   } else if (TypeMatch(A->dtype, kDLInt, 8)) {
     ab_type = CUDA_R_8I;
   } else if (TypeMatch(A->dtype, DataType::TypeCode::kFloat8_e4m3fn, 8)) {
+#if CUDART_VERSION >= 11800

Review Comment:
   ![high](https://www.gstatic.com/codereviewagent/high-priority.svg)
   
   The `CUDART_VERSION` for CUDA 11.8 is `11080`, not `11800`. The convention used in this repository (and by NVIDIA) is `major * 1000 + minor * 10`, as evidenced by the check for CUDA 10.1 using `10010` on line 139. Using `11800` will cause this feature to be incorrectly disabled for users on CUDA 11.8.
   
   ```suggestion
   #if CUDART_VERSION >= 11080
   ```



##########
src/runtime/contrib/cublas/cublas.cc:
##########
@@ -201,6 +205,7 @@ void CallCublasLt(cublasLtHandle_t hdl, cudaStream_t stream,
                                                       &bias->data, sizeof(float*)));
   }
 
+#if CUDART_VERSION >= 11800

Review Comment:
   ![high](https://www.gstatic.com/codereviewagent/high-priority.svg)
   
   The `CUDART_VERSION` for CUDA 11.8 is `11080`, not `11800`. Using `11800` will cause scaling pointers to be incorrectly reported as unsupported on CUDA 11.8 systems.
   
   ```suggestion
   #if CUDART_VERSION >= 11080
   ```



-- 
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: discuss-archive-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: discuss-archive-unsubscribe@tvm.apache.org
For additional commands, e-mail: discuss-archive-help@tvm.apache.org


Re: [PR] fix: version mismatch of CUDA symbols. [tvm]

Posted by "gemini-code-assist[bot] (via GitHub)" <gi...@apache.org>.
gemini-code-assist[bot] commented on code in PR #19432:
URL: https://github.com/apache/tvm/pull/19432#discussion_r3130466325


##########
src/runtime/contrib/cublas/cublas.cc:
##########
@@ -169,10 +169,14 @@ void CallCublasLt(cublasLtHandle_t hdl, cudaStream_t stream,
     ab_type = CUDA_R_16BF;
   } else if (TypeMatch(A->dtype, kDLInt, 8)) {
     ab_type = CUDA_R_8I;
-  } else if (TypeMatch(A->dtype, DataType::TypeCode::kFloat8_e4m3fn, 8)) {
+  } 
+
+#if CUDART_VERSION >= 11800
+  else if (TypeMatch(A->dtype, DataType::TypeCode::kFloat8_e4m3fn, 8)) {
     TVM_FFI_ICHECK(TypeMatch(B->dtype, DataType::TypeCode::kFloat8_e4m3fn, 8));
     ab_type = CUDA_R_8F_E4M3;
   }
+#endif

Review Comment:
   ![high](https://www.gstatic.com/codereviewagent/high-priority.svg)
   
   When `CUDART_VERSION` is less than 11.8, the `else if` block for `kFloat8_e4m3fn` is completely removed. This causes the code to fall through to the default `ab_type = CUDA_R_32F` initialization, which will lead to incorrect results or runtime errors when processing Float8 data. It is safer to explicitly throw an error if an unsupported data type is requested for the compiled CUDA version.
   
   ```c
     else if (TypeMatch(A->dtype, DataType::TypeCode::kFloat8_e4m3fn, 8)) {
   #if CUDART_VERSION >= 11800
       TVM_FFI_ICHECK(TypeMatch(B->dtype, DataType::TypeCode::kFloat8_e4m3fn, 8));
       ab_type = CUDA_R_8F_E4M3;
   #else
       TVM_FFI_THROW(InternalError) << "Float8 (E4M3) is only supported in CUDA 11.8 and above.";
   #endif
     }
   ```



-- 
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: discuss-archive-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: discuss-archive-unsubscribe@tvm.apache.org
For additional commands, e-mail: discuss-archive-help@tvm.apache.org


Re: [PR] fix: version mismatch of CUDA symbols [tvm]

Posted by "gemini-code-assist[bot] (via GitHub)" <gi...@apache.org>.
gemini-code-assist[bot] commented on code in PR #19432:
URL: https://github.com/apache/tvm/pull/19432#discussion_r3130537473


##########
src/runtime/contrib/cublas/cublas.cc:
##########
@@ -211,6 +216,7 @@ void CallCublasLt(cublasLtHandle_t hdl, cudaStream_t stream,
     CHECK_CUBLAS_ERROR(cublasLtMatmulDescSetAttribute(op_desc, CUBLASLT_MATMUL_DESC_B_SCALE_POINTER,
                                                       &scaleB_data, sizeof(float*)));
   }
+#endif

Review Comment:
   ![medium](https://www.gstatic.com/codereviewagent/medium-priority.svg)
   
   When `CUDART_VERSION` is less than 11.8, the scaling pointers `scaleA` and `scaleB` are silently ignored if provided. To avoid silent correctness issues, it is better to throw an error if these pointers are non-null on unsupported CUDA versions, consistent with how the FP8 type check is handled at line 177.
   
   ```c
   #else
     if (scaleA != nullptr || scaleB != nullptr) {
       TVM_FFI_THROW(InternalError) << "Scaling pointers are only supported in CUDA 11.8 and above.";
     }
   #endif
   ```



-- 
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: discuss-archive-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: discuss-archive-unsubscribe@tvm.apache.org
For additional commands, e-mail: discuss-archive-help@tvm.apache.org


Re: [PR] fix: version mismatch of CUDA symbols [tvm]

Posted by "Kokoro2336 (via GitHub)" <gi...@apache.org>.
Kokoro2336 commented on PR #19432:
URL: https://github.com/apache/tvm/pull/19432#issuecomment-4304172196

   /gemini review


-- 
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: discuss-archive-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: discuss-archive-unsubscribe@tvm.apache.org
For additional commands, e-mail: discuss-archive-help@tvm.apache.org


Re: [PR] [Fix][CUDA] Version compatibility of CUDA symbols [tvm]

Posted by "tlopex (via GitHub)" <gi...@apache.org>.
tlopex merged PR #19432:
URL: https://github.com/apache/tvm/pull/19432


-- 
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: discuss-archive-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: discuss-archive-unsubscribe@tvm.apache.org
For additional commands, e-mail: discuss-archive-help@tvm.apache.org


Re: [PR] fix: version mismatch of CUDA symbols [tvm]

Posted by "Kokoro2336 (via GitHub)" <gi...@apache.org>.
Kokoro2336 commented on PR #19432:
URL: https://github.com/apache/tvm/pull/19432#issuecomment-4304140793

   /gemini review


-- 
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: discuss-archive-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: discuss-archive-unsubscribe@tvm.apache.org
For additional commands, e-mail: discuss-archive-help@tvm.apache.org