Graph not a DAG

126 views
Skip to first unread message

Iulian Valentin Brumar

unread,
Sep 13, 2020, 2:17:39 PM9/13/20
to PandA project discussions and questions
Hello,

I'm a student experimenting with Panda. I'm trying to do HLS on a simple function but Panda is complaining that the graph is not a DAG. I assume that it's referring to the control flow of the function I'm trying to synthesize. However the control flow seems to be a DAG (directed acyclic graph?) for the function I'm synthesizing. Also, the same error shows up if I'm trying to synthesize pretty much anything in the .ll file. I've tried to search this particular error in the source code of Panda but couldn't find it. I think it's generated dynamically.

Here's the command I was executing and I'm attaching the .ll file written in llvm8:

~/tools/panda-0.9.5.install/bin/bambu h264.ll --compiler=I386_CLANG7 --top-fname=Clip1c -v 4


I would appreciate any pointer towards how I could solve this problem.

Thank you,
Iulian

Iulian Valentin Brumar

unread,
Sep 13, 2020, 10:07:14 PM9/13/20
to PandA project discussions and questions
I meant "in llvm7" not "in llvm8".
Sincerely,
Iulian

Fabrizio Ferrandi

unread,
Sep 14, 2020, 11:07:41 AM9/14/20
to PandA project discussions and questions
Dear Iulian,
The issue happens because the translation unit has at least one non-tail recursive function.
bambu works on a projection of the call graph starting from the user defined top-function. Unfortunately, such projections are not done in all the steps.
I've fixed the issue internally. Just wait a bit for the regression to complete and then I'll publish the fix.
Thank you very much for the bug report.
Cheers,
Fabrizio


Iulian Valentin Brumar

unread,
Sep 15, 2020, 2:32:37 AM9/15/20
to PandA project discussions and questions
Thanks very much Fabrizio,

Will be back here once I've tried the fix.

I've also noticed in another context the issue that you mentioned regarding the HLS process not finishing even though the error happens in a different function than the one synthesized or any of its callees. This happened for unsupported LLVM intrinsics for functions with a variable number of arguments.

Will this bugfix also allow in general synthesizable functions to be translated to verilog even though some other unrelated function in the bitcode might have non-synthesizable features.

Again, thanks very much for the help,
Iulian

Iulian Valentin Brumar

unread,
Sep 15, 2020, 3:49:08 PM9/15/20
to PandA project discussions and questions
Correction on my text. This was actually a question:

Will this bugfix also allow in general synthesizable functions to be translated to verilog even though some other unrelated function in the bitcode might have non-synthesizable features?

Thanks,
Iulian

Fabrizio Ferrandi

unread,
Sep 15, 2020, 4:17:52 PM9/15/20
to Iulian Valentin Brumar, PandA project discussions and questions
Yes, it will.
If the top function and all the functions called, directly or indirectly, are synthesizable then the Verilog will be generated. This will happen independently by what happens in the rest of the translation unit.
Cheers,
Fabrizio 

--
Name:                  Fabrizio Ferrandi  
Department:            Dipartimento di Elettronica Informazione
                        e Bioingegneria  
Organization:          Politecnico di Milano  
Address:               Piazza Leonardo Da Vinci, 32
 z.i.p./City:           I-20133 Milano, Italy 
Phone:                 +39 02 2399 3479 
Fax:                   +39 02 2399 3411 
 www: http://ferrandi.faculty.polimi.it

Il giorno 15 set 2020, alle ore 21:49, Iulian Valentin Brumar <ibr...@g.harvard.edu> ha scritto:


--
You received this message because you are subscribed to the Google Groups "PandA project discussions and questions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to panda-project-discussio...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/panda-project-discussions-questions/ec351650-103f-41e8-ab7d-97bbc5c874fcn%40googlegroups.com.

Fabrizio Ferrandi

unread,
Sep 16, 2020, 10:59:37 AM9/16/20
to PandA project discussions and questions
Dear Iulian,


This branch should be sufficiently stable and includes the fixes we discussed in this thread.

In addition, I would like to have further information on the unsupported LLVM intrinsics you saw. In particular, I would like to understand if such intrinsics could be supported. We added some support of LLVM intrinsics but I'm expecting that this part needs to be improved.

Cheers,
Fabrizio

Iulian Valentin Brumar

unread,
Sep 20, 2020, 3:11:38 AM9/20/20
to PandA project discussions and questions
Dear Fabrizio,

Thanks very much for sharing the link to panda-0.9.7-dev. I've noticed that there might even be support for newer versions of LLVM. That's awesome! At the end of the email I'm attaching a source code in C that uses a variable number of parameters but it is not synthesizable at this moment in case it is a feature you plan to add to Panda in the future*.

At the moment I'm trying to compile the 0.9.7 branch and there are some compilation errors with the versions of gcc I have available in the system. In particular I'm getting this error with gcc/g++ versions 5, 6 and 7: link_to_error_messages.

Is this a compiler (gcc/g++) issue on my side?

Thanks very much for the support,
Iulian

and I've copy-pasted it here too:

#include <stdio.h>
#include <stdarg.h>

double average(int num,...) {
va_list valist;
double sum = 0.0;
int i; /* initialize valist for num number of arguments */
va_start(valist, num); /* access all the arguments assigned to valist */
for (i = 0; i < num; i++) { sum += va_arg(valist, int); } /* clean memory reserved for valist */
va_end(valist);
return sum/num;
}

int main() {
printf("Average of 2, 3, 4, 5 = %f\n", average(4, 2,3,4,5));
printf("Average of 5, 10, 15 = %f\n", average(3, 5,10,15));

Michele Fiorito

unread,
Sep 22, 2020, 4:22:23 AM9/22/20
to Iulian Valentin Brumar, PandA project discussions and questions

Dear Iulian,

 

about your compilation issue with panda-0.9.7-dev I can tell you it is probably related to your boost library version, if you can update it to the latest version the compilation process should complete just fine. Anyway I will try to fix the code so that it works with older boost versions too.

Thank you for reporting the bug.

 

Kind regards,

Michele Fiorito.

 

Da: Iulian Valentin Brumar
Inviato: domenica 20 settembre 2020 09:11
A: PandA project discussions and questions
Oggetto: Re: Graph not a DAG

Fabrizio Ferrandi

unread,
Sep 25, 2020, 1:10:03 AM9/25/20
to PandA project discussions and questions


Dear Iulian,

we published on the panda-0.9.7-dev branch a new version of the code. This includes the fix mentioned by Michele plus others.
I've still not an answer for the var args support. I hope to have one by end of today.
Cheers,
Fabrizio

Iulian Valentin Brumar

unread,
Oct 3, 2020, 1:02:17 AM10/3/20
to PandA project discussions and questions

Thanks Fabrizio,

This is awesome, I've been working with it for the past week and it works amazing.

I have this example though, that I wasn't able to synthesize although it seemed like an intuitive HLS kernel. I'm pretty sure I'm doing something wrong here but can't figure it out. I'm running this example:

#include<stdio.h>

void sum(int a[8], int b[8], int res[8], int sizes) {
    for (int i = 0; i < sizes; ++i)
        res[i] += a[i] + b[i];

}

int main() {
    int arr1[8] = {1, 2, 3, 4, 5, 6, 7, 9};
    int arr2[8] = {1, 2, 3, 4, 5, 6, 7, 9};
    int res[8] = {0, 0, 0, 0, 0, 0, 0, 0};

    sum(arr1, arr2, res, 8);

    printf("The result of the two sums is  %i\n", res[1]);
}

When I try to run it through panda, it breaks when panda is running internally a clang command. The assert that's breaking is:
clang-7: path_to_llvm7_installation/include/llvm/ADT/APInt.h:1559: uint64_t llvm::APInt::getZExtValue() const: Assertion `getActiveBits() <= 64 && "Too many bits for uint64_t"' failed
1.    Per-module optimization passes
2.    Running pass 'clang7_plugin_dumpGimpleSSA' on module '/home/ibrumar/tools/panda-github-install/bin/main_heavier_sum.ll'.
#0 0x00007f8461bb184a llvm::sys::PrintStackTrace(llvm::raw_ostream&) /home/ibrumar/tools/llvm-7.0.0/llvm/lib/Support/Unix/Signals.inc:494:0
#1 0x00007f8461bafecc llvm::sys::RunSignalHandlers() /home/ibrumar/tools/llvm-7.0.0/llvm/lib/Support/Signals.cpp:67:0
...

Please let me know if there is an obvious solution to this or if it's more related to the way the code is written and it needs to be massaged.

Thank you,
Iulian

Michele Fiorito

unread,
Oct 3, 2020, 5:17:48 AM10/3/20
to Iulian Valentin Brumar, PandA project discussions and questions

Dear Iulian,

 

I’m now working to solve your issue, but I would like you to share some more information about your setup to help me reproducing and solving the problem.

Please let me know if possible which Linux distribution you are working on, what are the versions of libraries and compilers related to Panda you have installed on your machine (just the non-standard ones, not from apt), and particularly what you used as configure command string to compile Panda and what arguments you are passing to bambu to synthesize your kernel.

Furthermore, I would like to know if you are just interested in exploiting Panda as an HLS tool as is, or if you are planning to develop some new features to be added to the framework.

Thank you again for your interest and for reporting your issue, this is really helpful for us to know.

 

Kind regards,

 

Michele Fiorito.

 

Da: Iulian Valentin Brumar
Inviato: sabato 3 ottobre 2020 07:02

Iulian Valentin Brumar

unread,
Oct 3, 2020, 5:11:58 PM10/3/20
to PandA project discussions and questions
Thanks a lot Michele, let me share here some of the details:

Linux distribution: Ubuntu 16.04.6 LTS
SW versions: panda-0.9.7, llvm-7.0, g++-7, gcc-7.
Configure line: ../configure --enable-bambu --with-clang7=/path_to_clang7_bin/clang-7  --prefix=/panda_prefix/panda-github-install --with-boost=/path_to_the_boost_lib/boost_1_74_0/

I've shared the config.log if that's helpful since it contains most if not all the compilation details. And yes, I can see potential for extending panda in the future although uncertain at this moment. If the question is regarding getting in touch with the other developers, I'm already on one of the slack channels Antonino organized. Also, as I'm getting used to panda I'll be asking fewer questions but thought that it might be useful for other people who are getting started with this tool as well :)

Please let me know if anything else is needed for this and I appreciate the support.

Sincerely,
Iulian
config.log
Reply all
Reply to author
Forward
0 new messages