Skip to content

[Clang][Docs] Document -Xarch_ better #127890

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Feb 20, 2025
Merged

[Clang][Docs] Document -Xarch_ better #127890

merged 5 commits into from
Feb 20, 2025

Conversation

jhuber6
Copy link
Contributor

@jhuber6 jhuber6 commented Feb 19, 2025

Summary:
This argument is esoteric and previously didn't even work consistently
across the targets. Now that's fixed we should document it better.

@llvmbot llvmbot added the clang Clang issues not falling into any other category label Feb 19, 2025
@llvmbot
Copy link
Member

llvmbot commented Feb 19, 2025

@llvm/pr-subscribers-clang

Author: Joseph Huber (jhuber6)

Changes

Summary:
This argument is esoteric and previously didn't even work consistently
across the targets. Now that's fixed we should document it better.


Full diff: https://github.com/llvm/llvm-project/pull/127890.diff

1 Files Affected:

  • (modified) clang/include/clang/Driver/Options.td (+6)
diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td
index 5ad187926e710..b5598a44758a8 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -934,6 +934,12 @@ def Xanalyzer : Separate<["-"], "Xanalyzer">,
   Group<StaticAnalyzer_Group>;
 def Xarch__ : JoinedAndSeparate<["-"], "Xarch_">, Flags<[NoXarchOption]>,
   HelpText<"Pass <arg> to the compiliation if the target matches <arch>">,
+  DocBrief<[{Specifies that the argument should only be used if the compileation
+  target matches the specified architecture. This can be used with the target
+  CPU, triple architecture, or offloading host and device. This is most useful
+  for separating behavior undesirable on one of the targets when combining many
+  compilation jobs, as is commong with offloading. For example, -Xarch_x86_64,
+  -Xarch_gfx90a, and -Xarch_device are all valid selectors.}]>,
   MetaVarName<"<arch> <arg>">;
 def Xarch_host : Separate<["-"], "Xarch_host">, Flags<[NoXarchOption]>,
   HelpText<"Pass <arg> to the CUDA/HIP host compilation">, MetaVarName<"<arg>">;

Summary:
This argument is esoteric and previously didn't even work consistently
across the targets. Now that's fixed we should document it better.
Copy link
Contributor

@jplehr jplehr left a comment

Choose a reason for hiding this comment

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

Certainly an improvement. I think this is good, but do not feel confident right now to already approve.

for separating behavior undesirable on one of the targets when combining many
compilation jobs, as is commong with offloading. For example, -Xarch_x86_64,
-Xarch_gfx90a, and -Xarch_device are all valid selectors.}]>,
MetaVarName<"<arch> <arg>">;
Copy link
Member

Choose a reason for hiding this comment

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

I think the 'special' cases of -Xarch_host and -Xarch_device should somehow be mentioned.

Can we make the help a separate record and use it for all -Xarch* option variants consistently?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There are special cases? I thought it was self evident for offloading. But I think they are handled as different flags so I could put the help under them if that's what you mean.

Copy link
Member

@Artem-B Artem-B Feb 19, 2025

Choose a reason for hiding this comment

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

We do have them defined below as separate options, and you do already mention Xarch_device in the help message.
To the user unfamiliar with the implementation they all look like the same -Xarch_* option, but somehow get separate help message and treatment. It would be good to document a coherent picture of how it all fits together.

Can we make the help a separate record and use it for all -Xarch* option variants consistently?

Scratch that, it's a docBrief, so a single instance attached to this option is fine, I just want to expand it to include the wildcard host/device pseudo-arches that -Xarch effectively accepts.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

How about now?

Copy link
Member

Choose a reason for hiding this comment

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

SGTM.

@jhuber6 jhuber6 merged commit 007f601 into llvm:main Feb 20, 2025
6 of 7 checks passed
@jhuber6 jhuber6 deleted the XarchDocs branch February 20, 2025 01:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang Clang issues not falling into any other category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants