[PATCH] D156886: [CUDA][HIP] Reorganize options for documentation

2023-08-04 Thread Yaxun Liu via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
yaxunl marked 2 inline comments as done.
Closed by commit rGf037b895b7e9: [CUDA][HIP] Reorganize options for 
documentation (authored by yaxunl).
Herald added a project: clang.

Changed prior to commit:
  https://reviews.llvm.org/D156886?vs=546434&id=547349#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D156886/new/

https://reviews.llvm.org/D156886

Files:
  clang/include/clang/Driver/Options.td

Index: clang/include/clang/Driver/Options.td
===
--- clang/include/clang/Driver/Options.td
+++ clang/include/clang/Driver/Options.td
@@ -150,12 +150,22 @@
 Group, DocFlatten;
 def pedantic_Group : OptionGroup<"">, Group,
  DocFlatten;
+
+def offload_Group : OptionGroup<"">, Group,
+   DocName<"Common Offloading options">;
+
 def opencl_Group : OptionGroup<"">, Group,
DocName<"OpenCL options">;
 
 def sycl_Group : OptionGroup<"">, Group,
  DocName<"SYCL options">;
 
+def cuda_Group : OptionGroup<"">, Group,
+   DocName<"CUDA options">;
+
+def hip_Group : OptionGroup<"">, Group,
+   DocName<"HIP options">;
+
 def m_Group : OptionGroup<"">, Group,
   DocName<"Target-dependent compilation options">;
 
@@ -987,32 +997,108 @@
   NegFlag,
   PosFlag>;
 
+// Common offloading options
+let Group = offload_Group in {
+def offload_arch_EQ : Joined<["--"], "offload-arch=">, Flags<[NoXarchOption]>,
+  HelpText<"Specify an offloading device architecture for CUDA, HIP, or OpenMP. (e.g. sm_35). "
+   "If 'native' is used the compiler will detect locally installed architectures. "
+   "For HIP offloading, the device architecture can be followed by target ID features "
+   "delimited by a colon (e.g. gfx908:xnack+:sramecc-). May be specified more than once.">;
+def no_offload_arch_EQ : Joined<["--"], "no-offload-arch=">, Flags<[NoXarchOption]>,
+  HelpText<"Remove CUDA/HIP offloading device architecture (e.g. sm_35, gfx906) from the list of devices to compile for. "
+   "'all' resets the list to its default value.">;
+
+def offload_new_driver : Flag<["--"], "offload-new-driver">, Flags<[CC1Option]>, Group,
+  MarshallingInfoFlag>, HelpText<"Use the new driver for offloading compilation.">;
+def no_offload_new_driver : Flag<["--"], "no-offload-new-driver">, Flags<[CC1Option]>, Group,
+  HelpText<"Don't Use the new driver for offloading compilation.">;
+
+def offload_device_only : Flag<["--"], "offload-device-only">, Flags<[FlangOption]>,
+  HelpText<"Only compile for the offloading device.">;
+def offload_host_only : Flag<["--"], "offload-host-only">, Flags<[FlangOption]>,
+  HelpText<"Only compile for the offloading host.">;
+def offload_host_device : Flag<["--"], "offload-host-device">, Flags<[FlangOption]>,
+  HelpText<"Compile for both the offloading host and device (default).">;
+
 def gpu_use_aux_triple_only : Flag<["--"], "gpu-use-aux-triple-only">,
   InternalDriverOpt, HelpText<"Prepare '-aux-triple' only without populating "
   "'-aux-target-cpu' and '-aux-target-feature'.">;
+def amdgpu_arch_tool_EQ : Joined<["--"], "amdgpu-arch-tool=">,
+  HelpText<"Tool used for detecting AMD GPU arch in the system.">;
+def nvptx_arch_tool_EQ : Joined<["--"], "nvptx-arch-tool=">,
+  HelpText<"Tool used for detecting NVIDIA GPU arch in the system.">;
+
+defm gpu_rdc : BoolFOption<"gpu-rdc",
+  LangOpts<"GPURelocatableDeviceCode">, DefaultFalse,
+  PosFlag,
+  NegFlag>;
+
+def fgpu_default_stream_EQ : Joined<["-"], "fgpu-default-stream=">,
+  HelpText<"Specify default stream. The default value is 'legacy'. (CUDA/HIP only)">,
+  Flags<[CC1Option]>,
+  Values<"legacy,per-thread">,
+  NormalizedValuesScope<"LangOptions::GPUDefaultStreamKind">,
+  NormalizedValues<["Legacy", "PerThread"]>,
+  MarshallingInfoEnum, "Legacy">;
+
+def fgpu_flush_denormals_to_zero : Flag<["-"], "fgpu-flush-denormals-to-zero">,
+  HelpText<"Flush denormal floating point values to zero in CUDA/HIP device mode.">;
+def fno_gpu_flush_denormals_to_zero : Flag<["-"], "fno-gpu-flush-denormals-to-zero">;
+
+defm gpu_defer_diag : BoolFOption<"gpu-defer-diag",
+  LangOpts<"GPUDeferDiag">, DefaultFalse,
+  PosFlag, NegFlag,
+  BothFlags<[], " host/device related diagnostic messages for CUDA/HIP">>;
+
+defm gpu_exclude_wrong_side_overloads : BoolFOption<"gpu-exclude-wrong-side-overloads",
+  LangOpts<"GPUExcludeWrongSideOverloads">, DefaultFalse,
+  PosFlag,
+  NegFlag,
+  BothFlags<[HelpHidden], " in overloading resolution for CUDA/HIP">>;
+
+def cuid_EQ : Joined<["-"], "cuid=">, Flags<[CC1Option]>,
+  HelpText<"An ID for compilation unit, which should be the same for the same "
+   "compilation unit but different for different compil

[PATCH] D156886: [CUDA][HIP] Reorganize options for documentation

2023-08-04 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl marked 2 inline comments as done.
yaxunl added inline comments.



Comment at: clang/include/clang/Driver/Options.td:155
+def offload_Group : OptionGroup<"">, Group,
+   DocName<"Common Offloading flags">;
+

MaskRay wrote:
> The existing `flags` uses are misnomer (`Flag` does not accept values). 
> Perhaps use `options` for new option groups.
will do



Comment at: clang/include/clang/Driver/Options.td:1021
+def offload_host_device : Flag<["--"], "offload-host-device">, 
Flags<[FlangOption]>,
+  HelpText<"Only compile for the offloading host.">;
+

jhuber6 wrote:
> Can you fix this copy paste error while you're here?
It has been fixed in the trunk.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D156886/new/

https://reviews.llvm.org/D156886

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D156886: [CUDA][HIP] Reorganize options for documentation

2023-08-02 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay accepted this revision.
MaskRay added inline comments.



Comment at: clang/include/clang/Driver/Options.td:155
+def offload_Group : OptionGroup<"">, Group,
+   DocName<"Common Offloading flags">;
+

The existing `flags` uses are misnomer (`Flag` does not accept values). Perhaps 
use `options` for new option groups.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D156886/new/

https://reviews.llvm.org/D156886

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D156886: [CUDA][HIP] Reorganize options for documentation

2023-08-02 Thread Joseph Huber via Phabricator via cfe-commits
jhuber6 accepted this revision.
jhuber6 added a comment.
This revision is now accepted and ready to land.

I think this is good, there's been some confusion around which ones goes to 
what.




Comment at: clang/include/clang/Driver/Options.td:1021
+def offload_host_device : Flag<["--"], "offload-host-device">, 
Flags<[FlangOption]>,
+  HelpText<"Only compile for the offloading host.">;
+

Can you fix this copy paste error while you're here?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D156886/new/

https://reviews.llvm.org/D156886

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D156886: [CUDA][HIP] Reorganize options for documentation

2023-08-02 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl created this revision.
yaxunl added reviewers: tra, MaskRay, jhuber6.
Herald added subscribers: mattd, carlosgalvezp, Naghasan, Anastasia.
Herald added a reviewer: sscalpone.
Herald added a project: All.
yaxunl requested review of this revision.
Herald added a reviewer: jdoerfert.
Herald added subscribers: jplehr, sstefan1.

Reorganize options and group them as "Common Offloading flags", "CUDA flags" 
and "HIP flags", so that they will be grouped together like "OpenCL flags" and 
"SYCL flags" in https://clang.llvm.org/docs/ClangCommandLineReference.html


https://reviews.llvm.org/D156886

Files:
  clang/include/clang/Driver/Options.td

Index: clang/include/clang/Driver/Options.td
===
--- clang/include/clang/Driver/Options.td
+++ clang/include/clang/Driver/Options.td
@@ -150,12 +150,22 @@
 Group, DocFlatten;
 def pedantic_Group : OptionGroup<"">, Group,
  DocFlatten;
+
+def offload_Group : OptionGroup<"">, Group,
+   DocName<"Common Offloading flags">;
+
 def opencl_Group : OptionGroup<"">, Group,
DocName<"OpenCL flags">;
 
 def sycl_Group : OptionGroup<"">, Group,
  DocName<"SYCL flags">;
 
+def cuda_Group : OptionGroup<"">, Group,
+   DocName<"CUDA flags">;
+
+def hip_Group : OptionGroup<"">, Group,
+   DocName<"HIP flags">;
+
 def m_Group : OptionGroup<"">, Group,
   DocName<"Target-dependent compilation options">;
 
@@ -987,32 +997,108 @@
   NegFlag,
   PosFlag>;
 
+// Common offloading options
+let Group = offload_Group in {
+def offload_arch_EQ : Joined<["--"], "offload-arch=">, Flags<[NoXarchOption]>,
+  HelpText<"Specify an offloading device architecture for CUDA, HIP, or OpenMP. (e.g. sm_35). "
+   "If 'native' is used the compiler will detect locally installed architectures. "
+   "For HIP offloading, the device architecture can be followed by target ID features "
+   "delimited by a colon (e.g. gfx908:xnack+:sramecc-). May be specified more than once.">;
+def no_offload_arch_EQ : Joined<["--"], "no-offload-arch=">, Flags<[NoXarchOption]>,
+  HelpText<"Remove CUDA/HIP offloading device architecture (e.g. sm_35, gfx906) from the list of devices to compile for. "
+   "'all' resets the list to its default value.">;
+
+def offload_new_driver : Flag<["--"], "offload-new-driver">, Flags<[CC1Option]>, Group,
+  MarshallingInfoFlag>, HelpText<"Use the new driver for offloading compilation.">;
+def no_offload_new_driver : Flag<["--"], "no-offload-new-driver">, Flags<[CC1Option]>, Group,
+  HelpText<"Don't Use the new driver for offloading compilation.">;
+
+def offload_device_only : Flag<["--"], "offload-device-only">, Flags<[FlangOption]>,
+  HelpText<"Only compile for the offloading device.">;
+def offload_host_only : Flag<["--"], "offload-host-only">, Flags<[FlangOption]>,
+  HelpText<"Only compile for the offloading host.">;
+def offload_host_device : Flag<["--"], "offload-host-device">, Flags<[FlangOption]>,
+  HelpText<"Only compile for the offloading host.">;
+
 def gpu_use_aux_triple_only : Flag<["--"], "gpu-use-aux-triple-only">,
   InternalDriverOpt, HelpText<"Prepare '-aux-triple' only without populating "
   "'-aux-target-cpu' and '-aux-target-feature'.">;
+def amdgpu_arch_tool_EQ : Joined<["--"], "amdgpu-arch-tool=">,
+  HelpText<"Tool used for detecting AMD GPU arch in the system.">;
+def nvptx_arch_tool_EQ : Joined<["--"], "nvptx-arch-tool=">,
+  HelpText<"Tool used for detecting NVIDIA GPU arch in the system.">;
+
+defm gpu_rdc : BoolFOption<"gpu-rdc",
+  LangOpts<"GPURelocatableDeviceCode">, DefaultFalse,
+  PosFlag,
+  NegFlag>;
+
+def fgpu_default_stream_EQ : Joined<["-"], "fgpu-default-stream=">,
+  HelpText<"Specify default stream. The default value is 'legacy'. (CUDA/HIP only)">,
+  Flags<[CC1Option]>,
+  Values<"legacy,per-thread">,
+  NormalizedValuesScope<"LangOptions::GPUDefaultStreamKind">,
+  NormalizedValues<["Legacy", "PerThread"]>,
+  MarshallingInfoEnum, "Legacy">;
+
+def fgpu_flush_denormals_to_zero : Flag<["-"], "fgpu-flush-denormals-to-zero">,
+  HelpText<"Flush denormal floating point values to zero in CUDA/HIP device mode.">;
+def fno_gpu_flush_denormals_to_zero : Flag<["-"], "fno-gpu-flush-denormals-to-zero">;
+
+defm gpu_defer_diag : BoolFOption<"gpu-defer-diag",
+  LangOpts<"GPUDeferDiag">, DefaultFalse,
+  PosFlag, NegFlag,
+  BothFlags<[], " host/device related diagnostic messages for CUDA/HIP">>;
+
+defm gpu_exclude_wrong_side_overloads : BoolFOption<"gpu-exclude-wrong-side-overloads",
+  LangOpts<"GPUExcludeWrongSideOverloads">, DefaultFalse,
+  PosFlag,
+  NegFlag,
+  BothFlags<[HelpHidden], " in overloading resolution for CUDA/HIP">>;
+
+def cuid_EQ : Joined<["-"], "cuid=">, Flags<[CC1Option]>,
+  HelpText<"An ID for compilation unit, which should be the same for the same "
+   "compilation