[clang] [CMake] Change GCC_INSTALL_PREFIX from warning to fatal error (PR #85891)

2024-04-23 Thread Harmen Stoppels via cfe-commits

haampie wrote:

Users of `GCC_INSTALL_PREFIX` typically have GCC installed in a unique, 
non-standard prefix, where clang's default search just worked.

Now those users have to generate config files for post-install, AND figure out 
how to make clang behave correctly when building runtimes. That's not ideal.

@MaskRay can you please make the error message more informative? It should 
probably say that users additionally have to set `RUNTIMES_CMAKE_ARGS=...` as 
well as generating `clang.cfg`, `clang++.cfg` config files. (And what about 
`flang.cfg` and/or `flang-new.cfg`?)

More clarity please :)

https://github.com/llvm/llvm-project/pull/85891
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [CMake] Change GCC_INSTALL_PREFIX from warning to fatal error (PR #85891)

2024-04-24 Thread Harmen Stoppels via cfe-commits

haampie wrote:

I disagree, `--gcc-install-dir` is sure an improvement over `--gcc-toolchain`, 
but they're both weaker than the compile time option `GCC_INSTALL_PREFIX` 
because of runtimes.

You're looking to remove `GCC_INSTALL_PREFIX`, then give a clear alternative 
that's equivalent. The current error message about config files is misleading 
since it potentially runtimes will use an undesired gcc version when they're 
built, which is rather opaque.

A different point: `flang-new` does not accept `--gcc-install-dir`. Is that an 
oversight?

https://github.com/llvm/llvm-project/pull/85891
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [AMDGPU] Remove detection of hip runtime for Spack (PR #133263)

2025-04-02 Thread Harmen Stoppels via cfe-commits

haampie wrote:

@yxsamliu can you land this? I cannot

https://github.com/llvm/llvm-project/pull/133263
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [AMDGPU] Remove detection of hip runtime for Spack (PR #133263)

2025-03-27 Thread Harmen Stoppels via cfe-commits

https://github.com/haampie edited 
https://github.com/llvm/llvm-project/pull/133263
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [AMDGPU] Remove detection of hip runtime for Spack (PR #133263)

2025-03-27 Thread Harmen Stoppels via cfe-commits

https://github.com/haampie edited 
https://github.com/llvm/llvm-project/pull/133263
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [AMDGPU] Remove detection of hip runtime for Spack (PR #133263)

2025-03-27 Thread Harmen Stoppels via cfe-commits

https://github.com/haampie edited 
https://github.com/llvm/llvm-project/pull/133263
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [AMDGPU] Remove detection of hip runtime for Spack (PR #133263)

2025-03-27 Thread Harmen Stoppels via cfe-commits

haampie wrote:

I believe Spack sets either `HIP_PATH` or `ROCM_PATH` for clang which is 
considered before the auto-detection removed in this PR.

https://github.com/llvm/llvm-project/pull/133263
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [AMDGPU] Remove detection of hip runtime for Spack (PR #133263)

2025-03-27 Thread Harmen Stoppels via cfe-commits

https://github.com/haampie created 
https://github.com/llvm/llvm-project/pull/133263

There is special logic to detect the hip runtime when llvm is installed
with Spack. It works by matching the install prefix of llvm against
`llvm-amdgpu-*` followed by effectively globbing for

```
/../hip-x.y.z-*/
```

and checking there is exactly one such directory.

I would suggest to remove autodetection for the following reasons:

1. In the Spack ecosystem it's by design that every packages lives in
   its own prefix, and can only know where its dependencies are
   installed, it has no clue what its dependents are and where they are
   installed. This heuristic detection breaks that invariant, and is
   rather surprising to Spack users.
2. The detection can lead to false positives, since users can be using
   an llvm installed "upstream" with their own build of hip locally, and
   they may not realize that clang is picking up upstream hip instead of
   their local copy.
3. It only works if the directory name is `llvm-amdgpu-*` which happens
   to be the name of AMD's fork of `llvm`, so it makes no sense that
   this code lives in the main LLVM repo for which the Spack package
   name is `llvm`.
4. Users can change the install directory structure, meaning that this
   detection is not robust under config changes in Spack.


>From 1b80fbf40282790367c8e83b73f18ae683ab8b82 Mon Sep 17 00:00:00 2001
From: Harmen Stoppels 
Date: Thu, 27 Mar 2025 15:41:00 +0100
Subject: [PATCH] [AMDGPU] Remove detection of hip runtime for Spack

There is special logic to detect the hip runtime when llvm is installed
with Spack. It works by matching the install prefix of llvm against
`llvm-amdgpu-*` followed by effectively globbing for

```
/../hip-x.y.z-*/
```

and checking there is exactly one such directory.

I would suggest to remove autodetection for the following reasons:

1. In the Spack ecosystem it's by design that every packages lives in
   its own prefix, and can only know where its dependencies are
   installed, it has no clue what its dependents are and where they are
   installed. This heuristic detection breaks that invariant, and is
   rather surprising to Spack users.
2. The detection can lead to false positives, since users can be using
   an llvm installed "upstream" with their own build of hip locally, and
   they may not realize that clang is picking up upstream hip instead of
   their local copy.
3. It only works if the directory name is `llvm-amdgpu-*` which happens
   to be the name of AMD's fork of `llvm`, so it makes no sense that
   this code lives in the main LLVM repo for which the Spack package
   name is `llvm`.
4. Users can change the install directory structure, meaning that this
   detection is not robust under config changes in Spack.
---
 clang/lib/Driver/ToolChains/AMDGPU.cpp| 67 +--
 .../bin/.hipVersion   |  5 --
 .../include/hip/hip_runtime.h |  0
 .../amdgcn/bitcode/asanrtl.bc |  0
 .../amdgcn/bitcode/hip.bc |  0
 .../amdgcn/bitcode/ockl.bc|  0
 .../amdgcn/bitcode/oclc_abi_version_400.bc|  0
 .../amdgcn/bitcode/oclc_abi_version_500.bc|  0
 .../amdgcn/bitcode/oclc_abi_version_600.bc|  0
 .../oclc_correctly_rounded_sqrt_off.bc|  0
 .../bitcode/oclc_correctly_rounded_sqrt_on.bc |  0
 .../amdgcn/bitcode/oclc_daz_opt_off.bc|  0
 .../amdgcn/bitcode/oclc_daz_opt_on.bc |  0
 .../amdgcn/bitcode/oclc_finite_only_off.bc|  0
 .../amdgcn/bitcode/oclc_finite_only_on.bc |  0
 .../amdgcn/bitcode/oclc_isa_version_1010.bc   |  0
 .../amdgcn/bitcode/oclc_isa_version_1011.bc   |  0
 .../amdgcn/bitcode/oclc_isa_version_1012.bc   |  0
 .../amdgcn/bitcode/oclc_isa_version_803.bc|  0
 .../amdgcn/bitcode/oclc_isa_version_900.bc|  0
 .../amdgcn/bitcode/oclc_isa_version_908.bc|  0
 .../amdgcn/bitcode/oclc_unsafe_math_off.bc|  0
 .../amdgcn/bitcode/oclc_unsafe_math_on.bc |  0
 .../bitcode/oclc_wavefrontsize64_off.bc   |  0
 .../amdgcn/bitcode/oclc_wavefrontsize64_on.bc |  0
 .../amdgcn/bitcode/ocml.bc|  0
 .../amdgcn/bitcode/opencl.bc  |  0
 .../bin/.keep |  0
 clang/test/Driver/rocm-detect.hip | 47 -
 29 files changed, 1 insertion(+), 118 deletions(-)
 delete mode 100644 
clang/test/Driver/Inputs/rocm-spack/hip-4.0.0-5f63slrursbrvfe2txrrjkynbsywsob5/bin/.hipVersion
 delete mode 100644 
clang/test/Driver/Inputs/rocm-spack/hip-4.0.0-5f63slrursbrvfe2txrrjkynbsywsob5/include/hip/hip_runtime.h
 delete mode 100644 
clang/test/Driver/Inputs/rocm-spack/llvm-amdgpu-4.0.0-ieagcs7inf7runpyfvepqkurasoglq4z/amdgcn/bitcode/asanrtl.bc
 delete mode 100644 
clang/test/Driver/Inputs/rocm-spack/llvm-amdgpu-4.0.0-ieagcs7inf7runpyfvepqkurasoglq4z/amdgcn/bitcode/hip.bc
 delete mode 100644 
clang/test/Driver/Inputs/rocm-spack/llvm-amdgpu-4.0.0-ieagcs7inf7runpyfvepqkurasoglq4z