@@ -130,11 +130,39 @@ jobs:
130130
131131 echo "Building for GPU target: ${{ matrix.gpu_target }}"
132132
133+ # Detect available compilers (prioritize ROCm-specific compilers)
134+ if [ -f "/opt/rocm/bin/hipcc" ] && [ -f "/opt/rocm/bin/amdclang++" ]; then
135+ C_COMPILER="/opt/rocm/bin/hipcc"
136+ CXX_COMPILER="/opt/rocm/bin/amdclang++"
137+ echo "Using ROCm hipcc and amdclang++ compilers"
138+ elif [ -f "/opt/rocm/bin/clang" ]; then
139+ C_COMPILER="/opt/rocm/bin/clang"
140+ CXX_COMPILER="/opt/rocm/bin/clang++"
141+ echo "Using ROCm clang compilers"
142+ elif [ -f "/opt/rocm/llvm/bin/clang" ]; then
143+ C_COMPILER="/opt/rocm/llvm/bin/clang"
144+ CXX_COMPILER="/opt/rocm/llvm/bin/clang++"
145+ echo "Using ROCm LLVM compilers"
146+ else
147+ C_COMPILER="clang"
148+ CXX_COMPILER="clang++"
149+ echo "Using system compilers"
150+ # Install system clang if not available
151+ sudo apt install -y clang
152+ fi
153+
154+ echo "Using C compiler: $C_COMPILER"
155+ echo "Using CXX compiler: $CXX_COMPILER"
156+
157+ # Verify compilers exist
158+ $C_COMPILER --version || echo "C compiler not working"
159+ $CXX_COMPILER --version || echo "CXX compiler not working"
160+
133161 # Configure with ROCm 7.1 and specific GPU target
134162 cmake .. \
135163 -DCMAKE_BUILD_TYPE=Release \
136- -DCMAKE_C_COMPILER=/opt/rocm/bin/clang \
137- -DCMAKE_CXX_COMPILER=/opt/rocm/bin/clang++ \
164+ -DCMAKE_C_COMPILER="$C_COMPILER" \
165+ -DCMAKE_CXX_COMPILER="$CXX_COMPILER" \
138166 -DCMAKE_PREFIX_PATH=/opt/rocm \
139167 -DGPU_TARGETS="${{ env.GPU_TARGET }}" \
140168 -DHIP_PLATFORM=amd \
0 commit comments