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 host benchmarks to a subdirectory for easier distinction #3887

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

Priya2698
Copy link
Collaborator

No description provided.

@Priya2698 Priya2698 requested review from naoyam and xwang233 February 13, 2025 23:39
Copy link

github-actions bot commented Feb 13, 2025

Review updated until commit 06c353a

Description

  • Move host benchmarks to subdirectory for organization

  • Update imports to use relative paths

  • Add __init__.py for correct import structure


Changes walkthrough 📝

Relevant files
Enhancement
test_adaptive_layernorm_host.py
Update import to relative path                                                     

benchmarks/python/host/test_adaptive_layernorm_host.py

  • Update import statement to use relative path
+1/-1     
test_many_pointwise_ops_host.py
Update imports to relative paths                                                 

benchmarks/python/host/test_many_pointwise_ops_host.py

  • Update import statements to use relative paths
+2/-2     
test_many_segments_host.py
Update import to relative path                                                     

benchmarks/python/host/test_many_segments_host.py

  • Update import statement to use relative path
+1/-1     
Additional files
__init__.py [link]   

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

🧪 No relevant tests
⚡ Recommended focus areas for review

Import Path

The import path for run_benchmark has been changed from a relative import to an absolute import. Ensure that this change does not break the module's ability to locate run_benchmark when the script is executed.

from ..core import run_benchmark
Import Path

The import path for run_benchmark and PROMOTE_DTYPES has been changed from a relative import to an absolute import. Ensure that this change does not break the module's ability to locate these imports when the script is executed.

from ..core import run_benchmark
import torch
Import Path

The import path for run_benchmark has been changed from a relative import to an absolute import. Ensure that this change does not break the module's ability to locate run_benchmark when the script is executed.

from ..core import run_benchmark

Copy link
Collaborator

@naoyam naoyam left a comment

Choose a reason for hiding this comment

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

LGTM, but let's rename the directory to benchmarks/python/host/.

Copy link
Collaborator

@xwang233 xwang233 left a comment

Choose a reason for hiding this comment

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

I think import benchmarks from global space could be problematic. For example, pytorch used to accidentally add their benchmarks/ folder to the global package and import benchmarks.python.core here would cause import error (and it did). Let's use relative import instead.

Another concern I have is if moving the benchmark script would cause any changes in benchmark JSON output?

@Priya2698
Copy link
Collaborator Author

I think import benchmarks from global space could be problematic. For example, pytorch used to accidentally add their benchmarks/ folder to the global package and import benchmarks.python.core here would cause import error (and it did). Let's use relative import instead.

Oh that's a good point. I will change it.

Another concern I have is if moving the benchmark script would cause any changes in benchmark JSON output?

Can you elaborate? I can check if there are any paths in the JSON output that will be changed. If this is too much overhead for the dashboard, we can only rename benchmarks to have _host in them. I mainly made this change so everyone can easily locate the 3 host benchmarks instead of scrolling through our (growing) list of benchmarks.

@xwang233
Copy link
Collaborator

I can check if there are any paths in the JSON output that will be changed

Yes, that's the concern. I guess there aren't paths in the JSON output but let's double check.

Dashboard visualization should be fine. We may need to update the CI script that runs benchmark. Currently it runs test_*.py at depth 1. I'll have to update the script to search benchmark scripts recursively. This won't be a big problem.

@xwang233
Copy link
Collaborator

I just verified that there's no change in the path in generated pytest benchmark JSON file. I've also updated the CI script to recursively search test_*.py benchmark scripts.

Once the relative import issue is resolved, we're ready to go.

@Priya2698
Copy link
Collaborator Author

!build

@Priya2698
Copy link
Collaborator Author

I just verified that there's no change in the path in generated pytest benchmark JSON file. I've also updated the CI script to recursively search test_*.py benchmark scripts.

Once the relative import issue is resolved, we're ready to go.

Thanks, Xiao.
The subdir name is host. I also changed test_many_pointwise_ops.py -> test_many_pointwise_ops_host.py for consistency. With the subdirectory we may not need host in the name, though. I

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.

3 participants