-
Notifications
You must be signed in to change notification settings - Fork 377
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
[TorchAcc] Update padding strategy when using persistent cache #2464
Conversation
swift/torchacc_utils.py
Outdated
@@ -30,6 +30,15 @@ def get_bucket_sizes(max_length: int) -> List[int]: | |||
if os.getenv('TORCHACC_DATA_BUCKETS') is not None: | |||
bucket_sizes = [int(x) for x in os.getenv('TORCHACC_DATA_BUCKETS').split(',')] | |||
bucket_sizes.append(max_length) | |||
elif os.getenv('TORCHACC_CACHE_PATH') is not None: # padding strategy when persistent cache is enabled | |||
p = 1.4 |
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.
Maybe we could add an environment variable for the p.
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.
Fixed.
swift/torchacc_utils.py
Outdated
@@ -30,6 +30,15 @@ def get_bucket_sizes(max_length: int) -> List[int]: | |||
if os.getenv('TORCHACC_DATA_BUCKETS') is not None: | |||
bucket_sizes = [int(x) for x in os.getenv('TORCHACC_DATA_BUCKETS').split(',')] | |||
bucket_sizes.append(max_length) | |||
elif os.getenv('TORCHACC_CACHE_PATH') is not None: # padding strategy when persistent cache is enabled |
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.
Could we replace the else
block with this logic as defualt bucketing strategy?
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.
Fixed.
65df450
to
7b22094
Compare
8f81c68
to
ebf50a2
Compare
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.
LGTM
ebf50a2
to
18c1674
Compare
PR type
PR information
Optimize padding strategy when persistent cache is enabled, so we can enjoy performance boost with little extra compilaiton.
Experiment results
Around 10% e2e performance improvement for TorchAcc backend.