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 2021/03/12 18:58:56 UTC

[GitHub] [tvm] areusch opened a new pull request #7653: Rename GraphRuntime to GraphExecutor

areusch opened a new pull request #7653:
URL: https://github.com/apache/tvm/pull/7653


   This PR implements the "GraphRuntime" part of [[RFC] Rename GraphRuntime and ilk to e.g. GraphExecutor](https://discuss.tvm.apache.org/t/rfc-rename-graphruntime-and-ilk-to-e-g-graphexecutor/9255). It's quite invasive, so it would be great if everyone could look it over. I think this PR is almost entirely targeted find-replace, as shown by the commit history.
   
   one thing I noticed: @u99127 to look at ARM Compute Lib changes, i'm not sure how you prefer to notate ARM compute lib.
   
   @tqchen @jroesch @junrushao1994 @tkonolige @zhiics @manupa-arm @ZihengJiang 
   


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [tvm] tkonolige commented on a change in pull request #7653: Rename GraphRuntime to GraphExecutor

Posted by GitBox <gi...@apache.org>.
tkonolige commented on a change in pull request #7653:
URL: https://github.com/apache/tvm/pull/7653#discussion_r593485323



##########
File path: CMakeLists.txt
##########
@@ -303,12 +303,12 @@ else()
   list(APPEND COMPILER_SRCS ${STACKVM_RUNTIME_SRCS})
 endif(USE_STACKVM_RUNTIME)
 
-if(USE_GRAPH_RUNTIME)
+if(USE_GRAPH_EXECUTOR)
   message(STATUS "Build with Graph runtime support...")

Review comment:
       Missed one




----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [tvm] zhiics commented on pull request #7653: Rename GraphRuntime to GraphExecutor

Posted by GitBox <gi...@apache.org>.
zhiics commented on pull request #7653:
URL: https://github.com/apache/tvm/pull/7653#issuecomment-804657364


   @areusch yeah, warning may not be needed. I was just trying to make sure that we don't break all the downstream deployment by letting them know that what is going to happen there. 


-- 
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:
users@infra.apache.org



[GitHub] [tvm] areusch commented on pull request #7653: Rename GraphRuntime to GraphExecutor

Posted by GitBox <gi...@apache.org>.
areusch commented on pull request #7653:
URL: https://github.com/apache/tvm/pull/7653#issuecomment-807800442


   @yzhliu @jroesch @tqchen would be great if we can merge this soon as it's easy for this PR to run in to merge conflicts.


-- 
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:
users@infra.apache.org



[GitHub] [tvm] tqchen commented on pull request #7653: Rename GraphRuntime to GraphExecutor

Posted by GitBox <gi...@apache.org>.
tqchen commented on pull request #7653:
URL: https://github.com/apache/tvm/pull/7653#issuecomment-805343734


   Given we are pre-1.0 we can just do our best effort when backward compact is possible but not necessary have to spend an extra mile of effort. may not hurt to post a notice to forum as well. e.g. https://discuss.tvm.apache.org/t/notice-tvm-runtime-rpc-upgrade-in-pr7488/9237/5


-- 
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:
users@infra.apache.org



[GitHub] [tvm] cnv1989 commented on a change in pull request #7653: Rename GraphRuntime to GraphExecutor

Posted by GitBox <gi...@apache.org>.
cnv1989 commented on a change in pull request #7653:
URL: https://github.com/apache/tvm/pull/7653#discussion_r600716290



##########
File path: apps/android_deploy/app/src/main/java/org/apache/tvm/android/demo/MainActivity.java
##########
@@ -224,108 +224,115 @@ protected void onPostExecute(Integer status) {
     }
 
     /*
-        Execute prediction for processed decode input bitmap image content on TVM graph runtime.
+        Execute prediction for processed decode input bitmap image content on TVM graph executor.
      */
     private class ModelRunAsyncTask extends AsyncTask<Bitmap, Void, Integer> {
         ProgressDialog dialog = new ProgressDialog(MainActivity.this);
 
         @Override
         protected Integer doInBackground(Bitmap... bitmaps) {
-            if (null != graphRuntimeModule) {
-                int count  = bitmaps.length;
-                for (int i = 0 ; i < count ; i++) {
-                    long processingTimeMs = SystemClock.uptimeMillis();
-                    Log.i(TAG, "Decode JPEG image content");
-
-                    // extract the jpeg content
-                    ByteArrayOutputStream stream = new ByteArrayOutputStream();
-                    bitmaps[i].compress(Bitmap.CompressFormat.JPEG,100,stream);
-                    byte[] byteArray = stream.toByteArray();
-                    Bitmap imageBitmap = BitmapFactory.decodeByteArray(byteArray, 0, byteArray.length);
-
-                    // crop input image at centre to model input size
-                    // commecial deploy note:: instead of cropying image do resize
-                    // image to model input size so we never lost the image content
-                    Bitmap cropImageBitmap = Bitmap.createBitmap(MODEL_INPUT_SIZE, MODEL_INPUT_SIZE, Bitmap.Config.ARGB_8888);
-                    Matrix frameToCropTransform = getTransformationMatrix(imageBitmap.getWidth(), imageBitmap.getHeight(),
-                            MODEL_INPUT_SIZE, MODEL_INPUT_SIZE, 0, true);
-                    Canvas canvas = new Canvas(cropImageBitmap);
-                    canvas.drawBitmap(imageBitmap, frameToCropTransform, null);
-
-                    // image pixel int values
-                    int[] pixelValues = new int[MODEL_INPUT_SIZE * MODEL_INPUT_SIZE];
-                    // image RGB float values
-                    float[] imgRgbValues = new float[MODEL_INPUT_SIZE * MODEL_INPUT_SIZE * IMG_CHANNEL];
-                    // image RGB transpose float values
-                    float[] imgRgbTranValues = new float[MODEL_INPUT_SIZE * MODEL_INPUT_SIZE * IMG_CHANNEL];
-
-                    // pre-process the image data from 0-255 int to normalized float based on the
-                    // provided parameters.
-                    cropImageBitmap.getPixels(pixelValues, 0, MODEL_INPUT_SIZE, 0, 0, MODEL_INPUT_SIZE, MODEL_INPUT_SIZE);
-                    for (int j = 0; j < pixelValues.length; ++j) {
-                        imgRgbValues[j * 3 + 0] = ((pixelValues[j] >> 16) & 0xFF)/255.0f;
-                        imgRgbValues[j * 3 + 1] = ((pixelValues[j] >> 8) & 0xFF)/255.0f;
-                        imgRgbValues[j * 3 + 2] = (pixelValues[j] & 0xFF)/255.0f;
-                    }
-
-                    // pre-process the image rgb data transpose based on the provided parameters.
-                    for (int k = 0; k < IMG_CHANNEL; ++k) {
-                        for (int l = 0; l < MODEL_INPUT_SIZE; ++l) {
-                            for (int m = 0; m < MODEL_INPUT_SIZE; ++m) {
-                                int dst_index = m + MODEL_INPUT_SIZE*l + MODEL_INPUT_SIZE*MODEL_INPUT_SIZE*k;
-                                int src_index = k + IMG_CHANNEL*m + IMG_CHANNEL*MODEL_INPUT_SIZE*l;
-                                imgRgbTranValues[dst_index] = imgRgbValues[src_index];
-                            }
-                        }
-                    }
-
-                    // get the function from the module(set input data)
-                    Log.i(TAG, "set input data");
-                    NDArray inputNdArray = NDArray.empty(new long[]{1, IMG_CHANNEL, MODEL_INPUT_SIZE, MODEL_INPUT_SIZE}, new TVMType("float32"));;
-                    inputNdArray.copyFrom(imgRgbTranValues);
-                    Function setInputFunc = graphRuntimeModule.getFunction("set_input");
-                    setInputFunc.pushArg(INPUT_NAME).pushArg(inputNdArray).invoke();
-                    // release tvm local variables
-                    inputNdArray.release();
-                    setInputFunc.release();
-
-                    // get the function from the module(run it)
-                    Log.i(TAG, "run function on target");
-                    Function runFunc = graphRuntimeModule.getFunction("run");
-                    runFunc.invoke();
-                    // release tvm local variables
-                    runFunc.release();
-
-                    // get the function from the module(get output data)
-                    Log.i(TAG, "get output data");
-                    NDArray outputNdArray = NDArray.empty(new long[]{1, 1000}, new TVMType("float32"));
-                    Function getOutputFunc = graphRuntimeModule.getFunction("get_output");
-                    getOutputFunc.pushArg(OUTPUT_INDEX).pushArg(outputNdArray).invoke();
-                    float[] output = outputNdArray.asFloatArray();
-                    // release tvm local variables
-                    outputNdArray.release();
-                    getOutputFunc.release();
-
-                    // display the result from extracted output data
-                    if (null != output) {
-                        int maxPosition = -1;
-                        float maxValue = 0;
-                        for (int j = 0; j < output.length; ++j) {
-                            if (output[j] > maxValue) {
-                                maxValue = output[j];
-                                maxPosition = j;
-                            }
-                        }
-                        processingTimeMs = SystemClock.uptimeMillis() - processingTimeMs;
-                        String label = "Prediction Result : ";
-                        label += labels.size() > maxPosition ? labels.get(maxPosition) : "unknown";
-                        label += "\nPrediction Time : " + processingTimeMs + "ms";
-                        mResultView.setText(label);
-                    }
-                    Log.i(TAG, "prediction finished");
+          if (null != graphExecutorModule) {

Review comment:
       Why is the indent size here is 2 while everywhere else its 4?




-- 
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:
users@infra.apache.org



[GitHub] [tvm] tqchen commented on pull request #7653: Rename GraphRuntime to GraphExecutor

Posted by GitBox <gi...@apache.org>.
tqchen commented on pull request #7653:
URL: https://github.com/apache/tvm/pull/7653#issuecomment-808173098


   oops. sorry there is a merge conflict due to another renaming PR. @areusch can you rebase. will prioritize merging this 


-- 
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:
users@infra.apache.org



[GitHub] [tvm] u99127 commented on pull request #7653: Rename GraphRuntime to GraphExecutor

Posted by GitBox <gi...@apache.org>.
u99127 commented on pull request #7653:
URL: https://github.com/apache/tvm/pull/7653#issuecomment-797733396


   @d-smirnov , @lhutton1 , @mbaret  : could you please take a look ? 


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [tvm] areusch commented on pull request #7653: Rename GraphRuntime to GraphExecutor

Posted by GitBox <gi...@apache.org>.
areusch commented on pull request #7653:
URL: https://github.com/apache/tvm/pull/7653#issuecomment-804961316


   @zhiics it's definitely a breaking change, i'm not opposed to the warning or some other way to notify downstream users. I don't know if code or forum or other is the best channel for that--i'm inclined to lean towards code in case forum or elsewhere also has snippets that may become outdated. i'm happy to do whatever you propose--which way do you prefer?
   
   @tqchen @jroesch  in case they have thoughts


-- 
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:
users@infra.apache.org



[GitHub] [tvm] areusch commented on pull request #7653: Rename GraphRuntime to GraphExecutor

Posted by GitBox <gi...@apache.org>.
areusch commented on pull request #7653:
URL: https://github.com/apache/tvm/pull/7653#issuecomment-797686966


   µTVM note: you will need to nuke `build/standalone_crt` after this change.


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [tvm] cnv1989 commented on a change in pull request #7653: Rename GraphRuntime to GraphExecutor

Posted by GitBox <gi...@apache.org>.
cnv1989 commented on a change in pull request #7653:
URL: https://github.com/apache/tvm/pull/7653#discussion_r600716290



##########
File path: apps/android_deploy/app/src/main/java/org/apache/tvm/android/demo/MainActivity.java
##########
@@ -224,108 +224,115 @@ protected void onPostExecute(Integer status) {
     }
 
     /*
-        Execute prediction for processed decode input bitmap image content on TVM graph runtime.
+        Execute prediction for processed decode input bitmap image content on TVM graph executor.
      */
     private class ModelRunAsyncTask extends AsyncTask<Bitmap, Void, Integer> {
         ProgressDialog dialog = new ProgressDialog(MainActivity.this);
 
         @Override
         protected Integer doInBackground(Bitmap... bitmaps) {
-            if (null != graphRuntimeModule) {
-                int count  = bitmaps.length;
-                for (int i = 0 ; i < count ; i++) {
-                    long processingTimeMs = SystemClock.uptimeMillis();
-                    Log.i(TAG, "Decode JPEG image content");
-
-                    // extract the jpeg content
-                    ByteArrayOutputStream stream = new ByteArrayOutputStream();
-                    bitmaps[i].compress(Bitmap.CompressFormat.JPEG,100,stream);
-                    byte[] byteArray = stream.toByteArray();
-                    Bitmap imageBitmap = BitmapFactory.decodeByteArray(byteArray, 0, byteArray.length);
-
-                    // crop input image at centre to model input size
-                    // commecial deploy note:: instead of cropying image do resize
-                    // image to model input size so we never lost the image content
-                    Bitmap cropImageBitmap = Bitmap.createBitmap(MODEL_INPUT_SIZE, MODEL_INPUT_SIZE, Bitmap.Config.ARGB_8888);
-                    Matrix frameToCropTransform = getTransformationMatrix(imageBitmap.getWidth(), imageBitmap.getHeight(),
-                            MODEL_INPUT_SIZE, MODEL_INPUT_SIZE, 0, true);
-                    Canvas canvas = new Canvas(cropImageBitmap);
-                    canvas.drawBitmap(imageBitmap, frameToCropTransform, null);
-
-                    // image pixel int values
-                    int[] pixelValues = new int[MODEL_INPUT_SIZE * MODEL_INPUT_SIZE];
-                    // image RGB float values
-                    float[] imgRgbValues = new float[MODEL_INPUT_SIZE * MODEL_INPUT_SIZE * IMG_CHANNEL];
-                    // image RGB transpose float values
-                    float[] imgRgbTranValues = new float[MODEL_INPUT_SIZE * MODEL_INPUT_SIZE * IMG_CHANNEL];
-
-                    // pre-process the image data from 0-255 int to normalized float based on the
-                    // provided parameters.
-                    cropImageBitmap.getPixels(pixelValues, 0, MODEL_INPUT_SIZE, 0, 0, MODEL_INPUT_SIZE, MODEL_INPUT_SIZE);
-                    for (int j = 0; j < pixelValues.length; ++j) {
-                        imgRgbValues[j * 3 + 0] = ((pixelValues[j] >> 16) & 0xFF)/255.0f;
-                        imgRgbValues[j * 3 + 1] = ((pixelValues[j] >> 8) & 0xFF)/255.0f;
-                        imgRgbValues[j * 3 + 2] = (pixelValues[j] & 0xFF)/255.0f;
-                    }
-
-                    // pre-process the image rgb data transpose based on the provided parameters.
-                    for (int k = 0; k < IMG_CHANNEL; ++k) {
-                        for (int l = 0; l < MODEL_INPUT_SIZE; ++l) {
-                            for (int m = 0; m < MODEL_INPUT_SIZE; ++m) {
-                                int dst_index = m + MODEL_INPUT_SIZE*l + MODEL_INPUT_SIZE*MODEL_INPUT_SIZE*k;
-                                int src_index = k + IMG_CHANNEL*m + IMG_CHANNEL*MODEL_INPUT_SIZE*l;
-                                imgRgbTranValues[dst_index] = imgRgbValues[src_index];
-                            }
-                        }
-                    }
-
-                    // get the function from the module(set input data)
-                    Log.i(TAG, "set input data");
-                    NDArray inputNdArray = NDArray.empty(new long[]{1, IMG_CHANNEL, MODEL_INPUT_SIZE, MODEL_INPUT_SIZE}, new TVMType("float32"));;
-                    inputNdArray.copyFrom(imgRgbTranValues);
-                    Function setInputFunc = graphRuntimeModule.getFunction("set_input");
-                    setInputFunc.pushArg(INPUT_NAME).pushArg(inputNdArray).invoke();
-                    // release tvm local variables
-                    inputNdArray.release();
-                    setInputFunc.release();
-
-                    // get the function from the module(run it)
-                    Log.i(TAG, "run function on target");
-                    Function runFunc = graphRuntimeModule.getFunction("run");
-                    runFunc.invoke();
-                    // release tvm local variables
-                    runFunc.release();
-
-                    // get the function from the module(get output data)
-                    Log.i(TAG, "get output data");
-                    NDArray outputNdArray = NDArray.empty(new long[]{1, 1000}, new TVMType("float32"));
-                    Function getOutputFunc = graphRuntimeModule.getFunction("get_output");
-                    getOutputFunc.pushArg(OUTPUT_INDEX).pushArg(outputNdArray).invoke();
-                    float[] output = outputNdArray.asFloatArray();
-                    // release tvm local variables
-                    outputNdArray.release();
-                    getOutputFunc.release();
-
-                    // display the result from extracted output data
-                    if (null != output) {
-                        int maxPosition = -1;
-                        float maxValue = 0;
-                        for (int j = 0; j < output.length; ++j) {
-                            if (output[j] > maxValue) {
-                                maxValue = output[j];
-                                maxPosition = j;
-                            }
-                        }
-                        processingTimeMs = SystemClock.uptimeMillis() - processingTimeMs;
-                        String label = "Prediction Result : ";
-                        label += labels.size() > maxPosition ? labels.get(maxPosition) : "unknown";
-                        label += "\nPrediction Time : " + processingTimeMs + "ms";
-                        mResultView.setText(label);
-                    }
-                    Log.i(TAG, "prediction finished");
+          if (null != graphExecutorModule) {

Review comment:
       Why ss the indent size here is 2 while everywhere else its 4?




-- 
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:
users@infra.apache.org



[GitHub] [tvm] zhiics commented on pull request #7653: Rename GraphRuntime to GraphExecutor

Posted by GitBox <gi...@apache.org>.
zhiics commented on pull request #7653:
URL: https://github.com/apache/tvm/pull/7653#issuecomment-805361926


   > @zhiics it's definitely a breaking change, i'm not opposed to the warning or some other way to notify downstream users. I don't know if code or forum or other is the best channel for that--i'm inclined to lean towards code in case forum or elsewhere also has snippets that may become outdated. i'm happy to do whatever you propose--which way do you prefer?
   > 
   > @tqchen @jroesch in case they have thoughts
   
   @areusch Thanks. I also prefer code for the the same reason you mentioned.


-- 
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:
users@infra.apache.org



[GitHub] [tvm] tkonolige commented on a change in pull request #7653: Rename GraphRuntime to GraphExecutor

Posted by GitBox <gi...@apache.org>.
tkonolige commented on a change in pull request #7653:
URL: https://github.com/apache/tvm/pull/7653#discussion_r593485505



##########
File path: CMakeLists.txt
##########
@@ -326,7 +326,7 @@ if(USE_PROFILER)
   file(GLOB RUNTIME_GRAPH_DEBUG_SRCS src/runtime/graph/debug/*.cc)

Review comment:
       missed this

##########
File path: docs/install/from_source.rst
##########
@@ -88,7 +88,7 @@ The configuration of TVM can be modified by `config.cmake`.
   - On macOS, for some versions of Xcode, you need to add ``-lc++abi`` in the LDFLAGS or you'll get link errors.
   - Change ``set(USE_CUDA OFF)`` to ``set(USE_CUDA ON)`` to enable CUDA backend. Do the same for other backends and libraries
     you want to build for (OpenCL, RCOM, METAL, VULKAN, ...).
-  - To help with debugging, ensure the embedded graph runtime and debugging functions are enabled with ``set(USE_GRAPH_RUNTIME ON)`` and ``set(USE_GRAPH_RUNTIME_DEBUG ON)``
+  - To help with debugging, ensure the embedded graph executor and debugging functions are enabled with ``set(USE_GRAPH_EXECUTOR ON)`` and ``set(USE_GRAPH_EXECUTOR_DEBUG ON)``

Review comment:
       ```suggestion
     - To help with debugging, ensure the embedded graph executor and debugging functions are enabled with ``set(USE_GRAPH_EXECUTOR ON)`` and ``set(USE_PROFILER ON)``
   ```




----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [tvm] areusch commented on a change in pull request #7653: Rename GraphRuntime to GraphExecutor

Posted by GitBox <gi...@apache.org>.
areusch commented on a change in pull request #7653:
URL: https://github.com/apache/tvm/pull/7653#discussion_r597152991



##########
File path: CMakeLists.txt
##########
@@ -326,7 +326,7 @@ if(USE_PROFILER)
   file(GLOB RUNTIME_GRAPH_DEBUG_SRCS src/runtime/graph/debug/*.cc)

Review comment:
       I think this is fine, the var name derives from the path. or do you mean we should fix path to e.g. src/runtime/graph_executor/...?




-- 
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:
users@infra.apache.org



[GitHub] [tvm] tqchen merged pull request #7653: Rename GraphRuntime to GraphExecutor

Posted by GitBox <gi...@apache.org>.
tqchen merged pull request #7653:
URL: https://github.com/apache/tvm/pull/7653


   


-- 
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:
users@infra.apache.org



[GitHub] [tvm] areusch commented on a change in pull request #7653: Rename GraphRuntime to GraphExecutor

Posted by GitBox <gi...@apache.org>.
areusch commented on a change in pull request #7653:
URL: https://github.com/apache/tvm/pull/7653#discussion_r597154342



##########
File path: docs/install/from_source.rst
##########
@@ -88,7 +88,7 @@ The configuration of TVM can be modified by `config.cmake`.
   - On macOS, for some versions of Xcode, you need to add ``-lc++abi`` in the LDFLAGS or you'll get link errors.
   - Change ``set(USE_CUDA OFF)`` to ``set(USE_CUDA ON)`` to enable CUDA backend. Do the same for other backends and libraries
     you want to build for (OpenCL, RCOM, METAL, VULKAN, ...).
-  - To help with debugging, ensure the embedded graph runtime and debugging functions are enabled with ``set(USE_GRAPH_RUNTIME ON)`` and ``set(USE_GRAPH_RUNTIME_DEBUG ON)``
+  - To help with debugging, ensure the embedded graph executor and debugging functions are enabled with ``set(USE_GRAPH_EXECUTOR ON)`` and ``set(USE_GRAPH_EXECUTOR_DEBUG ON)``

Review comment:
       done




-- 
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:
users@infra.apache.org



[GitHub] [tvm] areusch commented on a change in pull request #7653: Rename GraphRuntime to GraphExecutor

Posted by GitBox <gi...@apache.org>.
areusch commented on a change in pull request #7653:
URL: https://github.com/apache/tvm/pull/7653#discussion_r600763358



##########
File path: apps/android_deploy/app/src/main/java/org/apache/tvm/android/demo/MainActivity.java
##########
@@ -224,108 +224,115 @@ protected void onPostExecute(Integer status) {
     }
 
     /*
-        Execute prediction for processed decode input bitmap image content on TVM graph runtime.
+        Execute prediction for processed decode input bitmap image content on TVM graph executor.
      */
     private class ModelRunAsyncTask extends AsyncTask<Bitmap, Void, Integer> {
         ProgressDialog dialog = new ProgressDialog(MainActivity.this);
 
         @Override
         protected Integer doInBackground(Bitmap... bitmaps) {
-            if (null != graphRuntimeModule) {
-                int count  = bitmaps.length;
-                for (int i = 0 ; i < count ; i++) {
-                    long processingTimeMs = SystemClock.uptimeMillis();
-                    Log.i(TAG, "Decode JPEG image content");
-
-                    // extract the jpeg content
-                    ByteArrayOutputStream stream = new ByteArrayOutputStream();
-                    bitmaps[i].compress(Bitmap.CompressFormat.JPEG,100,stream);
-                    byte[] byteArray = stream.toByteArray();
-                    Bitmap imageBitmap = BitmapFactory.decodeByteArray(byteArray, 0, byteArray.length);
-
-                    // crop input image at centre to model input size
-                    // commecial deploy note:: instead of cropying image do resize
-                    // image to model input size so we never lost the image content
-                    Bitmap cropImageBitmap = Bitmap.createBitmap(MODEL_INPUT_SIZE, MODEL_INPUT_SIZE, Bitmap.Config.ARGB_8888);
-                    Matrix frameToCropTransform = getTransformationMatrix(imageBitmap.getWidth(), imageBitmap.getHeight(),
-                            MODEL_INPUT_SIZE, MODEL_INPUT_SIZE, 0, true);
-                    Canvas canvas = new Canvas(cropImageBitmap);
-                    canvas.drawBitmap(imageBitmap, frameToCropTransform, null);
-
-                    // image pixel int values
-                    int[] pixelValues = new int[MODEL_INPUT_SIZE * MODEL_INPUT_SIZE];
-                    // image RGB float values
-                    float[] imgRgbValues = new float[MODEL_INPUT_SIZE * MODEL_INPUT_SIZE * IMG_CHANNEL];
-                    // image RGB transpose float values
-                    float[] imgRgbTranValues = new float[MODEL_INPUT_SIZE * MODEL_INPUT_SIZE * IMG_CHANNEL];
-
-                    // pre-process the image data from 0-255 int to normalized float based on the
-                    // provided parameters.
-                    cropImageBitmap.getPixels(pixelValues, 0, MODEL_INPUT_SIZE, 0, 0, MODEL_INPUT_SIZE, MODEL_INPUT_SIZE);
-                    for (int j = 0; j < pixelValues.length; ++j) {
-                        imgRgbValues[j * 3 + 0] = ((pixelValues[j] >> 16) & 0xFF)/255.0f;
-                        imgRgbValues[j * 3 + 1] = ((pixelValues[j] >> 8) & 0xFF)/255.0f;
-                        imgRgbValues[j * 3 + 2] = (pixelValues[j] & 0xFF)/255.0f;
-                    }
-
-                    // pre-process the image rgb data transpose based on the provided parameters.
-                    for (int k = 0; k < IMG_CHANNEL; ++k) {
-                        for (int l = 0; l < MODEL_INPUT_SIZE; ++l) {
-                            for (int m = 0; m < MODEL_INPUT_SIZE; ++m) {
-                                int dst_index = m + MODEL_INPUT_SIZE*l + MODEL_INPUT_SIZE*MODEL_INPUT_SIZE*k;
-                                int src_index = k + IMG_CHANNEL*m + IMG_CHANNEL*MODEL_INPUT_SIZE*l;
-                                imgRgbTranValues[dst_index] = imgRgbValues[src_index];
-                            }
-                        }
-                    }
-
-                    // get the function from the module(set input data)
-                    Log.i(TAG, "set input data");
-                    NDArray inputNdArray = NDArray.empty(new long[]{1, IMG_CHANNEL, MODEL_INPUT_SIZE, MODEL_INPUT_SIZE}, new TVMType("float32"));;
-                    inputNdArray.copyFrom(imgRgbTranValues);
-                    Function setInputFunc = graphRuntimeModule.getFunction("set_input");
-                    setInputFunc.pushArg(INPUT_NAME).pushArg(inputNdArray).invoke();
-                    // release tvm local variables
-                    inputNdArray.release();
-                    setInputFunc.release();
-
-                    // get the function from the module(run it)
-                    Log.i(TAG, "run function on target");
-                    Function runFunc = graphRuntimeModule.getFunction("run");
-                    runFunc.invoke();
-                    // release tvm local variables
-                    runFunc.release();
-
-                    // get the function from the module(get output data)
-                    Log.i(TAG, "get output data");
-                    NDArray outputNdArray = NDArray.empty(new long[]{1, 1000}, new TVMType("float32"));
-                    Function getOutputFunc = graphRuntimeModule.getFunction("get_output");
-                    getOutputFunc.pushArg(OUTPUT_INDEX).pushArg(outputNdArray).invoke();
-                    float[] output = outputNdArray.asFloatArray();
-                    // release tvm local variables
-                    outputNdArray.release();
-                    getOutputFunc.release();
-
-                    // display the result from extracted output data
-                    if (null != output) {
-                        int maxPosition = -1;
-                        float maxValue = 0;
-                        for (int j = 0; j < output.length; ++j) {
-                            if (output[j] > maxValue) {
-                                maxValue = output[j];
-                                maxPosition = j;
-                            }
-                        }
-                        processingTimeMs = SystemClock.uptimeMillis() - processingTimeMs;
-                        String label = "Prediction Result : ";
-                        label += labels.size() > maxPosition ? labels.get(maxPosition) : "unknown";
-                        label += "\nPrediction Time : " + processingTimeMs + "ms";
-                        mResultView.setText(label);
-                    }
-                    Log.i(TAG, "prediction finished");
+          if (null != graphExecutorModule) {

Review comment:
       good catch @cnv1989, I had run git-clang-format directly rather than with the script, and it looks like it affected java files. reverted.




-- 
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:
users@infra.apache.org



[GitHub] [tvm] areusch commented on pull request #7653: Rename GraphRuntime to GraphExecutor

Posted by GitBox <gi...@apache.org>.
areusch commented on pull request #7653:
URL: https://github.com/apache/tvm/pull/7653#issuecomment-805394924


   @zhiics I've added Python backwards-compat. Please let me know if you think this is adequate. If so, I think we are ready to merge.


-- 
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:
users@infra.apache.org



[GitHub] [tvm] areusch commented on pull request #7653: Rename GraphRuntime to GraphExecutor

Posted by GitBox <gi...@apache.org>.
areusch commented on pull request #7653:
URL: https://github.com/apache/tvm/pull/7653#issuecomment-802318182


   @zhiics good call. I added python backwards compatibility for the `create` API. I don't know whether we are sensitive to backwards compatibility for the other languages. since the rest are compiled, it seems like we may not need a deprecation warning there (but, I am happy to add one, I am just not sure what would be best). I could also see us doing something slightly different than precedent here given the magnitude of the change.


-- 
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:
users@infra.apache.org