tqchen commented on a change in pull request #7472:
URL: https://github.com/apache/tvm/pull/7472#discussion_r578711807



##########
File path: include/tvm/runtime/profiling.h
##########
@@ -0,0 +1,80 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/*!
+ * \file include/tvm/runtime/profiling.h
+ * \brief Runtime profiling including timers.
+ */
+#ifndef TVM_RUNTIME_PROFILING_H_
+#define TVM_RUNTIME_PROFILING_H_
+
+#include <dlpack/dlpack.h>
+#include <tvm/runtime/c_runtime_api.h>
+#include <tvm/runtime/device_api.h>
+#include <tvm/runtime/object.h>
+#include <tvm/runtime/registry.h>
+
+#include <chrono>
+#include <map>
+#include <string>
+
+namespace tvm {
+namespace runtime {
+
+/*!
+ * \brief Default timer if one does not exist to the platform.
+ * \param ctx The context to time on.
+ *
+ * Note that this timer performs synchronization between the device and CPU,
+ * which can lead to overhead in the reported results.
+ */
+TypedPackedFunc<int64_t()> DefaultTimer(TVMContext ctx);

Review comment:
       As a compiler we do not have opinions about which stream to use, and 
users can set the streams of the operator they would like to run on via 
https://github.com/apache/tvm/blob/main/include/tvm/runtime/c_runtime_api.h#L482.
 For example, if you want to embed the generated operator into a pytorch 
program, you might want to set the context stream to be the stream of the 
current pytorch context




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to