This is an automated email from the ASF dual-hosted git repository.

tqchen pushed a commit to branch refactor-s3
in repository https://gitbox.apache.org/repos/asf/tvm.git

commit ddad26ff3bef67ec32e00c864f7d58f6b2b8c644
Author: tqchen <[email protected]>
AuthorDate: Mon May 5 09:35:15 2025 -0400

    [WIN] Remove lock to avoid mutex dep at init time
---
 ffi/src/ffi/traceback_win.cc     |  2 ++
 src/node/attr_registry.h         | 11 +----------
 src/target/llvm/llvm_instance.cc |  2 +-
 3 files changed, 4 insertions(+), 11 deletions(-)

diff --git a/ffi/src/ffi/traceback_win.cc b/ffi/src/ffi/traceback_win.cc
index 4c89c4f239..d49f9e00af 100644
--- a/ffi/src/ffi/traceback_win.cc
+++ b/ffi/src/ffi/traceback_win.cc
@@ -23,8 +23,10 @@
  */
 #ifdef _MSC_VER
 
+// clang-format off
 #include <windows.h>
 #include <dbghelp.h>  // NOLINT(*)
+// clang-format on
 
 #include <tvm/ffi/c_api.h>
 #include <tvm/ffi/error.h>
diff --git a/src/node/attr_registry.h b/src/node/attr_registry.h
index 2b022d3e45..e150549bb9 100644
--- a/src/node/attr_registry.h
+++ b/src/node/attr_registry.h
@@ -28,7 +28,6 @@
 #include <tvm/runtime/packed_func.h>
 
 #include <memory>
-#include <mutex>
 #include <unordered_map>
 #include <utility>
 #include <vector>
@@ -95,7 +94,6 @@ class AttrRegistry {
    */
   void UpdateAttr(const String& attr_name, const KeyType& key, Any value, int 
plevel) {
     using runtime::TVMRetValue;
-    std::lock_guard<std::mutex> lock(mutex_);
     auto& op_map = attrs_[attr_name];
     if (op_map == nullptr) {
       op_map.reset(new AttrRegistryMapContainerMap<KeyType>());
@@ -122,7 +120,6 @@ class AttrRegistry {
    * \param key The key to the attribute table.
    */
   void ResetAttr(const String& attr_name, const KeyType& key) {
-    std::lock_guard<std::mutex> lock(mutex_);
     auto& op_map = attrs_[attr_name];
     if (op_map == nullptr) {
       return;
@@ -139,7 +136,6 @@ class AttrRegistry {
    * \return The result attribute map.
    */
   const AttrRegistryMapContainerMap<KeyType>& GetAttrMap(const String& 
attr_name) {
-    std::lock_guard<std::mutex> lock(mutex_);
     auto it = attrs_.find(attr_name);
     if (it == attrs_.end()) {
       LOG(FATAL) << "Attribute \'" << attr_name << "\' is not registered";
@@ -152,10 +148,7 @@ class AttrRegistry {
    * \param attr_name The name of the attribute.
    * \return The check result.
    */
-  bool HasAttrMap(const String& attr_name) {
-    std::lock_guard<std::mutex> lock(mutex_);
-    return attrs_.count(attr_name);
-  }
+  bool HasAttrMap(const String& attr_name) { return attrs_.count(attr_name); }
 
   /*!
    * \return a global singleton of the registry.
@@ -166,8 +159,6 @@ class AttrRegistry {
   }
 
  private:
-  // mutex to avoid registration from multiple threads.
-  std::mutex mutex_;
   // entries in the registry
   std::vector<std::unique_ptr<EntryType>> entries_;
   // map from name to entries.
diff --git a/src/target/llvm/llvm_instance.cc b/src/target/llvm/llvm_instance.cc
index a83a146826..b6191f5e85 100644
--- a/src/target/llvm/llvm_instance.cc
+++ b/src/target/llvm/llvm_instance.cc
@@ -363,7 +363,7 @@ LLVMTargetInfo::LLVMTargetInfo(LLVMInstance& instance, 
const TargetJSON& target)
   }
 #else
   if (maybe_level.has_value()) {
-    int level = maybe_level.value().operator int();
+    int level = maybe_level.value().cast<int>();
     if (level <= 0) {
       opt_level_ = llvm::CodeGenOptLevel::None;
     } else if (level == 1) {

Reply via email to