-
Notifications
You must be signed in to change notification settings - Fork 358
Add Sparsify overhead benchmark #3021
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -40,6 +40,18 @@ def benchmark(num_tokens, hidden_size=8192, intermediate_size=8192): | |
| input_tensor = torch.randn(num_tokens, hidden_size).to(torch.bfloat16).cuda() | ||
| fp16_time = benchmark_microseconds(ffn_ref, input_tensor) | ||
|
|
||
| # Sparsify-only benchmarks | ||
| ao_fast_sparsification_time = benchmark_microseconds( | ||
| torch.ops.torchao.sparse24_sm90_sparsify( | ||
| input_tensor, | ||
| "cutlass", | ||
| "srelu", | ||
| "largest", | ||
| dtype=torch.float8_e4m3fn, | ||
| ) | ||
| ) | ||
| cusparse_time = benchmark_microseconds(torch._cslt_compress, input_tensor) | ||
|
|
||
| # bf16 | ||
| ffn_clone = ( | ||
| nn.Sequential( | ||
|
|
@@ -117,7 +129,10 @@ def benchmark(num_tokens, hidden_size=8192, intermediate_size=8192): | |
| "fp8_c_time (us)": fp8_c_time, | ||
| "fp8_c_sparse_time (us)": fp8_c_sparse_time, | ||
| "fp8_c_activation_sparse_time (us)": fp8_c_activation_sparse_time, | ||
| "ao_fast_sparsification_time (us)": ao_fast_sparsification_time, | ||
| "cusparse*_compress_time (us)": cusparse_time, | ||
|
||
| "speedup": fp8_c_time / fp8_c_activation_sparse_time, | ||
| "sparsify_speedup": cusparse_time / ao_fast_sparsification_time, | ||
| } | ||
|
|
||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should be "identity" here instead
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please update this :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the reminder; I missed it.