tqchen commented on PR #17599:
URL: https://github.com/apache/tvm/pull/17599#issuecomment-2631723860
Thanks @srkreddy1238 for updates. I take a closer look and now understands
the motivation behind `add_attributes`. This is mainly to handle the case of
conv2d operators where texture can be supported.
However, attaching op attributes into the `call_tir` indeed introduce less
desirable impact, as the specification of `call_tir` originally do not have to
deal with these attributes, and having them will results in "leak through".
This would increase the surface area for developers working with `call_tir`
I also now understand the demand is to enable the finally fused `call_tir`
function to decide whether texture memory is feasible.
I think it is more cleaner to try a different approach. Instead of relying
on legalize pass, let us introduce an adreno specific `conv_dispatch` which
can be used before legalize, to offload these conv operators. We specifically
attach the attribute `tir.opencl_texture_2d_supported = true` to the call node.
Now the remaining question is where the schedule can appear
- The most clean way is to actually have `relax.andreno.conv_dispatch` to
call the dlight schedule and construct such call_tir, and mark it as already
scheduled. The only issue is that in such case followup FuseOps/TIR should
treat this as opaque, and do not yet have capabilities to run more fusions. But
we should be fine getting the right conv2d op scheduled
To further enable fusion, one can try adopt the following customized
legalize sequence
- S0: `relax.andreno.conv_dispatch`: run conv dispatch and mark it as
opaque with `tir.opencl_texture_2d_supported = true`
- S1: Run legalize and analysis
- S2: Do a pattern match to manually fuse the ewise onto the conv2d (by
creating a sub function that calls into conv2d then ewise), this will create a
sub function that calls into conv2d and then ewise, which can then be consumed
by FuseTIR
- Run FuseOps (this will try to fuse the other ops)
- Run FuseTIR
- Run dlight
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]