ecolab-nus / morpher

An Open-Source Tool for CGRA Accelerators
MIT License
52 stars 7 forks source link

Weird RecMin II generated by Morpher. #10

Open halfmanli opened 1 year ago

halfmanli commented 1 year ago

Here's the code:

int a[10], b[10], c[10];
__attribute__((noinline)) void test() {
    for (int i = 0; i < 10; i++) {
#ifdef CGRA_COMPILER
        please_map_me();
#endif
        c[i] = a[i] * b[i];
    }
}

int main() { test(); }

Here's my command:

python -u run_morpher.py cava/test_recii.c test config/microspeech_hycube_mm_0.yaml

And Morpher says:

MAP begin... 
Initial target II = 4 (ResMin II = 2 , RecMin II = 4, UserGiven II = 0 )
Current target II = 4, Iteration = 0
noConflicts!
Current target II = 4, Iteration = 1
noCongestion!
noConflicts!
Map Success with II = 4!!!

That's weird because there's no dependency between the i-th iteration and (i+1)-th iteration. Could you please explain the reason why RecMin II is 4 here? I really appreciate that. @zhaoying-LI

zhaoying-LI commented 1 year ago

It is because of iteration variable "i"