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-tirx.git


The following commit(s) were added to refs/heads/main by this push:
     new 00c3d86a Inline simple public API accessors and forwarding helpers 
(#18)
00c3d86a is described below

commit 00c3d86aa647e474268e338c6e1026359f7153e1
Author: Tianqi Chen <[email protected]>
AuthorDate: Wed Oct 21 20:01:56 2026 -0400

    Inline simple public API accessors and forwarding helpers (#18)
    
    Move 29 small module, pass, target, layout, builder, and
    dispatch-context helpers into their owning public headers, removing
    their redundant out-of-line DLL exports. Keep shared registries, TLS,
    transformation executors, hidden implementation factories, and
    diagnostic ownership in the library; preserve the helpers’ existing
    checks, allocation, and copy/move behavior.
---
 include/tvm/ir/module.h              | 47 +++++++++++++++++++++++++++++-------
 include/tvm/ir/transform.h           | 29 +++++++++++++++++++---
 include/tvm/script/ir_builder/base.h | 19 ++++++++++++---
 include/tvm/target/target.h          | 34 ++++++++++++++++++++++----
 include/tvm/tirx/layout.h            | 37 +++++++++++++++++++++++-----
 include/tvm/tirx/tile/context.h      | 10 ++++++--
 src/ir/module.cc                     | 46 -----------------------------------
 src/ir/transform.cc                  | 24 ------------------
 src/script/ir_builder/base.cc        | 25 -------------------
 src/target/target.cc                 | 31 ------------------------
 src/tirx/ir/layout/tile_core.cc      | 32 ------------------------
 src/tirx/tile/context.cc             | 12 ---------
 12 files changed, 146 insertions(+), 200 deletions(-)

diff --git a/include/tvm/ir/module.h b/include/tvm/ir/module.h
index 9a22f91a..db518ffe 100644
--- a/include/tvm/ir/module.h
+++ b/include/tvm/ir/module.h
@@ -177,7 +177,10 @@ class IRModuleNode : public ffi::Object {
    * \param update Controls whether you can replace a definition in the
    * environment.
    */
-  TVM_TIRX_DLL void Add(const GlobalVar& var, const BaseFunc& func, bool 
update = false);
+  void Add(const GlobalVar& var, const BaseFunc& func, bool update = false) {
+    BaseFunc checked_func = func;
+    AddUnchecked(var, checked_func);
+  }
 
   /*!
    * \brief Add a function to the global environment.
@@ -193,27 +196,36 @@ class IRModuleNode : public ffi::Object {
    * \param var The name of the global function to update.
    * \param func The new function.
    */
-  TVM_TIRX_DLL void Update(const GlobalVar& var, const BaseFunc& func);
+  void Update(const GlobalVar& var, const BaseFunc& func) { this->Add(var, 
func, true); }
 
   /*!
    * \brief Update an array of global infos in the global environment.
    * \param name The name of the global info.
    * \param info The new array of global infos.
    */
-  TVM_TIRX_DLL void UpdateGlobalInfo(const ffi::String& name, const 
ffi::Array<GlobalInfo>& info);
+  void UpdateGlobalInfo(const ffi::String& name, const ffi::Array<GlobalInfo>& 
info) {
+    this->global_infos.Set(name, info);
+  }
 
   /*!
    * \brief Remove a function from the global environment.
    * \param var The name of the global function to update.
    */
-  TVM_TIRX_DLL void Remove(const GlobalVar& var);
+  void Remove(const GlobalVar& var) {
+    auto functions_node = this->functions.CopyOnWrite();
+    functions_node->erase(var);
+    auto gvar_node = global_var_map_.CopyOnWrite();
+    gvar_node->erase(var->name_hint);
+  }
 
   /*!
    * \brief Check if the global_var_map_ contains a global variable.
    * \param name The variable name.
    * \returns true if contains, otherise false.
    */
-  TVM_TIRX_DLL bool ContainGlobalVar(const ffi::String& name) const;
+  bool ContainGlobalVar(const ffi::String& name) const {
+    return global_var_map_.find(name) != global_var_map_.end();
+  }
 
   /*!
    * \brief Lookup a global function by its variable.
@@ -234,27 +246,34 @@ class IRModuleNode : public ffi::Object {
    * \param var The global var to lookup.
    * \returns The function named by the variable argument.
    */
-  TVM_TIRX_DLL BaseFunc Lookup(const GlobalVar& var) const;
+  BaseFunc Lookup(const GlobalVar& var) const {
+    auto it = functions.find(var);
+    TVM_FFI_ICHECK(it != functions.end()) << "There is no definition of " << 
var;
+    return (*it).second;
+  }
 
   /*!
    * \brief Look up a global function by its string name
    * \param name The name of the function.
    * \returns The function named by the argument.
    */
-  TVM_TIRX_DLL BaseFunc Lookup(const ffi::String& name) const;
+  BaseFunc Lookup(const ffi::String& name) const {
+    GlobalVar id = this->GetGlobalVar(name);
+    return this->Lookup(id);
+  }
 
   /*!
    * \brief Update the functions inside this environment by
    *        functions in another environment.
    * \param other The other environment.
    */
-  TVM_TIRX_DLL void Update(const IRModule& other);
+  void Update(const IRModule& other);
 
   /*!
    * \brief Create a shallow copy of this IRModule.
    * \returns The shallow copy of the IRModule.
    */
-  TVM_TIRX_DLL IRModule ShallowCopy();
+  IRModule ShallowCopy();
 
   static constexpr TVMFFISEqHashKind _type_s_eq_hash_kind = 
kTVMFFISEqHashKindTreeNode;
 
@@ -312,6 +331,16 @@ class IRModule : public ffi::ObjectRef {
   TVM_DEFINE_OBJECT_REF_COW_METHOD(IRModuleNode);
 };
 
+inline void IRModuleNode::Update(const IRModule& mod) {
+  for (auto pair : mod->functions) {
+    this->AddUnchecked(pair.first, pair.second);
+  }
+}
+
+inline IRModule IRModuleNode::ShallowCopy() {
+  return IRModule(this->functions, this->attrs, this->global_infos);
+}
+
 namespace attr {
 
 // Following are attributes for IRModule only.
diff --git a/include/tvm/ir/transform.h b/include/tvm/ir/transform.h
index c515e95a..58500e32 100644
--- a/include/tvm/ir/transform.h
+++ b/include/tvm/ir/transform.h
@@ -87,7 +87,7 @@ class PassContext : public ffi::ObjectRef {
    * \brief Construct a PassContext containing the default configurations.
    * \return The new PassContext.
    */
-  TVM_TIRX_DLL static PassContext Create();
+  static PassContext Create();
   /*!
    * \brief Get the default pass context in the current scope.
    * \return The pass context.
@@ -134,7 +134,7 @@ class PassContext : public ffi::ObjectRef {
    * \param mod The module that an optimization pass runs on.
    * \param info The pass information.
    */
-  TVM_TIRX_DLL void InstrumentAfterPass(const IRModule& mod, const PassInfo& 
info) const;
+  void InstrumentAfterPass(const IRModule& mod, const PassInfo& info) const;
 
   /*!
    * \brief Check whether a pass is enabled.
@@ -259,7 +259,12 @@ class PassInfo : public ffi::ObjectRef {
    * \param opt_level The optimization level
    * \param name Name of the pass.
    */
-  TVM_TIRX_DLL PassInfo(int opt_level, ffi::String name);
+  PassInfo(int opt_level, ffi::String name) {
+    auto pass_info = ffi::make_object<PassInfoObj>();
+    pass_info->opt_level = opt_level;
+    pass_info->name = std::move(name);
+    data_ = std::move(pass_info);
+  }
 
   TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(PassInfo, ffi::ObjectRef, 
PassInfoObj);
 };
@@ -316,7 +321,9 @@ class Pass : public ffi::ObjectRef {
    *
    * \return The transformed module.
    */
-  TVM_TIRX_DLL IRModule operator()(IRModule mod) const;
+  IRModule operator()(IRModule mod) const {
+    return this->operator()(std::move(mod), PassContext::Current());
+  }
 
   /*!
    * \brief Transform mod using a functor under a given pass context.
@@ -658,6 +665,20 @@ inline PassContextObj* PassContext::operator->() {
   return static_cast<PassContextObj*>(get_mutable());
 }
 
+inline PassContext PassContext::Create() {
+  return PassContext(ffi::UnsafeInit{}, ffi::make_object<PassContextObj>());
+}
+
+inline void PassContext::InstrumentAfterPass(const IRModule& ir_module,
+                                             const PassInfo& pass_info) const {
+  auto pass_ctx_node = this->operator->();
+  if (pass_ctx_node->instruments.defined()) {
+    for (PassInstrument pi : pass_ctx_node->instruments) {
+      pi->RunAfterPass(ir_module, pass_info);
+    }
+  }
+}
+
 }  // namespace transform
 }  // namespace tvm
 
diff --git a/include/tvm/script/ir_builder/base.h 
b/include/tvm/script/ir_builder/base.h
index 580f78b1..3836eda6 100644
--- a/include/tvm/script/ir_builder/base.h
+++ b/include/tvm/script/ir_builder/base.h
@@ -184,15 +184,26 @@ class IRBuilderObj : public ffi::Object {
    * \brief Push a frontend source location for IR constructed in the nested 
scope.
    * \return The index of the pushed scope, valid until it is popped.
    */
-  TVM_TIRX_DLL int64_t PushLoc(Location loc);
+  int64_t PushLoc(Location loc) {
+    locs.push_back(std::move(loc));
+    return static_cast<int64_t>(locs.size()) - 1;
+  }
   /*!
    * \brief Update a source location without changing its nested scopes.
    * \param index The index returned by PushLoc for a scope that has not been 
popped.
    * \param loc The replacement location for that scope.
    */
-  TVM_TIRX_DLL void UpdateLoc(int64_t index, Location loc);
+  void UpdateLoc(int64_t index, Location loc) {
+    TVM_FFI_CHECK(index >= 0 && static_cast<size_t>(index) < locs.size(), 
ValueError)
+        << "Invalid source location scope";
+    locs[index] = std::move(loc);
+  }
   /*! \brief Pop the innermost frontend source location. */
-  TVM_TIRX_DLL void PopLoc();
+  void PopLoc() {
+    TVM_FFI_CHECK(!locs.empty(), ValueError)
+        << "ValueError: No source location exists in the builder scope";
+    locs.pop_back();
+  }
   /*! \brief Normalize the full active source stack with an optional explicit 
location. */
   TVM_TIRX_DLL Location ResolveLoc(Location location = UnknownLoc()) const;
   /*! \brief Compose active and explicit source context onto the same 
supported node or frame. */
@@ -206,7 +217,7 @@ class IRBuilderObj : public ffi::Object {
 class IRBuilder : public ffi::ObjectRef {
  public:
   /*! \brief Creates an IRBuilder. */
-  TVM_TIRX_DLL IRBuilder();
+  IRBuilder() { data_ = ffi::make_object<IRBuilderObj>(); }
   TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(IRBuilder, ffi::ObjectRef, 
IRBuilderObj);
 
  public:
diff --git a/include/tvm/target/target.h b/include/tvm/target/target.h
index 5e9300f0..4e12f08e 100644
--- a/include/tvm/target/target.h
+++ b/include/tvm/target/target.h
@@ -31,6 +31,7 @@
 #include <tvm/runtime/device_api.h>
 #include <tvm/target/target_kind.h>
 
+#include <algorithm>
 #include <string>
 
 namespace tvm {
@@ -65,9 +66,14 @@ class TargetObj : public ffi::Object {
   /*! \return Export target to JSON-like configuration */
   TVM_TIRX_DLL ffi::Map<ffi::String, ffi::Any> ToConfig() const;
   /*! \return The ffi::Optional<Target> typed target host of the TargetObj */
-  TVM_TIRX_DLL ffi::Optional<Target> GetHost() const;
+  ffi::Optional<Target> GetHost() const;
   /*! \return The device type for this target */
-  TVM_TIRX_DLL int GetTargetDeviceType() const;
+  int GetTargetDeviceType() const {
+    if (ffi::Optional<int64_t> device_type = 
GetAttr<int64_t>("target_device_type")) {
+      return static_cast<int>(device_type.value());
+    }
+    return kind->default_device_type;
+  }
 
   /*!
    * \brief Check if the target contains a key
@@ -77,7 +83,10 @@ class TargetObj : public ffi::Object {
    * \return True if the target's `TargetObj::keys` contains the
    * specified key, False otherwise.
    */
-  TVM_TIRX_DLL bool HasKey(const ffi::String& query_key) const;
+  bool HasKey(const ffi::String& query_key) const {
+    return std::any_of(keys.begin(), keys.end(),
+                       [&query_key](const auto& key) { return key == 
query_key; });
+  }
 
   static void RegisterReflection() {
     namespace refl = tvm::ffi::reflection;
@@ -174,7 +183,12 @@ class Target : public ffi::ObjectRef {
    * \param target The Target typed object with host field undefined for target
    * \param host The Target typed object for target host
    */
-  TVM_TIRX_DLL explicit Target(Target target, ffi::Optional<Target> host);
+  explicit Target(Target target, ffi::Optional<Target> host) {
+    ffi::ObjectPtr<TargetObj> n = ffi::make_object<TargetObj>(*target.get());
+    n->host =
+        host.has_value() ? 
ffi::Optional<ffi::ObjectRef>(std::move(host).value()) : std::nullopt;
+    data_ = std::move(n);
+  }
   explicit Target(ffi::UnsafeInit tag, ffi::ObjectPtr<TargetObj> n) : 
ffi::ObjectRef(tag) {
     data_ = std::move(n);
   }
@@ -184,7 +198,15 @@ class Target : public ffi::ObjectRef {
   TVM_TIRX_DLL static Target WithHost(const Target& target, const 
ffi::Optional<Target>& host);
 
   /*! \return The target with the host stripped out */
-  TVM_TIRX_DLL Target WithoutHost() const;
+  Target WithoutHost() const {
+    if ((*this)->GetHost()) {
+      auto output = ffi::make_object<TargetObj>(*get());
+      output->host = std::nullopt;
+      return Target(ffi::UnsafeInit{}, std::move(output));
+    } else {
+      return *this;
+    }
+  }
 
  private:
   // enable with syntax.
@@ -202,6 +224,8 @@ class Target : public ffi::ObjectRef {
   TVM_TIRX_DLL void ExitWithScope();
 };
 
+inline ffi::Optional<Target> TargetObj::GetHost() const { return 
this->host.as<Target>(); }
+
 namespace attr {
 /*! \brief Optional backend configuration on a Target, distinct from 
serialized IR/runtime JSON. */
 inline constexpr ffi::reflection::AttrKey<ffi::Map<ffi::String, ffi::Any>> 
kBackendConfig{
diff --git a/include/tvm/tirx/layout.h b/include/tvm/tirx/layout.h
index 1085dd90..cadee745 100644
--- a/include/tvm/tirx/layout.h
+++ b/include/tvm/tirx/layout.h
@@ -30,10 +30,13 @@
 #include <tvm/ffi/object.h>
 #include <tvm/ir/expr.h>
 #include <tvm/ir/module.h>
+#include <tvm/ir/prim/op.h>
 #include <tvm/sym/analyzer.h>
 #include <tvm/target/target.h>
 #include <tvm/tirx/tile/thread_scope.h>
 
+#include <algorithm>
+
 namespace tvm {
 
 namespace tirx {
@@ -154,7 +157,10 @@ class IterNode : public ffi::Object {
 
 class Iter : public ffi::ObjectRef {
  public:
-  TVM_TIRX_DLL explicit Iter(PrimExpr extent, PrimExpr stride, Axis axis);
+  explicit Iter(PrimExpr extent, PrimExpr stride, Axis axis) {
+    auto n = ffi::make_object<IterNode>(std::move(extent), std::move(stride), 
std::move(axis));
+    data_ = std::move(n);
+  }
   TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(Iter, ffi::ObjectRef, 
IterNode);
 };
 
@@ -177,11 +183,20 @@ class TileLayoutNode : public LayoutNode {
 
 class TileLayout : public Layout {
  public:
-  TVM_TIRX_DLL explicit TileLayout(ffi::Array<Iter> shard, ffi::Array<Iter> 
replica,
-                                   ffi::Map<Axis, PrimExpr> offset);
+  explicit TileLayout(ffi::Array<Iter> shard, ffi::Array<Iter> replica,
+                      ffi::Map<Axis, PrimExpr> offset)
+      : Layout(ffi::UnsafeInit{}) {
+    auto n = ffi::make_object<TileLayoutNode>();
+    n->shard = std::move(shard);
+    n->replica = std::move(replica);
+    n->offset = std::move(offset);
+    data_ = std::move(n);
+  }
 
   /*! \brief Get the shape of the shard */
-  TVM_TIRX_DLL ffi::Array<PrimExpr> GetShardShape() const;
+  ffi::Array<PrimExpr> GetShardShape() const {
+    return get()->shard.Map([](const Iter& iter) { return iter->extent; });
+  }
 
   /*!
    * \brief Whether the tile describes contiguous row-major memory strides.
@@ -193,10 +208,20 @@ class TileLayout : public Layout {
   TVM_TIRX_DLL bool IsContiguous(ffi::Optional<sym::Analyzer> analyzer = 
std::nullopt) const;
 
   /*! \brief Is the layout trivial (pure memory, identical mapping) */
-  TVM_TIRX_DLL bool IsTrivial() const;
+  bool IsTrivial() const {
+    if (get()->shard.size() > 1) return false;
+    if (get()->shard.size() == 1) {
+      if (!get()->shard[0]->axis->IsMemoryAxis() || 
!prim::IsOne(get()->shard[0]->stride))
+        return false;
+    }
+    return get()->replica.size() == 0 && get()->offset.size() == 0;
+  }
 
   /*! \brief Has Thread Axis */
-  TVM_TIRX_DLL bool HasThreadAxis() const;
+  bool HasThreadAxis() const {
+    return std::any_of(get()->shard.begin(), get()->shard.end(),
+                       [](const Iter& iter) { return 
iter->axis->IsThreadAxis(); });
+  }
 
   /*! \brief Get the scope pair of the layout */
   TVM_TIRX_DLL ffi::Optional<Tuple<ThreadScope, ThreadScope>> GetScope() const;
diff --git a/include/tvm/tirx/tile/context.h b/include/tvm/tirx/tile/context.h
index 97bff8b4..03f936a7 100644
--- a/include/tvm/tirx/tile/context.h
+++ b/include/tvm/tirx/tile/context.h
@@ -114,10 +114,16 @@ class DispatchContextObj : public ffi::Object {
   TVM_TIRX_DLL void AddPostTensorDefStmt(TensorVar tensor, Stmt stmt);
 
   /*! \brief Set a value in the shared state cache. */
-  TVM_TIRX_DLL void SharedStateSet(ffi::String key, ffi::ObjectRef value);
+  void SharedStateSet(ffi::String key, ffi::ObjectRef value) { 
shared_state.Set(key, value); }
 
   /*! \brief Get a value from the shared state cache. */
-  TVM_TIRX_DLL ffi::Optional<ffi::ObjectRef> SharedStateGet(ffi::String key);
+  ffi::Optional<ffi::ObjectRef> SharedStateGet(ffi::String key) {
+    auto it = shared_state.find(key);
+    if (it != shared_state.end()) {
+      return (*it).second;
+    }
+    return ffi::Optional<ffi::ObjectRef>();
+  }
 
   TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tirx.DispatchContext", 
DispatchContextObj, ffi::Object);
 };
diff --git a/src/ir/module.cc b/src/ir/module.cc
index a1f3d2f2..857006e5 100644
--- a/src/ir/module.cc
+++ b/src/ir/module.cc
@@ -132,10 +132,6 @@ TVM_FFI_STATIC_INIT_BLOCK() {
       });
 }
 
-bool IRModuleNode::ContainGlobalVar(const ffi::String& name) const {
-  return global_var_map_.find(name) != global_var_map_.end();
-}
-
 GlobalVar IRModuleNode::GetGlobalVar(const ffi::String& name) const {
   auto it = global_var_map_.find(name);
   if (it == global_var_map_.end()) {
@@ -166,11 +162,6 @@ tvm::ffi::Array<GlobalVar> IRModuleNode::GetGlobalVars() 
const {
   return tvm::ffi::Array<GlobalVar>(global_vars);
 }
 
-void IRModuleNode::Add(const GlobalVar& var, const BaseFunc& f, bool update) {
-  BaseFunc checked_func = f;
-  AddUnchecked(var, checked_func);
-}
-
 void IRModuleNode::AddUnchecked(const GlobalVar& var, const BaseFunc& func) {
   this->functions.Set(var, func);
 
@@ -185,43 +176,6 @@ void IRModuleNode::AddUnchecked(const GlobalVar& var, 
const BaseFunc& func) {
   global_var_map_.Set(var->name_hint, var);
 }
 
-void IRModuleNode::Update(const GlobalVar& var, const BaseFunc& func) {
-  this->Add(var, func, true);
-}
-
-void IRModuleNode::UpdateGlobalInfo(const ffi::String& name, const 
ffi::Array<GlobalInfo>& info) {
-  this->global_infos.Set(name, info);
-}
-
-void IRModuleNode::Remove(const GlobalVar& var) {
-  auto functions_node = this->functions.CopyOnWrite();
-  functions_node->erase(var);
-  auto gvar_node = global_var_map_.CopyOnWrite();
-  gvar_node->erase(var->name_hint);
-}
-
-BaseFunc IRModuleNode::Lookup(const GlobalVar& var) const {
-  auto it = functions.find(var);
-  TVM_FFI_ICHECK(it != functions.end()) << "There is no definition of " << var;
-  return (*it).second;
-}
-
-BaseFunc IRModuleNode::Lookup(const ffi::String& name) const {
-  GlobalVar id = this->GetGlobalVar(name);
-  return this->Lookup(id);
-}
-
-void IRModuleNode::Update(const IRModule& mod) {
-  for (auto pair : mod->functions) {
-    // TODO(@jroesch): rename into IRModule.
-    this->AddUnchecked(pair.first, pair.second);
-  }
-}
-
-IRModule IRModuleNode::ShallowCopy() {
-  return IRModule(this->functions, this->attrs, this->global_infos);
-}
-
 IRModule IRModule::FromExpr(const Expr& expr,
                             const tvm::ffi::Map<GlobalVar, BaseFunc>& 
global_funcs) {
   auto mod = IRModule(global_funcs);
diff --git a/src/ir/transform.cc b/src/ir/transform.cc
index 80a7cda7..965dfd20 100644
--- a/src/ir/transform.cc
+++ b/src/ir/transform.cc
@@ -180,10 +180,6 @@ ffi::Map<ffi::String, ffi::Map<ffi::String, ffi::String>> 
PassContext::ListConfi
   return PassConfigManager::Global()->ListConfigs();
 }
 
-PassContext PassContext::Create() {
-  return PassContext(ffi::UnsafeInit{}, ffi::make_object<PassContextObj>());
-}
-
 namespace {
 struct ClearOnError {
   ffi::Array<PassInstrument>* instruments{nullptr};
@@ -281,19 +277,6 @@ bool PassContext::InstrumentBeforePass(const IRModule& 
ir_module, const PassInfo
   return should_run;
 }
 
-void PassContext::InstrumentAfterPass(const IRModule& ir_module, const 
PassInfo& pass_info) const {
-  auto pass_ctx_node = this->operator->();
-  if (pass_ctx_node->instruments.defined()) {
-    for (PassInstrument pi : pass_ctx_node->instruments) {
-      pi->RunAfterPass(ir_module, pass_info);
-    }
-  }
-}
-
-IRModule Pass::operator()(IRModule mod) const {
-  return this->operator()(std::move(mod), PassContext::Current());
-}
-
 namespace {
 /*! \brief Marker line that precedes the TVMScript-rendered location block. */
 constexpr const char* kLocationMarker = "Location (TVMScript):";
@@ -465,13 +448,6 @@ class ModulePass : public Pass {
   TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(ModulePass, Pass, 
ModulePassObj);
 };
 
-PassInfo::PassInfo(int opt_level, ffi::String name) {
-  auto pass_info = ffi::make_object<PassInfoObj>();
-  pass_info->opt_level = opt_level;
-  pass_info->name = std::move(name);
-  data_ = std::move(pass_info);
-}
-
 ModulePass::ModulePass(
     ffi::TypedFunction<IRModule(ffi::RValueRef<IRModule>, PassContext)> 
pass_func,
     PassInfo pass_info)
diff --git a/src/script/ir_builder/base.cc b/src/script/ir_builder/base.cc
index 6a2d83eb..1cd23480 100644
--- a/src/script/ir_builder/base.cc
+++ b/src/script/ir_builder/base.cc
@@ -146,31 +146,6 @@ void 
IRBuilderFrameObj::AddCallback(ffi::TypedFunction<void()> callback) {
   IRBuilder::Current()->frames.back()->callbacks.push_back(callback);
 }
 
-IRBuilder::IRBuilder() {
-  ffi::ObjectPtr<IRBuilderObj> n = ffi::make_object<IRBuilderObj>();
-  n->frames.clear();
-  n->result = std::nullopt;
-  n->locs.clear();
-  data_ = n;
-}
-
-int64_t IRBuilderObj::PushLoc(Location loc) {
-  locs.push_back(std::move(loc));
-  return static_cast<int64_t>(locs.size()) - 1;
-}
-
-void IRBuilderObj::UpdateLoc(int64_t index, Location loc) {
-  TVM_FFI_CHECK(index >= 0 && static_cast<size_t>(index) < locs.size(), 
ValueError)
-      << "Invalid source location scope";
-  locs[index] = std::move(loc);
-}
-
-void IRBuilderObj::PopLoc() {
-  TVM_FFI_CHECK(!locs.empty(), ValueError)
-      << "ValueError: No source location exists in the builder scope";
-  locs.pop_back();
-}
-
 Location IRBuilderObj::ResolveLoc(Location location) const {
   std::vector<Location> normalized;
   normalized.reserve(locs.size());
diff --git a/src/target/target.cc b/src/target/target.cc
index 56dee045..b1dffa3e 100644
--- a/src/target/target.cc
+++ b/src/target/target.cc
@@ -126,13 +126,6 @@ Target::Target(const ffi::Map<ffi::String, ffi::Any>& 
config) {
   data_ = std::move(target);
 }
 
-Target::Target(Target target, ffi::Optional<Target> host) {
-  ffi::ObjectPtr<TargetObj> n = ffi::make_object<TargetObj>(*target.get());
-  n->host =
-      host.has_value() ? 
ffi::Optional<ffi::ObjectRef>(std::move(host).value()) : std::nullopt;
-  data_ = std::move(n);
-}
-
 TVM_FFI_STATIC_INIT_BLOCK() {
   namespace refl = tvm::ffi::reflection;
   TargetObj::RegisterReflection();
@@ -157,30 +150,6 @@ ffi::Map<ffi::String, ffi::Any> TargetObj::ToConfig() 
const {
   return result;
 }
 
-ffi::Optional<Target> TargetObj::GetHost() const { return 
this->host.as<Target>(); }
-
-Target Target::WithoutHost() const {
-  if ((*this)->GetHost()) {
-    auto output = ffi::make_object<TargetObj>(*get());
-    output->host = std::nullopt;
-    return Target(ffi::UnsafeInit{}, std::move(output));
-  } else {
-    return *this;
-  }
-}
-
-int TargetObj::GetTargetDeviceType() const {
-  if (ffi::Optional<int64_t> device_type = 
GetAttr<int64_t>("target_device_type")) {
-    return static_cast<int>(device_type.value());
-  }
-  return kind->default_device_type;
-}
-
-bool TargetObj::HasKey(const ffi::String& query_key) const {
-  return std::any_of(keys.begin(), keys.end(),
-                     [&query_key](const auto& key) { return key == query_key; 
});
-}
-
 /*! \brief Entry to hold the Target context stack. */
 struct TVMTargetThreadLocalEntry {
   /*! \brief The current target context */
diff --git a/src/tirx/ir/layout/tile_core.cc b/src/tirx/ir/layout/tile_core.cc
index 38b0b7b4..b5f57773 100644
--- a/src/tirx/ir/layout/tile_core.cc
+++ b/src/tirx/ir/layout/tile_core.cc
@@ -150,11 +150,6 @@ TVM_FFI_INLINE ffi::Expected<ffi::UnchangedOr<ffi::Any>> 
TileLayoutMaybeInplaceM
 TVM_FFI_STATIC_INIT_BLOCK() { ComposeLayoutNode::RegisterReflection(); }
 
 /**************** Iter ****************/
-Iter::Iter(PrimExpr extent, PrimExpr stride, Axis axis) {
-  auto n = ffi::make_object<IterNode>(extent, stride, axis);
-  data_ = std::move(n);
-}
-
 TVM_FFI_STATIC_INIT_BLOCK() {
   namespace refl = tvm::ffi::reflection;
   IterNode::RegisterReflection();
@@ -170,16 +165,6 @@ TVM_FFI_STATIC_INIT_BLOCK() {
 }
 
 /**************** TileLayout ****************/
-TileLayout::TileLayout(ffi::Array<Iter> shard, ffi::Array<Iter> replica,
-                       ffi::Map<Axis, PrimExpr> offset)
-    : Layout(ffi::UnsafeInit{}) {
-  auto n = ffi::make_object<TileLayoutNode>();
-  n->shard = shard;
-  n->replica = replica;
-  n->offset = offset;
-  data_ = std::move(n);
-}
-
 TVM_FFI_STATIC_INIT_BLOCK() {
   namespace refl = tvm::ffi::reflection;
   TileLayoutNode::RegisterReflection();
@@ -307,10 +292,6 @@ ffi::Map<ffi::String, PrimExpr> 
layout_details::Apply(const TileLayoutNode* layo
   return result;
 }
 
-ffi::Array<PrimExpr> TileLayout::GetShardShape() const {
-  return get()->shard.Map([](const Iter& iter) { return iter->extent; });
-}
-
 bool TileLayout::IsContiguous(ffi::Optional<sym::Analyzer> analyzer) const {
   if (!get()->replica.empty()) return false;
   static const Axis memory_axis = Axis::Get("m");
@@ -336,14 +317,6 @@ bool TileLayout::IsContiguous(ffi::Optional<sym::Analyzer> 
analyzer) const {
   return true;
 }
 
-bool TileLayout::IsTrivial() const {
-  if (get()->shard.size() > 1) return false;
-  if (get()->shard.size() == 1) {
-    if (!get()->shard[0]->axis->IsMemoryAxis() || 
!IsOne(get()->shard[0]->stride)) return false;
-  }
-  return get()->replica.size() == 0 && get()->offset.size() == 0;
-}
-
 TVM_FFI_STATIC_INIT_BLOCK() {
   namespace refl = tvm::ffi::reflection;
   refl::GlobalDef().def("tirx.TileLayoutIsContiguous",
@@ -355,11 +328,6 @@ TVM_FFI_STATIC_INIT_BLOCK() {
   });
 }
 
-bool TileLayout::HasThreadAxis() const {
-  return std::any_of(get()->shard.begin(), get()->shard.end(),
-                     [](const Iter& iter) { return iter->axis->IsThreadAxis(); 
});
-}
-
 ffi::Optional<ffi::Tuple<ThreadScope, ThreadScope>> TileLayout::GetScope() 
const {
   if (!HasThreadAxis()) return std::nullopt;
 
diff --git a/src/tirx/tile/context.cc b/src/tirx/tile/context.cc
index 65b8d014..e58e60ad 100644
--- a/src/tirx/tile/context.cc
+++ b/src/tirx/tile/context.cc
@@ -73,18 +73,6 @@ void DispatchContextObj::AddPostTensorDefStmt(TensorVar 
tensor, Stmt stmt) {
   callbacks.Set(callback::kPostTensorDefStmt.name, mapping);
 }
 
-void DispatchContextObj::SharedStateSet(ffi::String key, ffi::ObjectRef value) 
{
-  shared_state.Set(key, value);
-}
-
-ffi::Optional<ffi::ObjectRef> DispatchContextObj::SharedStateGet(ffi::String 
key) {
-  auto it = shared_state.find(key);
-  if (it != shared_state.end()) {
-    return (*it).second;
-  }
-  return ffi::Optional<ffi::ObjectRef>();
-}
-
 DispatchContext::DispatchContext(Target target, ThreadScope thread_scope,
                                  ffi::Map<ffi::String, ffi::Tuple<PrimVar, 
PrimExpr>> launch_params,
                                  ffi::Map<Var, Range> var_range_map, bool 
alloc_only,

Reply via email to