Skip to content

Conversation

@slyubomirsky
Copy link
Contributor

@slyubomirsky slyubomirsky commented Jan 30, 2024

This PR handles in-place PrimFuncs in FuseTIR, namely by propagating the in-place indices. This required a few updates in the two passes but nothing very heavy-duty.

@slyubomirsky slyubomirsky changed the title [Unity][Transform] Handle call_tir_inplace in FuseTIR [Unity][Transform] Handle call_tir_inplace in FuseTIR and FuseOps. Jan 30, 2024
Copy link
Contributor

@Lunderberg Lunderberg left a comment

Choose a reason for hiding this comment

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

Overall, looks good! The main requests for changing are to make it more robust against upstream errors.

mutator.fused_tir_funcs_.Set(gv, fused_tir);
const auto& [prim_func, indices] = FusedTIRConstructor::GetFusedTIR(mod, gv);
mutator.fused_tir_funcs_.Set(gv, prim_func);
if (!indices.empty()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Nitpick: Using if (indices.size()) instead of if (!indices.empty()) would avoiding double-negatives and make the condition easier to read. (Though, personal preference as if (indices.size()) relies on conversion of non-zero size_t to true.)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Kind of subjective, I think "not empty" is readable (sounds more like how it would be phrased verbally). I'll change it if you prefer it.

Copy link
Contributor

Choose a reason for hiding this comment

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

Probably more personal preference, so either works.

@slyubomirsky slyubomirsky changed the title [Unity][Transform] Handle call_tir_inplace in FuseTIR and FuseOps. [Unity][Transform] Handle call_tir_inplace in FuseTIR and FuseOps Jan 30, 2024
Copy link
Contributor

@Lunderberg Lunderberg left a comment

Choose a reason for hiding this comment

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

Thank you for the changes, and looks good!

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.

2 participants