Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions clang/include/clang/Driver/Options.td
Original file line number Diff line number Diff line change
Expand Up @@ -932,9 +932,20 @@ def W_Joined : Joined<["-"], "W">, Group<W_Group>,
def Xanalyzer : Separate<["-"], "Xanalyzer">,
HelpText<"Pass <arg> to the static analyzer">, MetaVarName<"<arg>">,
Group<StaticAnalyzer_Group>;
def Xarch__ : JoinedAndSeparate<["-"], "Xarch_">, Flags<[NoXarchOption]>,
HelpText<"Pass <arg> to the compiliation if the target matches <arch>">,
MetaVarName<"<arch> <arg>">;
def Xarch__
: JoinedAndSeparate<["-"], "Xarch_">,
Flags<[NoXarchOption]>,
HelpText<"Pass <arg> to the compilation if the target matches <arch>">,
DocBrief<
[{Specifies that the argument should only be used if the compilation
target matches the specified architecture. This can be used with the target
CPU, triple architecture, or offloading host and device. It 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. -Xarch_device will
forward the argument to the offloading device while -Xarch_host will target
the host system, which can be used to suppress incompatible GPU arguments.}]>,
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.

def Xarch_host : Separate<["-"], "Xarch_host">, Flags<[NoXarchOption]>,
HelpText<"Pass <arg> to the CUDA/HIP host compilation">, MetaVarName<"<arg>">;
def Xarch_device : Separate<["-"], "Xarch_device">, Flags<[NoXarchOption]>,
Expand Down