rocm: fall back to unfused bias-grad when hipBLASLt lacks BGRADB algo#1619
Open
sreerohi wants to merge 1 commit into
Open
rocm: fall back to unfused bias-grad when hipBLASLt lacks BGRADB algo#1619sreerohi wants to merge 1 commit into
sreerohi wants to merge 1 commit into
Conversation
TE's LayerNormColumnParallelLinear backward issues a bias-fused wgrad GEMM (HIPBLASLT_EPILOGUE_BGRADB) via tex.generic_gemm. On gfx950 (MI350-355), hipBLASLt has no algorithm for some shapes (notably Qwen2.5-0.5B's QKV: BF16, M ~ max_tokens_per_gpu, N=1152, K=896), raising "Unable to find any suitable algorithms" in TE's backward. Wrap tex.generic_gemm at module import on ROCm so that, when this specific RuntimeError fires AND the call is the bias-fused wgrad path (bias != None and grad == True), we retry the GEMM with bias=None and compute bias_grad ourselves via grad_output.sum(dim=0). Mathematically identical to BGRADB; just not fused into the same kernel. The wrapper is a no-op on CUDA and on shapes hipBLASLt can serve.
Contributor
|
Warning Gemini encountered an error creating the review. You can try again by commenting |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TE's LayerNormColumnParallelLinear backward issues a bias-fused wgrad GEMM (HIPBLASLT_EPILOGUE_BGRADB on ROCm) via tex.generic_gemm. On gfx950 (MI350-355), hipBLASLt has no algorithm for some shapes (notably Qwen2.5-0.5B's QKV: BF16, M ~ max_tokens_per_gpu, N=1152, K=896), raising "Unable to find any suitable algorithms" in TE's backward.
Wrap tex.generic_gemm at module import on ROCm so that, when this specific RuntimeError fires AND the call is the bias-fused wgrad path (bias != None and grad == True), we retry the GEMM with bias=None and compute bias_grad ourselves via grad_output.sum(dim=0). Mathematically identical to BGRADB; just not fused into the same kernel.
The wrapper is a no-op on CUDA and on shapes hipBLASLt can serve.
Supersedes #1138