Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions benchmarks/benchmark_e2e_fp8_sparse_linear.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Copy link
Contributor

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

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please update this :)

Copy link
Contributor Author

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.

"largest",
dtype=torch.float8_e4m3fn,
)
)
cusparse_time = benchmark_microseconds(torch._cslt_compress, input_tensor)

# bf16
ffn_clone = (
nn.Sequential(
Expand Down Expand Up @@ -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,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cusparse_time isnt a good name for this because there is a seperate cusparse library, aside from cusparselt. please use cusparselt here instead

Also looks like theres a typo in the string?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I didn't know it due to my lack of background.

"speedup": fp8_c_time / fp8_c_activation_sparse_time,
"sparsify_speedup": cusparse_time / ao_fast_sparsification_time,
}


Expand Down
Loading