Compare commits
2 Commits
617e11044f
...
9f2d6fd2d2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9f2d6fd2d2 | ||
|
|
57635b4ea6 |
@@ -27,11 +27,9 @@ build_dir = "$BUILD_DIR"
|
||||
try:
|
||||
from torch.utils.cpp_extension import load
|
||||
|
||||
# Find ixformer include/lib dirs for linking
|
||||
extra_include = ["$SCRIPT_DIR/csrc/ilu"]
|
||||
extra_ldflags = []
|
||||
|
||||
# ixformer lib dirs — bridge needs these at runtime, not compile time
|
||||
for p in ["/usr/local/corex/lib64/python3/dist-packages/ixformer",
|
||||
"/usr/local/corex/lib64"]:
|
||||
if os.path.isdir(p):
|
||||
@@ -40,6 +38,10 @@ try:
|
||||
extra_ldflags.append(f"-L{p}")
|
||||
extra_ldflags.append(f"-Wl,-rpath,{p}")
|
||||
|
||||
# Use load() for compilation only. It may fail on import because
|
||||
# ixformer::infer symbols need RTLD_GLOBAL preload at runtime.
|
||||
# That's OK — we just need the .so file to exist.
|
||||
try:
|
||||
ext = load(
|
||||
name="ix_unified_bridge",
|
||||
sources=[src],
|
||||
@@ -49,10 +51,26 @@ try:
|
||||
build_directory=build_dir,
|
||||
)
|
||||
funcs = [x for x in dir(ext) if not x.startswith('_')]
|
||||
print(f"[build_bridge] SUCCESS via cpp_extension: {len(funcs)} functions")
|
||||
print(f"[build_bridge] functions: {funcs}")
|
||||
print(f"[build_bridge] SUCCESS via cpp_extension: {len(funcs)} functions: {funcs}")
|
||||
sys.exit(0)
|
||||
except ImportError as ie:
|
||||
# Compilation succeeded but import failed (expected: ixformer symbols unresolved)
|
||||
# Check if .so was actually produced
|
||||
built = glob.glob(os.path.join(build_dir, "ix_unified_bridge*.so"))
|
||||
if built:
|
||||
print(f"[build_bridge] COMPILED OK: {built[0]}")
|
||||
print(f"[build_bridge] Import deferred to runtime (ixformer preload needed): {ie}")
|
||||
sys.exit(0)
|
||||
else:
|
||||
print(f"[build_bridge] No .so produced: {ie}")
|
||||
sys.exit(1)
|
||||
|
||||
except Exception as e:
|
||||
# Check if .so exists from compilation before the exception
|
||||
built = glob.glob(os.path.join(build_dir, "ix_unified_bridge*.so"))
|
||||
if built:
|
||||
print(f"[build_bridge] COMPILED OK (exception during import): {built[0]}")
|
||||
sys.exit(0)
|
||||
print(f"[build_bridge] cpp_extension failed: {e}")
|
||||
sys.exit(1)
|
||||
PYEOF
|
||||
|
||||
@@ -28,10 +28,9 @@
|
||||
# --max-seq-len-to-capture 32768 --enable-auto-tool-choice \
|
||||
# --tool-call-parser qwen3_coder --reasoning-parser qwen3
|
||||
|
||||
# NOTE: intentionally NO set -e — individual patch failures must NOT abort
|
||||
# NOTE: intentionally NO set -e or set -o pipefail — individual patch failures must NOT abort
|
||||
# the entire build. Each step logs its own errors, and non-critical patches
|
||||
# (xformers, diagnostics) may legitimately fail if the base image differs.
|
||||
set -o pipefail
|
||||
|
||||
# Always cd to script directory so relative paths (./qwen3_5.py, ./vendor_overrides, etc) work
|
||||
cd "$(dirname "$0")"
|
||||
|
||||
Reference in New Issue
Block a user