Skip to content

[1/N] Change C-style casts to static_cast or reinterpret_cast#165750

Closed
cyyever wants to merge 7 commits intopytorch:mainfrom
cyyever:static_cast
Closed

[1/N] Change C-style casts to static_cast or reinterpret_cast#165750
cyyever wants to merge 7 commits intopytorch:mainfrom
cyyever:static_cast

Conversation

@cyyever
Copy link
Collaborator

@cyyever cyyever commented Oct 17, 2025

This series of changes try to cover C style casts into C++ alternatives.

cc @H-Huang @awgu @wanchaol @fegin @fduwjj @wz337 @wconstab @d4l3k @pragupta @msaroufim @dcci

@pytorch-bot
Copy link

pytorch-bot bot commented Oct 17, 2025

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/165750

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:

❌ 1 New Failure

As of commit deba160 with merge base 15ff1cd (image):

NEW FAILURE - The following job has failed:

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

Copy link
Collaborator

@Skylion007 Skylion007 left a comment

Choose a reason for hiding this comment

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

GitHub kept erroring my leaving inline comments. Some of the static casts from std::string.data to char cast, are they really necessary?

Some of the reinterpret casts should be const casts, which are bit safer.

Also slight nit: I noticed unique_devices set checks for membership before insertion. I think you can just call.Insert on it and it will be a noop if the key is present and return an std::pair where the second value tells you if it succeeded or not.

@albanD albanD added the triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module label Oct 19, 2025
@cyyever cyyever force-pushed the static_cast branch 5 times, most recently from e9e257f to 0e217cc Compare October 19, 2025 04:00
@cyyever cyyever requested a review from Skylion007 October 19, 2025 04:20
@cyyever
Copy link
Collaborator Author

cyyever commented Oct 19, 2025

@Skylion007 Applied your advices.

@cyyever cyyever requested a review from albanD October 19, 2025 04:22
@cyyever
Copy link
Collaborator Author

cyyever commented Oct 20, 2025

@pytorchbot merge -r

@pytorch-auto-revert
Copy link

@pytorchbot revert -m "Reverted automatically by pytorch's autorevert, to avoid this behaviour add the tag autorevert: disable" -c autorevert

This PR is attributed to have caused regression in:

Please investigate and fix the issues.

@pytorchmergebot
Copy link
Collaborator

@pytorchbot successfully started a revert job. Check the current status here.
Questions? Feedback? Please reach out to the PyTorch DevX Team

@pytorchmergebot
Copy link
Collaborator

@cyyever your PR has been successfully reverted.

pytorchmergebot added a commit that referenced this pull request Oct 20, 2025
…#165750)"

This reverts commit e1e8491.

Reverted #165750 on behalf of https://github.com/pytorch-auto-revert due to Reverted automatically by pytorch's autorevert, to avoid this behaviour add the tag autorevert: disable ([comment](#165750 (comment)))
@pytorchmergebot pytorchmergebot added Reverted ci-no-td Do not run TD on this PR labels Oct 20, 2025
pytorchmergebot pushed a commit to renato-arantes/pytorch that referenced this pull request Oct 20, 2025
…h#165750)

This series of changes try to cover C style casts into C++ alternatives.

Pull Request resolved: pytorch#165750
Approved by: https://github.com/Skylion007
@clee2000
Copy link
Contributor

I think this revert is wrong, the failures are probably due to the AWS outage instead

@cyyever cyyever restored the static_cast branch October 20, 2025 23:22
@cyyever cyyever reopened this Oct 20, 2025
@cyyever
Copy link
Collaborator Author

cyyever commented Oct 20, 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

@cyyever
Copy link
Collaborator Author

cyyever commented Oct 20, 2025

@pytorchbot merge -f "invalid revert by pytorch-auto-revert bot "

@pytorchmergebot
Copy link
Collaborator

The merge job was canceled or timed out. This most often happen if two merge requests were issued for the same PR, or if merge job was waiting for more than 6 hours for tests to finish. In later case, please do not hesitate to reissue the merge command
For more information see pytorch-bot wiki.

@pytorchmergebot
Copy link
Collaborator

Merge started

Your change will be merged immediately since you used the force (-f) flag, bypassing any CI checks (ETA: 1-5 minutes). Please use -f as last resort and instead consider -i/--ignore-current to continue the merge ignoring current failures. This will allow currently pending tests to finish and report signal before the merge.

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

Chao1Han pushed a commit to Chao1Han/pytorch that referenced this pull request Oct 21, 2025
…h#165750)

This series of changes try to cover C style casts into C++ alternatives.

Pull Request resolved: pytorch#165750
Approved by: https://github.com/Skylion007
Chao1Han pushed a commit to Chao1Han/pytorch that referenced this pull request Oct 21, 2025
…pytorch#165750)"

This reverts commit e1e8491.

Reverted pytorch#165750 on behalf of https://github.com/pytorch-auto-revert due to Reverted automatically by pytorch's autorevert, to avoid this behaviour add the tag autorevert: disable ([comment](pytorch#165750 (comment)))
Chao1Han pushed a commit to Chao1Han/pytorch that referenced this pull request Oct 21, 2025
…h#165750)

This series of changes try to cover C style casts into C++ alternatives.

Pull Request resolved: pytorch#165750
Approved by: https://github.com/Skylion007
zhudada0120 pushed a commit to zhudada0120/pytorch that referenced this pull request Oct 22, 2025
…h#165750)

This series of changes try to cover C style casts into C++ alternatives.

Pull Request resolved: pytorch#165750
Approved by: https://github.com/Skylion007
zhudada0120 pushed a commit to zhudada0120/pytorch that referenced this pull request Oct 22, 2025
…pytorch#165750)"

This reverts commit e1e8491.

Reverted pytorch#165750 on behalf of https://github.com/pytorch-auto-revert due to Reverted automatically by pytorch's autorevert, to avoid this behaviour add the tag autorevert: disable ([comment](pytorch#165750 (comment)))
zhudada0120 pushed a commit to zhudada0120/pytorch that referenced this pull request Oct 22, 2025
…h#165750)

This series of changes try to cover C style casts into C++ alternatives.

Pull Request resolved: pytorch#165750
Approved by: https://github.com/Skylion007
@cyyever cyyever deleted the static_cast branch November 3, 2025 02:59
pytorchmergebot pushed a commit that referenced this pull request Nov 3, 2025
A follow-up of #165750 to clean up C casts.

Pull Request resolved: #165891
Approved by: https://github.com/Skylion007

Co-authored-by: Aaron Gokaslan <aaronGokaslan@gmail.com>
pytorch-bot bot pushed a commit that referenced this pull request Nov 4, 2025
A follow-up of #165750 to clean up C casts.

Pull Request resolved: #165891
Approved by: https://github.com/Skylion007

Co-authored-by: Aaron Gokaslan <aaronGokaslan@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci-no-td Do not run TD on this PR ciflow/h100-symm-mem ciflow/inductor ciflow/trunk Trigger trunk jobs on your pull request Merged oncall: distributed Add this issue/PR to distributed oncall triage queue open source release notes: distributed (c10d) release notes category Reverted triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants