Skip to content
This repository was archived by the owner on Jan 26, 2024. It is now read-only.
This repository was archived by the owner on Jan 26, 2024. It is now read-only.

#define __local clashes with libcxx templates #68

@aaronmondal

Description

@aaronmondal

There is a global #define __local in device_library_decls.h. This symbol is already used by some libcxx templates. Building (and depending on) libcxx with the (soon to be default) _LIBCPP_REMOVE_TRANSITIVE_INCLUDES macro causes these templates to break, as the define leaks into them:

In file included from hip_example/example.cpp:5:
In file included from external/rules_ll~override~rules_ll_dependencies~hip/include/hip/hip_runtime.h:62:
In file included from external/rules_ll~override~rules_ll_dependencies~hipamd/include/hip/amd_detail/amd_hip_runtime.h:380:
In file included from external/rules_ll~override~rules_ll_dependencies~hipamd/include/hip/amd_detail/amd_math_functions.h:32:
In file included from external/llvm-project-overlay~17-init-bcr.2~llvm_project_overlay~llvm-project/libcxx/include/algorithm:1732:
external/llvm-project-overlay~17-init-bcr.2~llvm_project_overlay~llvm-project/libcxx/include/__algorithm/copy_backward.h:72:58: error: expected unqualified-id
    __result = std::__copy_backward<_AlgPolicy>(_Traits::__local(__first), _Traits::__end(__slast), std::move(__result))
                                                         ^
external/rules_ll~override~rules_ll_dependencies~hipamd/include/hip/amd_detail/device_library_decls.h:121:17: note: expanded from macro '__local'
#define __local __attribute__((address_space(3)))
                ^

https://github.com/ROCm-Developer-Tools/hipamd/blob/4209792929ddf54ba9530813b7879cfdee42df14/include/hip/amd_detail/device_library_decls.h#L120-L125

An ad-hoc fix is to rename the define to something like __device_local or to write out the attribute. However, I'm not sure whether the __local macro is used in the wider ROCm ecosystem.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions