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

eDSL: Superior NameGen #2153

Open
anshumanmohan opened this issue Jun 17, 2024 · 1 comment
Open

eDSL: Superior NameGen #2153

anshumanmohan opened this issue Jun 17, 2024 · 1 comment
Labels
C: calyx-py Items that have to do with the builder library good first issue Good issue to start contributing on Calyx

Comments

@anshumanmohan
Copy link
Contributor

anshumanmohan commented Jun 17, 2024

The eDSL currently does a quick and dirty job when it comes to name generation.

It maintains a counter starting at 0, and every time it needs to makes a new name for a cell, it does something like {the_op_in_question}_{counter++}. This is why end up with things like reg_0, add_1, mult_2, etc.

The true solution is something akin to what Calyx itself does:

pub struct NameGenerator {
name_hash: HashMap<Id, i64>,
generated_names: HashSet<Id>,
}

It actually tracks existing names and avoids clashes. Let's eventually upgrade the eDSL to something like this.

Originally posted by @anshumanmohan in #2152 (comment)

@anshumanmohan anshumanmohan changed the title eDSL: NameGen eDSL: Superior NameGen Jun 17, 2024
@anshumanmohan anshumanmohan added C: calyx-py Items that have to do with the builder library good first issue Good issue to start contributing on Calyx labels Jun 17, 2024
@ethanuppal
Copy link
Contributor

@rachitnigam, I'm curious why name_hash isn't used additionally to store whether the name has been defined, this task delegated to a separate HashSet? It doesn't seem hard to remove generated_names and keep the same functionality. That being said, it's not important.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: calyx-py Items that have to do with the builder library good first issue Good issue to start contributing on Calyx
Projects
None yet
Development

No branches or pull requests

2 participants