[llvm-dev] LLVM crashing while trying to build SPEC with Clang

Doerfert, Johannes via llvm-dev llvm-dev at lists.llvm.org
Mon Aug 5 12:57:34 PDT 2019


The SSA value %4 is defined in each loop with different types. They cannot be in the same function.

--
written from my phone

________________________________
From: Chatterjee, Bodhisatwa <bxc583 at psu.edu>
Sent: Monday, August 5, 2019 2:55:53 PM
To: Doerfert, Johannes <jdoerfert at anl.gov>
Subject: Re: LLVM crashing while trying to build SPEC with Clang


Hello Johannes,


Thank you for your reply.


They should be in the same function, as I invoked the build_dependencies() inside the runOnFunction(). According to my print statements, these loops are in the same function called 'check_su3'

You can also check the code of my pass, as I have attached it here.

Thanks,
Bodhisatwa

________________________________
From: Doerfert, Johannes <jdoerfert at anl.gov>
Sent: Monday, August 5, 2019 2:49:20 PM
To: Chatterjee, Bodhisatwa <bxc583 at psu.edu>
Subject: Re: LLVM crashing while trying to build SPEC with Clang

These two loops are not in the same function. That is the problem.

--
written from my phone

________________________________
From: Chatterjee, Bodhisatwa <bxc583 at psu.edu>
Sent: Monday, August 5, 2019 2:39:44 PM
To: Doerfert, Johannes <jdoerfert at anl.gov>
Subject: Re: LLVM crashing while trying to build SPEC with Clang

Hello Johannes,

Thank you for your reply. Since I had errs() statement in my pass, so I know exactly where llvm crashes. It crashed while I was checking dependencies between two particular loops in the same function.

While constructing the dependence pointers between memory instructions in these loops, can I somehow check for 'interprocedural queries' and avoid them(since they caused the crash)?

Also, speaking of caching, do you mean that I should invoke a separate pass which would use the Instruction Pointers from all the previous function passes and then check the dependencies?


The memory instructions for these loops are given below:
For Loop No. 7
  %1 = load %struct.su3_matrix*, %struct.su3_matrix** %c.addr, align 8
  %2 = load i32, i32* %i, align 4
  %3 = load double, double* %real, align 8
  %4 = load %struct.su3_matrix*, %struct.su3_matrix** %c.addr, align 8
  %5 = load i32, i32* %i, align 4
  %6 = load double, double* %real6, align 8
  %7 = load %struct.su3_matrix*, %struct.su3_matrix** %c.addr, align 8
  %8 = load i32, i32* %i, align 4
  %9 = load double, double* %imag, align 8
  %10 = load %struct.su3_matrix*, %struct.su3_matrix** %c.addr, align 8
  %11 = load i32, i32* %i, align 4
  %12 = load double, double* %imag15, align 8
  %13 = load %struct.su3_matrix*, %struct.su3_matrix** %c.addr, align 8
  %14 = load i32, i32* %i, align 4
  %15 = load double, double* %real21, align 8
  %16 = load %struct.su3_matrix*, %struct.su3_matrix** %c.addr, align 8
  %17 = load i32, i32* %i, align 4
  %18 = load double, double* %real26, align 8
  %19 = load %struct.su3_matrix*, %struct.su3_matrix** %c.addr, align 8
  %20 = load i32, i32* %i, align 4
  %21 = load double, double* %imag33, align 8
  %22 = load %struct.su3_matrix*, %struct.su3_matrix** %c.addr, align 8
  %23 = load i32, i32* %i, align 4
  %24 = load double, double* %imag38, align 8
  %25 = load %struct.su3_matrix*, %struct.su3_matrix** %c.addr, align 8
  %26 = load i32, i32* %i, align 4
  %27 = load double, double* %real45, align 8
  %28 = load %struct.su3_matrix*, %struct.su3_matrix** %c.addr, align 8
  %29 = load i32, i32* %i, align 4
  %30 = load double, double* %real50, align 8
  %31 = load %struct.su3_matrix*, %struct.su3_matrix** %c.addr, align 8
  %32 = load i32, i32* %i, align 4
  %33 = load double, double* %imag57, align 8
  %34 = load %struct.su3_matrix*, %struct.su3_matrix** %c.addr, align 8
  %35 = load i32, i32* %i, align 4
  %36 = load double, double* %imag62, align 8
  store double %add64, double* %ar, align 8
  %37 = load double, double* %ar, align 8
  %call = call double @sqrt(double %37) #4
  store double %38, double* %ar, align 8
  %39 = load double, double* %max, align 8
  %40 = load double, double* %ar, align 8
  %41 = load double, double* %ar, align 8
  store double %41, double* %max, align 8

For Loop No. 2
  %4 = load %struct.site*, %struct.site** %s, align 8
  %5 = load i32, i32* %dir, align 4
  store %struct.su3_matrix* %arrayidx, %struct.su3_matrix** %mat, align 8
  %6 = load %struct.su3_matrix*, %struct.su3_matrix** %mat, align 8
  %call = call double @check_su3(%struct.su3_matrix* %6)
  store double %call, double* %deviation, align 8
  %7 = load double, double* %deviation, align 8
  %call5 = call i32 (...) @mynode()
  %8 = load i32, i32* %i, align 4
  %9 = load i32, i32* %dir, align 4
  %10 = load double, double* %deviation, align 8
  %call6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str, i64 0, i64 0), i32 %call5, i32 %8, i32 %9, double %10)
  %call7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
  store i32 0, i32* %ii, align 4
  %call29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0))
  store i32 0, i32* %ii, align 4
  %call59 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0))
  %37 = load %struct._IO_FILE*, %struct._IO_FILE** @stdout, align 8
  %call60 = call i32 @fflush(%struct._IO_FILE* %37)
  call void @terminate(i32 1)
  %38 = load double, double* %max_deviation, align 8
  %39 = load double, double* %deviation, align 8
  %40 = load double, double* %deviation, align 8
  store double %40, double* %max_deviation, align 8
  %41 = load double, double* %deviation, align 8
  %42 = load double, double* %deviation, align 8
  %43 = load double, double* %av_deviation, align 8
  store double %add, double* %av_deviation, align 8


Thanks a lot,
Bodhisatwa


________________________________
From: Doerfert, Johannes <jdoerfert at anl.gov>
Sent: Monday, August 5, 2019 2:07:34 PM
To: llvm-dev at lists.llvm.org <llvm-dev at lists.llvm.org>; Chatterjee, Bodhisatwa <bxc583 at psu.edu>
Subject: Re: LLVM crashing while trying to build SPEC with Clang

It seems that your pass is somehow passing pointers defined in different functions to the alias interface, maybe you cache them in one run invocation and use them in the next?

The assertion text: BasicAliasAnalysis doesn't support interprocedural queries.
The assertion is in /media/kiit/3E9AF7519AF703E5/llvm-project/llvm/lib/Analysis/BasicAliasAnalysis.cpp line 823
The function is llvm::AliasResult llvm::BasicAAResult::alias(const llvm::MemoryLocation&, const llvm::MemoryLocation&, llvm::AAQueryInfo&)
To get a better idea where in your code the invocation is build it in debug mode.

Cheers,
  Johannes

________________________________________
From: llvm-dev <llvm-dev-bounces at lists.llvm.org> on behalf of Chatterjee, Bodhisatwa via llvm-dev <llvm-dev at lists.llvm.org>
Sent: Monday, August 5, 2019 13:57
To: llvm-dev at lists.llvm.org
Subject: [llvm-dev] LLVM crashing while trying to build SPEC with Clang

Hello,


I am building the SPEC 2006 Benchmark with Clang as the compiler. I have written a function pass in LLVM and I am trying to run that for SPEC by invoking the pass in the build options of SPEC. The build options of SPEC are in a *.cfg config file, which allows us to specify the choice of compiler while building SPEC. (https://nam01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.spec.org%2Fcpu2006%2FDocs%2Finstall-guide-unix.html&data=02%7C01%7Cbxc583%40psu.edu%7C09f9e3dad2a64b4a7f8808d719d82fe7%7C7cf48d453ddb4389a9c1c115526eb52e%7C0%7C0%7C637006288616822487&sdata=lhwNligtKVUezS4O%2BvIFB6c9qJ9hNeWcoszQuxHvOZE%3D&reserved=0<https://nam01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.spec.org%2Fcpu2006%2FDocs%2Finstall-guide-unix.html&data=02%7C01%7Cbxc583%40psu.edu%7Cb698195e72ba451cb24408d719de065e%7C7cf48d453ddb4389a9c1c115526eb52e%7C0%7C0%7C637006313691359515&sdata=SXU%2BUxLasnPSQ%2FJe6H9povq6rf7OsLQ7QNl3%2FtdA8Sw%3D&reserved=0>)


The pass runs for several functions, but llvm crashes at a certain point. I am checking dependencies between various loops in a function in that pass.


The crash message and stack dump is:


clang-9: /media/kiit/3E9AF7519AF703E5/llvm-project/llvm/lib/Analysis/BasicAliasAnalysis.cpp:823: llvm::AliasResult llvm::BasicAAResult::alias(const llvm::MemoryLocation&, const llvm::MemoryLocation&, llvm::AAQueryInfo&): Assertion `notDifferentParent(LocA.Ptr, LocB.Ptr) && "BasicAliasAnalysis doesn't support interprocedural queries."' failed.
Stack dump:
0. Program arguments: /media/kiit/3E9AF7519AF703E5/llvm/bin/clang-9 -cc1 -triple x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free -main-file-name check_unitarity.c -mrelocation-model static -mthread-model posix -mdisable-fp-elim -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64 -dwarf-column-info -debugger-tuning=gdb -coverage-notes-file /media/kiit/3E9AF7519AF703E5/New_Spec/cpu2006/benchspec/CPU2006/433.milc/run/build_base_amd64-m64-gcc42-nn.0006/check_unitarity.gcno -resource-dir /media/kiit/3E9AF7519AF703E5/llvm/lib/clang/9.0.0 -D SPEC_CPU -D NDEBUG -I . -D FN -D FAST -D CONGRAD_TMP_VECTORS -D DSLASH_TMP_LINKS -D SPEC_CPU_LP64 -I/opt/intel/compilers_and_libraries_2019.2.187/linux/ipp/include -I/opt/intel/compilers_and_libraries_2019.2.187/linux/mkl/include -I/opt/intel/compilers_and_libraries_2019.2.187/linux/pstl/include -I/opt/intel/compilers_and_libraries_2019.2.187/linux/tbb/include -I/opt/intel/compilers_and_libraries_2019.2.187/linux/tbb/include -I/opt/intel/compilers_and_libraries_2019.2.187/linux/daal/include -I/opt/intel/compilers_and_libraries_2019.2.187/linux/ipp/include -I/opt/intel/compilers_and_libraries_2019.2.187/linux/mkl/include -I/opt/intel/compilers_and_libraries_2019.2.187/linux/pstl/include -I/opt/intel/compilers_and_libraries_2019.2.187/linux/tbb/include -I/opt/intel/compilers_and_libraries_2019.2.187/linux/tbb/include -I/opt/intel/compilers_and_libraries_2019.2.187/linux/daal/include -internal-isystem /usr/local/include -internal-isystem /media/kiit/3E9AF7519AF703E5/llvm/lib/clang/9.0.0/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -fdebug-compilation-dir /media/kiit/3E9AF7519AF703E5/New_Spec/cpu2006/benchspec/CPU2006/433.milc/run/build_base_amd64-m64-gcc42-nn.0006 -ferror-limit 19 -fmessage-length 0 -fobjc-runtime=gcc -fdiagnostics-show-option -load /media/kiit/3E9AF7519AF703E5/llvm-pass-skeleton/build/skeleton/libSkeletonPass.so -o check_unitarity.o -x c check_unitarity.c -faddrsig
1. <eof> parser at end of file
2. Per-function optimization
3. Running pass 'Unnamed pass: implement Pass::getPassName()' on function '@check_su3'
 #0 0x0000000004f2a60f llvm::sys::PrintStackTrace(llvm::raw_ostream&) /media/kiit/3E9AF7519AF703E5/llvm-project/llvm/lib/Support/Unix/Signals.inc:494:0

I have included my function pass and the SPEC Config file(*.cfg) here.

Thanks,
Bodhisatwa




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190805/5c57a36c/attachment.html>


More information about the llvm-dev mailing list