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

Pipelining #64

Open
sampsyo opened this issue Feb 13, 2019 · 3 comments
Open

Pipelining #64

sampsyo opened this issue Feb 13, 2019 · 3 comments
Labels
Discussion Needed Language features that need more discussion before implementation

Comments

@sampsyo
Copy link
Contributor

sampsyo commented Feb 13, 2019

Without a specific proposal, this issue is to remind us that we will need some manner of pipelining annotation for loops. It's likely we can use a desugaring strategy similar to the new one for unrolling as described in #58, which takes a source loop like this:

for (...) unroll k {
  c1
  ---
  c2
}

To:

for (...) {
  c1(0); c1(1); ...
  ---
  c2(0); c2(2); ...
}

Where a pipelined version of the original loop would look something like this, where the "duplicated" commands get offset according to the initiation interval:

for (...) {
  c1(0)
  ---
  c2(0); c1(1)
  ---
  c2(1)
}
@rachitnigam rachitnigam added the Discussion Needed Language features that need more discussion before implementation label Feb 14, 2019
@rachitnigam
Copy link
Member

Page 208 of the manual says that when Vivado can't figure the value of a dynamic iterator, it assumes that all reads depend on write and vice-versa.

In this example:

for (row = 0; row < rows + 1; row++) {
  for (col = 0; col < cols + 1; col++) {
  #pragma HLS PIPELINE II=1
  if (col < cols) {
    buff_A[2][col] = buff_A[1][col]; // read from buff_A[1][col]
    buff_A[1][col] = buff_A[0][col]; // write to buff_A[1][col]
    buff_B[1][col] = buff_B[0][col];
    temp = buff_A[0][col];
  }

Vivado will not respect a PIPELINE pragma. The manual states that program has to manually specify the lack of dependency using DEPENDENCE pragma.

Since we are already very conservative with pipelining and don't allow bank conflicts, we should aggressively use this pragma.

@rachitnigam rachitnigam added Discussion Needed Language features that need more discussion before implementation and removed Discussion Needed Language features that need more discussion before implementation labels Mar 14, 2019
@rachitnigam
Copy link
Member

rachitnigam commented Mar 17, 2019

While thinking about an implementation strategy, I came across this discussion

This comment in the thread is slightly concerning to me:

When a loop or function is pipelined, Vivado HLS unrolls all loops in the hierarchy below the function or loop so as to meet your pipeline directive.

This would mean that some new syntax of the form:

for (let ...) unroll .. pipeline k {
  for (...) ... pipeline l {
  }
}

might not preserve the semantics we claim it has (where the inner loops has an initiation interval of l while the outer loops has k). I'm trying to find more in depth explanation of the pragma. The explanation in Vivado manual isn't complete. @sa2257 do you know of any other sources I should read?

A higher level point is we need to clarify the semantics of pipelining in nested loops.

@rachitnigam
Copy link
Member

The occurrence pragma also seems important for pipelining things effectively. Not sure if there is a clean semantics for those.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Discussion Needed Language features that need more discussion before implementation
Projects
None yet
Development

No branches or pull requests

2 participants