[Unity][Transform] Handle call_tir_inplace in FuseTIR and FuseOps#16487
[Unity][Transform] Handle call_tir_inplace in FuseTIR and FuseOps#16487slyubomirsky merged 8 commits intoapache:mainfrom
call_tir_inplace in FuseTIR and FuseOps#16487Conversation
call_tir_inplace in FuseTIRcall_tir_inplace in FuseTIR and FuseOps.
Lunderberg
left a comment
There was a problem hiding this comment.
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()) { |
There was a problem hiding this comment.
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.)
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Probably more personal preference, so either works.
call_tir_inplace in FuseTIR and FuseOps.call_tir_inplace in FuseTIR and FuseOps
Lunderberg
left a comment
There was a problem hiding this comment.
Thank you for the changes, and looks good!
ce9d196 to
111f08e
Compare
This PR handles in-place
PrimFuncs inFuseTIR, namely by propagating the in-place indices. This required a few updates in the two passes but nothing very heavy-duty.