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

Attributes everywhere #311

Closed
rachitnigam opened this issue Dec 16, 2020 · 4 comments · Fixed by #340
Closed

Attributes everywhere #311

rachitnigam opened this issue Dec 16, 2020 · 4 comments · Fixed by #340
Labels
C: Calyx Extension or change to the Calyx IL S: Available Can be worked upon

Comments

@rachitnigam
Copy link
Contributor

Attribute annotations are currently limited to just groups. This proposal makes them available to cells, ports, and components. Attributes should become a general mechanism to attach extra information to various parts of the IL.

As a starting example, consider a type recovery pass that walks over cells and ports and tries to come up with signed or unsigned type for each:

component foo(@type("signed") inp1: 32) -> (@type("signed") out: 32) {
  cells {
    @type("unsigned") r = std_reg(32);
  }
}

Following the principle laid out in #270 ("everything that is solved for groups must be solved for components"), we can attach "static" information to a component and change the compilation of invoke (#273) to generate a faster FSM.

@sampsyo
Copy link
Contributor

sampsyo commented Dec 16, 2020

Nice. This is a cool idea. And I like the implicit proposal that we could use this for an optional "overlay" type system that actually represents data types.

@sgpthomas
Copy link
Collaborator

would be a useful debugging tool as well. for an analysis like live-range-analysis, it would be super useful to be able to annotate the things live at each group

@rachitnigam rachitnigam added C: Calyx Extension or change to the Calyx IL S: Available Can be worked upon labels Dec 26, 2020
@rachitnigam
Copy link
Contributor Author

An annotation called "fsm" that the verilog backend can use to generate optimized case-based transition:

cells {
  @encoding("fsm") fsm = std_reg(32); // <- added during compilation
}

@cgyurgyik
Copy link
Collaborator

Another idea is following LLVM's opaque pointer approach, i.e., give types to reads/writes instead of the underlying memory. This is similar to what our binary operators currently do, and would ensure we don't have type clashing for the memory, which will likely be reinterpreted many different ways.

component foo(@type("signed") inp1: 32) -> (@type("signed") out: 32) {
  cells {
    r = std_reg(32);
  }
  wires {
    @type("unsigned") out = r.out; 
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: Calyx Extension or change to the Calyx IL S: Available Can be worked upon
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants