From f4d421928020b0046b998f1e8266e4a436e852f0 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 11 Aug 2026 09:48:10 +0000 Subject: [PATCH] =?UTF-8?q?fix(bridge):=20ix=5Fmoe=5Fbridge=E9=93=BE?= =?UTF-8?q?=E6=8E=A5=E5=8A=A0--unresolved-symbols=20+=20probe=E8=84=9A?= =?UTF-8?q?=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ix_moe_bridge.so编译成功但加载时undefined symbol: silu_and_mul 原因:libixformer.so的符号在link time不可用 修复:-Wl,--unresolved-symbols=ignore-in-shared-libs (和ix_unified_bridge.sh用的同一个方案) 运行时符号解析:ix_unified.py已有RTLD_GLOBAL preload逻辑 新增probe_all_so.py:在真机上探测12个.so的全部导出方法 --- ex_engine/precompile_ix_bridge.py | 2 +- probe_all_so.py | 52 +++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+), 1 deletion(-) create mode 100644 probe_all_so.py diff --git a/ex_engine/precompile_ix_bridge.py b/ex_engine/precompile_ix_bridge.py index edd0995b..cfe5ce34 100644 --- a/ex_engine/precompile_ix_bridge.py +++ b/ex_engine/precompile_ix_bridge.py @@ -85,7 +85,7 @@ def main(): logger.warning("This is expected if building outside the base image") # Build flags - extra_ldflags = [] + extra_ldflags = ["-Wl,--unresolved-symbols=ignore-in-shared-libs"] for d in lib_dirs: extra_ldflags.extend([f"-L{d}", "-Wl,-rpath," + d]) extra_ldflags.append("-lixformer") diff --git a/probe_all_so.py b/probe_all_so.py new file mode 100644 index 00000000..5738f3e9 --- /dev/null +++ b/probe_all_so.py @@ -0,0 +1,52 @@ +"""在真机上运行:python3 probe_all_so.py +输出每个.so的全部导出Python方法""" +import importlib.util, os, sys + +SO_DIR = None +for d in [ + "/usr/local/corex/lib64/python3/dist-packages/vllm", + "/usr/local/corex/lib/python3/dist-packages/vllm", +]: + if os.path.isfile(os.path.join(d, "corex_gdn_causal_conv.so")): + SO_DIR = d + break + +if not SO_DIR: + # try prebuilt + SO_DIR = os.path.join(os.path.dirname(__file__), + "qwen3_6_scripts/prebuilt/corex-3.2.3-ivcore10") + +ALL = [ + "corex_gdn_causal_conv", + "corex_gdn_packed_decode", + "corex_gdn_beta_decay", + "corex_gdn_qk_map", + "corex_gdn_gated_norm", + "corex_attn_head_rms_norm", + "corex_paged_kv_gather", + "corex_fused_paged_prefill", + "corex_block_major_kv_transfer", + "corex_moe_direct_routed", + "corex_moe_exact_reduce", + "corex_moe_weight_gather", +] + +for name in ALL: + so = os.path.join(SO_DIR, f"{name}.so") + if not os.path.isfile(so): + print(f"✗ {name}: NOT FOUND at {so}") + continue + try: + spec = importlib.util.spec_from_file_location(name, so) + mod = importlib.util.module_from_spec(spec) + spec.loader.exec_module(mod) + funcs = [x for x in dir(mod) if not x.startswith('_')] + print(f"✓ {name}: {funcs}") + # Try to get docstrings/signatures + for f in funcs: + obj = getattr(mod, f) + doc = getattr(obj, '__doc__', '') + if doc: + print(f" {f}: {doc.strip()[:200]}") + except Exception as e: + print(f"✗ {name}: {e}")