Skip to content

Commit 0435097

Browse files
committed
fix infllmv2 link
Signed-off-by: Ceng23333 <441651826@qq.com>
1 parent fb8eba4 commit 0435097

File tree

4 files changed

+5
-20
lines changed

4 files changed

+5
-20
lines changed

test/infinicore/ops/test_infllmv2_attention.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,6 @@
2828

2929
sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
3030

31-
# Load InfLLM-v2 with RTLD_GLOBAL before libinfinicore_cpp_api resolves mha_* symbols.
32-
try:
33-
from infllmv2_loader import preload_infllmv2_if_available
34-
except ImportError:
35-
pass
36-
else:
37-
preload_infllmv2_if_available()
38-
3931
import infinicore
4032
import torch
4133

test/infinicore/ops/test_simple_gla_decode_recurrent.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,6 @@
1818

1919
import torch
2020

21-
from infllmv2_loader import preload_infllmv2_if_available
22-
23-
preload_infllmv2_if_available()
24-
2521
import infinicore
2622

2723
from framework import (

test/infinicore/ops/test_simple_gla_prefill.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,6 @@
1616

1717
import torch
1818

19-
from infllmv2_loader import preload_infllmv2_if_available
20-
21-
preload_infllmv2_if_available()
22-
2319
import infinicore
2420

2521
from framework import (
@@ -153,4 +149,3 @@ def main():
153149

154150
if __name__ == "__main__":
155151
main()
156-

xmake.lua

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -575,9 +575,11 @@ target("infinicore_cpp_api")
575575
local abs = path.absolute(resolved_infllmv2)
576576
local so_dir = path.directory(abs)
577577
local so_name = path.filename(abs)
578-
target:add("linkdirs", so_dir, { public = true })
579-
target:add("ldflags", "-l:" .. so_name, { public = true })
580-
target:add("ldflags", "-Wl,-rpath," .. so_dir, { public = true })
578+
-- IMPORTANT: ensure `infinicore_cpp_api` gets a DT_NEEDED on infllm_v2 .so.
579+
-- Using `shflags` (not `ldflags`) and `--no-as-needed` avoids the linker
580+
-- dropping the dependency and leaving runtime undefined symbols
581+
-- (e.g. `mha_varlen_fwd`) that would otherwise require LD_PRELOAD/ctypes preload.
582+
target:add("shflags", "-Wl,--no-as-needed -L" .. so_dir .. " -l:" .. so_name .. " -Wl,-rpath," .. so_dir, { public = true })
581583
end
582584
end)
583585

0 commit comments

Comments
 (0)