You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by an...@apache.org on 2022/09/17 00:01:32 UTC

[tvm] 14/18: vm.cc optional

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

andrewzhaoluo pushed a commit to branch aluo/rebase-09162022-autotensorization
in repository https://gitbox.apache.org/repos/asf/tvm.git

commit 26be4144110c7598901793312fbde6399fe2eb9e
Author: Andrew Zhao Luo <an...@gmail.com>
AuthorDate: Fri Sep 2 15:08:26 2022 -0700

    vm.cc optional
---
 src/runtime/vm/profiler/vm.cc | 2 +-
 src/runtime/vm/profiler/vm.h  | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/runtime/vm/profiler/vm.cc b/src/runtime/vm/profiler/vm.cc
index db8a3f5dc2..0ace910b5c 100644
--- a/src/runtime/vm/profiler/vm.cc
+++ b/src/runtime/vm/profiler/vm.cc
@@ -73,7 +73,7 @@ PackedFunc VirtualMachineDebug::GetFunction(const std::string& name,
           invoke(arg_name);
           prof_.operator*().Stop();
           auto report = prof_.operator*().Report();
-          prof_ = std::nullopt;  // releases hardware counters
+          prof_ = dmlc::optional<profiling::Profiler>();  // releases hardware counters
           return report;
         });
   } else if (name == "profile_rpc") {
diff --git a/src/runtime/vm/profiler/vm.h b/src/runtime/vm/profiler/vm.h
index f0374c75a7..0c9e94c0dd 100644
--- a/src/runtime/vm/profiler/vm.h
+++ b/src/runtime/vm/profiler/vm.h
@@ -25,11 +25,11 @@
 #ifndef TVM_RUNTIME_VM_PROFILER_VM_H_
 #define TVM_RUNTIME_VM_PROFILER_VM_H_
 
+#include <dmlc/optional.h>
 #include <tvm/runtime/profiling.h>
 #include <tvm/runtime/vm/vm.h>
 
 #include <memory>
-#include <optional>
 #include <string>
 #include <unordered_map>
 #include <vector>
@@ -55,7 +55,7 @@ class VirtualMachineDebug : public VirtualMachine {
   void OpStopHook() final;
 
   std::unordered_map<Index, std::string> packed_index_map_;
-  std::optional<profiling::Profiler> prof_;
+  dmlc::optional<profiling::Profiler> prof_;
 };
 
 }  // namespace vm