[JAX][Core] Fix Grouped GEMM cuBLAS version and SM arch checks - #2765
Conversation
Signed-off-by: Jeremy Berchtold <jberchtold@nvidia.com>
|
/te-ci |
Greptile SummaryThis PR fixes two related bugs in Transformer Engine's grouped GEMM support: (1) the JAX Python-side capability check in Key changes:
Confidence Score: 4/5
Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[grouped_gemm called] --> B{_can_use_v2_grouped_gemm?}
B --> C{_v2_grouped_gemm_available\ncompile-time cuBLAS >= 13.3?}
C -- No --> V1[Use v1 legacy path\nnvte_multi_tensor_gemm]
C -- Yes --> D{get_device_compute_capability 0\n>= SM100?}
D -- No\nHopper / older --> V1
D -- Yes --> E{scaling_mode == NO_SCALING\ndtype == bfloat16\nno bias?}
E -- No --> V1
E -- Yes --> F[Use v2 path\nnvte_grouped_gemm]
F --> G{C++ runtime checks}
G --> H{sm_arch current_device\n>= 100?}
H -- No --> ERR1[NVTE_CHECK error:\nrequires SM100+]
H -- Yes --> I{cublas_version\n>= 130300?}
I -- No --> ERR2[NVTE_CHECK error:\nrequires cuBLAS 13.3+]
I -- Yes --> OK[Execute grouped GEMM]
Last reviewed commit: f17e674 |
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> Signed-off-by: Kirthi Shankar Sivamani <ksivamani@nvidia.com>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> Signed-off-by: Kirthi Shankar Sivamani <ksivamani@nvidia.com>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> Signed-off-by: Kirthi Shankar Sivamani <ksivamani@nvidia.com>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> Signed-off-by: Kirthi Shankar Sivamani <ksivamani@nvidia.com>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> Signed-off-by: Kirthi Shankar Sivamani <ksivamani@nvidia.com>
Signed-off-by: Kirthi Shankar Sivamani <ksivamani@nvidia.com>
|
/te-ci |
|
|
||
| # nvte_grouped_gemm (the v2 kernel) requires SM100+ (Blackwell or newer). | ||
| # Fall back to the v1 path on SM90 (Hopper) and older architectures. | ||
| if get_device_compute_capability(0) < 100: |
There was a problem hiding this comment.
Hardcoded device index 0 may misidentify architecture in multi-GPU systems
get_device_compute_capability(0) always queries device 0, regardless of which GPU JAX is actually dispatching work to. In a heterogeneous multi-GPU system — for example, one where device 0 is SM100+ (Blackwell) but the active computation device is SM90 (Hopper) — the check would incorrectly allow the v2 path, causing the C++ runtime guard in check_grouped_gemm_requirements to raise an error. The reverse (device 0 is SM90, active device is SM100+) would just silently fall back to v1, wasting performance.
While this matches the existing pattern used at line 88 (get_cublas_workspace_size_bytes), that context is less likely to cause a hard failure. For correctness it would be safer to iterate over all JAX devices and take the minimum compute capability, or find the current active device. That said, this is a pre-existing limitation of the helper function itself and extremely unlikely in practice since mixed SM90/SM100 node configurations are rare.
|
/te-ci |
|
/te-ci |
* Fix GMM cuBLAS version and SM arch checks Signed-off-by: Jeremy Berchtold <jberchtold@nvidia.com> * Update transformer_engine/common/gemm/cublaslt_grouped_gemm.cu Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> Signed-off-by: Kirthi Shankar Sivamani <ksivamani@nvidia.com> * Update transformer_engine/common/gemm/cublaslt_grouped_gemm.cu Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> Signed-off-by: Kirthi Shankar Sivamani <ksivamani@nvidia.com> * Update transformer_engine/common/gemm/cublaslt_grouped_gemm.cu Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> Signed-off-by: Kirthi Shankar Sivamani <ksivamani@nvidia.com> * Update transformer_engine/common/gemm/cublaslt_grouped_gemm.cu Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> Signed-off-by: Kirthi Shankar Sivamani <ksivamani@nvidia.com> * Update transformer_engine/common/gemm/cublaslt_grouped_gemm.cu Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> Signed-off-by: Kirthi Shankar Sivamani <ksivamani@nvidia.com> * Update transformer_engine/common/gemm/cublaslt_grouped_gemm.cu Signed-off-by: Kirthi Shankar Sivamani <ksivamani@nvidia.com> --------- Signed-off-by: Jeremy Berchtold <jberchtold@nvidia.com> Signed-off-by: Kirthi Shankar Sivamani <ksivamani@nvidia.com> Co-authored-by: Kirthi Shankar Sivamani <ksivamani@nvidia.com> Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
…A#2765) * Fix GMM cuBLAS version and SM arch checks Signed-off-by: Jeremy Berchtold <jberchtold@nvidia.com> * Update transformer_engine/common/gemm/cublaslt_grouped_gemm.cu Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> Signed-off-by: Kirthi Shankar Sivamani <ksivamani@nvidia.com> * Update transformer_engine/common/gemm/cublaslt_grouped_gemm.cu Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> Signed-off-by: Kirthi Shankar Sivamani <ksivamani@nvidia.com> * Update transformer_engine/common/gemm/cublaslt_grouped_gemm.cu Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> Signed-off-by: Kirthi Shankar Sivamani <ksivamani@nvidia.com> * Update transformer_engine/common/gemm/cublaslt_grouped_gemm.cu Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> Signed-off-by: Kirthi Shankar Sivamani <ksivamani@nvidia.com> * Update transformer_engine/common/gemm/cublaslt_grouped_gemm.cu Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> Signed-off-by: Kirthi Shankar Sivamani <ksivamani@nvidia.com> * Update transformer_engine/common/gemm/cublaslt_grouped_gemm.cu Signed-off-by: Kirthi Shankar Sivamani <ksivamani@nvidia.com> --------- Signed-off-by: Jeremy Berchtold <jberchtold@nvidia.com> Signed-off-by: Kirthi Shankar Sivamani <ksivamani@nvidia.com> Co-authored-by: Kirthi Shankar Sivamani <ksivamani@nvidia.com> Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> Signed-off-by: Varun Thumbe <vthumbe@nvidia.com>
Description
Fixes SM arch check for TE/JAX Grouped GEMM. Also fixes cuBLAS version check in TE common to cuBLAS 13.3+ as cuBLAS 13.2 contains a wgrad numerical error if any groups have size
0.Type of change
Changes
Checklist: