Skip to content

Conversation

xuhancn
Copy link
Collaborator

@xuhancn xuhancn commented Aug 30, 2025

Split too long string to smaller pieces when its length larger than 16000, fix msvc c2026.

reproducer:

pytest test\inductor\test_aot_inductor.py -v -k test_runtime_checks_large_cpu

Error message:
image

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:
image

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

@xuhancn xuhancn added module: windows Windows support for PyTorch ciflow/trunk Trigger trunk jobs on your pull request topic: not user facing topic category intel This tag is for PR from Intel labels Aug 30, 2025
Copy link

pytorch-bot bot commented Aug 30, 2025

🔗 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 SEVs

There are 1 currently active SEVs. If your PR is affected, please view them below:

✅ No Failures

As of commit 26575cd with merge base f44ad54 (image):
💚 Looks good so far! There are no failures yet. 💚

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@xuhancn
Copy link
Collaborator Author

xuhancn commented Aug 30, 2025

@pytorchbot rebase

@pytorchmergebot
Copy link
Collaborator

@pytorchbot started a rebase job onto refs/remotes/origin/viable/strict. Check the current status here

@pytorchmergebot
Copy link
Collaborator

Successfully rebased xu_fix_msvc_C2026 onto refs/remotes/origin/viable/strict, please pull locally before adding more changes (for example, via git checkout xu_fix_msvc_C2026 && git pull --rebase)

@xuhancn xuhancn marked this pull request as ready for review August 30, 2025 19:34
@xuhancn xuhancn changed the title [AOTI] split too long string to smaller pieces when it larger than 16000, fix msvc c2026. [AOTI] split too long string to smaller pieces when its length larger than 16000, fix msvc c2026. Aug 30, 2025
jansel
jansel previously requested changes Aug 31, 2025
Comment on lines 896 to 911
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})";'
)
Copy link
Contributor

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)

Copy link
Collaborator Author

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.

@xuhancn xuhancn added this to the ge milestone Aug 31, 2025
@xuhancn xuhancn requested a review from jansel August 31, 2025 19:01
@xuhancn
Copy link
Collaborator Author

xuhancn commented Sep 2, 2025

@pytorchbot merge

@pytorchmergebot
Copy link
Collaborator

Merge started

Your 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

Advanced Debugging
Check the merge workflow status
here

@xuhancn xuhancn deleted the xu_fix_msvc_C2026 branch September 2, 2025 00:09
markc-614 pushed a commit to markc-614/pytorch that referenced this pull request Sep 17, 2025
… 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
mansiag05 pushed a commit to mansiag05/pytorch that referenced this pull request Sep 22, 2025
… 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/inductor ciflow/trunk Trigger trunk jobs on your pull request intel This tag is for PR from Intel Merged module: inductor module: windows Windows support for PyTorch open source release notes: inductor (aoti) topic: not user facing topic category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants