Skip to content

[Issue]: Comgr cant find bitcode files #294

@Zeppopa

Description

@Zeppopa

Problem Description

Hi! I am in need of some hints.

I am cross-compiling ROCm and encountered trouble with the comgr build not locating the bitcode files. I have all the files installed.

root@fitting8:/fs/root/context/host/amd-comgr-rocm-6.2.4/crossroot# find -name bitcode
./opt/rocm/amdgcn/bitcode
root@fitting8:/fs/root/context/host/amd-comgr-rocm-6.2.4/crossroot# ls ./opt/rocm/amdgcn/bitcode | wc -l
62

But then building it looks for the files in the root@fitting8:/fs/root/context/host/amd-comgr-rocm-6.2.4/crossroot/amdgcn/bitcode skipping the /opt/rocm/ prefix.

I suppose that bitcode files path is set in comgr/cmake/DeviceLibs.cmake

get_target_property(bc_lib_path ${AMDGCN_LIB_TARGET} LOCATION)
  if(NOT bc_lib_path)
    get_target_property(bc_lib_path ${AMDGCN_LIB_TARGET} OUTPUT_NAME)
  endif()

  if(NOT bc_lib_path)
    message(FATAL_ERROR "Could not find path to bitcode library")
  endif()

  if(HOST_BIN_PATH)
    set(BC2H_COMMAND "${HOST_BIN_PATH}/bc2h")
  else()
    set(BC2H_COMMAND "${CMAKE_CURRENT_BINARY_DIR}/bc2h")
  endif()

  add_custom_command(OUTPUT ${INC_DIR}/${header}
          COMMAND ${BC2H_COMMAND} ${bc_lib_path}
                 ${INC_DIR}/${header}
                 "${AMDGCN_LIB_TARGET}_lib"
    DEPENDS bc2h ${AMDGCN_LIB_TARGET} ${bc_lib_path}
    COMMENT "Generating ${AMDGCN_LIB_TARGET}.inc"
  )
  set_property(DIRECTORY APPEND PROPERTY
    ADDITIONAL_MAKE_CLEAN_FILES ${INC_DIR}/${header})

Is there a way to add this /opt/rocm prefix for a bc files location?

The cmake config is:

cmake  \
                -DCMAKE_BUILD_TYPE=Release \
                -DCMAKE_PREFIX_PATH="$LLVM_PROJECT;$DEVICE_LIBS" \
                 $(ause_notenable host "-DHOST_BIN_PATH=/opt/rocm/bin") \
                 $(ause_notenable host "-DHOST_LLVM_BIN_PATH=/opt/rocm/bin") \
                -DCMAKE_INSTALL_PREFIX=/opt/rocm

I am building 6.2.4 version, cause we only have llvm18 in our work distro. If it was fixed in the newer version commit link would be much appreciated.

Operating System

CPU

GPU

ROCm Version

ROCm 6.2.4

ROCm Component

llvm-project

Steps to Reproduce

No response

(Optional for Linux users) Output of /opt/rocm/bin/rocminfo --support

No response

Additional Information

No response

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions