FAQ About abi Configuration

Symptom

  • Symptom 1

    The error message "undefined reference to "std::__cxx11 ***" is displayed during the compilation and linking of atb or mki.

    fffec0150000-fffec0160000 rw-p 214a70000 08:11 42336262	/datal/models/Lite-32K/SFT-V4.0-20240621-INT8/SFT-13B v20240621 longbase ep3.data
    fffec0160000-fffec0170000 rw-p e8d90000 08:11 42336262	/datal/models/Lite-32K/SFT-V4.0-20240621-INT8/SFT-13B v20240621 longbase ep3.data
    fffec0170000-fffec0180000 rw-p 1a03c0000 08:11 42336262	/datal/models/Lite-32K/SFT-V4.0-20240621-INT8/SFT-13B v20240621 longbase_ep3.data
    fffec0180000-fffec01a0000 rw-p 1a03b0000 08:11 42336262	/datal/models/Lite-32K/SFT-V4.0-20240621-INT8/SFT-13B v20240621 longbase ep3.data
    fffec01a0000-fffec01c0000 rw-p 1b8530000 08:11 42336262	/datal/models/Lite-32K/SFT-V4.0-20240621-INT8/SFT-13B v20240621 longbase ep3.data
    Program received signal SIGABRT, Aborted.
    [Switching to Thread 0xfff7aa3a1990 (LWP 41895)]
    0x0000ffffbc3850e8 in raise () from /Lib64/libc.so.6
    Missing separate debuginfos, use: debuginfo-install glibc-2.17-260.el7.aarch64 zlib-1.2.7-18.el7.aarch64
    (gdb) bt
    #0  0x0000ffffbc3850e8 in raise () from /lib64/libc.s0.6
    #1  0x0000ffffoc386760 in abort () from /1ib64/libc.so.6
    #2  0x0000ffffbc3c5048 in __Libc_message () from /Lib64/Libc.so.6
    #3  0x0000ffffbc3cd58c in _int free () from /lib64/libc.so.6
    #4  0x0000ffffadd85c08 in std::__detail::_Compiler<std::__cxx11::regex_traits<char> >::_Compiler(char const*, std::locale const&, std::tegex_con
        stants::syntax option type) () from /usr/local/Ascend/nnal/atb/latest/atb/cxx_abi_1/lib/libmki.so
    #5  0x0000ffffadd7450c in Mki::LogSinkFile::DeleteOldestFile() () from /usr/local/Ascend/nnal/atb/latest/atb/cxx_abi_1/lib/libmki.so
    #6  0x0000ffffadd74df4 in Mki::LogSinkFile::OpenFile() () from /usr/local/Ascend/nnal/atb/latest/atb/cxx_abi_1/lib/libmki.so
    #7	0x0000ffffadd75080 in Mki::LogSinkFile::Log(char const*, unsigned long) () from /usr/local/Ascend/nnal/atb/latest/atb/cxx_abi_1/lib/libmki.so
    #8  0x000Offffadd6f4e4 in Mki::LogCore::Log(char const*, unsigned long) () from /usr/local/Ascend/nnal/atb/latest/atb/cxx_abi_1/lib/libmki.so
    #9  0x0000ffffadd863Oc in Mki::LogStream::~LogStream() () from /usr/local/Ascend/nnal/atb/latest/atb/cxx_abi_1/lib/libmki.so
    #10 0x0000ffffb0494abO in atb::SelfAttentionOperation::PAMaskDimCheckNz(atb::SVector<atb::TensorDesc> const&) const ()
        from /usr/local/Ascend/nnal/atb/latest/atb/cxx_abi_1/lib/libatb.so
    #11 0x0000ffffb0496984 in atb::SelfAttentionOperation::InferShapePADimCheck(atb::SVector<atb::TensorDesc> const&) const ()
        from /usr/local/Ascend/nnal/atb/latest/atb/cxx_abi_1/lib/libatb.so
    #12 0x0000ffffb0498ae0 in atb::SelfAttentionOperation::SetupCheckImpl(atb::SVector<atb::Tensor> const&, atb::SVector<atb::Tensor> const&) const
        from /usr/local/Ascend/nnal/atb/latest/atb/cxx_abi_1/lib/libatb.so
    #13 0x0000ffffb04e77ac in atb::OperationBase::SetupCheck(atb::VariantPack const&, atb::Context*) ()
        from /usr/local/Ascend/nnal/atb/latest/atb/cxx_abi_1/lib/libatb.so
    #14 0x0000ffffb04eca4c in atb::OperationBase::Setup(atb::VariantPack const&, unsigned long&, atb::Context*) ()
        from /usr/local/Ascend/nnal/atb/latest/atb/cxx_abi_1/lib/libatb.so

  • Symptom 2

    "undefined symbol: ***cxx11***" is displayed when atb is executed.

    python {source_code_path}/ascend-transformer-boost/tests/apitest/torch_atb_test/op_test/linear_parallel/matmul_allreduce_pertoken_test.py
    Traceback (most recent call last):
      File "{python_install_path}/site-packages/torch_atb/__init__.py", line 25, in _load_atb_libs
        ctypes.CDLL(str(atb_lib_path / lib_file), mode=ctypes.RTLD_GLOBAL)
      File "{python_install_path}/ctypes/__init__.py", line 374, in __init__
        self._handle = _dlopen(self._name, mode)
    OSError: {CANN_nnal_install_path}/nnal/atb/latest/atb/cxx_abi_1/lib/libcann_ops_adapter.so: undefined symbol: _ZN3Mki6Status10FailStatusEiRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
    
    The above exception was the direct cause of the following exception:
    
    Traceback (most recent call last):
      File "{source_code_path}/ascend-transformer-boost/tests/apitest/torch_atb_test/op_test/linear_parallel/matmul_allreduce_pertoken_test.py", line 12, in <module>
        import torch_atb
      File "{python_install_path}/site-packages/torch_atb/__init__.py", line 35, in <module>
        _load_atb_libs()
      File "{python_install_path}/site-packages/torch_atb/__init__.py", line 27, in _load_atb_libs
        raise RuntimeError(f"Failed to load {lib_file}: {err}") from err
    RuntimeError: Failed to load libasdops.so: {CANN_nnal_install_path}/nnal/atb/latest/atb/cxx_abi_1/lib/libcann_ops_adapter.so: undefined symbol: _ZN3Mki6Status10FailStatusEiRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
    [ERROR] 2025-07-28-11:58:16 (PID:1974512, Device:-1, RankID:-1) ERR99999 UNKNOWN application exception
  • Symptom 3

    An error occurs when param with members of the string type is used to create an atb operation. The log information is as follows: atb create operation failed.

    [2025-07-28 14:24:11.340266] [error] [2063924] [all_reduce_operation.cpp:86] param rsv has a non-zero value, please check the compilation version.
    [2025-07-28 14:24:11.340266] [error] [2063923] [all_reduce_operation.cpp:86] param rsv has a non-zero value, please check the compilation version.
    all_reduce_demo.cpp:58 [error]: all_reduce_demo.cpp:58 [error]: 11
    
    atb create operation failedatb create operation failed
    
    all_reduce_demo.cpp:137 [error]: 1
    multithread task 0 failed
    all_reduce_demo.cpp:137 [error]: 1
    multithread task 1 failed

Cause Analysis

  • The preceding examples show errors reported when abi1 is used to compile or execute ATB-related functions in the framework of the abi0 version.
  • Different versions of abi (such as the old abi and C++11 abi) implement std::string in different ways. The old abi (C++98/03) has unique implementation in memory management and small string optimization (SSO), while the C++11 abi improves memory allocation and shared memory management.

These differences may cause memory conflicts, crashes, or link errors when std::string objects are transferred in programs compiled in different abi versions. For details about the configuration logic of the ATB for the abi version, see abi configuration method.

Solution

  • There is a torch in the environment.
    # Use torch to check the abi version corresponding to the current framework.
    echo $(python3 -c 'import torch; print(torch.compiled_with_cxx11_abi())')
    # If true is displayed in the output:
    source ${nnal_install_path}/nnal/atb/set_env.sh --cxx_abi=1
    # Or
    source ${nnal_install_path}/nnal/atb/set_env.sh
    # If false is displayed in the output:
    source ${nnal_install_path}/nnal/atb/set_env.sh --cxx_abi=0
    # Or
    source ${nnal_install_path}/nnal/atb/set_env.sh
  • No torch is required in the environment.
    • If you cannot determine which abi version to use, determine it by yourself. For details about the default settings, see abi configuration method.
    • You can try to use the ABI configuration that is opposite to the current setting.