During the development of relay passes, a problem come up repeatedly: a pass often get input it does not expect, and as a result, it fail (either implicitly, taking exponential time or produce incorrect output, or explicitly, typically when a functor does not get match). typical example is interpreter/aot compiler need fuseops ran (more precisely, it need no Op outside of PrimitiveFunction) and need the expr having no sharing, fold scale axis/fuse ops not working on pattern matching (will fuse through both of them, while they do special case on if), partial evaluator assuming no recursion right now, dead code eliminator assuming no effect... I think we should have a feature manager, which, given a module, or an expr, will return a set of feature (feature is an enum). pass then can check that the input is good, by using the feature manager to calculate the given input, then checking to see if there is anymore. we can also bake this into the pass manager: each pass will have to specify three more argument: FeatureSet input_features, FeatureSet add_features, FeatureSet remove_features, that denote which feature can this pass handle, which feature it may add, and which feature it will remove. This make the passmanager more robust (we can know whether a sequence is safe to run, before actually running it, and we can use this to guide random shuffling of pass). @tqchen @zhiics @jroesch @slyubomirsky any idea?
-- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/dmlc/tvm/issues/3236