Anatoliylitv/tiled and 2 pass layer norm#3424
Open
anatoliylitv wants to merge 2 commits into
Open
Conversation
… it accordingly with tiled one where performance is better.
|
Jenkins build for 20a3ce6fac4bcf46d9846f98270b85ce3346efc5 commit finished as FAILURE |
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.
Hugging Face model dropped 5-10% after switching to tiled kernel (10+ model and tests).
Implemented mixed approach, using combination of Tiled and Two Pass:
Hugging Face (huggingface_bart) performance is back:
Legacy Two pass performance=1652, 1644
Tiled performance =1574, 1568
Mixed performance =1649, 1652
Synthetic reproducer where performance from chess board like became uniform, keeping benefits from both implementation:
Layer Norm Gamma/Beta Backward — Benchmark Summary
Device: AMD Instinct MI350X (ROCm, warp_size=64)
Warmup: 20 · Iters: 100 · all times in µs, averaged over 3 runs
Legacy:
cuComputePartGradGammaBeta+cuComputeGradGammaBeta(original two-pass,M ≥ 128)Tiled:
LaunchGammaBetaBackwardCUDAKernel(single-pass tiled,M ≥ 128)Mixed: new dispatcher — picks legacy for
128 ≤ M ≤ 65536, tiled forM > 65536 && N/64 < sm_count/2(
M < 128always usesGammaBetaBackwardSimpleCUDAKernelin all three runs)Observations
Wins (mixed picks the right kernel):
tile256_large / _bf16 / _fp32(M=4096): ~2.4× faster than tiledgpt2_style(M=8192): ~3.5× faster than tiledrms_tile256(M=4096): ~1.9× faster than tiledtwo_pass_huge_M,llm_hidden_4096,rms_llm,rms_two_pass(M=131072): no regression vs tiled, massive win vs legacy (4–7×)cc @jeffdaily @sunway513 @jithunnair-amd @pruthvistony @ROCmSupport @jataylo @hongxiayang @naromero77amd @pragupta @jerrymannil @xinyazhang
Submission Checklist