Skip to content

Conversation

tlemo
Copy link
Collaborator

@tlemo tlemo commented Feb 9, 2021

This PR introduced Fusion::lookupValue(), which looks up a Val node for a specified (vtype, name)

It should allow a clean solution for #643

@tlemo tlemo requested review from csarofeen and shmsong February 9, 2021 01:30
Copy link
Collaborator

@naoyam naoyam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

val_deque_.push_back(val);
return getValName(*(val->getValType()));
const auto vtype = *val->getValType();
const auto name = getValName(vtype);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A quick question just for clarification. When copying from Fusion 1 to Fusion 2, does the copying of the Vals need to proceed in the same order they are registered in Fusion 1 so that the name lookup will work?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good question: when cloning a fusion, the names will be copied directly w/o going through this registration path.

Copy link

@shmsong shmsong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks for implementing this very useful feature. 👍

@csarofeen
Copy link
Owner

Why is it cleaner to have a look up map than it is to track which nodes were created from which? I'm just fundamentally missing why this is a better approach. It seems like a stricter requirement on the fusion copy api than what we're relying on today.

@tlemo
Copy link
Collaborator Author

tlemo commented Feb 9, 2021

Why is it cleaner to have a look up map than it is to track which nodes were created from which? I'm just fundamentally missing why this is a better approach. It seems like a stricter requirement on the fusion copy api than what we're relying on today.

I tried to answer this in #643. Or more precisely, I tried to explain why the cloning mapping is an internal artifact not intended for external use (and it's not guaranteed to keep working the way it does - future changes to the cloning logic should not impact anything else). Even more importantly, the changes to the Fusion interface needed in order to expose the mapping are deeply problematic.

There's also separation of concerns: name to node lookup is a generic and independent operation which can be used for other use cases (ex. binding values for expression evaluation) and it doesn't have to be tied to the place where we do the copy.

@tlemo tlemo merged commit b9fde03 into 20_12_3_devel Feb 9, 2021
@tlemo tlemo deleted the tv_lookup branch February 11, 2021 18:05
tlemo added a commit that referenced this pull request Feb 11, 2021
csarofeen pushed a commit that referenced this pull request Apr 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants