18 Commits

Author SHA1 Message Date
Yaxun (Sam) Liu
661d91a0fd [clang] Make amdgpu-arch tool work on Windows
Currently amdgpu-arch tool detects AMD GPU by dynamically
loading HSA runtime shared library and using HSA API's,
which is not available on Windows.

This patch makes it work on Windows by dynamically loading
HIP runtime dll and using HIP API's.

Reviewed by: Matt Arsenault, Joseph Huber, Johannes Doerfert

Differential Revision: https://reviews.llvm.org/D153725
2023-07-08 00:01:02 -04:00
Joseph Huber
66da9ec073 [Clang] Remove direct linking of offloading runtimes from the arch tools
The tools `amdgpu-arch` and `nvptx-arch` are used to query the supported
GPUs on a system to implement features like `--offload-arch=native` as
well as generally being useful for setting up tests. However, we
currently directly link these if they are availible. This patch removes
this because it causes many problems on the user not having the libaries
present or misconfigured at build time. Since these are built
unconditionally we shoudl keep the dependencies away from clang.

Fixes https://github.com/llvm/llvm-project/issues/62784

Reviewed By: ye-luo

Differential Revision: https://reviews.llvm.org/D150807
2023-05-17 17:47:49 -05:00
Joseph Huber
a26aabefe5 [Clang] Add --version and --help messages to amdgpu/nvptx-arch
Summray:
These clang tools should print some basic help and version messages so
they are less opaque.

Reviewed By: ye-luo

Differential Revision: https://reviews.llvm.org/D145944
2023-03-13 12:32:42 -05:00
Jon Chesterfield
bfe4514add [amdgpuarch] Delete stray hsa #include line 2023-01-25 21:40:35 +00:00
Joseph Huber
679c352ff4 [Clang][NFC] Tweak error message for GPU architecture tools
Summary:
There shouldn't be an extra newline in these messages.
2023-01-19 12:48:28 -06:00
Joseph Huber
4ce454c654 [Clang] Configure definitions for amdgpu/nvptx arch query tools
Summary:
These tools are built unconditionally now. However, there seemed to be
problems where the headers would be found during cross compilation, but
no libraries present. To combat this we should elect to make the CMake
indicate whether or not we should use the dynamic library method or link
it directly rather than using `__has_include`.
2023-01-17 14:27:12 -06:00
Joseph Huber
f6ace23172 [amdgpu-arch] Dynamically load the HSA runtime if not found during the build
We use the `amdgpu-arch` tool to query the installed GPUs at runtime.
One problem is that this tool is currently not build if the person
building the LLVM binary does not have the HSA runtime on their system.
This means that if someone built and distrubted an installation of LLVM
without HSA, then the user will not be able to use it even if they have
it on their system.

This patch makes us build this tool unconditionally and adds extra logic
to dynamically load HSA if it's present.

Reviewed By: JonChesterfield

Differential Revision: https://reviews.llvm.org/D141859
2023-01-16 13:13:45 -06:00
Matt Arsenault
39a83ebd47 amdgpu-arch: Prefer hsa/hsa.h over hsa.h
The header now prints a warning if you include hsa.h telling you to
include hsa/hsa.h
2023-01-04 20:51:51 -05:00
Pushpinder Singh
c711aa0f6f [amdgpu-arch] Guard hsa.h with __has_include
This patch is suppose to fix the issue of hsa.h not found.
Issue was reported in D99949

Reviewed By: JonChesterfield

Differential Revision: https://reviews.llvm.org/D102067
2021-05-10 07:33:30 +00:00
Pushpinder Singh
59ad4e0f01 Reapply "[AMDGPU][OpenMP] Add amdgpu-arch tool to list AMD GPUs installed"
This reverts commit 93604305bb72201641f31cc50a6e7b2fe65d3af3.
2021-04-27 10:47:05 +00:00
Pushpinder Singh
93604305bb Revert "Reapply "[AMDGPU][OpenMP] Add amdgpu-arch tool to list AMD GPUs installed""
This reverts commit 15be0c41d2e59fb4599c9aebf21ede498c61f51d.
2021-04-27 02:23:44 +00:00
Jon Chesterfield
15be0c41d2 Reapply "[AMDGPU][OpenMP] Add amdgpu-arch tool to list AMD GPUs installed"
This reverts commit 24c1ed3b34f7602b955e52cd8a362f4e27eb5f20.
2021-04-23 01:07:16 +01:00
Jon Chesterfield
24c1ed3b34 Revert "[AMDGPU][OpenMP] Add amdgpu-arch tool to list AMD GPUs installed"
This reverts commit 722d4d8e7585457d407d0639a4ae2610157e06a8.

Unclear where hsa.h should be included from, see report in D99949
2021-04-22 19:39:37 +01:00
Pushpinder Singh
722d4d8e75 [AMDGPU][OpenMP] Add amdgpu-arch tool to list AMD GPUs installed
This patch adds new clang tool named amdgpu-arch which uses
HSA to detect installed AMDGPU and report back latter's march.
This tool is built only if system has HSA installed.

The value printed by amdgpu-arch is used to fill -march when
latter is not explicitly provided in -Xopenmp-target.

Reviewed By: JonChesterfield, gregrodgers

Differential Revision: https://reviews.llvm.org/D99949
2021-04-22 05:20:28 +00:00
Pushpinder Singh
0ad50bf27f Revert "[AMDGPU][OpenMP] Add amdgpu-arch tool to list AMD GPUs installed"
This reverts commit 3194761d2763a471dc6426a3e77c1445cb9ded3b.
2021-04-21 08:05:38 +00:00
Pushpinder Singh
3194761d27 [AMDGPU][OpenMP] Add amdgpu-arch tool to list AMD GPUs installed
This patch adds new clang tool named amdgpu-arch which uses
HSA to detect installed AMDGPU and report back latter's march.
This tool is built only if system has HSA installed.

The value printed by amdgpu-arch is used to fill -march when
latter is not explicitly provided in -Xopenmp-target.

Reviewed By: JonChesterfield, gregrodgers

Differential Revision: https://reviews.llvm.org/D99949
2021-04-21 05:05:49 +00:00
Pushpinder Singh
efc013ec4d Revert "[AMDGPU][OpenMP] Add amdgpu-arch tool to list AMD GPUs installed"
This reverts commit 7029cffc4e78556cfe820791c612968bb15b2ffb.
2021-04-16 09:16:58 +00:00
Pushpinder Singh
7029cffc4e [AMDGPU][OpenMP] Add amdgpu-arch tool to list AMD GPUs installed
This patch adds new clang tool named amdgpu-arch which uses
HSA to detect installed AMDGPU and report back latter's march.
This tool is built only if system has HSA installed.

The value printed by amdgpu-arch is used to fill -march when
latter is not explicitly provided in -Xopenmp-target.

Reviewed By: JonChesterfield, gregrodgers

Differential Revision: https://reviews.llvm.org/D99949
2021-04-16 05:26:20 +00:00