vinx13 commented on PR #14097:
URL: https://github.com/apache/tvm/pull/14097#issuecomment-1445035675

   I think a question we need to think about is whether we need duplicated args 
in BYOC cases. There are design tradeoffs here:
   
   A1: Keep duplicated args so that the composite function signature is 
consistent with the pattern (`add(wildcard(), wildcard())`). In most cases this 
is easier for codegen. It can directly use arg0 and arg1 of the function as 
args for `add`. This is also the case for cutlass byoc, where we use arg0, arg1 
for x and w of conv2d, respectively. 
   
   A2: Allow args being deduplicated. This approach indeed will generate 
duplicating composite function (with one arg or two args for add) for the 
codegen. 
   
   On the other hand, We also find some cases that the composite function 
doesn’t have args in the consistent argument order as the pattern / or 
‘so-called’ anchor op. For example, we may have composite function like:
   ```
   def fused_permute_matmul(y, x):
     lv = permute_dims(y)
     return matmul(x, lv)
   ```
   where the arg order of `matmul` is different from the composite function. 
   In fact, the op fuser generally doesn’t guarantee the argument order of the 
fused function, its order is simply the order  of the appearance of bindings in 
the original function. And as a result, for the above case we have to find the 
matmul, and then for each arg of matmul we need to find the corresponding 
function argument. 
   
   If the order of args in generally not assumed and we need to find such 
correspondence (anchor op args <-> function args) anyways, then whether the 
function args are deduplicated probably is less important. 
   


-- 
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]

Reply via email to