Mousius commented on PR #14010:
URL: https://github.com/apache/tvm/pull/14010#issuecomment-1433383813

   > > @srkreddy1238 is there a reason you're not doing this via something like 
`RelayToTIR` or similar? it seems you could create a `Target` hook which would 
do this whenever it encounters specific parameters rather than having to 
manually add it to the `tvmc` command line?
   > 
   > @Mousius thanks for the review.
   > 
   > Initially I thought of this approach where I can create an external 
codegen and extend the `REGISTERED_CODEGEN` as shown below.
   > 
   > 
https://github.com/apache/tvm/blob/e7ad4bc0717537807b24a27f8f9c75586b1ee047/python/tvm/driver/tvmc/composite_target.py#L50
   > 
   > 
   > This way tvmc calls the pass_pipeline and we can do what ever we want over 
the module.
   > These hooks are essentially small personalization over existing 
transforms. Like in this example we tried to customize the Mixed Precision pass 
for Adreno. Essentially we are helping developers with these simple reusable 
utilities. These hooks are optional features on the existing target and they 
may grow over time. Creating multiple targets for each such feature results in 
multiple similar targets definitions.
   > 
   > I thought hooks may be a better approach to keep them away from the 
existing real external codegens.
   > 
   > What do you think ?
   
   I think there's two different thoughts:
   
   Rather than wrapping this in `tvmc`, it'd be good to use `Target` hooks and 
process the `Target` within the hook to decide any additional lowering passes, 
there's also pre-processing logic which you can apply - I gather this is harder 
as it's going through some GPU target? I'm a bit nervous about creating a whole 
hook registry for this as it seems like we should be pushing that into the 
`Target` rather than working around it in `tvmc`- from a users point of view it 
should be something like:
   ```
   tvmc --target=opencl --target-opencl-mixed-precision
   ```
   Else, do you agree it's a bit odd to have to essentially build your ML 
pipeline in CLI arguments?
   
   The other thing is that you mentioned this being reusable utility, I like 
that approach more, and I'm curious whether we can add a `--mixed-precision` 
option so as to benefit all `Target`s? 


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