You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by GitBox <gi...@apache.org> on 2022/05/18 19:22:33 UTC

[GitHub] [tvm] areusch commented on a diff in pull request #11244: [CRT runtime] Added functions TVMPlatformPreFuncCall and TVMPlatformPostFuncCall

areusch commented on code in PR #11244:
URL: https://github.com/apache/tvm/pull/11244#discussion_r876261416


##########
include/tvm/runtime/crt/platform.h:
##########
@@ -116,6 +116,24 @@ tvm_crt_error_t TVMPlatformTimerStop(double* elapsed_time_seconds);
  */
 tvm_crt_error_t TVMPlatformGenerateRandom(uint8_t* buffer, size_t num_bytes);
 
+/*! \brief Platform-specific before measurement call.
+ *
+ * A function which is called before calling TVMFuncCall in the RuntimeEvaluator.
+ * Can be used, for example, to initialize stuff using platform-specific code.

Review Comment:
   ```suggestion
    * Can be used, for example, to reset global state which may affect the results of measurement.
   ```



##########
src/runtime/crt/common/crt_runtime_api.c:
##########
@@ -526,6 +526,11 @@ tvm_crt_error_t RunTimeEvaluator(tvm_function_index_t function_index, TVMValue*
     int exec_count = 0;
     // do-while structure ensures we run even when `min_repeat_ms` isn't set (i.e., is 0).
     do {
+      err = TVMPlatformBeforeMeasurement();
+      if (err != kTvmErrorNoError && err != kTvmErrorFunctionCallNotImplemented) {

Review Comment:
   i think you could just do the one check `err != kTvmErrorNoError` and return `kTvmErrorNoError` by default from the weak-linked functions. thoughts?



##########
include/tvm/runtime/crt/platform.h:
##########
@@ -116,6 +116,24 @@ tvm_crt_error_t TVMPlatformTimerStop(double* elapsed_time_seconds);
  */
 tvm_crt_error_t TVMPlatformGenerateRandom(uint8_t* buffer, size_t num_bytes);
 
+/*! \brief Platform-specific before measurement call.
+ *
+ * A function which is called before calling TVMFuncCall in the RuntimeEvaluator.

Review Comment:
   ```suggestion
    * A function which is called before calling TVMFuncCall in the TimeEvaluator.
   ```



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

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org