Skip to content

[Flang][AMDGPU] Add rocm-path flag #88190

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 6 commits into from
Apr 12, 2024
Merged
Show file tree
Hide file tree
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
3 changes: 2 additions & 1 deletion clang/include/clang/Driver/Options.td
Original file line number Diff line number Diff line change
Expand Up @@ -1341,7 +1341,8 @@ def hip_link : Flag<["--"], "hip-link">, Group<opencl_Group>,
HelpText<"Link clang-offload-bundler bundles for HIP">;
def no_hip_rt: Flag<["-"], "no-hip-rt">, Group<hip_Group>,
HelpText<"Do not link against HIP runtime libraries">;
def rocm_path_EQ : Joined<["--"], "rocm-path=">, Group<hip_Group>,
def rocm_path_EQ : Joined<["--"], "rocm-path=">,
Visibility<[FlangOption]>, Group<hip_Group>,
Copy link
Contributor

Choose a reason for hiding this comment

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

Just making sure, but adding the explicit visibility here doesn't override the standard clang ones?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ninja check-clang does not report any error. Is it enough?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, should be fine.

HelpText<"ROCm installation path, used for finding and automatically linking required bitcode libraries.">;
def hip_path_EQ : Joined<["--"], "hip-path=">, Group<hip_Group>,
HelpText<"HIP runtime installation path, used for finding HIP version and adding HIP include path.">;
Expand Down
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
6 changes: 6 additions & 0 deletions flang/test/Driver/Inputs/rocm/bin/.hipVersion
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Auto-generated by cmake
# NOTE: The trailing whitespace is added on purpose to verify that these
# whitespaces are trimmed before paring.
HIP_VERSION_MAJOR=3
HIP_VERSION_MINOR=6
HIP_VERSION_PATCH=20214-a2917cd
Empty file.
6 changes: 6 additions & 0 deletions flang/test/Driver/Inputs/rocm/share/hip/hipVersion
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Auto-generated by cmake
# NOTE: The trailing whitespace is added on purpose to verify that these
# whitespaces are trimmed before paring.
HIP_VERSION_MAJOR=3
HIP_VERSION_MINOR=6
HIP_VERSION_PATCH=20214-a2917cd
1 change: 1 addition & 0 deletions flang/test/Driver/driver-help-hidden.f90
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@
! CHECK-NEXT: -pthread Support POSIX threads in generated code
! CHECK-NEXT: -P Disable linemarker output in -E mode
! CHECK-NEXT: -resource-dir <value> The directory which holds the compiler resource files
! CHECK-NEXT: --rocm-path=<value> ROCm installation path, used for finding and automatically linking required bitcode libraries.
! CHECK-NEXT: -Rpass-analysis=<value> Report transformation analysis from optimization passes whose name matches the given POSIX regular expression
! CHECK-NEXT: -Rpass-missed=<value> Report missed transformations by optimization passes whose name matches the given POSIX regular expression
! CHECK-NEXT: -Rpass=<value> Report transformations performed by optimization passes whose name matches the given POSIX regular expression
Expand Down
1 change: 1 addition & 0 deletions flang/test/Driver/driver-help.f90
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@
! HELP-NEXT: -print-target-triple Print the normalized target triple
! HELP-NEXT: -pthread Support POSIX threads in generated code
! HELP-NEXT: -P Disable linemarker output in -E mode
! HELP-NEXT: --rocm-path=<value> ROCm installation path, used for finding and automatically linking required bitcode libraries.
! HELP-NEXT: -Rpass-analysis=<value> Report transformation analysis from optimization passes whose name matches the given POSIX regular expression
! HELP-NEXT: -Rpass-missed=<value> Report missed transformations by optimization passes whose name matches the given POSIX regular expression
! HELP-NEXT: -Rpass=<value> Report transformations performed by optimization passes whose name matches the given POSIX regular expression
Expand Down
6 changes: 6 additions & 0 deletions flang/test/Driver/omp-driver-offload.f90
Original file line number Diff line number Diff line change
Expand Up @@ -201,3 +201,9 @@
! RUN: -nogpulibc %s 2>&1 \
! RUN: | FileCheck --check-prefix=NO-LIBC-GPU-AMDGPU %s
! NO-LIBC-GPU-AMDGPU-NOT: "-lcgpu-amdgpu"

! RUN: %flang -### -v --target=x86_64-unknown-linux-gnu -fopenmp \
! RUN: --offload-arch=gfx900 \
! RUN: --rocm-path=%S/Inputs/rocm %s 2>&1 \
! RUN: | FileCheck --check-prefix=ROCM-PATH %s
! ROCM-PATH: Found HIP installation: {{.*Inputs.*rocm}}, version 3.6.20214-a2917cd