You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by GitBox <gi...@apache.org> on 2022/09/01 14:42:09 UTC
[GitHub] [tvm] sunggg commented on a diff in pull request #12628: [MetaSchedule] Introduce `Union` and `OrderedUnion` in Database
sunggg commented on code in PR #12628:
URL: https://github.com/apache/tvm/pull/12628#discussion_r960742815
##########
include/tvm/meta_schedule/database.h:
##########
@@ -357,6 +357,22 @@ class Database : public runtime::ObjectRef {
*/
TVM_DLL static Database JSONDatabase(String path_workload, String path_tuning_record,
bool allow_missing);
+ /*!
+ * \brief A database composed of multiple databases, allowing users to guide IR rewriting using
+ * combined knowledge of those databases. To each query, it returns the best record among all the
+ * databases given.
+ * \param databases The list of databases to be combined.
+ * \return The combined database.
+ */
+ TVM_DLL static Database UnionDatabase(Array<Database, void> databases);
Review Comment:
Discussed offline with @junrushao and learned about more context behind the naming.
I'm okay with the naming, but would like to suggest more documentation with examples for better guidance.
Some examples we could use:
```python
### Examples
Assumption:
* db1, d2 does not have tuning records for the target workload.
* each db3, db4, db5 have tuning records r3, r4, r5 for target workload respectively.
Case 1. `UnionDatabase`:
merged_db = ms.database.UnionDatabase(
db1, # no record
db2, # no record
db3, # has r3
db4 # has r4
)
# This return best one between r3 and r4
merged_db.query_tuning_record(..., target_workload)
Case 2. `OrderedUnionDatabase`
merged_db = ms.database.OrderedUnionDatabase(
db1, # no record
db2, # no record
db3, # has r3
db4 # has r4
)
# This return r3
merged_db.query_tuning_record(..., target_workload)
Case 3. Mix-use scenario
merged_db = ms.database.UnionDatabase(
db1, # no record
db2, # no record
db3, # has r3
ms.database.OrderedUnionDatabase( # returns r4
db4, # has r4
db5, # has r5
)
)
# This return best one between r3 and r4
merged_db.query_tuning_record(..., target_workload)
Case 4. Another mix-use scenario
merged_db = ms.database.UnionDatabase(
db1, # no record
db2, # no record
db3, # has r3
ms.database.UnionDatabase( # returns best one between r4 and r5
db4, # has r4
db5, # has r5
)
)
# This return best one among r3, r4 and r5
merged_db.query_tuning_record(..., target_workload)
Case 5. Yet another mix-use scenario
merged_db = ms.database.OrderedUnionDatabase(
db1, # no record
db2, # no record
ms.database.UnionDatabase( # returns best one between r3 and r4
db3, # has r3
db4, # has r4
)
db5, # has r5
)
# This return best one between r3 and r4
merged_db.query_tuning_record(..., target_workload)
```
--
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-unsubscribe@tvm.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org