Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

按照官方指南编译vecadd.cl后运行./spike_test时程序卡住 #37

Open
lijyhh opened this issue Jan 8, 2025 · 0 comments
Open

Comments

@lijyhh
Copy link

lijyhh commented Jan 8, 2025

环境 (Environment)

  • 操作系统: Windows 11 with WSL2, Ubuntu 22.04
  • LLVM版本: 使用了来自OpenGPGPU的官方发布的软件工具链以及自己编译的LLVM
  • RISC-V模拟器: ventus-gpgpu-isa-simulator,按照项目提供的说明安装

重现步骤 (Steps to Reproduce)

  1. 按照llvm-project项目中的"4.1.1 Compile directly"部分的指导,对vecadd.cl进行编译。
  2. 使用以下命令进行编译:
    ./install/bin/clang -cl-std=CL2.0 -target riscv32 -mcpu=ventus-gpgpu vecadd.cl  ./install/lib/crt0.o -L./install/lib -lworkitem -I./libclc/generic/include -nodefaultlibs ./libclc/riscv32/lib/workitem/get_global_id.cl -O1 -cl-std=CL2.0 -Wl,-T,utils/ldscripts/ventus/elf32lriscv.ld -o vecadd.riscv
  3. 将编译得到的vecadd.riscv文件拷贝到ventus-gpgpu-isa-simulator/gpgpu-testcase/driver/build目录下。
  4. 在终端中运行./spike_test

预期行为 (Expected Behavior)

./spike_test应该正常完成执行,并输出正确的结果。

实际行为 (Actual Behavior)

当运行./spike_test时,程序会在Spike模拟器中卡住,终端输出如下:

$ ./spike_test 
[INFO]: [HW DRIVER] in [FILE] ventus.cpp,[LINE]25,[fn] vt_dev_open: vt_dev_open : hello world from ventus.cpp
spike device initialize: allocating local memory: to allocate at 0x70000000 with 268435456 bytes
spike device initialize: allocating pc source memory: to allocate at 0x80000000 with 268435456 bytes
to allocate at 0x90000000 with 268435456 bytes
to allocate at 0xa0000000 with 131072 bytes
Warning: the memory at  [0xA0020000, 0xA002003F] has been realigned
to the 4 KiB page size: [0xA0020000, 0xA0020FFF]
to allocate at 0xa0020000 with 4096 bytes
Warning: the memory at  [0xA0021000, 0xA002103F] has been realigned
to the 4 KiB page size: [0xA0021000, 0xA0021FFF]
to allocate at 0xa0021000 with 4096 bytes
Warning: the memory at  [0xA0022000, 0xA002203F] has been realigned
to the 4 KiB page size: [0xA0022000, 0xA0022FFF]
to allocate at 0xa0022000 with 4096 bytes
Warning: the memory at  [0xA0023000, 0xA0023007] has been realigned
to allocate at 0xa0024000 with 268435456 bytes
to copy to 0xa0020000 with 64 bytes
to copy to 0xa0021000 with 64 bytes
to copy to 0xa0021000 with 64 bytes
to copy to 0xa0022000 with 56 bytes
to copy to 0xa0023000 with 8 bytes
arg gpgpu is numw:4,numt:8,numwg:1,kernelx:1,kernely:1,kernelz:1,ldssize:0x1000,pdssize:0x10000000,pdsbase:0xa0000000,knlbase:0xa0022000,currwgid:0
vaddr mem scope is -m0x70000000:0xb0024000
src file is vecadd.riscv, run log is written to vecadd.riscv.log
spike -l --log-commits -p4 --isa rv32gcv_zfh --pc=0x80000000 -m0x70000000:0xb0024000 --varch vlen:256,elen:32 --gpgpuarch numw:4,numt:8,numwg:1,kernelx:1,kernely:1,kernelz:1,ldssize:0x1000,pdssize:0x10000000,pdsbase:0xa0000000,knlbase:0xa0022000,currwgid:0 --log=vecadd.riscv.log vecadd.riscv

程序会在此处卡住,生成的vecadd.riscv.log文件持续增大。曾经达到过200多G,然后我将该文件删除了。

额外信息 (Additional Information)

  • 我尝试了官方发布的LLVM工具链和自己编译的LLVM,但问题依旧存在。
  • 使用gpgpu-testcase/vsw_testcase目录下的预编译vecadd.riscv文件可以正常运行./spike_test,这表明可能是我的编译过程或环境设置存在问题。

问题 (Questions)

  1. 编译vecadd.cl时是否需要特定的设置或标志?我可能遗漏了什么?是否有更新后的使用教程或命令?
  2. 当前版本的LLVM工具链或RISC-V模拟器是否存在已知的问题,可能会导致这种行为?
  3. 是否有推荐的方法来调试编译后的RISC-V二进制文件(vecadd.riscv),以确定它在何处卡住?

感谢您的帮助!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant