cucapra/dahlia

Mysterious error when compiling doubly-unrolled access

Closed this issue · 1 comments

Compiling this program:

decl q: ubit<32>[8 bank 2];

for (let i: ubit<4> = 0..8) unroll 2 {
  q[i] := 0;
  ---
  for (let j: ubit<4> = 0..8) unroll 2 {
    let q0: ubit<32> = q[i];
  }
}

Produces this mysterious error message:

[Error] 1

I imagine this should pass the capability checker (although I am not 100% certain). It is possible to rewrite the program to:

decl q: ubit<32>[8 bank 2];

for (let i: ubit<4> = 0..8) unroll 2 {
  q[i] := 0;
  ---
  let q0: ubit<32> = q[i];
  for (let j: ubit<4> = 0..8) unroll 2 {
  }
}

which works totally fine, so it's not a blocking issue.

FWIW, the same thing seems to happen with writes, which should be an error (I think).

If you do -l debug you'll get the stack trace. This is the loop checker erroring out with a bad error message. I ran into this too. Haven't looked into why this is happening.