[libclc] [libclc] Fix using normalized triple for the directory name (PR #194607)

Konrad Kleine via cfe-commits cfe-commits at lists.llvm.org
Tue May 5 02:42:42 PDT 2026


kwk wrote:

I'm running a build with this PR applied locally. I expect it to work as expected. BUT one needs to "correctly" configure the build. For example I tried configuring the build with `-DRUNTIMES_spirv-mesa3d-_LLVM_ENABLE_RUNTIMES=libclc` as it says in the `libclc/README.md`. Then internally the `spirv-mesa3d-` triple gets normalized in `runtimes/CMakeLists.txt` like this:

```console
$ clang --target=spirv-mesa3d- -print-target-triple 
spirv-unknown-mesa3d
```

This is because in `llvm/lib/TargetParser/Triple.cpp` the term `mesa3d` is recognized as an OS and placed in third position. The install path for `libclc.spv` there ends up in `spirv-unknown-mesa3d/libclc.spv`.

IMHO the best option is to change the `libclc/README.md` in this very PR to include a mesa triple that is kept during normalization `spirv-mesa-mesa3d` (same for `spirv64` of course): 

```console
$ clang --target=spirv-mesa-mesa3d -print-target-triple 
spirv-mesa-mesa3d
```

This way we can "guarantee" that good advice was given to build libclc on all operating systems that the mesa project is built on.

In essence, these are the CMake configurations/flags I suggest for the `libclc/README.md` wrt. mesa:

```
'-DLLVM_RUNTIME_TARGETS=spirv-mesa-mesa3d;spirv64-mesa-mesa3d'
-DRUNTIMES_spirv-mesa-mesa3d_LLVM_ENABLE_RUNTIMES=libclc
-DRUNTIMES_spirv64-mesa-mesa3d_LLVM_ENABLE_RUNTIMES=libclc
```

Notice the triple `spirv64-mesa-mesa3d` or `spirv-mesa-mesa3d` with `mesa` being the LLVM recognized vendor.

https://github.com/llvm/llvm-project/pull/194607


More information about the cfe-commits mailing list