Skip to content

Conversation

@xuhancn
Copy link
Contributor

@xuhancn xuhancn commented Dec 3, 2025

Issue:
When triton build failed, it missed verbose error message display.

Fixing:
It referenced to PyTorch cpp_builder code, to show verbose error message: https://github.com/pytorch/pytorch/blob/2bec68e73b64715354af076ad309335f943e36cd/torch/_inductor/cpp_builder.py#L613-L631

Local validation:
After this fixing, it should shows the verbose build fail message:
image

New contributor declaration

  • I am not making a trivial change, such as fixing a typo in a comment.

  • I have written a PR description following these
    rules.

  • I have run pre-commit run --from-ref origin/main --to-ref HEAD.

  • Select one of the following.

    • I have added tests.
      • /test for lit tests
      • /unittest for C++ tests
      • /python/test for end-to-end tests
    • This PR does not need a test because FILL THIS IN.
  • Select one of the following.

    • I have not added any lit tests.
    • The lit tests I have added follow these best practices,
      including the "tests should be minimal" section. (Usually running Python code
      and using the instructions it generates is not minimal.)

Comment on lines +114 to +118
try:
subprocess.run(cc_cmd, check=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
except subprocess.CalledProcessError as e:
output = e.stdout.decode(*SUBPROCESS_DECODE_ARGS)
raise RuntimeError(output)
Copy link
Contributor

Choose a reason for hiding this comment

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

Hi @xuhancn. Thanks for your contribution!

Let's try simplifying the code. Does this work for you?

Suggested change
try:
subprocess.run(cc_cmd, check=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
except subprocess.CalledProcessError as e:
output = e.stdout.decode(*SUBPROCESS_DECODE_ARGS)
raise RuntimeError(output)
subprocess.check_output(cc_cmd, stderr=subprocess.STDOUT, encoding=locale.getpreferredencoding())

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi @anmyachev I think my code is better, we'd better keep try-except block. It is working well in PyTorch for a long time.

Copy link
Contributor

Choose a reason for hiding this comment

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

We have one more criterion: how much the code deviates from the upstream. I use this as a guide when trying to modify your code. The smaller it is, the easier it is to support for us and potentially upstream it.

Several things from docs: https://docs.python.org/3.10/library/subprocess.html#subprocess.check_output

The main reason why you use try-except is to decode the output (at least I see it like this). However, if immediately pass encoding to the call command, then this is not necessary.

@anmyachev
Copy link
Contributor

Closes #3760

Copy link
Contributor

@anmyachev anmyachev left a comment

Choose a reason for hiding this comment

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

If I haven't convinced you, you can merge the changes as is.

@xuhancn xuhancn requested a review from anmyachev December 4, 2025 12:15
@whitneywhtsang whitneywhtsang merged commit c6cd398 into intel:main Dec 5, 2025
41 of 48 checks passed
@xuhancn xuhancn deleted the xu_fix_build_fail_message branch December 5, 2025 00:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants