UCLA-VAST / AutoSA

AutoSA: Polyhedral-Based Systolic Array Compiler
MIT License
191 stars 31 forks source link

Program received signal SIGSEGV, Segmentation fault #1

Closed yandaweixx closed 4 years ago

yandaweixx commented 4 years ago

Hi, there is a core dump problem after I run the install.sh and execute the autoisa program:

0 0x00007ffff65666c5 in isl_space_is_params () from /home/AutoSA/src/isl/.libs/libisl.so.22

1 0x00007ffff656b5bc in isl_space_params () from /home//AutoSA/src/isl/.libs/libisl.so.22

2 0x00007ffff658ea8b in isl_union_map_empty_space () from /home/davi/AutoSA/src/isl/.libs/libisl.so.22

3 0x0000555555585622 in compute_tagged_rar_dep (ps=0x5555559ab890) at ppcg.c:999

4 0x00005555555859a4 in compute_dependences (scop=0x5555559ab890) at ppcg.c:1103

5 0x0000555555586152 in ppcg_scop_from_pet_scop (scop=0x5555559bcc70, options=0x5555558073d0) at ppcg.c:1284

6 0x0000555555586336 in transform (p=0x55555580ca10, scop=0x5555559bcc70, user=0x7fffffffdf20) at ppcg.c:1349

7 0x00007ffff6bb2b22 in pet_transform (scop=0x5555559bcc70, user=0x7fffffffde80) at pet.cc:1297

8 0x00007ffff6bb35fd in PetASTConsumer::call_fn (scop=, this=0x7fffffffdd00) at pet.cc:660

9 PetASTConsumer::scan_scops (fd=0x555555960838, this=0x7fffffffdd00) at pet.cc:691

10 PetASTConsumer::HandleTopLevelDecl (this=0x7fffffffdd00, dg=...) at pet.cc:723

11 0x00007ffff6ca57e3 in clang::ParseAST(clang::Sema&, bool, bool) () from /home/davi/AutoSA/src/pet/.libs/libpet.so.10

12 0x00007ffff6bb7d0d in foreach_scop_in_C_source (ctx=ctx@entry=0x555555807620,

filename=filename@entry=0x555555807940 "../autosa_tests/mm/kernel.c", function=function@entry=0x0, options=<optimized out>, 
fn=fn@entry=0x7ffff6bb2ab0 <pet_transform(pet_scop*, void*)>, user=user@entry=0x7fffffffde80) at pet.cc:1174

13 0x00007ffff6bb81be in pet_foreach_scop_in_C_source (ctx=ctx@entry=0x555555807620,

filename=filename@entry=0x555555807940 "../autosa_tests/mm/kernel.c", function=function@entry=0x0, 
fn=fn@entry=0x7ffff6bb2ab0 <pet_transform(pet_scop*, void*)>, user=user@entry=0x7fffffffde80) at pet.cc:1204

14 0x00007ffff6bb8307 in pet_transform_C_source (ctx=0x555555807620, input=, out=,

transform=0x5555555862b1 <transform>, user=0x7fffffffdf20) at pet.cc:1340

15 0x00005555555863e2 in ppcg_transform (ctx=0x555555807620, input=0x555555807940 "../autosa_tests/mm/kernel.c",

out=0x555555807a80, options=0x5555558073d0, fn=0x5555555b2df0 <generate_wrap(isl_printer*, ppcg_scop*, void*)>, 
user=0x7fffffffdf50) at ppcg.c:1372

16 0x00005555555b3156 in generate_sa (ctx=ctx@entry=0x555555807620,

input=input@entry=0x555555807940 "../autosa_tests/mm/kernel.c", out=0x555555807a80, options=options@entry=0x5555558073d0, 

---Type to continue, or q to quit--- print=print@entry=0x5555555b79e0 <print_hw(isl_printer, autosa_prog, isl_ast_node*, autosa_hw_module*, int, autosa_hw_top_module, autosa_drain_merge_func*, int, autosa_types, void*)>, user=user@entry=0x7fffffffe030) at autosa_trans.cpp:3664

17 0x00005555555ba11e in generate_autosa_xilinx_hls_c (ctx=0x555555807620, options=0x5555558073d0,

input=0x555555807940 "../autosa_tests/mm/kernel.c") at autosa_xilinx_hls_c.cpp:2956

18 0x000055555558667e in autosa_main_wrap (argc=1, argv=0x7fffffffe1c8) at ppcg.c:1458

19 0x00007ffff58fdb97 in __libc_start_main (main=0x5555555685a0 <main(int, char**)>, argc=10, argv=0x7fffffffe1c8,

init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffffffe1b8) at ../csu/libc-start.c:310

20 0x000055555556878a in _start ()

whbldhwj commented 4 years ago

Hi, can you provide me with the AutoSA command you are using to reproduce the errors?

yandaweixx commented 4 years ago

Hi, thanks for your reply, I have tried run this command : ./autosa ./autosa_tests/mm/kernel.c --AutoSA-config=./autosa_config/autosa_config.json --target=autosa_hls_c --AutoSA-autosa --AutoSA-two-level-buffer --AutoSA-uram --isl-schedule-whole-component --AutoSA-output-dir=./autosa.tmp/output --sa-sizes="{kernel[0]->array_part[16,16,16];kernel[0]->array_part_L2[2,2,2];kernel[0]->latency[8,8];kernel[0]->simd[2]}" --AutoSA-simd-info=./autosa_tests/mm/simd_info.json

And, the shell script at the AutoSA dir just generate some empty file in the output dir, and then, I fixed the LDPATH manully, run the autosa binary( in AutoSA/./src/.libs/autosa) with the arguments above , finally I got the coredump problem.

whbldhwj commented 4 years ago

Hi,

Sorry for the late reply. I was suspecting the environment is not successfully installed. I've tried to reproduce the problem on my machine and it worked fine. Specifically, here is my environment: Ubuntu 16.04, GCC 5.4 As the AutoSA uses PET which relies on LLVM. I've tried both the LLVM3.9 and LLVM 9. And It both worked. Note that the current infrastructure won't work after LLVM 10. I've found this thread on ISL's forum: https://groups.google.com/forum/#!msg/isl-development/W4hwfdkJylk/hUR4nWu6AwAJ, and a patch is needed to support LLVM 10. Simply speaking, please only use LLVM no newer than LLVM9.

BTW, I updated the install.sh script. The command autogen.sh is disabled in the previous version. You will need to run this script to generate the necessary Makefile and Configure files first.

whbldhwj commented 4 years ago

I found the same problem in the docker environment. I'll try to fix it and let you know soon.

whbldhwj commented 4 years ago

Hi, I just fixed the bug. It should work now. You may also try the Docker image directly. docker pull whbldhwj/autosa:latest Let me know if it works for you now.

yandaweixx commented 4 years ago

Hi, I update the code from the git, and it works, there is no coredump problem, and after I run the test command :

"./autosa ./autosa_tests/mm/kernel.c --AutoSA-config=./autosa_config/autosa_config.json --target=autosa_hls_c --AutoSA-autosa --AutoSA-two-level-buffer --AutoSA-uram --isl-schedule-whole-component --AutoSA-output-dir=./autosa.tmp/output --AutoSA-simd-info=./autosa_tests/mm/simd_info.json" .

The kernel file seems to be empty: "davi@ubuntu-test:~/AutoSA$ ll -a autosa.tmp/output/src/kernel_* -rw-rw-r-- 1 davi davi 410 6月 9 10:04 autosa.tmp/output/src/kernel_host.cpp -rw-rw-r-- 1 davi davi 2498 6月 9 10:04 autosa.tmp/output/src/kernel_host.hpp -rw-rw-r-- 1 davi davi 45 6月 9 10:04 autosa.tmp/output/src/kernel_kernel.h -rw-rw-r-- 1 davi davi 0 6月 9 10:04 autosa.tmp/output/src/kernel_kernel_modules.cpp -rw-rw-r-- 1 davi davi 53 6月 9 10:04 autosa.tmp/output/src/kernel_top_gen.cpp -rw-rw-r-- 1 davi davi 0 6月 9 10:04 autosa.tmp/output/src/kernel_top_gen.h "

I will try the docker image later.

whbldhwj commented 4 years ago

The default setting will only set the space_time stage in the auto mode. For the rest of the stages, they are all set in the manual mode. Using the command above, you may see the following messages:

[AutoSA] 6 systolic arrays generated.
[AutoSA] Appy PE optimization.
[AutoSA] Apply array partitioning.

This means that AutoSA stops at the stage of array partitioning. You will find the tuning.json under the directory ${autosa_dir}/autosa.tmp/output, which shows the candidate loops and their loop bounds. If you wanna see which loops they are in the schedule tree, add the flag --AutoSA-verbose when compiling. Since the entire compilation flow is not finished, the files you see under the output/src directory are just placeholders and therefore are empty.

There are two solutions: 1) Change the rest of the stages to auto mode in the autosa_config.json. Let AutoSA finish the rest stages by choosing the default tiling factors. 2) Use the suggested command in the example folder. E.g.,

./autosa ./autosa_tests/mm/kernel.c --AutoSA-config=./autosa_config/autosa_config.json --target=autosa_hls_c --AutoSA-autosa --AutoSA-two-level-buffer --AutoSA-uram --isl-schedule-whole-component --AutoSA-output-dir=./autosa.tmp/output --sa-sizes="{kernel[0]->array_part[16,16,16];kernel[0]->array_part_L2[2,2,2];kernel[0]->latency[8,8];kernel[0]->simd[2]}" --AutoSA-simd-info=./autosa_tests/mm/simd_info.json

You should be able to see the final outputs by either approach.

yandaweixx commented 4 years ago

Thanks for your direction. It works and I should read the readme carefully. This is a magnificent project, and hope to develop better!

whbldhwj commented 4 years ago

Thanks! It's an ongoing research project and I'll keep improving it. Keep an eye on our future updates. :)

Cheers,