Skip to content
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

Move output tensor allocation out of benchmark function for GEMM #2328

Merged
merged 3 commits into from
Sep 24, 2024

Conversation

anmyachev
Copy link
Contributor

@anmyachev anmyachev commented Sep 24, 2024

Geomean was incorrectly calculated for GEMM (in #2298), after recalculating I saw a deterioration in the ratio, which may be due to allocations.

Let's see: https://github.com/intel/intel-xpu-backend-for-triton/actions/runs/11019414473

The Triton GEMM adv geomean increased by ~1TFlops.

@anmyachev anmyachev marked this pull request as ready for review September 24, 2024 18:12
@@ -256,7 +252,13 @@ def benchmark(B, M, N, K, provider):
_, min_ms, max_ms, mean_ms, cv = benchmark_suit.do_bench(lambda: torch.matmul(a, b), warmup=10, rep=10,
quantiles=quantiles, fast_flush=False)
elif provider == 'triton':
triton_fn = lambda: matmul(a, b)
if len(a.shape) == 3 and len(b.shape) == 3:
Copy link
Contributor

Choose a reason for hiding this comment

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

how about assert len(a.shape) == len(b.shape)?

Copy link
Contributor Author

@anmyachev anmyachev Sep 24, 2024

Choose a reason for hiding this comment

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

how about assert len(a.shape) == len(b.shape)?

@whitneywhtsang could you elaborate a bit?

how about assert len(a.shape) == len(b.shape)?

Should I add this assert before if?

Copy link
Contributor

Choose a reason for hiding this comment

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

something like #2328 (comment)

@anmyachev anmyachev enabled auto-merge (squash) September 24, 2024 19:38
@anmyachev anmyachev merged commit 768e5bb into main Sep 24, 2024
5 checks passed
@anmyachev anmyachev deleted the amyachev/gemm-allocations branch September 24, 2024 19:39
@anmyachev anmyachev restored the amyachev/gemm-allocations branch September 24, 2024 21:25
@anmyachev anmyachev deleted the amyachev/gemm-allocations branch October 18, 2024 09:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants