mirror of
https://github.com/kvcache-ai/ktransformers.git
synced 2026-11-05 01:07:28 +00:00
[GH-ISSUE #1667] [kt-kernel] Error: AMD CPU 编译成功但提示 undefined symbol: aocl_gemm_s8s8s32os32 #1073
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
kvcache-ai/ktransformers#1073
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @xzy103 on GitHub (Dec 4, 2025).
Original GitHub issue: https://github.com/kvcache-ai/ktransformers/issues/1667
Reminder
System Info
系统:WSL Ubuntu 24.04
硬件:AMD CPU
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Address sizes: 48 bits physical, 48 bits virtual
Byte Order: Little Endian
CPU(s): 16
On-line CPU(s) list: 0-15
Vendor ID: AuthenticAMD
Model name: AMD Ryzen 7 5800H with Radeon Graphics
CPU family: 25
Model: 80
Thread(s) per core: 2
Core(s) per socket: 8
Socket(s): 1
Stepping: 0
BogoMIPS: 6387.84
Virtualization features:
Virtualization: AMD-V
Hypervisor vendor: Microsoft
Virtualization type: full
Caches (sum of all):
L1d: 256 KiB (8 instances)
L1i: 256 KiB (8 instances)
L2: 4 MiB (8 instances)
L3: 16 MiB (1 instance)
NUMA:
NUMA node(s): 1
NUMA node0 CPU(s): 0-15
Reproduction
kt-kernel,可以编译成功,但在最终验证时提示异常:
我查找到该符号函数是存在的:
通过手动设置环境变量解决了问题:
不过这种方法治标不治本。
问了下ai,说是CMakeLists.txt中有关
if(KTRANSFORMERS_CPU_MOE_AMD)那段:我看不太懂,求大神补救~
Others
No response
@0xhaggis commented on GitHub (Dec 5, 2025):
Same error when compiling from source.
@0xhaggis commented on GitHub (Dec 5, 2025):
The solution is to install https://www.amd.com/en/developer/aocl/eula/aocl-5-1-eula.html?filename=aocl-linux-aocc-5.1.0.tar.gz first.
@0xhaggis commented on GitHub (Dec 5, 2025):
Actually, no. That gets the project to compile. After compiling I still get OP's error:
@xzy103 commented on GitHub (Dec 5, 2025):
是的,的确需要先安装
aocl,我也是安装了的,出现undefined symbol: aocl_gemm_s8s8s32os32是因为编译时没有link造成的,通过设置环境变量可以不优雅地解决:Yes, you really do need to install
aoclfirst. I have it installed as well. Theundefined symbol: aocl_gemm_s8s8s32os32error is caused by not linking it during compilation. You can work around this in a rather inelegant way by setting environment variables:@xzy103 commented on GitHub (Dec 5, 2025):
(发现忘star了,已补)
问题成功解决了!在环境变量中加入这行即可:
完整的环境变量配置是:
解决思路
异常提示
undefined symbol: aocl_gemm_s8s8s32os32找到该symbol与这两个文件关联:
/opt/AMD/aocl/aocl-linux-aocc-5.1.0/aocc/lib/libblis-mt.so/opt/AMD/aocl/aocl-linux-aocc-5.1.0/aocc/lib/libblis.so使用
export LD_PRELOAD=/opt/AMD/aocl/aocl-linux-aocc-5.1.0/aocc/lib/libblis.so不优雅地解决了,说明所需的链接是存在的,只是编译器找不到。而这两个文件属于blis这个工具,blis是aocl自带的,已经设置了环境变量
AOCL_ROOT,按说应该找得到。于是我查阅了源码,在
setup.py中显示环境变量CPUINFER_BLIS_ROOT指向blis工具所在位置。可我
echo $CPUINFER_BLIS_ROOT却为空,说明这个环境变量没有配置。我的bils在aocl工具集下,因此是同一个目录,所以只需要设置
export CPUINFER_BLIS_ROOT=$AOCL_ROOT。🎉验证通过!
建议
问题主要是不知道环境变量该怎么设置造成的,希望文档中可以补充相关说明。