Skip to content

Include headers for symbols previously reached through ATen/Context.h - #200675

Closed
ezyang wants to merge 4 commits into
gh/ezyang/3618/basefrom
gh/ezyang/3618/head
Closed

ezyang wants to merge 4 commits into
gh/ezyang/3618/basefrom
gh/ezyang/3618/head

Conversation

@ezyang

@ezyang ezyang commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Stack from ghstack (oldest at bottom):

These files use symbols that ATen/Context.h declares or includes
(at::globalContext(), at::getAccelerator(), CPUGeneratorImpl, the
AutoDispatchBelow* guards, c10::utils::check_env, ...) without including
the header that provides them. They compile today only because the
generated per-operator headers (ATen/ops/*.h) include ATen/Context.h.

Include the providing header directly: ATen/Context.h only where
globalContext() or a Context-owned enum is used, otherwise the narrower
ATen/core/LegacyTypeDispatch.h, ATen/DeviceAccelerator.h,
ATen/CPUGeneratorImpl.h or c10/util/env.h. No functional change. This
prepares for removing the ATen/Context.h include from the per-operator
header template in the next PR.

cc @jgong5 @mingfeima @XiaobingSuper @sanchitintel @ashokei @jingxu10 @aditew01

…xt.h from generated per-op headers

[ghstack-poisoned]
@pytorch-bot

pytorch-bot Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

🔗 Helpful Links

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

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

✅ No Failures

As of commit e1b1096 with merge base 44a629b (image):
💚 Looks good so far! There are no failures yet. 💚

🟢 GREEN LIGHT - OUTDATED (earlier commit) - PR approved to be merged without human review:

  • Triviality
    • Behavior-neutral tweaks: every hunk only adds an #include line, with no other line in any file changing
    • Each added header (ATen/core/LegacyTypeDispatch.h, ATen/DeviceAccelerator.h, ATen/CPUGeneratorImpl.h, c10/util/env.h) is already included by ATen/Context.h
  • Correctness
    • Spot-checked uses match the added headers: createCPUGenerator in irparser.cpp, getAccelerator in node.h, check_env in Linear.cpp
    • globalContext() uses in SparseCsrTensorUtils.h and xpu Conv.cpp explain the direct ATen/Context.h includes
  • Scope
    • About 45 sites, all the same edit type; the codegen template ADInplaceOrViewType.cpp gains only an include line
    • The consequential removal of ATen/Context.h from the per-operator template is in the next PR, #​200676, not here

reason: clean
Reviewed commit: 362a79b (NOT the current head e1b1096)

Inference job

🐛 Report a wrong verdict

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

… code (fixes Activation.cpp build break)

[ghstack-poisoned]
@ezyang

ezyang commented Oct 13, 2026

Copy link
Copy Markdown
Contributor Author

@pytorchbot merge

@pytorch-bot pytorch-bot Bot added the ciflow/trunk Trigger trunk jobs on your pull request label Oct 13, 2026
@pytorchmergebot

Copy link
Copy Markdown
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

ezyang added a commit that referenced this pull request Oct 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/inductor ciflow/mps Run MPS tests (subset of trunk) ciflow/trunk Trigger trunk jobs on your pull request Merged module: cpu CPU specific problem (e.g., perf, algorithm) release notes: inductor (aoti) release notes: mps Release notes category release notes: quantization release notes category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants