-
Notifications
You must be signed in to change notification settings - Fork 615
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
Quadratic naming with recursive functions #1606
Comments
lol. What's the desired behavior? It shouldn't grow linearly, either, or the same sort of issues will crop up eventually, especially with longer base names. If you rewrite this example iteratively (https://scastie.scala-lang.org/b2r2IB3cQFWALeO1SpFFKQ) you get logarithmic growth in the form of a postfixed integer, which seems desirable. Yet, we presumably do want multiple non-recursive function calls to build up these longish names. Maybe we could heuristically filter out the recursive (and mutually recursive) cases by not adding a prefix that has already been added before. Maybe it is as simple as building up a list of prefixes that have been used (("x", "w") in this case) and not adding a prefix that has already been used. |
For fixing just the quadratic issue, I think there's a straightforward solution. Basically this occurs because when doing a connection, eg. As for the linear growth issue, obviously we don't want that either, but I am treating it as a separate issue. It's admittedly not the best user experience but I was just thinking about adding a |
We could try to filter out prefixes that we've already seen so that's an option, but that would likely affect places where it may be desirable to repeat a prefix once or twice based on a particular call stack (in non-recursive places). |
Or, more simply, truncate the prefix to (N - suffix-length) chars, where N is the longest name we want to support. You're right, separate issue, though. |
Fixes #1606 Previously, the Data itself would be put on the prefix stack and its full name would be used as the prefix for subsequent names. This meant that prefixes would grow quadratically as the prefix is present both on the Data pushed to the stack, and on the stack itself. This is fixed by just using the "local" name of the Data being pushed on the stack. A related issue is defering the name resolution. This led to unintuitive behavior when the name of a Data used as a prefix is overriden later (usually when the Data is a return value). The overriding name would show up in prefixes twice instead of once. It is much more intuitive to grab the name at the moment of the connection creating the prefix rather than defering to later.
Fixes #1606 Previously, the Data itself would be put on the prefix stack and its full name would be used as the prefix for subsequent names. This meant that prefixes would grow quadratically as the prefix is present both on the Data pushed to the stack, and on the stack itself. This is fixed by just using the "local" name of the Data being pushed on the stack. A related issue is deferring the name resolution. This led to unintuitive behavior when the name of a Data used as a prefix is overridden later (usually when the Data is a return value). The overriding name would show up in prefixes twice instead of once. It is much more intuitive to grab the name at the moment of the connection creating the prefix rather than deferring to later.
Fixes #1606 Previously, the Data itself would be put on the prefix stack and its full name would be used as the prefix for subsequent names. This meant that prefixes would grow quadratically as the prefix is present both on the Data pushed to the stack, and on the stack itself. This is fixed by just using the "local" name of the Data being pushed on the stack. A related issue is deferring the name resolution. This led to unintuitive behavior when the name of a Data used as a prefix is overridden later (usually when the Data is a return value). The overriding name would show up in prefixes twice instead of once. It is much more intuitive to grab the name at the moment of the connection creating the prefix rather than deferring to later. Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Fixes #1606 Previously, the Data itself would be put on the prefix stack and its full name would be used as the prefix for subsequent names. This meant that prefixes would grow quadratically as the prefix is present both on the Data pushed to the stack, and on the stack itself. This is fixed by just using the "local" name of the Data being pushed on the stack. A related issue is deferring the name resolution. This led to unintuitive behavior when the name of a Data used as a prefix is overridden later (usually when the Data is a return value). The overriding name would show up in prefixes twice instead of once. It is much more intuitive to grab the name at the moment of the connection creating the prefix rather than deferring to later. Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> (cherry picked from commit 1b15dca)
* When prefixing with a data, eagly get local name (#1614) Fixes #1606 Previously, the Data itself would be put on the prefix stack and its full name would be used as the prefix for subsequent names. This meant that prefixes would grow quadratically as the prefix is present both on the Data pushed to the stack, and on the stack itself. This is fixed by just using the "local" name of the Data being pushed on the stack. A related issue is deferring the name resolution. This led to unintuitive behavior when the name of a Data used as a prefix is overridden later (usually when the Data is a return value). The overriding name would show up in prefixes twice instead of once. It is much more intuitive to grab the name at the moment of the connection creating the prefix rather than deferring to later. Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> (cherry picked from commit 1b15dca) * Waive MiMa failures on package private methods Co-authored-by: Jack Koenig <[email protected]>
Co-authored-by: Scala Steward <[email protected]> Co-authored-by: Scala Steward <[email protected]> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
When using an intermediate
Wire
(orReg
, anyData
) in a recursive function, the new naming behavior results in a quadratic naming blowup:This gives:
Executable example: https://scastie.scala-lang.org/O0xhmu4eRgqdXmUb2CfqbA
While this is very funny, it's also an important bug to fix. Internally I'm seeing names well over 2000 characters long and since the Verilog spec allows tools to only support names up to 1024 characters, we're already hitting problems in various tools.
Type of issue: bug report
Impact: no functional change
Development Phase: request
The text was updated successfully, but these errors were encountered: