Lunderberg commented on PR #15916:
URL: https://github.com/apache/tvm/pull/15916#issuecomment-1787961361

   > The simpler approach, is actually to just enable well-form check to detect 
the related issues and require tuple to be inlined.
   
   Oh, certainly agreed that the well-formed check is the simpler one to 
introduce in the short-term.  I think it adds complexity in the long-term, 
though.
   
   * Not evident to readers of the code.  A well-formed check can only detect 
ill-formed IR once it has been generated.  Encoding it in the C++ types used in 
the IR informs a reader what structures are allowed.
     
   * Not evident to pass writers.  A well-formed check can only detect 
ill-formed IR after a pass runs.  Encoding it in the C++ types of the IR 
provides feedback from the C++ compiler, because ill-formed structures would 
cause a compilation error.
     
   * Not comprehensive.  A well-formed check can only detect whether the 
currently tested input to a pass produces ill-formed IR.  Encoding a 
requirement in the C++ types of the IR ensures that a pass cannot produce 
ill-formed IR.
   
   > Where pass writer can simply do the items if needed once detected by 
wellform check.
   
   This is the case I want to avoid, because this is too late of a warning.  It 
occurs after a pass has been designed and written, often only when more 
comprehensive inputs are used in CI.  Adding a new design constraint that late 
in development often requires re-design of the implementation in order to 
follow the new constraint, resulting in significant repetition of effort.
   
   > Aka we would like to eliminate the extra binding lookup for both syntax 
reason, as well as reduction of metral overhead for having to think about 
optional binding lookup or polymorphism.
   
   I agree with the reasoning of reducing the mental overhead, but think that 
comes from having as many constraints exposed to the C++ type system as 
possible.  (See [earlier 
comment](https://github.com/apache/tvm/pull/15916#issuecomment-1781157045) for 
ways this could be done.)  By making illegal states be impossible to represent, 
the mental overhead of avoiding illegal states is removed. If illegal states 
can be represented, we increase the mental overhead of avoiding those illegal 
states.


-- 
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: commits-unsubscr...@tvm.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to