Skip to content

[hail] Simplify nested struct inserts broken by lets#7096

Merged
danking merged 3 commits intohail-is:masterfrom
tpoterba:struct-unpacking-2
Sep 20, 2019
Merged

[hail] Simplify nested struct inserts broken by lets#7096
danking merged 3 commits intohail-is:masterfrom
tpoterba:struct-unpacking-2

Conversation

@tpoterba
Copy link
Contributor

Following up on the last PR, that didn't actually solve the general problem. See the test at the bottom for an example of an IR that wasn't matching the rule.

case _ => true
}
case Let(name, value, body) if {
@tailrec def getNestedInsertFields(x: IR): Option[InsertFields] = x match {
Copy link
Member

Choose a reason for hiding this comment

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

Ultimately, I think the right way to handle optimization rules being obscured by lets (and other things like ifs) is with commuting conversions. In this case, the commuting conversion is Let("a", Let("b", B, A), body) -> Let("b", B, Let("a", A, body)). After all instances of that rule have run, the value of a let never contains a top-level let.

Do you think that would have any negative consequences in the current system? I'm a little concerned about how complex some of these simplify rules are getting.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oh, this does seem better. I'll give that a shot.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

great suggestion! Takes the simplify.scala change down to one line :)

@danking danking merged commit edd724f into hail-is:master Sep 20, 2019
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.

3 participants