KEMBAR78
Cut a version of TORCH_ERROR_CODE_CHECK in headeronly from AOTI by janeyx99 · Pull Request #159604 · pytorch/pytorch · GitHub
Skip to content

Conversation

@janeyx99
Copy link
Contributor

@janeyx99 janeyx99 commented Jul 31, 2025

@pytorch-bot
Copy link

pytorch-bot bot commented Jul 31, 2025

🔗 Helpful Links

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

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:

✅ You can merge normally! (1 Unrelated Failure)

As of commit 810a751 with merge base 9b953bb (image):

UNSTABLE - The following job is marked as unstable, possibly due to flakiness on trunk:

  • pull / linux-jammy-py3_9-clang9-xla / test (xla, 1, 1, linux.12xlarge, unstable) (gh) (#158876)
    /var/lib/jenkins/workspace/xla/torch_xla/csrc/runtime/BUILD:476:14: Compiling torch_xla/csrc/runtime/xla_util_test.cpp failed: (Exit 1): gcc failed: error executing CppCompile command (from target //torch_xla/csrc/runtime:xla_util_test) /usr/bin/gcc -U_FORTIFY_SOURCE -fstack-protector -Wall -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer -g0 -O2 '-D_FORTIFY_SOURCE=1' -DNDEBUG -ffunction-sections ... (remaining 229 arguments skipped)

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

@janeyx99 janeyx99 requested a review from desertfire August 1, 2025 15:52
janeyx99 added a commit that referenced this pull request Aug 1, 2025
@janeyx99 janeyx99 requested a review from albanD August 1, 2025 18:01
@janeyx99 janeyx99 added the ciflow/trunk Trigger trunk jobs on your pull request label Aug 1, 2025
#include <stdexcept>

#if defined(__GNUC__) || defined(__clang__)
#define TORCH_NOINLINE __attribute__((noinline))
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we can simply use C10_NOINLINE now since it has been moved to a header-only file.

#define TORCH_SUCCESS 0
#define TORCH_FAILURE 1

TORCH_NOINLINE static void throw_exception(
Copy link
Contributor

Choose a reason for hiding this comment

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

I think using namespace detail and inline is more consistent with other header files, instead of using static.

janeyx99 added a commit that referenced this pull request Aug 1, 2025
Copy link
Collaborator

@albanD albanD left a comment

Choose a reason for hiding this comment

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

lint needs fixing, but SGTM otherwise.

Copy link
Contributor

@desertfire desertfire left a comment

Choose a reason for hiding this comment

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

Looks good other that the part I commented.

#define TORCH_FAILURE 1

namespace torch::headeronly::detail {
C10_NOINLINE inline void throw_exception(
Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry for the churn, but looking at this conflicting declaration C10_NOINLINE inline, I realized my previous suggestion doesn't make sense. The reason of having C10_NOINLINE here is because it was causing very slow compilation. I think we still need the old way of declaring this as static.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, as in it was getting inlined everyone during compilation which made it slower?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The namespace shouldn't affect anything, right?

janeyx99 added a commit that referenced this pull request Aug 5, 2025
@janeyx99 janeyx99 added release notes: build release notes category and removed release notes: inductor (aoti) labels Aug 5, 2025
janeyx99 added a commit that referenced this pull request Aug 5, 2025
@janeyx99
Copy link
Contributor Author

janeyx99 commented Aug 5, 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

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants