-
Notifications
You must be signed in to change notification settings - Fork 10
[Feat]: add gemm baseline profile #58
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
base: refactor
Are you sure you want to change the base?
Conversation
RMLYC
commented
Dec 17, 2025
- Add gemm baseline profile
Summary of ChangesHello @RMLYC, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces a foundational baseline profiling capability for General Matrix Multiply (GEMM) operations within the benchmarking suite. The primary goal is to enable consistent performance measurement of GEMM using the PyTorch backend and to enhance the command-line interface for the GEMM benchmark, providing greater control over profiling parameters such as tuning and matrix transposition. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
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.
Code Review
This pull request adds baseline profiling for GEMM operations. The changes introduce a baseline_profile method in gemm.py and update the profile_run.py script to handle more GEMM parameters. My review includes feedback on improving the profiling script's output clarity and fixing a bug in how command-line flags are constructed from CSV inputs. I've also suggested making the autotuning flag configurable for better flexibility.
| str(args_dict['dtype']), '--tune' | ||
| ] | ||
|
|
||
| if args_dict.get('trans_A', False): | ||
| cmd_args.append('--trans_A') | ||
|
|
||
| if args_dict.get('trans_B', False): | ||
| cmd_args.append('--trans_B') |
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.
There are two issues with the current implementation for building command arguments:
- The
--tuneflag is added unconditionally. This prevents running benchmarks without autotuning. It's better to make this configurable via the input CSV. - The checks for
trans_Aandtrans_Bare incorrect.csv.DictReaderreads all values as strings. A check likeif args_dict.get('trans_A', False)will beTrueeven if the value is the string'False', leading to incorrect benchmark execution. The check should explicitly compare against'true'.
The suggested change below fixes both issues by making all three flags (tune, trans_A, trans_B) conditional and using a safe string comparison. This will allow you to control these flags from your gemm.csv file.
| str(args_dict['dtype']), '--tune' | |
| ] | |
| if args_dict.get('trans_A', False): | |
| cmd_args.append('--trans_A') | |
| if args_dict.get('trans_B', False): | |
| cmd_args.append('--trans_B') | |
| str(args_dict['dtype']) | |
| ] | |
| if args_dict.get('tune', 'false').lower() == 'true': | |
| cmd_args.append('--tune') | |
| if args_dict.get('trans_A', 'false').lower() == 'true': | |
| cmd_args.append('--trans_A') | |
| if args_dict.get('trans_B', 'false').lower() == 'true': | |
| cmd_args.append('--trans_B') |
| def baseline_profile(self, *inputs, warmup=100, rep=100, device="cuda:0"): | ||
|
|
||
| print("===== Profiling MatMul torch backend =====") | ||
| return super().baseline_profile(self.ref_program, *inputs, backend="torch", warmup=warmup, rep=rep, device=device) |
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.
The print statement here is redundant, as the parent baseline_profile method already prints a descriptive header (===== Profiling {backend} =====). Removing this line and the extra blank line will make the output cleaner and the code more concise.
| def baseline_profile(self, *inputs, warmup=100, rep=100, device="cuda:0"): | |
| print("===== Profiling MatMul torch backend =====") | |
| return super().baseline_profile(self.ref_program, *inputs, backend="torch", warmup=warmup, rep=rep, device=device) | |
| def baseline_profile(self, *inputs, warmup=100, rep=100, device="cuda:0"): | |
| return super().baseline_profile(self.ref_program, *inputs, backend="torch", warmup=warmup, rep=rep, device=device) |