Open
Conversation
~2x improvement
Optimized:
Benchmark 0: 0.0047 ms (min=0.0045, max=0.0051) {'num_tokens': 256, 'hidden_dim': 4096, 'group_size': 128, 'seed': 2146}
Benchmark 1: 0.0069 ms (min=0.0068, max=0.0075) {'num_tokens': 256, 'hidden_dim': 8192, 'group_size': 128, 'seed': 3129}
Benchmark 2: 0.0719 ms (min=0.0718, max=0.0725) {'num_tokens': 4096, 'hidden_dim': 7168, 'group_size': 128, 'seed': 54352}
Baseline:
Benchmark 0: 0.0070 ms (min=0.0068, max=0.0075) {'num_tokens': 256, 'hidden_dim': 4096, 'group_size': 128, 'seed': 2146}
Benchmark 1: 0.0120 ms (min=0.0118, max=0.0125) {'num_tokens': 256, 'hidden_dim': 8192, 'group_size': 128, 'seed': 3129}
Benchmark 2: 0.1563 ms (min=0.1562, max=0.1570) {'num_tokens': 4096, 'hidden_dim': 7168, 'group_size': 128, 'seed': 54352}
Results:
Benchmark 0: 0.0231 ms (min=0.0230, max=0.0236) {'B': 1, 'D': 1536, 'S': 2048, 'W': 4, 'seed': 2146}
Benchmark 1: 0.0352 ms (min=0.0349, max=0.0361) {'B': 1, 'D': 2560, 'S': 2048, 'W': 4, 'seed': 3129}
Benchmark 2: 0.0651 ms (min=0.0650, max=0.0659) {'B': 1, 'D': 2560, 'S': 4096, 'W': 4, 'seed': 54352}
Baseline:
Benchmark 0: 0.2165 ms (min=0.2163, max=0.2176) {'B': 1, 'D': 1536, 'S': 2048, 'W': 4, 'seed': 2146}
Benchmark 1: 0.3577 ms (min=0.3574, max=0.3587) {'B': 1, 'D': 2560, 'S': 2048, 'W': 4, 'seed': 3129}
Benchmark 2: 0.7097 ms (min=0.7094, max=0.7108) {'B': 1, 'D': 2560, 'S': 4096, 'W': 4, 'seed': 54352}
Optimizations:
1. Eliminated tripled accumulator — replaced acc1/acc2/acc3 averaged with a single acc, removing 3x redundant compute and memory reads
2. Larger block sizes — [1, 64] or [1, 128] instead of [1, 8], increasing parallelism
3. More warps — num_warps=2-4 instead of 1, better SM utilization
4. More pipeline stages — num_stages=2-4 for large shapes to hide HBM latency via software pipelining
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.
PR for o kernel