Skip to content

HIP separable compilation linking fails when passed archives  #2154

@robertmaynard

Description

@robertmaynard

Found while working on implementing HIP support in CMake
Tested with compilers provided with ROCm 3.5 and 3.7

Given the following CMake:

cmake_minimum_required(VERSION 3.18)

project(static-lib-rdc HIP)

set(CMAKE_HIP_FLAGS "-fgpu-rdc")
set(CMAKE_HIP_ARCHITECTURES gfx908)

add_library(static-lib file1.cxx file2.hip.cxx file3.hip.cpp file4.hip file5.cu)

add_executable(verify main.cu)
target_link_libraries(verify PUBLIC static-lib)
set_source_files_properties(
    file1.cxx file2.hip.cxx file3.hip.cpp file4.hip file5.cu main.cu
  PROPERTIES
    LANGUAGE "HIP"
)

We get the following error when trying to link the verify executable

/opt/rocm/bin/hipcc -fgpu-rdc --amdgpu-target=gfx908 CMakeFiles/verify.dir/main.cu.o -o verify  libstatic-lib.a 
clang-11: error: no such file or directory: '/tmp/hipcc0wDdnRUU/file1.cxx.o /tmp/hipcc0wDdnRUU/file2.hip.cxx.o /tmp/hipcc0wDdnRUU/file3.hip.cpp.o /tmp/hipcc0wDdnRUU/file4.hip.o /tmp/hipcc0wDdnRUU/file5.cu.o'

It looks something is going wrong and the clang-offload-bundler files are not being placed in the correct location or being removed before linking.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions