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

Weird RecMII generated by the framework. #18

Open
halfmanli opened this issue Jun 16, 2023 · 1 comment
Open

Weird RecMII generated by the framework. #18

halfmanli opened this issue Jun 16, 2023 · 1 comment

Comments

@halfmanli
Copy link

I use the docker image. Here's my code:

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

int main() { test(); }

And the output says:

...
==================================
[ResMII: 1]
... number of cycles: 2 ...
==================================
[RecMII: 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 RecMII is 4 here? I really appreciate that.

@tancheng
Copy link
Owner

Hi halfmanli,
Thanks for your interest in the toolchain. That's a good question! Though in the C code you might not see dependency in the computation of c = a + b, there is actually dependency in i (i.e., i++ or i = i + 1). And you can see the cycle (length of 4 including phi, add, comp, br) in the generated DFG.
If your purpose is to decrease the RecMII, the mapper can do DFG node fusion to fuse at most two nodes together. You can write up your own code to replace a set of nodes with a single new node. In this way, the RecMII can be lowered. But note that the new node needs to be executed by a functional unit in the hardware, which means we also need to provide a special functional unit in the CGRA RTL to enable single cycle execution of the fused operations.

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

2 participants