-
Notifications
You must be signed in to change notification settings - Fork 25.6k
[AOTI] split too long string to smaller pieces when its length larger than 16000, fix msvc c2026. #161850
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
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/161850
Note: Links to docs will display an error until the docs builds have been completed. ❗ 1 Active SEVsThere are 1 currently active SEVs. If your PR is affected, please view them below: ✅ No FailuresAs of commit 26575cd with merge base f44ad54 ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
@pytorchbot rebase |
@pytorchbot started a rebase job onto refs/remotes/origin/viable/strict. Check the current status here |
…000, fix msvc c2026.
Successfully rebased |
ed6d4dd
to
6d52c49
Compare
if ( | ||
len(config.aot_inductor.serialized_out_spec) | ||
> MSVC_C2026_MAX_STRING_LENGTH | ||
): | ||
serialized_out_spec_strs = truncate_string( | ||
config.aot_inductor.serialized_out_spec, | ||
MSVC_C2026_MAX_STRING_LENGTH, | ||
) | ||
self.prefix.writeline("out_spec_ =") | ||
for truncate_str in serialized_out_spec_strs: | ||
self.prefix.writeline(f'R"({truncate_str})"') | ||
self.prefix.writeline(";") | ||
else: | ||
self.prefix.writeline( | ||
f'out_spec_ = R"({config.aot_inductor.serialized_out_spec})";' | ||
) |
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.
Put this duplicated pattern in a helper method (merge with the existing one).
Something like self.write_multiline_string("out_spec_", config.aot_inductor.serialized_out_spec)
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.
@jansel updated code as your comment.
@pytorchbot merge |
Merge startedYour change will be merged once all checks pass (ETA 0-4 Hours). Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
… than 16000, fix msvc c2026. (pytorch#161850) Split too long string to smaller pieces when its length larger than 16000, fix msvc c2026. reproducer: ```cmd pytest test\inductor\test_aot_inductor.py -v -k test_runtime_checks_large_cpu ``` Error message: <img width="1660" height="174" alt="image" src="https://github.com/user-attachments/assets/56fcd9be-24cb-484b-bfdc-f719ff2650b8" /> For MSVC c2026: https://learn.microsoft.com/en-us/cpp/error-messages/compiler-errors-1/compiler-error-c2026?view=msvc-170 We can split too long string to smaller pieces, it can fix this issue. Local validated: <img width="1122" height="232" alt="image" src="https://github.com/user-attachments/assets/cac54cc9-be51-4a5d-b408-06755a4debd5" /> Pull Request resolved: pytorch#161850 Approved by: https://github.com/jansel
… than 16000, fix msvc c2026. (pytorch#161850) Split too long string to smaller pieces when its length larger than 16000, fix msvc c2026. reproducer: ```cmd pytest test\inductor\test_aot_inductor.py -v -k test_runtime_checks_large_cpu ``` Error message: <img width="1660" height="174" alt="image" src="https://github.com/user-attachments/assets/56fcd9be-24cb-484b-bfdc-f719ff2650b8" /> For MSVC c2026: https://learn.microsoft.com/en-us/cpp/error-messages/compiler-errors-1/compiler-error-c2026?view=msvc-170 We can split too long string to smaller pieces, it can fix this issue. Local validated: <img width="1122" height="232" alt="image" src="https://github.com/user-attachments/assets/cac54cc9-be51-4a5d-b408-06755a4debd5" /> Pull Request resolved: pytorch#161850 Approved by: https://github.com/jansel
Split too long string to smaller pieces when its length larger than 16000, fix msvc c2026.
reproducer:
Error message:

For MSVC c2026:
https://learn.microsoft.com/en-us/cpp/error-messages/compiler-errors-1/compiler-error-c2026?view=msvc-170
We can split too long string to smaller pieces, it can fix this issue.
Local validated:

cc @peterjc123 @mszhanyi @skyline75489 @nbcsm @iremyux @Blackhex @jgong5 @mingfeima @XiaobingSuper @sanchitintel @ashokei @jingxu10 @voznesenskym @penguinwu @EikanWang @Guobing-Chen @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @ipiszy @chenyang78 @kadeng @muchulee8 @amjames @chauhang @aakhundov @coconutruben