Skip to content

Protect files that ET depends on to be pinned to c++17 - #168204

Closed
JacobSzwejbka wants to merge 652 commits into
mainfrom
protect-c17
Closed

JacobSzwejbka wants to merge 652 commits into
mainfrom
protect-c17

Conversation

@JacobSzwejbka

@JacobSzwejbka JacobSzwejbka commented Nov 20, 2025 •

Copy link
Copy Markdown
Contributor

Needed for #167822

ET is still pinned to c++17 and will remain that way for the forseeable future. We take a dep on these headers and pytorch/pytorch wants to bump to c++20. This is a pretty minimal way to avoid the issue recommended by @r-barnes

Added a unittest with the version restricted and then added a new linter that I manually tested by modifying the files to use a c++20 feature and verified it died.

@pytorch-bot

pytorch-bot Bot commented Nov 20, 2025 •

Copy link
Copy Markdown

🔗 Helpful Links

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

Note: Links to docs will display an error until the docs builds have been completed.

❌ 1 Cancelled Job, 83 Pending

As of commit 771fd25 with merge base e81262f (image):

CANCELLED JOB - The following job was cancelled. Please retry:

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

@JacobSzwejbka JacobSzwejbka added the topic: not user facing topic category label Nov 20, 2025
Comment thread c10/macros/Export.h Outdated

#include <torch/headeronly/macros/Export.h>

#pragma clang diagnostic pop

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

how come you still need this when the files in headeronly already have the same directives surrounding them?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I probably dont, but just being super careful in case someone comes along and changes the old header contents for some reason.

@r-barnes

Copy link
Copy Markdown
Contributor

@JacobSzwejbka - Could you please change your diff title to say "C++17"? C17 is a C standard.

@r-barnes

Copy link
Copy Markdown
Contributor

@JacobSzwejbka - it may not be feasible, but using machinery from C10_CLANG_DIAGNOSTIC_POP and friends could make this cleaner. Ideally, I imagine something like:

#define EXECUTORCH_COMPATIBILITY_PUSH C10_CLANG_DIAGNOSTIC_POP \ C10_CLANG_DIAGNOSTIC_ERROR(-Wpre-c++20-compat)
#define EXECUTORCH_COMPATIBILITY_POP C10_CLANG_DIAGNOSTIC_POP

and then gating files with

EXECUTORCH_COMPATIBILITY_PUSH

...

EXECUTORCH_COMPATIBILITY_POP

that way your code becomes self-documenting.

If setting up the headers to make this happen is too much of a bother, the existing system will be fine.

@malfet malfet left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This feels like a wrong way to do it:

  • One should use C10_DIAGNOSTIC_XXX macros
  • Headers can change, so a more reliable solution imo is to have a test that just compiles portions of the code with C++17
  • We probably want to document somewhere what is allowed and what is not

@JacobSzwejbka JacobSzwejbka changed the title Protect files that ET depends on to be pinned to c17 Protect files that ET depends on to be pinned to c++17 Nov 20, 2025
@JacobSzwejbka

Copy link
Copy Markdown
Contributor Author

@malfet

We probably want to document somewhere what is allowed and what is not

Do you have an idea of a good spot?

@JacobSzwejbka

JacobSzwejbka commented Nov 20, 2025 •

Copy link
Copy Markdown
Contributor Author

@r-barnes Happy to do EXECUTORCH_COMPATIBILITY_PUSH and update the deps. Does it matter where I define it? Can I just throw it in headeronl/macros/Macros.h or do you want me to make a new one?

@malfet

malfet commented Nov 20, 2025

Copy link
Copy Markdown
Collaborator

Do you have an idea of a good spot?

I have a few ideas, at the very least we can add it to some sort of a readme that talks about headeronly library

@cyyever

cyyever commented Nov 21, 2025

Copy link
Copy Markdown
Collaborator

The most portable way is to use set_property(TARGET c10 PROPERTY CXX_STANDARD 17).

@JacobSzwejbka

Copy link
Copy Markdown
Contributor Author

The most portable way is to use set_property(TARGET c10 PROPERTY CXX_STANDARD 17).

fwiw I dont want to restrict all of c10 to c++17. Only the parts ET needs.

@JacobSzwejbka

Copy link
Copy Markdown
Contributor Author

Ok talked with @malfet some and switched to just protecting them with CI and lints instead of pragmas in the files

@r-barnes r-barnes left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

lgtm. @malfet may have do final approval.

@meta-codesync

meta-codesync Bot commented Dec 1, 2025

Copy link
Copy Markdown

@JacobSzwejbka has imported this pull request. If you are a Meta employee, you can view this in D88078350.

angelayi and others added 9 commits December 8, 2025 14:50
PR removes the `msg` argument in `raise_observed_exception` and replace all users of it by the existing `args` one

Pull Request resolved: #169343
Approved by: https://github.com/Lucaskabela
…ack.cpp (#169207)"

This reverts commit bb30341.

Reverted #169207 on behalf of https://github.com/huydhn due to Sorry to keep reverting this, but the issue is still there ([comment](#169207 (comment)))
This PR fixes torch.fx handling of the newer `|` type. Otherwise, they could be errors like
```
"/torch/package/importer.py", line 95, in get_name
     name = obj.__name__
    AttributeError: 'types.UnionType' object has no attribute '__name__'. Did you mean: '__ne__'?
```

Pull Request resolved: #169453
Approved by: https://github.com/albanD, https://github.com/malfet
This reverts commit bc39b2b.

Reverted #169343 on behalf of https://github.com/huydhn due to It looks like there is a land race here failing lint ([comment](#169343 (comment)))
…#169043)

# Motivation
This PR aims to introduce `torch.xpu.memory.XPUPluggableAllocator` and focus on the frontend part. Meanwhile, we introduce an API `torch.xpu.memory.change_current_allocator` that used to change the current `XPUAllocator`. Both APIs has the CUDA counterpart.

# Additional Context
This API would be used in popular repos such as https://github.com/search?q=repo%3Avllm-project%2Fvllm%20cudapluggableallocator&type=code

Pull Request resolved: #169043
Approved by: https://github.com/EikanWang, https://github.com/gujinghui, https://github.com/eellison
ghstack dependencies: #168966
Summary: To fix failures like this on CI,

```
2025-12-03T19:04:16.4264214Z ##[endgroup]
2025-12-03T19:04:16.8364369Z Traceback (most recent call last):
2025-12-03T19:04:16.8365336Z   File "/usr/lib64/python3.9/runpy.py", line 197, in _run_module_as_main
2025-12-03T19:04:16.8366153Z     return _run_code(code, main_globals, None,
2025-12-03T19:04:16.8366898Z   File "/usr/lib64/python3.9/runpy.py", line 87, in _run_code
2025-12-03T19:04:16.8368113Z     exec(code, run_globals)
2025-12-03T19:04:16.8368891Z   File "/home/ec2-user/actions-runner/_work/pytorch/pytorch/tools/stats/upload_utilization_stats/upload_utilization_stats.py", line 17, in <module>
2025-12-03T19:04:16.8369619Z     from tools.stats.utilization_stats_lib import (
2025-12-03T19:04:16.8370231Z   File "/home/ec2-user/actions-runner/_work/pytorch/pytorch/tools/stats/utilization_stats_lib.py", line 13, in <module>
2025-12-03T19:04:16.8370807Z     class UtilizationStats:
2025-12-03T19:04:16.8371390Z   File "/home/ec2-user/actions-runner/_work/pytorch/pytorch/tools/stats/utilization_stats_lib.py", line 14, in UtilizationStats
2025-12-03T19:04:16.8371999Z     avg: float | None = None
2025-12-03T19:04:16.8372353Z TypeError: unsupported operand type(s) for |: 'type' and 'NoneType'
```

e.g. https://productionresultssa17.blob.core.windows.net/actions-results/e3792057-a4cd-4eaa-b759-317aa47a149b/workflow-job-run-9ddd4c2f-8892-5cca-89c2-e6d976902e9d/logs/job/job-logs.txt?rsct=text%2Fplain&se=2025-12-03T21%3A15%3A42Z&sig=gvBdBvL2Z6KRploHfvLZF07GZvwLvR7SvN%2FxM1Vo2Fw%3D&ske=2025-12-04T06%3A43%3A09Z&skoid=ca7593d4-ee42-46cd-af88-8b886a2f84eb&sks=b&skt=2025-12-03T18%3A43%3A09Z&sktid=398a6654-997b-47e9-b12b-9515b896b4de&skv=2025-11-05&sp=r&spr=https&sr=b&st=2025-12-03T21%3A05%3A37Z&sv=2025-11-05
Pull Request resolved: #169501
Approved by: https://github.com/malfet
This reverts commit a15066c.

Reverted #169453 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](#169453 (comment)))
Summary: Fix #169118. A small named buffer can be optimized as inlined constant, but if that named buffer is mutated later on, AOTI can generate wrong code if not respecting the mutation information. This PR fixes the issue by recording mutated_named_buffers when unlifting the input graph and pass to Inductor graph lowering.

Pull Request resolved: #169347
Approved by: https://github.com/yushangdi
@JacobSzwejbka

Copy link
Copy Markdown
Contributor Author

Sorry everyone. pushed a bad commit which triggered a bunch of auto tagging

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/linux-aarch64 linux aarch64 CI workflow topic: not user facing topic category

Projects

None yet

Development

Successfully merging this pull request may close these issues.