[llvm-branch-commits] [openmp] release/18.x: [OpenMP][OMPT] Fix hsa include when building amdgpu/src/rtl.cpp (PR #95484)

Thomas Debesse via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Thu Jun 13 23:29:10 PDT 2024


illwieckz wrote:

Here is a script to reproduce the bug:

```bash
#! /usr/bin/env bash

set -x -u -e -o pipefail

version="${1:-18}"

CMAKE_BUILD_PARALLEL_LEVEL="$(nproc)"
export CMAKE_BUILD_PARALLEL_LEVEL="${CMAKE_BUILD_PARALLEL_LEVEL:-4}"

workspace="llvm-bug95484-${version}"

rm -rf "${workspace}"
mkdir "${workspace}"
cd "${workspace}"

git clone --depth 1 \
	--branch "release/${version}.x" \
	'https://github.com/llvm/llvm-project.git' \
	'llvm-project'

git clone --depth 1 \
	'https://github.com/KhronosGroup/SPIRV-Headers.git' \
	'llvm-project/llvm/projects/SPIRV-Headers'

git clone --depth 1 \
	--branch "llvm_release_${version}0" \
	'https://github.com/KhronosGroup/SPIRV-LLVM-Translator.git' \
	'llvm-project/llvm/projects/SPIRV-LLVM-Translator'

cmake \
	-S'llvm-project/llvm' \
	-B'build' \
	-G'Ninja' \
	-D'CMAKE_INSTALL_PREFIX'='install' \
	-D'CMAKE_BUILD_TYPE'='Release' \
	-D'BUILD_SHARED_LIBS'='ON' \
	-D'LLVM_ENABLE_PROJECTS'='clang;openmp' \
	-D'LLVM_TARGETS_TO_BUILD'='Native' \
	-D'LLVM_EXPERIMENTAL_TARGETS_TO_BUILD'='SPIRV' \
	-D'LLVM_ENABLE_ASSERTIONS'='OFF' \
	-D'LLVM_ENABLE_RTTI'='ON' \
	-D'LLVM_BUILD_TESTS'='OFF' \
	-D'LLVM_BUILD_TOOLS'='ON' \
	-D'LLVM_SPIRV_INCLUDE_TESTS'='OFF' \
	-D'LLVM_EXTERNAL_PROJECTS'='SPIRV-Headers'

cmake --build 'build'

cmake --install 'build'
```

It can be used just by saving it as `llvm-bug95484` and running it by doing either:

- `./llvm-bug95484`
  to fetch and attempt a clean build of `release/18.x` in a way it reproduces the bug,
- `./llvm-bug95484 17`
  to fetch and reproduce the bug with `release/17.x`.

It will fail this way:

```
llvm-bug95484-18/llvm-project/openmp/libomptarget/plugins-nextgen/amdgpu/src/rtl.cpp:1902:37:
 error: ‘HSA_AMD_AGENT_INFO_TIMESTAMP_FREQUENCY’ was not declared in this scope;
 did you mean ‘HSA_SYSTEM_INFO_TIMESTAMP_FREQUENCY’?
 1902 |     if (auto Err = getDeviceAttrRaw(HSA_AMD_AGENT_INFO_TIMESTAMP_FREQUENCY,
      |                                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                     HSA_SYSTEM_INFO_TIMESTAMP_FREQUENCY
```

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


More information about the llvm-branch-commits mailing list