PhilippvK opened a new issue, #15549: URL: https://github.com/apache/tvm/issues/15549
I found out that while MetaScheduler Database Utilities (`QueryTuningRecord`, `QuerySchedule`, `QueryIRModule`) take a target argument, it is not used at all: https://github.com/apache/tvm/blob/01324ef97c22cb63fb7b2885e9cd2858e991779b/src/meta_schedule/database/database.cc#L177-L188 ### Expected behavior If a UnionDatabase is used to combine tuning records of different target hardware but the same task/workload, `GetTopK` should only return records which are matching the specified target `-model` and or `-key`. ### Actual behavior This leads to the problem that a Database will return TuningRecords which are unsupported on a given Target which is not desirable and may lead to crashes (i.e. when using auto-tensorization using target-specific llvm intrinsics). Additionally I was unable to combine multiple smaller MetaScheduler Databases into a singe large one which was a common practice for AutoTVM (See Tophub). ### Some context AutoTVM deals with target-specific records by performing a 2-level lookup: 1. Find best workload "by model" (i.e. `-model=bcm2837`) if match available 2. Otherwise find best workload "by target key" (i.e. `-keys=cpu`) if available 3. Do not return any record if step 1. & 2. failed. ### Proposed "Solution" To make MetaSchdule Databases aware of the targets `-model` attribute I had to adapt the [`GetTopK`](https://github.com/apache/tvm/blob/01324ef97c22cb63fb7b2885e9cd2858e991779b/src/meta_schedule/database/database.cc#L182) methods here: https://github.com/PhilippvK/tvm/commit/0f9d3aa6d22ef2891e21d3d2c4a196ec78163cf8 If an alignment between AutoTVM and Metascheduler is desirable here, I am happy to open up a PR for this after some further testing of my patch. In case this limitation was implemented intentionally, I would like to ask why the aforementioned methods do even accept a `Target` argument. ### Environment Any environment details, such as: Operating System, TVM version, etc ### Steps to reproduce Preferably a minimal script to cause the issue to occur. ### 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 -- 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]
