This is an automated email from the ASF dual-hosted git repository.
tqchen pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tvm.git
The following commit(s) were added to refs/heads/main by this push:
new 5b7c2fe787 [REFACTOR][Target] Move ConfigSchema into target headers
(#20509)
5b7c2fe787 is described below
commit 5b7c2fe787897c45dc5dbaa2a890e71ac88bd1bb
Author: Tianqi Chen <[email protected]>
AuthorDate: Wed Sep 30 22:24:27 2026 -0400
[REFACTOR][Target] Move ConfigSchema into target headers (#20509)
Place ConfigSchema with its TargetKind consumer and align its namespace
with the public target API. Update includes and type references while
preserving schema behavior.
---
include/tvm/{ir => target}/config_schema.h | 10 ++++------
include/tvm/target/target_kind.h | 4 ++--
src/target/target_kind.cc | 2 +-
tests/cpp/config_schema_test.cc | 3 +--
4 files changed, 8 insertions(+), 11 deletions(-)
diff --git a/include/tvm/ir/config_schema.h b/include/tvm/target/config_schema.h
similarity index 98%
rename from include/tvm/ir/config_schema.h
rename to include/tvm/target/config_schema.h
index 7131d8e617..7d9d04ef44 100644
--- a/include/tvm/ir/config_schema.h
+++ b/include/tvm/target/config_schema.h
@@ -18,14 +18,14 @@
*/
/*!
- * \file tvm/ir/config_schema.h
+ * \file tvm/target/config_schema.h
* \brief Minimal schema for dynamic config canonicalization and validation.
*
* This utility is intended for dynamic map-like configs (e.g. Target options),
* where we still want type checking, optional defaulting, and
canonicalization.
*/
-#ifndef TVM_IR_CONFIG_SCHEMA_H_
-#define TVM_IR_CONFIG_SCHEMA_H_
+#ifndef TVM_TARGET_CONFIG_SCHEMA_H_
+#define TVM_TARGET_CONFIG_SCHEMA_H_
#include <tvm/ffi/container/map.h>
#include <tvm/ffi/function.h>
@@ -39,7 +39,6 @@
#include <vector>
namespace tvm {
-namespace ir {
/*!
* \brief Dynamic config schema for map-like options.
@@ -236,7 +235,6 @@ class ConfigSchema {
bool error_on_unknown_ = true;
};
-} // namespace ir
} // namespace tvm
-#endif // TVM_IR_CONFIG_SCHEMA_H_
+#endif // TVM_TARGET_CONFIG_SCHEMA_H_
diff --git a/include/tvm/target/target_kind.h b/include/tvm/target/target_kind.h
index caea01b077..01acacd13e 100644
--- a/include/tvm/target/target_kind.h
+++ b/include/tvm/target/target_kind.h
@@ -27,8 +27,8 @@
#include <tvm/ffi/container/map.h>
#include <tvm/ffi/function.h>
#include <tvm/ffi/reflection/registry.h>
-#include <tvm/ir/config_schema.h>
#include <tvm/runtime/base.h>
+#include <tvm/target/config_schema.h>
#include <utility>
#include <vector>
@@ -75,7 +75,7 @@ class TargetKindNode : public ffi::Object {
private:
/*! \brief ConfigSchema for validating and resolving target attributes */
- ir::ConfigSchema schema_;
+ ConfigSchema schema_;
friend class TargetKindRegistry;
friend class TargetKindDef;
friend class TargetInternal;
diff --git a/src/target/target_kind.cc b/src/target/target_kind.cc
index 0e326f6a6f..d8e78a8140 100644
--- a/src/target/target_kind.cc
+++ b/src/target/target_kind.cc
@@ -189,7 +189,7 @@ TVM_FFI_STATIC_INIT_BLOCK() {
.set_default_device_type(kDLCPU) // line break
.def_option<ffi::Array<Target>>(
"devices",
-
ir::ConfigSchema::AttrValidator(ffi::TypedFunction<ffi::Any(ffi::Any)>( //
+ ConfigSchema::AttrValidator(ffi::TypedFunction<ffi::Any(ffi::Any)>(
//
[](ffi::Any val) -> ffi::Any {
// Allow elements to be strings or dicts, converting them to
Target objects.
if (val.try_cast<ffi::Array<Target>>().has_value()) return val;
diff --git a/tests/cpp/config_schema_test.cc b/tests/cpp/config_schema_test.cc
index 9db23a20ec..8d80099d96 100644
--- a/tests/cpp/config_schema_test.cc
+++ b/tests/cpp/config_schema_test.cc
@@ -21,10 +21,9 @@
#include <tvm/ffi/container/array.h>
#include <tvm/ffi/container/map.h>
#include <tvm/ffi/string.h>
-#include <tvm/ir/config_schema.h>
+#include <tvm/target/config_schema.h>
using namespace tvm;
-using namespace tvm::ir;
namespace refl = tvm::ffi::reflection;
// Basic int/bool/string option resolution