cucapra / dahlia

Time-sensitive affine types for predictable hardware generation
https://capra.cs.cornell.edu/dahlia
MIT License
130 stars 8 forks source link

Using fixed point in futil imports or function definitions doesn't work. #353

Closed cgyurgyik closed 3 years ago

cgyurgyik commented 3 years ago

Futil imports

import futil("primitives/bitnum/math.futil")
{
  def std_sqrt(in: ufix<32, 16>): ufix<32, 16>;
}

let x: ufix<32, 16> = 4.0;

let t: ufix<32, 16> = std_sqrt(x);

->

ERROR: Stage 'dahlia' had a non-zero exit code.
---------------- stderr ----------------
[Error] [Line 8, Column 23] `std_sqrt` should be assigned to its own `let` statement, e.g. `let _temp = std_sqrt(...);`
let t: ufix<32, 16> = std_sqrt(x);
                      ^
 This feature is not yet implemented. Please open a feature request for it.

Function definitions

def foo(in: ufix<32, 16>): ufix<32, 16> = {
  let temp: ufix<32, 16> = in;
  return temp;
}

let x: ufix<32, 16> = 4.0;

let t: ufix<32, 16> = foo(x);

->

ERROR: Stage 'dahlia' had a non-zero exit code.
---------------- stderr ----------------
[Error] [Line 8, Column 23] `foo` should be assigned to its own `let` statement, e.g. `let _temp = foo(...);`
let t: ufix<32, 16> = foo(x);
                      ^
 This feature is not yet implemented. Please open a feature request for it.
rachitnigam commented 3 years ago

Use -l debug to get the stack trace and see which line in the compiler throws this error.

cgyurgyik commented 3 years ago

This is with fuse a.fuse -b=futil -l=debug:

[Error] [Line 8, Column 22] `foo` should be assigned to its own `let` statement, e.g. `let _temp = foo(...);`
let t: fix<32, 16> = foo(x);
                     ^
 This feature is not yet implemented. Please open a feature request for it.
rachitnigam commented 3 years ago

Not sure which part of the compiler is throwing it. Probably the code for EApp in futilbackend. That flag should’ve dumped the stack trace. See the CLI flags of the compiler to make sure it’s not log-level or something