llvm / llvm/circt

[StandardToHandshake] Warn when task pipelining is used with memory

Open
#3,824 4 comments 0 reactions 1 assignee Claimed by @Dinistro View on GitHub
Dominant language
C++
Stars
2.2k
Forks
524
Avg merge
3d 2h
Merged PRs (30d)
46

Description

StandardToHandshake consumes a sequential input program and, by default, produces a circuit that can be executed in a pipelined manner.
When a program uses memory, this transformation might introduce unexpected behavior. See the following example:

```C
int func(bool flag) {
static int mem[2] = {0,0};
int res;
if (flag) {
mem[0] = 1; // A0
// other stuff that introduces delay
res = mem[1]; // A1
} else {
mem[1] = 1; // A2
// other stuff that introduces delay
res = mem[0]; // A3
}
return res;
}
```

Invoking the corresponding circuit with T0(flag = 1), and T1(flag = 0), will result in T1 returning 1, instead of 0.

A user assumes that the pipeline doesn't change the semantics, e.g., T0 and T1 should appear as being executed sequentially. In the example, the memory access A2 will happen before A1, thus causing unexpected/faulty behavior.

I suggest issuing a warning or even stopping the execution if memory together task pipelining is used.

CC @mortbopet: This is something we didn't discuss so far, right?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.