Files
project_6/probe_all_so.py
Claude f4d4219280 fix(bridge): ix_moe_bridge链接加--unresolved-symbols + probe脚本
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的全部导出方法
2026-08-11 09:48:14 +00:00

53 lines
1.6 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

"""在真机上运行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}")