-
Notifications
You must be signed in to change notification settings - Fork 299
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
[ExtractTestCode] Specify non-empty unqiue port names #6283
Conversation
auto name = getNameForPort(port.value(), srcPorts); | ||
// Append the port index to create unique names. | ||
auto name = | ||
b.getStringAttr(getNameForPort(port.value(), srcPorts).getValue() + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe can we do something simpler and more stable naming like this?
b.getStringAttr(getNameForPort(port.value(), srcPorts).getValue() + | |
auto name = getNameForPort(port.value(), srcPorts); | |
name = name.getValue().empty()? b.getStringAttr("arg" + Twine(port.index())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also “arg” seems to be a bit weird to me, can we do name this “port”?
So, the ETC introduces port name conflicts, that exposes the same bug, inconsistent port names on instance and module. So, we either check and rename only conflicting port names or create unique names by suffixing with the port index. I assumed the port names donot matter here, so suffixed with the index for all ports, instead of adding a check. |
792d689
to
4608a77
Compare
After looking at |
LGTM but may want someone who knows the code better than me to review |
llvm::SmallSetVector<StringRef, 8> portNames; | ||
portNames.insert(""); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use Namespace?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, we should use the Namespace
. Also added a check for empty string to use a stable and deterministic naming for them.
For such use cases, we need a Namespace::newName
which adds a given suffix only on conflict, the current version always adds the suffix.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Update ETC to add non-empty and unique port names. The name itself is not important, but this exposes a bug in inconsistent port names with the
hw.instance
and theModuleType
.This is a temporary fix, to unblock downstream tools, while the actual bug is fixed.