PhilippvK opened a new issue, #15548:
URL: https://github.com/apache/tvm/issues/15548

   In e030b14, the task extraction mechanism for MetaScheudle was adapted to 
use a Module-scope NameSupply for the naming of constants. However it seems 
like due to the use of `PostOrderVisit` in 
https://github.com/apache/tvm/blob/927df5966237f10978319044716d93c90bf8843c/src/relay/backend/task_extraction.cc#L80C10-L80C10,
 the generation of constant names starts with the last fused function 
(layer/layer/task) in the model while in the normal compilation flow it seems 
to  be the other way around.
   
   This leads to a few problems/limitations when matching the tasks using all 
ModuleEquality implementations
   1. The names of constants in a single tasks depends on all the previous/past 
layers in the model which makes it impossible to reuse tuning results for a 
single layer which also exits in a different model.
   2. Due to the swapped ordering of constant names I get missmatches when 
trying to use a previously trained database on the same TFLite model.
   
   ### Expected behavior
   
   The tuned records for the MLPerf Tiny KWS model should be used during 
compilation.
   
   ### Actual behavior
   
   Warning about failed lookup for tasks in JSON database:
   
   ```
   [11:46:25] .../llvm-gen/tvm/src/relay/backend/te_compiler_cache.cc:676: 
Warning: Cannot find workload: 
tvmgen_default_fused_nn_conv2d_subtract_add_fixed_point_multiply_per_axis_add_clip_cast_7
   ```
   
   Here is the diff between the TIR used in TVM compilation pipeline (green) 
vs. the one in the MetaScheduler Tuning database:
   
   
![tvm_meta_bug](https://github.com/apache/tvm/assets/7712605/4553313b-0f60-4697-ac32-435dec89cd59)
   
   The data of the NDArrays matches (which would not even be an issue when 
using the `ignore-ndarray` ModuleEquality), hence the only changes in the diff 
are die names of the constants.
   
   ### Environment
   
   - Ubuntu 20.04
   - Python 3.8
   - TVM commit 081cc2ef64c866f6dc2e33dbf6912395d09ca749 (Will check 
`upstream/main` later)
   
   ### Steps to reproduce
   
   Will follow up with a script later today!
   
   ### Triage
   
   Please refer to the list of label tags 
[here](https://github.com/apache/tvm/wiki/Issue-Triage-Labels) to find the 
relevant tags and add them below in a bullet format (example below).
   
   * tune:meta_schedule
   
   CC @masahi @mbs-octoml 


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