Skip to content

Commit 3081bf2

Browse files
committed
[REFACTOR][Target] Move ConfigSchema into target headers
Place ConfigSchema with its TargetKind consumer and align its namespace with the public target API. Update includes and type references while preserving schema behavior.
1 parent 0587e59 commit 3081bf2

4 files changed

Lines changed: 8 additions & 11 deletions

File tree

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@
1818
*/
1919

2020
/*!
21-
* \file tvm/ir/config_schema.h
21+
* \file tvm/target/config_schema.h
2222
* \brief Minimal schema for dynamic config canonicalization and validation.
2323
*
2424
* This utility is intended for dynamic map-like configs (e.g. Target options),
2525
* where we still want type checking, optional defaulting, and canonicalization.
2626
*/
27-
#ifndef TVM_IR_CONFIG_SCHEMA_H_
28-
#define TVM_IR_CONFIG_SCHEMA_H_
27+
#ifndef TVM_TARGET_CONFIG_SCHEMA_H_
28+
#define TVM_TARGET_CONFIG_SCHEMA_H_
2929

3030
#include <tvm/ffi/container/map.h>
3131
#include <tvm/ffi/function.h>
@@ -39,7 +39,6 @@
3939
#include <vector>
4040

4141
namespace tvm {
42-
namespace ir {
4342

4443
/*!
4544
* \brief Dynamic config schema for map-like options.
@@ -236,7 +235,6 @@ class ConfigSchema {
236235
bool error_on_unknown_ = true;
237236
};
238237

239-
} // namespace ir
240238
} // namespace tvm
241239

242-
#endif // TVM_IR_CONFIG_SCHEMA_H_
240+
#endif // TVM_TARGET_CONFIG_SCHEMA_H_

‎include/tvm/target/target_kind.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@
2727
#include <tvm/ffi/container/map.h>
2828
#include <tvm/ffi/function.h>
2929
#include <tvm/ffi/reflection/registry.h>
30-
#include <tvm/ir/config_schema.h>
3130
#include <tvm/runtime/base.h>
31+
#include <tvm/target/config_schema.h>
3232

3333
#include <utility>
3434
#include <vector>
@@ -75,7 +75,7 @@ class TargetKindNode : public ffi::Object {
7575

7676
private:
7777
/*! \brief ConfigSchema for validating and resolving target attributes */
78-
ir::ConfigSchema schema_;
78+
ConfigSchema schema_;
7979
friend class TargetKindRegistry;
8080
friend class TargetKindDef;
8181
friend class TargetInternal;

‎src/target/target_kind.cc‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ TVM_FFI_STATIC_INIT_BLOCK() {
189189
.set_default_device_type(kDLCPU) // line break
190190
.def_option<ffi::Array<Target>>(
191191
"devices",
192-
ir::ConfigSchema::AttrValidator(ffi::TypedFunction<ffi::Any(ffi::Any)>( //
192+
ConfigSchema::AttrValidator(ffi::TypedFunction<ffi::Any(ffi::Any)>( //
193193
[](ffi::Any val) -> ffi::Any {
194194
// Allow elements to be strings or dicts, converting them to Target objects.
195195
if (val.try_cast<ffi::Array<Target>>().has_value()) return val;

‎tests/cpp/config_schema_test.cc‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,9 @@
2121
#include <tvm/ffi/container/array.h>
2222
#include <tvm/ffi/container/map.h>
2323
#include <tvm/ffi/string.h>
24-
#include <tvm/ir/config_schema.h>
24+
#include <tvm/target/config_schema.h>
2525

2626
using namespace tvm;
27-
using namespace tvm::ir;
2827
namespace refl = tvm::ffi::reflection;
2928

3029
// Basic int/bool/string option resolution

0 commit comments

Comments
 (0)