Skip to content

Unused linker options when compiling for AMD GPUs #4701

@AlexanderSinn

Description

@AlexanderSinn

Every time I compile HiPACE++ (using AMReX development) for MI250X, I get the following warning:

clang++: warning: argument unused during compilation: '-Xoffload-linker --whole-archive' [-Wunused-command-line-argument]

It also happens in the CI of hipace; however, seemingly not with amrex.
https://github.com/Hi-PACE/hipace/actions/runs/18302787740/job/52113807454#step:5:586
https://github.com/Hi-PACE/hipace/actions/runs/18302787740/workflow

I noticed that the two options are explicitly set by AMReX; however, I don't know for which HIP versions this is/was necessary or if the compiler or linker prints the warning.

# ROCm 5.5: hipcc now relies on clang to offload code objects from (.a) archive files,
# so we need to tell the offload-linker to include all code objects in archives.
include(CheckLinkerFlag)
check_linker_flag(
CXX
"SHELL:-Xoffload-linker --whole-archive"
LINKER_HAS_WHOLE_ARCHIVE_OFFLOAD)
if(LINKER_HAS_WHOLE_ARCHIVE_OFFLOAD)
foreach(D IN LISTS AMReX_SPACEDIM)
target_link_options(amrex_${D}d PUBLIC
"$<$<LINK_LANGUAGE:HIP>:SHELL:-Xoffload-linker --whole-archive>"
"$<$<LINK_LANGUAGE:CXX>:SHELL:-Xoffload-linker --whole-archive>")
endforeach()
endif()

Metadata

Metadata

Assignees

No one assigned

    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