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

adding benchmarking #3

Merged
merged 8 commits into from
Aug 15, 2024
Merged

adding benchmarking #3

merged 8 commits into from
Aug 15, 2024

Conversation

adamomainz
Copy link
Collaborator

@adamomainz adamomainz commented Jul 30, 2024

Summary:
adding benchmarking by pulling out all the parts of torch we want to replace with triton and adding them to a single operators file. I also had to make some changes to the existing kernels since they had relative paths to triton itself

Test Plan:
made sure I didnt break anything so far

python3.9 -m main llama_chat_completion --profile=False --benchmark=True --ckpt_dir="models/llama/meta-llama/Meta-Llama-3-8B-Instruct/original" --tokenizer_path="models/llama/meta-llama/Meta-Llama-3-8B-Instruct/original/tokenizer.model" --use_triton=False

Output from benchmarks:

Screenshot 2024-08-09 at 1 18 32 PM

amainz added 3 commits July 30, 2024 13:11
Summary:

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:
@adamomainz adamomainz changed the title [DRAFT] adding benchmarking adding benchmarking Aug 9, 2024
@adamomainz adamomainz marked this pull request as ready for review August 9, 2024 18:20
Copy link
Collaborator

@bertmaher bertmaher left a comment

Choose a reason for hiding this comment

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

What are the False True args in your example command line doing? Let's make those proper named args so they're not a mystery :)

@@ -0,0 +1,143 @@
import torch.nn.functional as F
Copy link
Collaborator

Choose a reason for hiding this comment

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

This file should be math_ops.py to keep with standard conventions

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

fixing

@adamomainz
Copy link
Collaborator Author

What are the False True args in your example command line doing? Let's make those proper named args so they're not a mystery :)

@bertmaher fixed! was only in the test plan the params are properly named in the main.py file :)

Comment on lines 34 to 39
start_time = time.perf_counter()

with torch.profiler.record_function(name):
result = func(*args, **kwargs)

end_time = time.perf_counter()
Copy link
Collaborator

Choose a reason for hiding this comment

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

perf_counter isn't the right way to measure GPU time. Use torch.cuda.Event instead:
https://discuss.pytorch.org/t/how-to-measure-time-in-pytorch/26964

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

#5

@adamomainz adamomainz merged commit 792e99f into main Aug 15, 2024
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