Commit 1dcf8a16 by Yizhi Liu Committed by Tianqi Chen

Rename ml.dmlc.tvm to org.apache.tvm (#4290)

parent d64bf6b5
...@@ -21,7 +21,7 @@ This folder contains Android Demo app that allows us to show how to deploy model ...@@ -21,7 +21,7 @@ This folder contains Android Demo app that allows us to show how to deploy model
You will need [JDK](http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html), [Android SDK](https://developer.android.com/studio/index.html), [Android NDK](https://developer.android.com/ndk) and an Android device to use this. Make sure the `ANDROID_HOME` variable already points to your Android SDK folder or set it using `export ANDROID_HOME=[Path to your Android SDK, e.g., ~/Android/sdk]`. We use [Gradle](https://gradle.org) to build. Please follow [the installation instruction](https://gradle.org/install) for your operating system. You will need [JDK](http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html), [Android SDK](https://developer.android.com/studio/index.html), [Android NDK](https://developer.android.com/ndk) and an Android device to use this. Make sure the `ANDROID_HOME` variable already points to your Android SDK folder or set it using `export ANDROID_HOME=[Path to your Android SDK, e.g., ~/Android/sdk]`. We use [Gradle](https://gradle.org) to build. Please follow [the installation instruction](https://gradle.org/install) for your operating system.
Alternatively, you may execute Docker image we provide wich contains the required packages. Use the command below to build the image and enter interactive session. Note, that building with OpenCL was not tested from Docker. Alternatively, you may execute Docker image we provide which contains the required packages. Use the command below to build the image and enter interactive session. Note, that building with OpenCL was not tested from Docker.
```bash ```bash
./docker/build.sh demo_android -it bash ./docker/build.sh demo_android -it bash
...@@ -45,7 +45,7 @@ dependencies { ...@@ -45,7 +45,7 @@ dependencies {
compile 'com.android.support:appcompat-v7:26.0.1' compile 'com.android.support:appcompat-v7:26.0.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2' compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:design:26.0.1' compile 'com.android.support:design:26.0.1'
compile 'ml.dmlc.tvm:tvm4j-core:0.0.1-SNAPSHOT' compile 'org.apache.tvm:tvm4j-core:0.0.1-SNAPSHOT'
testCompile 'junit:junit:4.12' testCompile 'junit:junit:4.12'
} }
``` ```
...@@ -124,7 +124,7 @@ If everything goes well, you will find compile tools in `/opt/android-toolchain- ...@@ -124,7 +124,7 @@ If everything goes well, you will find compile tools in `/opt/android-toolchain-
Follow instruction to get compiled version model for android target [here.](http://docs.tvm.ai/deploy/android.html) Follow instruction to get compiled version model for android target [here.](http://docs.tvm.ai/deploy/android.html)
Copied these compiled model deploy_lib.so, deploy_graph.json and deploy_param.params to apps/android_deploy/app/src/main/assets/ and modify TVM flavor changes on [java](https://github.com/apache/incubator-tvm/blob/master/apps/android_deploy/app/src/main/java/ml/dmlc/tvm/android/demo/MainActivity.java#L81) Copied these compiled model deploy_lib.so, deploy_graph.json and deploy_param.params to apps/android_deploy/app/src/main/assets/ and modify TVM flavor changes on [java](https://github.com/apache/incubator-tvm/blob/master/apps/android_deploy/app/src/main/java/org/apache/tvm/android/demo/MainActivity.java#L81)
`CPU Verison flavor` `CPU Verison flavor`
``` ```
......
...@@ -38,7 +38,7 @@ android { ...@@ -38,7 +38,7 @@ android {
compileSdkVersion 26 compileSdkVersion 26
buildToolsVersion "26.0.1" buildToolsVersion "26.0.1"
defaultConfig { defaultConfig {
applicationId "ml.dmlc.tvm.android.demo" applicationId "org.apache.tvm.android.demo"
minSdkVersion 17 minSdkVersion 17
targetSdkVersion 26 targetSdkVersion 26
versionCode 1 versionCode 1
...@@ -68,6 +68,6 @@ dependencies { ...@@ -68,6 +68,6 @@ dependencies {
compile 'com.android.support:appcompat-v7:26.0.1' compile 'com.android.support:appcompat-v7:26.0.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2' compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:design:26.0.1' compile 'com.android.support:design:26.0.1'
compile 'ml.dmlc.tvm:tvm4j-core:0.0.1-SNAPSHOT' compile 'org.apache.tvm:tvm4j-core:0.0.1-SNAPSHOT'
testCompile 'junit:junit:4.12' testCompile 'junit:junit:4.12'
} }
...@@ -20,7 +20,7 @@ under the License. ...@@ -20,7 +20,7 @@ under the License.
--> -->
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="ml.dmlc.tvm.android.demo" > package="org.apache.tvm.android.demo" >
<uses-permission android:name="android.permission.CAMERA" /> <uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/> <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
...@@ -32,7 +32,7 @@ under the License. ...@@ -32,7 +32,7 @@ under the License.
android:supportsRtl="true" android:supportsRtl="true"
android:theme="@style/AppTheme" > android:theme="@style/AppTheme" >
<activity <activity
android:name=".MainActivity" android:name="org.apache.tvm.android.demo.MainActivity"
android:label="@string/app_name" android:label="@string/app_name"
android:theme="@style/AppTheme.NoActionBar" android:theme="@style/AppTheme.NoActionBar"
android:screenOrientation="portrait"> android:screenOrientation="portrait">
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
* limitations under the License. * limitations under the License.
*/ */
package ml.dmlc.tvm.android.demo; package org.apache.tvm.android.demo;
import android.Manifest; import android.Manifest;
import android.content.Intent; import android.content.Intent;
...@@ -53,12 +53,12 @@ import java.text.SimpleDateFormat; ...@@ -53,12 +53,12 @@ import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;
import java.util.Vector; import java.util.Vector;
import ml.dmlc.tvm.Function; import org.apache.tvm.Function;
import ml.dmlc.tvm.Module; import org.apache.tvm.Module;
import ml.dmlc.tvm.NDArray; import org.apache.tvm.NDArray;
import ml.dmlc.tvm.TVMContext; import org.apache.tvm.TVMContext;
import ml.dmlc.tvm.TVMValue; import org.apache.tvm.TVMValue;
import ml.dmlc.tvm.TVMType; import org.apache.tvm.TVMType;
public class MainActivity extends AppCompatActivity { public class MainActivity extends AppCompatActivity {
private static final String TAG = MainActivity.class.getSimpleName(); private static final String TAG = MainActivity.class.getSimpleName();
......
...@@ -16,7 +16,7 @@ endif ...@@ -16,7 +16,7 @@ endif
include $(config) include $(config)
LOCAL_SRC_FILES := ml_dmlc_tvm_native_c_api.cc LOCAL_SRC_FILES := org_apache_tvm_native_c_api.cc
LOCAL_LDFLAGS := -L$(SYSROOT)/usr/lib/ -llog LOCAL_LDFLAGS := -L$(SYSROOT)/usr/lib/ -llog
LOCAL_C_INCLUDES := $(ROOT_PATH)/include \ LOCAL_C_INCLUDES := $(ROOT_PATH)/include \
......
...@@ -18,8 +18,8 @@ ...@@ -18,8 +18,8 @@
PATH="$PATH:/usr/local/bin" PATH="$PATH:/usr/local/bin"
CURR_DIR=$(cd `dirname $0`; pwd) CURR_DIR=$(cd `dirname $0`; pwd)
ROOT_DIR="$CURR_DIR/../../../../../.." ROOT_DIR="$CURR_DIR/../../../../../.."
javah -o $CURR_DIR/ml_dmlc_tvm_native_c_api.h -cp "$ROOT_DIR/jvm/core/target/*" ml.dmlc.tvm.LibInfo || exit -1 javah -o $CURR_DIR/org_apache_tvm_native_c_api.h -cp "$ROOT_DIR/jvm/core/target/*" org.apache.tvm.LibInfo || exit -1
cp -f $ROOT_DIR/jvm/native/src/main/native/ml_dmlc_tvm_native_c_api.cc $CURR_DIR/ || exit -1 cp -f $ROOT_DIR/jvm/native/src/main/native/org_apache_tvm_native_c_api.cc $CURR_DIR/ || exit -1
cp -f $ROOT_DIR/jvm/native/src/main/native/jni_helper_func.h $CURR_DIR/ || exit -1 cp -f $ROOT_DIR/jvm/native/src/main/native/jni_helper_func.h $CURR_DIR/ || exit -1
rm -rf $CURR_DIR/../libs rm -rf $CURR_DIR/../libs
ndk-build --directory=$CURR_DIR ndk-build --directory=$CURR_DIR
...@@ -25,7 +25,7 @@ under the License. ...@@ -25,7 +25,7 @@ under the License.
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
tools:context="ml.dmlc.tvm.android.demo.MainActivity"> tools:context="org.apache.tvm.android.demo.MainActivity">
<android.support.design.widget.AppBarLayout <android.support.design.widget.AppBarLayout
android:layout_height="wrap_content" android:layout_height="wrap_content"
......
# 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.
org.gradle.jvmargs=-Xmx4096M
...@@ -39,7 +39,7 @@ dependencies { ...@@ -39,7 +39,7 @@ dependencies {
compile 'com.android.support:appcompat-v7:26.0.1' compile 'com.android.support:appcompat-v7:26.0.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2' compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:design:26.0.1' compile 'com.android.support:design:26.0.1'
compile 'ml.dmlc.tvm:tvm4j-core:0.0.1-SNAPSHOT' compile 'org.apache.tvm:tvm4j-core:0.0.1-SNAPSHOT'
testCompile 'junit:junit:4.12' testCompile 'junit:junit:4.12'
} }
``` ```
...@@ -64,12 +64,12 @@ If you see error: ...@@ -64,12 +64,12 @@ If you see error:
adb: failed to install app/build/outputs/apk/release/tvmrpc-release.apk: adb: failed to install app/build/outputs/apk/release/tvmrpc-release.apk:
Failure [INSTALL_FAILED_UPDATE_INCOMPATIBLE: Failure [INSTALL_FAILED_UPDATE_INCOMPATIBLE:
Package ml.dmlc.tvm.tvmrpc signatures do not match the previously installed version; ignoring!] Package org.apache.tvm.tvmrpc signatures do not match the previously installed version; ignoring!]
Run uninstall first: Run uninstall first:
```bash ```bash
$ANDROID_HOME/platform-tools/adb uninstall ml.dmlc.tvm.tvmrpc $ANDROID_HOME/platform-tools/adb uninstall org.apache.tvm.tvmrpc
``` ```
### Build with OpenCL ### Build with OpenCL
......
...@@ -29,7 +29,7 @@ android { ...@@ -29,7 +29,7 @@ android {
compileSdkVersion 26 compileSdkVersion 26
buildToolsVersion "26.0.1" buildToolsVersion "26.0.1"
defaultConfig { defaultConfig {
applicationId "ml.dmlc.tvm.tvmrpc" applicationId "org.apache.tvm.tvmrpc"
minSdkVersion 24 minSdkVersion 24
targetSdkVersion 26 targetSdkVersion 26
versionCode 1 versionCode 1
...@@ -58,6 +58,6 @@ dependencies { ...@@ -58,6 +58,6 @@ dependencies {
compile 'com.android.support:appcompat-v7:26.0.1' compile 'com.android.support:appcompat-v7:26.0.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2' compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:design:26.0.1' compile 'com.android.support:design:26.0.1'
compile 'ml.dmlc.tvm:tvm4j-core:0.0.1-SNAPSHOT' compile 'org.apache.tvm:tvm4j-core:0.0.1-SNAPSHOT'
testCompile 'junit:junit:4.12' testCompile 'junit:junit:4.12'
} }
...@@ -20,7 +20,7 @@ under the License. ...@@ -20,7 +20,7 @@ under the License.
--> -->
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="ml.dmlc.tvm.tvmrpc" > package="org.apache.tvm.tvmrpc" >
<uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.INTERNET" />
......
...@@ -15,27 +15,21 @@ ...@@ -15,27 +15,21 @@
* limitations under the License. * limitations under the License.
*/ */
package ml.dmlc.tvm.tvmrpc; package org.apache.tvm.tvmrpc;
import android.annotation.SuppressLint;
import android.app.AlertDialog; import android.app.AlertDialog;
import android.content.Context; import android.content.Context;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.os.Message;
import android.support.v7.app.AppCompatActivity; import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar; import android.support.v7.widget.Toolbar;
import android.widget.CompoundButton; import android.widget.CompoundButton;
import android.widget.EditText; import android.widget.EditText;
import android.widget.Switch; import android.widget.Switch;
import android.widget.Button;
import android.view.View;
import android.content.Intent; import android.content.Intent;
import android.app.NotificationChannel;
import android.app.NotificationManager;
public class MainActivity extends AppCompatActivity { public class MainActivity extends AppCompatActivity {
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
* limitations under the License. * limitations under the License.
*/ */
package ml.dmlc.tvm.tvmrpc; package org.apache.tvm.tvmrpc;
import android.os.Bundle; import android.os.Bundle;
import android.support.v7.app.AppCompatActivity; import android.support.v7.app.AppCompatActivity;
......
...@@ -15,12 +15,12 @@ ...@@ -15,12 +15,12 @@
* limitations under the License. * limitations under the License.
*/ */
package ml.dmlc.tvm.tvmrpc; package org.apache.tvm.tvmrpc;
import android.os.ParcelFileDescriptor; import android.os.ParcelFileDescriptor;
import java.net.Socket; import java.net.Socket;
import ml.dmlc.tvm.rpc.ConnectTrackerServerProcessor; import org.apache.tvm.rpc.ConnectTrackerServerProcessor;
import ml.dmlc.tvm.rpc.RPCWatchdog; import org.apache.tvm.rpc.RPCWatchdog;
/** /**
* Connect to RPC proxy and deal with requests. * Connect to RPC proxy and deal with requests.
......
...@@ -16,7 +16,7 @@ endif ...@@ -16,7 +16,7 @@ endif
include $(config) include $(config)
LOCAL_SRC_FILES := ml_dmlc_tvm_native_c_api.cc LOCAL_SRC_FILES := org_apache_tvm_native_c_api.cc
LOCAL_LDFLAGS := -L$(SYSROOT)/usr/lib/ -llog LOCAL_LDFLAGS := -L$(SYSROOT)/usr/lib/ -llog
LOCAL_C_INCLUDES := $(ROOT_PATH)/include \ LOCAL_C_INCLUDES := $(ROOT_PATH)/include \
......
...@@ -18,8 +18,8 @@ ...@@ -18,8 +18,8 @@
PATH="$PATH:/usr/local/bin" PATH="$PATH:/usr/local/bin"
CURR_DIR=$(cd `dirname $0`; pwd) CURR_DIR=$(cd `dirname $0`; pwd)
ROOT_DIR="$CURR_DIR/../../../../../.." ROOT_DIR="$CURR_DIR/../../../../../.."
javah -o $CURR_DIR/ml_dmlc_tvm_native_c_api.h -cp "$ROOT_DIR/jvm/core/target/*" ml.dmlc.tvm.LibInfo || exit -1 javah -o $CURR_DIR/org_apache_tvm_native_c_api.h -cp "$ROOT_DIR/jvm/core/target/*" org.apache.tvm.LibInfo || exit -1
cp -f $ROOT_DIR/jvm/native/src/main/native/ml_dmlc_tvm_native_c_api.cc $CURR_DIR/ || exit -1 cp -f $ROOT_DIR/jvm/native/src/main/native/org_apache_tvm_native_c_api.cc $CURR_DIR/ || exit -1
cp -f $ROOT_DIR/jvm/native/src/main/native/jni_helper_func.h $CURR_DIR/ || exit -1 cp -f $ROOT_DIR/jvm/native/src/main/native/jni_helper_func.h $CURR_DIR/ || exit -1
rm -rf $CURR_DIR/../libs rm -rf $CURR_DIR/../libs
ndk-build --directory=$CURR_DIR ndk-build --directory=$CURR_DIR
...@@ -25,7 +25,7 @@ under the License. ...@@ -25,7 +25,7 @@ under the License.
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
tools:context="ml.dmlc.tvm.tvmrpc.MainActivity"> tools:context="org.apache.tvm.tvmrpc.MainActivity">
<android.support.design.widget.AppBarLayout <android.support.design.widget.AppBarLayout
android:layout_height="wrap_content" android:layout_height="wrap_content"
......
...@@ -25,7 +25,7 @@ under the License. ...@@ -25,7 +25,7 @@ under the License.
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
tools:context="ml.dmlc.tvm.tvmrpc.RPCActivity"> tools:context="org.apache.tvm.tvmrpc.RPCActivity">
<android.support.design.widget.AppBarLayout <android.support.design.widget.AppBarLayout
android:layout_height="wrap_content" android:layout_height="wrap_content"
......
...@@ -18,7 +18,7 @@ import argparse ...@@ -18,7 +18,7 @@ import argparse
import re import re
default_team_id = "3FR42MXLK9" default_team_id = "3FR42MXLK9"
default_bundle_identifier = 'ml.dmlc.tvmrpc' default_bundle_identifier = 'org.apache.tvmrpc'
parser = argparse.ArgumentParser(description='Update tvmrpc.xcodeproj\ parser = argparse.ArgumentParser(description='Update tvmrpc.xcodeproj\
developer information') developer information')
......
...@@ -391,7 +391,7 @@ ...@@ -391,7 +391,7 @@
); );
INFOPLIST_FILE = tvmrpc/Info.plist; INFOPLIST_FILE = tvmrpc/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = ml.dmlc.tvmrpc; PRODUCT_BUNDLE_IDENTIFIER = org.apache.tvmrpc;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
}; };
name = Debug; name = Debug;
...@@ -411,7 +411,7 @@ ...@@ -411,7 +411,7 @@
); );
INFOPLIST_FILE = tvmrpc/Info.plist; INFOPLIST_FILE = tvmrpc/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = ml.dmlc.tvmrpc; PRODUCT_BUNDLE_IDENTIFIER = org.apache.tvmrpc;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
}; };
name = Release; name = Release;
...@@ -428,7 +428,7 @@ ...@@ -428,7 +428,7 @@
); );
INFOPLIST_FILE = tvmrpcLauncher/Info.plist; INFOPLIST_FILE = tvmrpcLauncher/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = ml.dmlc.tvmrpcLauncher; PRODUCT_BUNDLE_IDENTIFIER = org.apache.tvmrpcLauncher;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/tvmrpc.app/tvmrpc"; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/tvmrpc.app/tvmrpc";
}; };
...@@ -446,7 +446,7 @@ ...@@ -446,7 +446,7 @@
); );
INFOPLIST_FILE = tvmrpcLauncher/Info.plist; INFOPLIST_FILE = tvmrpcLauncher/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = ml.dmlc.tvmrpcLauncher; PRODUCT_BUNDLE_IDENTIFIER = org.apache.tvmrpcLauncher;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/tvmrpc.app/tvmrpc"; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/tvmrpc.app/tvmrpc";
}; };
......
...@@ -39,4 +39,4 @@ deploy_lib.so, deploy_graph.json, deploy_param.params will go to android target. ...@@ -39,4 +39,4 @@ deploy_lib.so, deploy_graph.json, deploy_param.params will go to android target.
## TVM Runtime for Android Target ## TVM Runtime for Android Target
Refer [here](https://github.com/apache/incubator-tvm/blob/master/apps/android_deploy/README.md#build-and-installation) to build CPU/OpenCL version flavor TVM runtime for android target. Refer [here](https://github.com/apache/incubator-tvm/blob/master/apps/android_deploy/README.md#build-and-installation) to build CPU/OpenCL version flavor TVM runtime for android target.
From android java TVM API to load model & execute can be referred at this [java](https://github.com/apache/incubator-tvm/blob/master/apps/android_deploy/app/src/main/java/ml/dmlc/tvm/android/demo/MainActivity.java) sample source. From android java TVM API to load model & execute can be referred at this [java](https://github.com/apache/incubator-tvm/blob/master/apps/android_deploy/app/src/main/java/org/apache/tvm/android/demo/MainActivity.java) sample source.
...@@ -122,9 +122,9 @@ if __name__ == "__main__": ...@@ -122,9 +122,9 @@ if __name__ == "__main__":
The following code snippet demonstrate how to load generated shared library (add_cpu.so). The following code snippet demonstrate how to load generated shared library (add_cpu.so).
```java ```java
import ml.dmlc.tvm.Module; import org.apache.tvm.Module;
import ml.dmlc.tvm.NDArray; import org.apache.tvm.NDArray;
import ml.dmlc.tvm.TVMContext; import org.apache.tvm.TVMContext;
import java.io.File; import java.io.File;
import java.util.Arrays; import java.util.Arrays;
...@@ -175,4 +175,4 @@ Server server = new Server(proxyHost, proxyPort, "key"); ...@@ -175,4 +175,4 @@ Server server = new Server(proxyHost, proxyPort, "key");
server.start(); server.start();
``` ```
You can also use `StandaloneServerProcessor` and `ConnectProxyServerProcessor` to build your own RPC server. Refer to [Android RPC Server](https://github.com/apache/incubator-tvm/blob/master/apps/android_rpc/app/src/main/java/ml/dmlc/tvm/tvmrpc/RPCProcessor.java) for more details. You can also use `StandaloneServerProcessor` and `ConnectProxyServerProcessor` to build your own RPC server. Refer to [Android RPC Server](https://github.com/apache/incubator-tvm/blob/master/apps/android_rpc/app/src/main/java/org/apache/tvm/tvmrpc/RPCProcessor.java) for more details.
\ No newline at end of file \ No newline at end of file
...@@ -24,13 +24,13 @@ under the License. ...@@ -24,13 +24,13 @@ under the License.
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<parent> <parent>
<groupId>ml.dmlc.tvm</groupId> <groupId>org.apache.tvm</groupId>
<artifactId>tvm4j-full-parent</artifactId> <artifactId>tvm4j-full-parent</artifactId>
<version>0.0.1-SNAPSHOT</version> <version>0.0.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
<groupId>ml.dmlc.tvm</groupId> <groupId>org.apache.tvm</groupId>
<artifactId>tvm4j-full-linux-x86_64</artifactId> <artifactId>tvm4j-full-linux-x86_64</artifactId>
<version>0.0.1-SNAPSHOT</version> <version>0.0.1-SNAPSHOT</version>
<name>TVM4J Package - Full Linux-x86_64</name> <name>TVM4J Package - Full Linux-x86_64</name>
...@@ -38,12 +38,12 @@ under the License. ...@@ -38,12 +38,12 @@ under the License.
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>ml.dmlc.tvm</groupId> <groupId>org.apache.tvm</groupId>
<artifactId>tvm4j-core</artifactId> <artifactId>tvm4j-core</artifactId>
<version>${project.version}</version> <version>${project.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>ml.dmlc.tvm</groupId> <groupId>org.apache.tvm</groupId>
<artifactId>libtvm4j-linux-x86_64</artifactId> <artifactId>libtvm4j-linux-x86_64</artifactId>
<version>${project.version}</version> <version>${project.version}</version>
<type>so</type> <type>so</type>
......
...@@ -48,7 +48,7 @@ under the License. ...@@ -48,7 +48,7 @@ under the License.
<useProjectArtifact>false</useProjectArtifact> <useProjectArtifact>false</useProjectArtifact>
<useStrictFiltering>false</useStrictFiltering> <useStrictFiltering>false</useStrictFiltering>
<includes> <includes>
<include>ml.dmlc.tvm:libtvm4j-linux-x86_64:so</include> <include>org.apache.tvm:libtvm4j-linux-x86_64:so</include>
</includes> </includes>
</dependencySet> </dependencySet>
</dependencySets> </dependencySets>
......
...@@ -24,13 +24,13 @@ under the License. ...@@ -24,13 +24,13 @@ under the License.
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<parent> <parent>
<groupId>ml.dmlc.tvm</groupId> <groupId>org.apache.tvm</groupId>
<artifactId>tvm4j-full-parent</artifactId> <artifactId>tvm4j-full-parent</artifactId>
<version>0.0.1-SNAPSHOT</version> <version>0.0.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
<groupId>ml.dmlc.tvm</groupId> <groupId>org.apache.tvm</groupId>
<artifactId>tvm4j-full-osx-x86_64</artifactId> <artifactId>tvm4j-full-osx-x86_64</artifactId>
<version>0.0.1-SNAPSHOT</version> <version>0.0.1-SNAPSHOT</version>
<name>TVM4J Package - Full OSX-x86_64</name> <name>TVM4J Package - Full OSX-x86_64</name>
...@@ -38,12 +38,12 @@ under the License. ...@@ -38,12 +38,12 @@ under the License.
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>ml.dmlc.tvm</groupId> <groupId>org.apache.tvm</groupId>
<artifactId>tvm4j-core</artifactId> <artifactId>tvm4j-core</artifactId>
<version>${project.version}</version> <version>${project.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>ml.dmlc.tvm</groupId> <groupId>org.apache.tvm</groupId>
<artifactId>libtvm4j-osx-x86_64</artifactId> <artifactId>libtvm4j-osx-x86_64</artifactId>
<version>${project.version}</version> <version>${project.version}</version>
<type>jnilib</type> <type>jnilib</type>
......
...@@ -48,7 +48,7 @@ under the License. ...@@ -48,7 +48,7 @@ under the License.
<useProjectArtifact>false</useProjectArtifact> <useProjectArtifact>false</useProjectArtifact>
<useStrictFiltering>false</useStrictFiltering> <useStrictFiltering>false</useStrictFiltering>
<includes> <includes>
<include>ml.dmlc.tvm:libtvm4j-osx-x86_64:jnilib</include> <include>org.apache.tvm:libtvm4j-osx-x86_64:jnilib</include>
</includes> </includes>
</dependencySet> </dependencySet>
</dependencySets> </dependencySets>
......
...@@ -24,13 +24,13 @@ under the License. ...@@ -24,13 +24,13 @@ under the License.
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<parent> <parent>
<groupId>ml.dmlc.tvm</groupId> <groupId>org.apache.tvm</groupId>
<artifactId>tvm4j-parent</artifactId> <artifactId>tvm4j-parent</artifactId>
<version>0.0.1-SNAPSHOT</version> <version>0.0.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
<groupId>ml.dmlc.tvm</groupId> <groupId>org.apache.tvm</groupId>
<artifactId>tvm4j-full-parent</artifactId> <artifactId>tvm4j-full-parent</artifactId>
<version>0.0.1-SNAPSHOT</version> <version>0.0.1-SNAPSHOT</version>
<name>TVM4J Package - Full Parent</name> <name>TVM4J Package - Full Parent</name>
......
...@@ -24,13 +24,13 @@ under the License. ...@@ -24,13 +24,13 @@ under the License.
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<parent> <parent>
<groupId>ml.dmlc.tvm</groupId> <groupId>org.apache.tvm</groupId>
<artifactId>tvm4j-parent</artifactId> <artifactId>tvm4j-parent</artifactId>
<version>0.0.1-SNAPSHOT</version> <version>0.0.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
<groupId>ml.dmlc.tvm</groupId> <groupId>org.apache.tvm</groupId>
<artifactId>tvm4j-core</artifactId> <artifactId>tvm4j-core</artifactId>
<version>0.0.1-SNAPSHOT</version> <version>0.0.1-SNAPSHOT</version>
<name>TVM4J Package - Core</name> <name>TVM4J Package - Core</name>
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
* limitations under the License. * limitations under the License.
*/ */
package ml.dmlc.tvm; package org.apache.tvm;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
* limitations under the License. * limitations under the License.
*/ */
package ml.dmlc.tvm; package org.apache.tvm;
/** /**
* Internal api functions. * Internal api functions.
......
...@@ -15,9 +15,9 @@ ...@@ -15,9 +15,9 @@
* limitations under the License. * limitations under the License.
*/ */
package ml.dmlc.tvm; package org.apache.tvm;
import ml.dmlc.tvm.NativeLibraryLoader.Action; import org.apache.tvm.NativeLibraryLoader.Action;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
* limitations under the License. * limitations under the License.
*/ */
package ml.dmlc.tvm; package org.apache.tvm;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
* limitations under the License. * limitations under the License.
*/ */
package ml.dmlc.tvm; package org.apache.tvm;
import java.util.List; import java.util.List;
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
* limitations under the License. * limitations under the License.
*/ */
package ml.dmlc.tvm; package org.apache.tvm;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
* limitations under the License. * limitations under the License.
*/ */
package ml.dmlc.tvm; package org.apache.tvm;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
import java.nio.ByteOrder; import java.nio.ByteOrder;
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
* limitations under the License. * limitations under the License.
*/ */
package ml.dmlc.tvm; package org.apache.tvm;
/** /**
* Base class of NDArray. To handle callback array. * Base class of NDArray. To handle callback array.
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
* limitations under the License. * limitations under the License.
*/ */
package ml.dmlc.tvm; package org.apache.tvm;
import java.io.File; import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
......
...@@ -15,9 +15,9 @@ ...@@ -15,9 +15,9 @@
* limitations under the License. * limitations under the License.
*/ */
package ml.dmlc.tvm; package org.apache.tvm;
import ml.dmlc.tvm.rpc.RPC; import org.apache.tvm.rpc.RPC;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
* limitations under the License. * limitations under the License.
*/ */
package ml.dmlc.tvm; package org.apache.tvm;
public class TVMType { public class TVMType {
public static final int INT = 0; public static final int INT = 0;
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
* limitations under the License. * limitations under the License.
*/ */
package ml.dmlc.tvm; package org.apache.tvm;
public class TVMValue { public class TVMValue {
public final TypeCode typeCode; public final TypeCode typeCode;
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
* limitations under the License. * limitations under the License.
*/ */
package ml.dmlc.tvm; package org.apache.tvm;
public class TVMValueBytes extends TVMValue { public class TVMValueBytes extends TVMValue {
public final byte[] value; public final byte[] value;
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
* limitations under the License. * limitations under the License.
*/ */
package ml.dmlc.tvm; package org.apache.tvm;
public class TVMValueDouble extends TVMValue { public class TVMValueDouble extends TVMValue {
public final double value; public final double value;
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
* limitations under the License. * limitations under the License.
*/ */
package ml.dmlc.tvm; package org.apache.tvm;
/** /**
* Java class related to TVM handles (TypeCode.HANDLE) * Java class related to TVM handles (TypeCode.HANDLE)
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
* limitations under the License. * limitations under the License.
*/ */
package ml.dmlc.tvm; package org.apache.tvm;
public class TVMValueLong extends TVMValue { public class TVMValueLong extends TVMValue {
public final long value; public final long value;
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
* limitations under the License. * limitations under the License.
*/ */
package ml.dmlc.tvm; package org.apache.tvm;
public class TVMValueNull extends TVMValue { public class TVMValueNull extends TVMValue {
public TVMValueNull() { public TVMValueNull() {
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
* limitations under the License. * limitations under the License.
*/ */
package ml.dmlc.tvm; package org.apache.tvm;
public class TVMValueString extends TVMValue { public class TVMValueString extends TVMValue {
public final String value; public final String value;
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
* limitations under the License. * limitations under the License.
*/ */
package ml.dmlc.tvm; package org.apache.tvm;
// Type code used in API calls // Type code used in API calls
public enum TypeCode { public enum TypeCode {
......
...@@ -17,12 +17,12 @@ ...@@ -17,12 +17,12 @@
* under the License. * under the License.
*/ */
package ml.dmlc.tvm.contrib; package org.apache.tvm.contrib;
import ml.dmlc.tvm.Function; import org.apache.tvm.Function;
import ml.dmlc.tvm.Module; import org.apache.tvm.Module;
import ml.dmlc.tvm.NDArray; import org.apache.tvm.NDArray;
import ml.dmlc.tvm.TVMContext; import org.apache.tvm.TVMContext;
/** /**
* Wrapper runtime module. * Wrapper runtime module.
......
...@@ -15,15 +15,15 @@ ...@@ -15,15 +15,15 @@
* limitations under the License. * limitations under the License.
*/ */
package ml.dmlc.tvm.contrib; package org.apache.tvm.contrib;
import ml.dmlc.tvm.Function; import org.apache.tvm.Function;
import ml.dmlc.tvm.Module; import org.apache.tvm.Module;
import ml.dmlc.tvm.TVMContext; import org.apache.tvm.TVMContext;
import ml.dmlc.tvm.TVMValue; import org.apache.tvm.TVMValue;
import ml.dmlc.tvm.rpc.RPC; import org.apache.tvm.rpc.RPC;
import ml.dmlc.tvm.rpc.RPCSession; import org.apache.tvm.rpc.RPCSession;
import ml.dmlc.tvm.rpc.TVMRemoteContext; import org.apache.tvm.rpc.TVMRemoteContext;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
......
...@@ -15,10 +15,10 @@ ...@@ -15,10 +15,10 @@
* limitations under the License. * limitations under the License.
*/ */
package ml.dmlc.tvm.rpc; package org.apache.tvm.rpc;
import ml.dmlc.tvm.Function; import org.apache.tvm.Function;
import ml.dmlc.tvm.TVMValue; import org.apache.tvm.TVMValue;
public class Client { public class Client {
/** /**
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
* limitations under the License. * limitations under the License.
*/ */
package ml.dmlc.tvm.rpc; package org.apache.tvm.rpc;
import java.io.InputStream; import java.io.InputStream;
import java.io.OutputStream; import java.io.OutputStream;
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
* limitations under the License. * limitations under the License.
*/ */
package ml.dmlc.tvm.rpc; package org.apache.tvm.rpc;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
......
...@@ -15,11 +15,11 @@ ...@@ -15,11 +15,11 @@
* limitations under the License. * limitations under the License.
*/ */
package ml.dmlc.tvm.rpc; package org.apache.tvm.rpc;
import ml.dmlc.tvm.Function; import org.apache.tvm.Function;
import ml.dmlc.tvm.Module; import org.apache.tvm.Module;
import ml.dmlc.tvm.TVMValue; import org.apache.tvm.TVMValue;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
......
...@@ -15,9 +15,9 @@ ...@@ -15,9 +15,9 @@
* limitations under the License. * limitations under the License.
*/ */
package ml.dmlc.tvm.rpc; package org.apache.tvm.rpc;
import ml.dmlc.tvm.Function; import org.apache.tvm.Function;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
......
...@@ -15,11 +15,11 @@ ...@@ -15,11 +15,11 @@
* limitations under the License. * limitations under the License.
*/ */
package ml.dmlc.tvm.rpc; package org.apache.tvm.rpc;
import ml.dmlc.tvm.Function; import org.apache.tvm.Function;
import ml.dmlc.tvm.Module; import org.apache.tvm.Module;
import ml.dmlc.tvm.TVMContext; import org.apache.tvm.TVMContext;
import java.io.File; import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
* limitations under the License. * limitations under the License.
*/ */
package ml.dmlc.tvm.rpc; package org.apache.tvm.rpc;
/** /**
* Watchdog for RPC. * Watchdog for RPC.
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
* limitations under the License. * limitations under the License.
*/ */
package ml.dmlc.tvm.rpc; package org.apache.tvm.rpc;
import java.io.IOException; import java.io.IOException;
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
* limitations under the License. * limitations under the License.
*/ */
package ml.dmlc.tvm.rpc; package org.apache.tvm.rpc;
/** /**
* Abstract runnable class for RPC server process. * Abstract runnable class for RPC server process.
......
package ml.dmlc.tvm.rpc; package org.apache.tvm.rpc;
import ml.dmlc.tvm.Function; import org.apache.tvm.Function;
import ml.dmlc.tvm.TVMValue; import org.apache.tvm.TVMValue;
import ml.dmlc.tvm.TVMValueBytes; import org.apache.tvm.TVMValueBytes;
import java.io.IOException; import java.io.IOException;
import java.net.Socket; import java.net.Socket;
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
* limitations under the License. * limitations under the License.
*/ */
package ml.dmlc.tvm.rpc; package org.apache.tvm.rpc;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
......
...@@ -15,9 +15,9 @@ ...@@ -15,9 +15,9 @@
* limitations under the License. * limitations under the License.
*/ */
package ml.dmlc.tvm.rpc; package org.apache.tvm.rpc;
import ml.dmlc.tvm.TVMContext; import org.apache.tvm.TVMContext;
// always related to RPCSession. Cannot construct by users. // always related to RPCSession. Cannot construct by users.
public class TVMRemoteContext extends TVMContext { public class TVMRemoteContext extends TVMContext {
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
* limitations under the License. * limitations under the License.
*/ */
package ml.dmlc.tvm.rpc; package org.apache.tvm.rpc;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
* limitations under the License. * limitations under the License.
*/ */
package ml.dmlc.tvm; package org.apache.tvm;
import org.junit.Test; import org.junit.Test;
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
* limitations under the License. * limitations under the License.
*/ */
package ml.dmlc.tvm; package org.apache.tvm;
import org.junit.BeforeClass; import org.junit.BeforeClass;
import org.junit.Test; import org.junit.Test;
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
* limitations under the License. * limitations under the License.
*/ */
package ml.dmlc.tvm; package org.apache.tvm;
import org.junit.Test; import org.junit.Test;
......
package ml.dmlc.tvm; package org.apache.tvm;
/* /*
* Licensed to the Apache Software Foundation (ASF) under one * Licensed to the Apache Software Foundation (ASF) under one
...@@ -20,7 +20,7 @@ package ml.dmlc.tvm; ...@@ -20,7 +20,7 @@ package ml.dmlc.tvm;
*/ */
import ml.dmlc.tvm.rpc.Server; import org.apache.tvm.rpc.Server;
import java.io.IOException; import java.io.IOException;
......
...@@ -15,15 +15,15 @@ ...@@ -15,15 +15,15 @@
* limitations under the License. * limitations under the License.
*/ */
package ml.dmlc.tvm.contrib; package org.apache.tvm.contrib;
import ml.dmlc.tvm.Module; import org.apache.tvm.Module;
import ml.dmlc.tvm.NDArray; import org.apache.tvm.NDArray;
import ml.dmlc.tvm.TVMContext; import org.apache.tvm.TVMContext;
import ml.dmlc.tvm.TestUtils; import org.apache.tvm.TestUtils;
import ml.dmlc.tvm.rpc.Client; import org.apache.tvm.rpc.Client;
import ml.dmlc.tvm.rpc.RPCSession; import org.apache.tvm.rpc.RPCSession;
import ml.dmlc.tvm.rpc.Server; import org.apache.tvm.rpc.Server;
import org.junit.BeforeClass; import org.junit.BeforeClass;
import org.junit.Test; import org.junit.Test;
import org.slf4j.Logger; import org.slf4j.Logger;
......
...@@ -15,12 +15,12 @@ ...@@ -15,12 +15,12 @@
* limitations under the License. * limitations under the License.
*/ */
package ml.dmlc.tvm.rpc; package org.apache.tvm.rpc;
import ml.dmlc.tvm.Function; import org.apache.tvm.Function;
import ml.dmlc.tvm.Module; import org.apache.tvm.Module;
import ml.dmlc.tvm.TVMValue; import org.apache.tvm.TVMValue;
import ml.dmlc.tvm.TestUtils; import org.apache.tvm.TestUtils;
import org.junit.Ignore; import org.junit.Ignore;
import org.junit.Test; import org.junit.Test;
import org.slf4j.Logger; import org.slf4j.Logger;
......
...@@ -24,7 +24,7 @@ under the License. ...@@ -24,7 +24,7 @@ under the License.
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<parent> <parent>
<groupId>ml.dmlc.tvm</groupId> <groupId>org.apache.tvm</groupId>
<artifactId>tvm4j-native-parent</artifactId> <artifactId>tvm4j-native-parent</artifactId>
<version>0.0.1-SNAPSHOT</version> <version>0.0.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
...@@ -39,7 +39,7 @@ under the License. ...@@ -39,7 +39,7 @@ under the License.
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>ml.dmlc.tvm</groupId> <groupId>org.apache.tvm</groupId>
<artifactId>tvm4j-core</artifactId> <artifactId>tvm4j-core</artifactId>
<version>${project.version}</version> <version>${project.version}</version>
<type>jar</type> <type>jar</type>
...@@ -68,7 +68,7 @@ under the License. ...@@ -68,7 +68,7 @@ under the License.
<source> <source>
<directory>../src/main/native</directory> <directory>../src/main/native</directory>
<fileNames> <fileNames>
<fileName>ml_dmlc_tvm_native_c_api.cc</fileName> <fileName>org_apache_tvm_native_c_api.cc</fileName>
</fileNames> </fileNames>
</source> </source>
</sources> </sources>
...@@ -96,9 +96,9 @@ under the License. ...@@ -96,9 +96,9 @@ under the License.
<javahProvider>default</javahProvider> <javahProvider>default</javahProvider>
<javahOutputDirectory>${project.build.directory}/custom-javah</javahOutputDirectory> <javahOutputDirectory>${project.build.directory}/custom-javah</javahOutputDirectory>
<workingDirectory>${basedir}</workingDirectory> <workingDirectory>${basedir}</workingDirectory>
<javahOutputFileName>ml_dmlc_tvm_native_c_api.h</javahOutputFileName> <javahOutputFileName>org_apache_tvm_native_c_api.h</javahOutputFileName>
<javahClassNames> <javahClassNames>
<javahClassName>ml.dmlc.tvm.LibInfo</javahClassName> <javahClassName>org.apache.tvm.LibInfo</javahClassName>
</javahClassNames> </javahClassNames>
</configuration> </configuration>
<goals> <goals>
......
...@@ -24,7 +24,7 @@ under the License. ...@@ -24,7 +24,7 @@ under the License.
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<parent> <parent>
<groupId>ml.dmlc.tvm</groupId> <groupId>org.apache.tvm</groupId>
<artifactId>tvm4j-native-parent</artifactId> <artifactId>tvm4j-native-parent</artifactId>
<version>0.0.1-SNAPSHOT</version> <version>0.0.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
...@@ -39,7 +39,7 @@ under the License. ...@@ -39,7 +39,7 @@ under the License.
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>ml.dmlc.tvm</groupId> <groupId>org.apache.tvm</groupId>
<artifactId>tvm4j-core</artifactId> <artifactId>tvm4j-core</artifactId>
<version>${project.version}</version> <version>${project.version}</version>
<type>jar</type> <type>jar</type>
...@@ -68,7 +68,7 @@ under the License. ...@@ -68,7 +68,7 @@ under the License.
<source> <source>
<directory>../src/main/native</directory> <directory>../src/main/native</directory>
<fileNames> <fileNames>
<fileName>ml_dmlc_tvm_native_c_api.cc</fileName> <fileName>org_apache_tvm_native_c_api.cc</fileName>
</fileNames> </fileNames>
</source> </source>
</sources> </sources>
...@@ -102,9 +102,9 @@ under the License. ...@@ -102,9 +102,9 @@ under the License.
<javahProvider>default</javahProvider> <javahProvider>default</javahProvider>
<javahOutputDirectory>${project.build.directory}/custom-javah</javahOutputDirectory> <javahOutputDirectory>${project.build.directory}/custom-javah</javahOutputDirectory>
<workingDirectory>${basedir}</workingDirectory> <workingDirectory>${basedir}</workingDirectory>
<javahOutputFileName>ml_dmlc_tvm_native_c_api.h</javahOutputFileName> <javahOutputFileName>org_apache_tvm_native_c_api.h</javahOutputFileName>
<javahClassNames> <javahClassNames>
<javahClassName>ml.dmlc.tvm.LibInfo</javahClassName> <javahClassName>org.apache.tvm.LibInfo</javahClassName>
</javahClassNames> </javahClassNames>
</configuration> </configuration>
<goals> <goals>
......
...@@ -24,7 +24,7 @@ under the License. ...@@ -24,7 +24,7 @@ under the License.
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<parent> <parent>
<groupId>ml.dmlc.tvm</groupId> <groupId>org.apache.tvm</groupId>
<artifactId>tvm4j-parent</artifactId> <artifactId>tvm4j-parent</artifactId>
<version>0.0.1-SNAPSHOT</version> <version>0.0.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
// Helper functions for RefXXX getter & setter // Helper functions for RefXXX getter & setter
jlong getLongField(JNIEnv *env, jobject obj) { jlong getLongField(JNIEnv *env, jobject obj) {
jclass refClass = env->FindClass("ml/dmlc/tvm/Base$RefLong"); jclass refClass = env->FindClass("org/apache/tvm/Base$RefLong");
jfieldID refFid = env->GetFieldID(refClass, "value", "J"); jfieldID refFid = env->GetFieldID(refClass, "value", "J");
jlong ret = env->GetLongField(obj, refFid); jlong ret = env->GetLongField(obj, refFid);
env->DeleteLocalRef(refClass); env->DeleteLocalRef(refClass);
...@@ -35,7 +35,7 @@ jlong getLongField(JNIEnv *env, jobject obj) { ...@@ -35,7 +35,7 @@ jlong getLongField(JNIEnv *env, jobject obj) {
} }
jint getIntField(JNIEnv *env, jobject obj) { jint getIntField(JNIEnv *env, jobject obj) {
jclass refClass = env->FindClass("ml/dmlc/tvm/Base$RefInt"); jclass refClass = env->FindClass("org/apache/tvm/Base$RefInt");
jfieldID refFid = env->GetFieldID(refClass, "value", "I"); jfieldID refFid = env->GetFieldID(refClass, "value", "I");
jint ret = env->GetIntField(obj, refFid); jint ret = env->GetIntField(obj, refFid);
env->DeleteLocalRef(refClass); env->DeleteLocalRef(refClass);
...@@ -43,21 +43,21 @@ jint getIntField(JNIEnv *env, jobject obj) { ...@@ -43,21 +43,21 @@ jint getIntField(JNIEnv *env, jobject obj) {
} }
void setIntField(JNIEnv *env, jobject obj, jint value) { void setIntField(JNIEnv *env, jobject obj, jint value) {
jclass refClass = env->FindClass("ml/dmlc/tvm/Base$RefInt"); jclass refClass = env->FindClass("org/apache/tvm/Base$RefInt");
jfieldID refFid = env->GetFieldID(refClass, "value", "I"); jfieldID refFid = env->GetFieldID(refClass, "value", "I");
env->SetIntField(obj, refFid, value); env->SetIntField(obj, refFid, value);
env->DeleteLocalRef(refClass); env->DeleteLocalRef(refClass);
} }
void setLongField(JNIEnv *env, jobject obj, jlong value) { void setLongField(JNIEnv *env, jobject obj, jlong value) {
jclass refClass = env->FindClass("ml/dmlc/tvm/Base$RefLong"); jclass refClass = env->FindClass("org/apache/tvm/Base$RefLong");
jfieldID refFid = env->GetFieldID(refClass, "value", "J"); jfieldID refFid = env->GetFieldID(refClass, "value", "J");
env->SetLongField(obj, refFid, value); env->SetLongField(obj, refFid, value);
env->DeleteLocalRef(refClass); env->DeleteLocalRef(refClass);
} }
void setStringField(JNIEnv *env, jobject obj, const char *value) { void setStringField(JNIEnv *env, jobject obj, const char *value) {
jclass refClass = env->FindClass("ml/dmlc/tvm/Base$RefString"); jclass refClass = env->FindClass("org/apache/tvm/Base$RefString");
jfieldID refFid = env->GetFieldID(refClass, "value", "Ljava/lang/String;"); jfieldID refFid = env->GetFieldID(refClass, "value", "Ljava/lang/String;");
env->SetObjectField(obj, refFid, env->NewStringUTF(value)); env->SetObjectField(obj, refFid, env->NewStringUTF(value));
env->DeleteLocalRef(refClass); env->DeleteLocalRef(refClass);
...@@ -65,7 +65,7 @@ void setStringField(JNIEnv *env, jobject obj, const char *value) { ...@@ -65,7 +65,7 @@ void setStringField(JNIEnv *env, jobject obj, const char *value) {
// Helper functions for TVMValue // Helper functions for TVMValue
jlong getTVMValueLongField(JNIEnv *env, jobject obj, jlong getTVMValueLongField(JNIEnv *env, jobject obj,
const char *clsname = "ml/dmlc/tvm/TVMValueLong") { const char *clsname = "org/apache/tvm/TVMValueLong") {
jclass cls = env->FindClass(clsname); jclass cls = env->FindClass(clsname);
jfieldID fid = env->GetFieldID(cls, "value", "J"); jfieldID fid = env->GetFieldID(cls, "value", "J");
jlong ret = env->GetLongField(obj, fid); jlong ret = env->GetLongField(obj, fid);
...@@ -74,7 +74,7 @@ jlong getTVMValueLongField(JNIEnv *env, jobject obj, ...@@ -74,7 +74,7 @@ jlong getTVMValueLongField(JNIEnv *env, jobject obj,
} }
jdouble getTVMValueDoubleField(JNIEnv *env, jobject obj) { jdouble getTVMValueDoubleField(JNIEnv *env, jobject obj) {
jclass cls = env->FindClass("ml/dmlc/tvm/TVMValueDouble"); jclass cls = env->FindClass("org/apache/tvm/TVMValueDouble");
jfieldID fid = env->GetFieldID(cls, "value", "D"); jfieldID fid = env->GetFieldID(cls, "value", "D");
jdouble ret = env->GetDoubleField(obj, fid); jdouble ret = env->GetDoubleField(obj, fid);
env->DeleteLocalRef(cls); env->DeleteLocalRef(cls);
...@@ -82,7 +82,7 @@ jdouble getTVMValueDoubleField(JNIEnv *env, jobject obj) { ...@@ -82,7 +82,7 @@ jdouble getTVMValueDoubleField(JNIEnv *env, jobject obj) {
} }
jstring getTVMValueStringField(JNIEnv *env, jobject obj) { jstring getTVMValueStringField(JNIEnv *env, jobject obj) {
jclass cls = env->FindClass("ml/dmlc/tvm/TVMValueString"); jclass cls = env->FindClass("org/apache/tvm/TVMValueString");
jfieldID fid = env->GetFieldID(cls, "value", "Ljava/lang/String;"); jfieldID fid = env->GetFieldID(cls, "value", "Ljava/lang/String;");
jstring ret = static_cast<jstring>(env->GetObjectField(obj, fid)); jstring ret = static_cast<jstring>(env->GetObjectField(obj, fid));
env->DeleteLocalRef(cls); env->DeleteLocalRef(cls);
...@@ -90,7 +90,7 @@ jstring getTVMValueStringField(JNIEnv *env, jobject obj) { ...@@ -90,7 +90,7 @@ jstring getTVMValueStringField(JNIEnv *env, jobject obj) {
} }
jobject newTVMValueHandle(JNIEnv *env, jlong value) { jobject newTVMValueHandle(JNIEnv *env, jlong value) {
jclass cls = env->FindClass("ml/dmlc/tvm/TVMValueHandle"); jclass cls = env->FindClass("org/apache/tvm/TVMValueHandle");
jmethodID constructor = env->GetMethodID(cls, "<init>", "(J)V"); jmethodID constructor = env->GetMethodID(cls, "<init>", "(J)V");
jobject object = env->NewObject(cls, constructor, value); jobject object = env->NewObject(cls, constructor, value);
env->DeleteLocalRef(cls); env->DeleteLocalRef(cls);
...@@ -98,7 +98,7 @@ jobject newTVMValueHandle(JNIEnv *env, jlong value) { ...@@ -98,7 +98,7 @@ jobject newTVMValueHandle(JNIEnv *env, jlong value) {
} }
jobject newTVMValueLong(JNIEnv *env, jlong value) { jobject newTVMValueLong(JNIEnv *env, jlong value) {
jclass cls = env->FindClass("ml/dmlc/tvm/TVMValueLong"); jclass cls = env->FindClass("org/apache/tvm/TVMValueLong");
jmethodID constructor = env->GetMethodID(cls, "<init>", "(J)V"); jmethodID constructor = env->GetMethodID(cls, "<init>", "(J)V");
jobject object = env->NewObject(cls, constructor, value); jobject object = env->NewObject(cls, constructor, value);
env->DeleteLocalRef(cls); env->DeleteLocalRef(cls);
...@@ -106,7 +106,7 @@ jobject newTVMValueLong(JNIEnv *env, jlong value) { ...@@ -106,7 +106,7 @@ jobject newTVMValueLong(JNIEnv *env, jlong value) {
} }
jobject newTVMValueDouble(JNIEnv *env, jdouble value) { jobject newTVMValueDouble(JNIEnv *env, jdouble value) {
jclass cls = env->FindClass("ml/dmlc/tvm/TVMValueDouble"); jclass cls = env->FindClass("org/apache/tvm/TVMValueDouble");
jmethodID constructor = env->GetMethodID(cls, "<init>", "(D)V"); jmethodID constructor = env->GetMethodID(cls, "<init>", "(D)V");
jobject object = env->NewObject(cls, constructor, value); jobject object = env->NewObject(cls, constructor, value);
env->DeleteLocalRef(cls); env->DeleteLocalRef(cls);
...@@ -115,7 +115,7 @@ jobject newTVMValueDouble(JNIEnv *env, jdouble value) { ...@@ -115,7 +115,7 @@ jobject newTVMValueDouble(JNIEnv *env, jdouble value) {
jobject newTVMValueString(JNIEnv *env, const char *value) { jobject newTVMValueString(JNIEnv *env, const char *value) {
jstring jvalue = env->NewStringUTF(value); jstring jvalue = env->NewStringUTF(value);
jclass cls = env->FindClass("ml/dmlc/tvm/TVMValueString"); jclass cls = env->FindClass("org/apache/tvm/TVMValueString");
jmethodID constructor = env->GetMethodID(cls, "<init>", "(Ljava/lang/String;)V"); jmethodID constructor = env->GetMethodID(cls, "<init>", "(Ljava/lang/String;)V");
jobject object = env->NewObject(cls, constructor, jvalue); jobject object = env->NewObject(cls, constructor, jvalue);
env->DeleteLocalRef(cls); env->DeleteLocalRef(cls);
...@@ -127,7 +127,7 @@ jobject newTVMValueBytes(JNIEnv *env, const TVMByteArray *arr) { ...@@ -127,7 +127,7 @@ jobject newTVMValueBytes(JNIEnv *env, const TVMByteArray *arr) {
jbyteArray jarr = env->NewByteArray(arr->size); jbyteArray jarr = env->NewByteArray(arr->size);
env->SetByteArrayRegion(jarr, 0, arr->size, env->SetByteArrayRegion(jarr, 0, arr->size,
reinterpret_cast<jbyte *>(const_cast<char *>(arr->data))); reinterpret_cast<jbyte *>(const_cast<char *>(arr->data)));
jclass cls = env->FindClass("ml/dmlc/tvm/TVMValueBytes"); jclass cls = env->FindClass("org/apache/tvm/TVMValueBytes");
jmethodID constructor = env->GetMethodID(cls, "<init>", "([B)V"); jmethodID constructor = env->GetMethodID(cls, "<init>", "([B)V");
jobject object = env->NewObject(cls, constructor, jarr); jobject object = env->NewObject(cls, constructor, jarr);
env->DeleteLocalRef(cls); env->DeleteLocalRef(cls);
...@@ -136,7 +136,7 @@ jobject newTVMValueBytes(JNIEnv *env, const TVMByteArray *arr) { ...@@ -136,7 +136,7 @@ jobject newTVMValueBytes(JNIEnv *env, const TVMByteArray *arr) {
} }
jobject newModule(JNIEnv *env, jlong value) { jobject newModule(JNIEnv *env, jlong value) {
jclass cls = env->FindClass("ml/dmlc/tvm/Module"); jclass cls = env->FindClass("org/apache/tvm/Module");
jmethodID constructor = env->GetMethodID(cls, "<init>", "(J)V"); jmethodID constructor = env->GetMethodID(cls, "<init>", "(J)V");
jobject object = env->NewObject(cls, constructor, value); jobject object = env->NewObject(cls, constructor, value);
env->DeleteLocalRef(cls); env->DeleteLocalRef(cls);
...@@ -144,7 +144,7 @@ jobject newModule(JNIEnv *env, jlong value) { ...@@ -144,7 +144,7 @@ jobject newModule(JNIEnv *env, jlong value) {
} }
jobject newFunction(JNIEnv *env, jlong value) { jobject newFunction(JNIEnv *env, jlong value) {
jclass cls = env->FindClass("ml/dmlc/tvm/Function"); jclass cls = env->FindClass("org/apache/tvm/Function");
jmethodID constructor = env->GetMethodID(cls, "<init>", "(J)V"); jmethodID constructor = env->GetMethodID(cls, "<init>", "(J)V");
jobject object = env->NewObject(cls, constructor, value); jobject object = env->NewObject(cls, constructor, value);
env->DeleteLocalRef(cls); env->DeleteLocalRef(cls);
...@@ -152,7 +152,7 @@ jobject newFunction(JNIEnv *env, jlong value) { ...@@ -152,7 +152,7 @@ jobject newFunction(JNIEnv *env, jlong value) {
} }
jobject newNDArray(JNIEnv *env, jlong handle, jboolean isview) { jobject newNDArray(JNIEnv *env, jlong handle, jboolean isview) {
jclass cls = env->FindClass("ml/dmlc/tvm/NDArrayBase"); jclass cls = env->FindClass("org/apache/tvm/NDArrayBase");
jmethodID constructor = env->GetMethodID(cls, "<init>", "(JZ)V"); jmethodID constructor = env->GetMethodID(cls, "<init>", "(JZ)V");
jobject object = env->NewObject(cls, constructor, handle, isview); jobject object = env->NewObject(cls, constructor, handle, isview);
env->DeleteLocalRef(cls); env->DeleteLocalRef(cls);
...@@ -168,7 +168,7 @@ jobject newObject(JNIEnv *env, const char *clsname) { ...@@ -168,7 +168,7 @@ jobject newObject(JNIEnv *env, const char *clsname) {
} }
void fromJavaDType(JNIEnv *env, jobject jdtype, TVMType *dtype) { void fromJavaDType(JNIEnv *env, jobject jdtype, TVMType *dtype) {
jclass tvmTypeClass = env->FindClass("ml/dmlc/tvm/TVMType"); jclass tvmTypeClass = env->FindClass("org/apache/tvm/TVMType");
dtype->code = (uint8_t)(env->GetIntField(jdtype, env->GetFieldID(tvmTypeClass, "typeCode", "I"))); dtype->code = (uint8_t)(env->GetIntField(jdtype, env->GetFieldID(tvmTypeClass, "typeCode", "I")));
dtype->bits = (uint8_t)(env->GetIntField(jdtype, env->GetFieldID(tvmTypeClass, "bits", "I"))); dtype->bits = (uint8_t)(env->GetIntField(jdtype, env->GetFieldID(tvmTypeClass, "bits", "I")));
dtype->lanes = (uint16_t)(env->GetIntField(jdtype, env->GetFieldID(tvmTypeClass, "lanes", "I"))); dtype->lanes = (uint16_t)(env->GetIntField(jdtype, env->GetFieldID(tvmTypeClass, "lanes", "I")));
...@@ -176,7 +176,7 @@ void fromJavaDType(JNIEnv *env, jobject jdtype, TVMType *dtype) { ...@@ -176,7 +176,7 @@ void fromJavaDType(JNIEnv *env, jobject jdtype, TVMType *dtype) {
} }
void fromJavaContext(JNIEnv *env, jobject jctx, TVMContext *ctx) { void fromJavaContext(JNIEnv *env, jobject jctx, TVMContext *ctx) {
jclass tvmContextClass = env->FindClass("ml/dmlc/tvm/TVMContext"); jclass tvmContextClass = env->FindClass("org/apache/tvm/TVMContext");
ctx->device_type = static_cast<DLDeviceType>(env->GetIntField(jctx, ctx->device_type = static_cast<DLDeviceType>(env->GetIntField(jctx,
env->GetFieldID(tvmContextClass, "deviceType", "I"))); env->GetFieldID(tvmContextClass, "deviceType", "I")));
ctx->device_id = static_cast<int>(env->GetIntField(jctx, ctx->device_id = static_cast<int>(env->GetIntField(jctx,
...@@ -206,7 +206,7 @@ jobject tvmRetValueToJava(JNIEnv *env, TVMValue value, int tcode) { ...@@ -206,7 +206,7 @@ jobject tvmRetValueToJava(JNIEnv *env, TVMValue value, int tcode) {
case kBytes: case kBytes:
return newTVMValueBytes(env, reinterpret_cast<TVMByteArray *>(value.v_handle)); return newTVMValueBytes(env, reinterpret_cast<TVMByteArray *>(value.v_handle));
case kNull: case kNull:
return newObject(env, "ml/dmlc/tvm/TVMValueNull"); return newObject(env, "org/apache/tvm/TVMValueNull");
default: default:
LOG(FATAL) << "Do NOT know how to handle return type code " << tcode; LOG(FATAL) << "Do NOT know how to handle return type code " << tcode;
} }
......
...@@ -17,10 +17,10 @@ ...@@ -17,10 +17,10 @@
* under the License. * under the License.
*/ */
/*! /*!
* \file ml_dmlc_tvm_native_c_api.cc * \file org_apache_tvm_native_c_api.cc
* \brief tvm4j jni source file * \brief tvm4j jni source file
*/ */
#include "ml_dmlc_tvm_native_c_api.h" // generated by javah #include "org_apache_tvm_native_c_api.h" // generated by javah
#ifdef TVM4J_ANDROID #ifdef TVM4J_ANDROID
#include "tvm_runtime.h" #include "tvm_runtime.h"
#else #else
...@@ -47,7 +47,7 @@ struct TVMFuncArgsThreadLocalEntry { ...@@ -47,7 +47,7 @@ struct TVMFuncArgsThreadLocalEntry {
}; };
typedef dmlc::ThreadLocalStore<TVMFuncArgsThreadLocalEntry> TVMFuncArgsThreadLocalStore; typedef dmlc::ThreadLocalStore<TVMFuncArgsThreadLocalEntry> TVMFuncArgsThreadLocalStore;
JNIEXPORT jint JNICALL Java_ml_dmlc_tvm_LibInfo_nativeLibInit JNIEXPORT jint JNICALL Java_org_apache_tvm_LibInfo_nativeLibInit
(JNIEnv *env, jobject obj, jstring jtvmLibFile) { (JNIEnv *env, jobject obj, jstring jtvmLibFile) {
if (_tvmHandle == NULL && !env->IsSameObject(jtvmLibFile, NULL)) { if (_tvmHandle == NULL && !env->IsSameObject(jtvmLibFile, NULL)) {
const char *tvmLibFile = env->GetStringUTFChars(jtvmLibFile, 0); const char *tvmLibFile = env->GetStringUTFChars(jtvmLibFile, 0);
...@@ -61,19 +61,19 @@ JNIEXPORT jint JNICALL Java_ml_dmlc_tvm_LibInfo_nativeLibInit ...@@ -61,19 +61,19 @@ JNIEXPORT jint JNICALL Java_ml_dmlc_tvm_LibInfo_nativeLibInit
return env->GetJavaVM(&_jvm); return env->GetJavaVM(&_jvm);
} }
JNIEXPORT jint JNICALL Java_ml_dmlc_tvm_LibInfo_shutdown(JNIEnv *env, jobject obj) { JNIEXPORT jint JNICALL Java_org_apache_tvm_LibInfo_shutdown(JNIEnv *env, jobject obj) {
if (_tvmHandle) { if (_tvmHandle) {
dlclose(_tvmHandle); dlclose(_tvmHandle);
} }
return 0; return 0;
} }
JNIEXPORT jstring JNICALL Java_ml_dmlc_tvm_LibInfo_tvmGetLastError(JNIEnv * env, jobject obj) { JNIEXPORT jstring JNICALL Java_org_apache_tvm_LibInfo_tvmGetLastError(JNIEnv * env, jobject obj) {
return env->NewStringUTF(TVMGetLastError()); return env->NewStringUTF(TVMGetLastError());
} }
// Function // Function
JNIEXPORT void JNICALL Java_ml_dmlc_tvm_LibInfo_tvmFuncPushArgLong( JNIEXPORT void JNICALL Java_org_apache_tvm_LibInfo_tvmFuncPushArgLong(
JNIEnv *env, jobject obj, jlong arg) { JNIEnv *env, jobject obj, jlong arg) {
TVMValue value; TVMValue value;
value.v_int64 = static_cast<int64_t>(arg); value.v_int64 = static_cast<int64_t>(arg);
...@@ -82,7 +82,7 @@ JNIEXPORT void JNICALL Java_ml_dmlc_tvm_LibInfo_tvmFuncPushArgLong( ...@@ -82,7 +82,7 @@ JNIEXPORT void JNICALL Java_ml_dmlc_tvm_LibInfo_tvmFuncPushArgLong(
e->tvmFuncArgTypes.push_back(kDLInt); e->tvmFuncArgTypes.push_back(kDLInt);
} }
JNIEXPORT void JNICALL Java_ml_dmlc_tvm_LibInfo_tvmFuncPushArgDouble( JNIEXPORT void JNICALL Java_org_apache_tvm_LibInfo_tvmFuncPushArgDouble(
JNIEnv *env, jobject obj, jdouble arg) { JNIEnv *env, jobject obj, jdouble arg) {
TVMValue value; TVMValue value;
value.v_float64 = static_cast<double>(arg); value.v_float64 = static_cast<double>(arg);
...@@ -91,7 +91,7 @@ JNIEXPORT void JNICALL Java_ml_dmlc_tvm_LibInfo_tvmFuncPushArgDouble( ...@@ -91,7 +91,7 @@ JNIEXPORT void JNICALL Java_ml_dmlc_tvm_LibInfo_tvmFuncPushArgDouble(
e->tvmFuncArgTypes.push_back(kDLFloat); e->tvmFuncArgTypes.push_back(kDLFloat);
} }
JNIEXPORT void JNICALL Java_ml_dmlc_tvm_LibInfo_tvmFuncPushArgString( JNIEXPORT void JNICALL Java_org_apache_tvm_LibInfo_tvmFuncPushArgString(
JNIEnv *env, jobject obj, jstring arg) { JNIEnv *env, jobject obj, jstring arg) {
TVMValue value; TVMValue value;
jstring garg = reinterpret_cast<jstring>(env->NewGlobalRef(arg)); jstring garg = reinterpret_cast<jstring>(env->NewGlobalRef(arg));
...@@ -103,7 +103,7 @@ JNIEXPORT void JNICALL Java_ml_dmlc_tvm_LibInfo_tvmFuncPushArgString( ...@@ -103,7 +103,7 @@ JNIEXPORT void JNICALL Java_ml_dmlc_tvm_LibInfo_tvmFuncPushArgString(
e->tvmFuncArgPushedStrs.push_back(std::make_pair(garg, value.v_str)); e->tvmFuncArgPushedStrs.push_back(std::make_pair(garg, value.v_str));
} }
JNIEXPORT void JNICALL Java_ml_dmlc_tvm_LibInfo_tvmFuncPushArgHandle( JNIEXPORT void JNICALL Java_org_apache_tvm_LibInfo_tvmFuncPushArgHandle(
JNIEnv *env, jobject obj, jlong arg, jint argType) { JNIEnv *env, jobject obj, jlong arg, jint argType) {
TVMValue value; TVMValue value;
value.v_handle = reinterpret_cast<void *>(arg); value.v_handle = reinterpret_cast<void *>(arg);
...@@ -112,7 +112,7 @@ JNIEXPORT void JNICALL Java_ml_dmlc_tvm_LibInfo_tvmFuncPushArgHandle( ...@@ -112,7 +112,7 @@ JNIEXPORT void JNICALL Java_ml_dmlc_tvm_LibInfo_tvmFuncPushArgHandle(
e->tvmFuncArgTypes.push_back(static_cast<int>(argType)); e->tvmFuncArgTypes.push_back(static_cast<int>(argType));
} }
JNIEXPORT void JNICALL Java_ml_dmlc_tvm_LibInfo_tvmFuncPushArgBytes( JNIEXPORT void JNICALL Java_org_apache_tvm_LibInfo_tvmFuncPushArgBytes(
JNIEnv *env, jobject obj, jbyteArray arg) { JNIEnv *env, jobject obj, jbyteArray arg) {
jbyteArray garg = reinterpret_cast<jbyteArray>(env->NewGlobalRef(arg)); jbyteArray garg = reinterpret_cast<jbyteArray>(env->NewGlobalRef(arg));
jbyte *data = env->GetByteArrayElements(garg, 0); jbyte *data = env->GetByteArrayElements(garg, 0);
...@@ -132,7 +132,7 @@ JNIEXPORT void JNICALL Java_ml_dmlc_tvm_LibInfo_tvmFuncPushArgBytes( ...@@ -132,7 +132,7 @@ JNIEXPORT void JNICALL Java_ml_dmlc_tvm_LibInfo_tvmFuncPushArgBytes(
// release (garg, data), byteArray later // release (garg, data), byteArray later
} }
JNIEXPORT jint JNICALL Java_ml_dmlc_tvm_LibInfo_tvmFuncListGlobalNames( JNIEXPORT jint JNICALL Java_org_apache_tvm_LibInfo_tvmFuncListGlobalNames(
JNIEnv *env, jobject obj, jobject jfuncNames) { JNIEnv *env, jobject obj, jobject jfuncNames) {
int outSize; int outSize;
const char **outArray; const char **outArray;
...@@ -157,12 +157,12 @@ JNIEXPORT jint JNICALL Java_ml_dmlc_tvm_LibInfo_tvmFuncListGlobalNames( ...@@ -157,12 +157,12 @@ JNIEXPORT jint JNICALL Java_ml_dmlc_tvm_LibInfo_tvmFuncListGlobalNames(
return ret; return ret;
} }
JNIEXPORT jint JNICALL Java_ml_dmlc_tvm_LibInfo_tvmFuncFree( JNIEXPORT jint JNICALL Java_org_apache_tvm_LibInfo_tvmFuncFree(
JNIEnv *env, jobject obj, jlong jhandle) { JNIEnv *env, jobject obj, jlong jhandle) {
return TVMFuncFree(reinterpret_cast<TVMFunctionHandle>(jhandle)); return TVMFuncFree(reinterpret_cast<TVMFunctionHandle>(jhandle));
} }
JNIEXPORT jint JNICALL Java_ml_dmlc_tvm_LibInfo_tvmFuncGetGlobal( JNIEXPORT jint JNICALL Java_org_apache_tvm_LibInfo_tvmFuncGetGlobal(
JNIEnv *env, jobject obj, jstring jname, jobject jhandle) { JNIEnv *env, jobject obj, jstring jname, jobject jhandle) {
TVMFunctionHandle handle; TVMFunctionHandle handle;
const char *name = env->GetStringUTFChars(jname, 0); const char *name = env->GetStringUTFChars(jname, 0);
...@@ -172,7 +172,7 @@ JNIEXPORT jint JNICALL Java_ml_dmlc_tvm_LibInfo_tvmFuncGetGlobal( ...@@ -172,7 +172,7 @@ JNIEXPORT jint JNICALL Java_ml_dmlc_tvm_LibInfo_tvmFuncGetGlobal(
return ret; return ret;
} }
JNIEXPORT jint JNICALL Java_ml_dmlc_tvm_LibInfo_tvmFuncCall( JNIEXPORT jint JNICALL Java_org_apache_tvm_LibInfo_tvmFuncCall(
JNIEnv *env, jobject obj, jlong jhandle, jobject jretVal) { JNIEnv *env, jobject obj, jlong jhandle, jobject jretVal) {
TVMFuncArgsThreadLocalEntry *e = TVMFuncArgsThreadLocalStore::Get(); TVMFuncArgsThreadLocalEntry *e = TVMFuncArgsThreadLocalStore::Get();
int numArgs = e->tvmFuncArgValues.size(); int numArgs = e->tvmFuncArgValues.size();
...@@ -211,9 +211,9 @@ JNIEXPORT jint JNICALL Java_ml_dmlc_tvm_LibInfo_tvmFuncCall( ...@@ -211,9 +211,9 @@ JNIEXPORT jint JNICALL Java_ml_dmlc_tvm_LibInfo_tvmFuncCall(
} }
// return TVMValue object to Java // return TVMValue object to Java
jclass refTVMValueCls = env->FindClass("ml/dmlc/tvm/Base$RefTVMValue"); jclass refTVMValueCls = env->FindClass("org/apache/tvm/Base$RefTVMValue");
jfieldID refTVMValueFid jfieldID refTVMValueFid
= env->GetFieldID(refTVMValueCls, "value", "Lml/dmlc/tvm/TVMValue;"); = env->GetFieldID(refTVMValueCls, "value", "Lorg/apache/tvm/TVMValue;");
env->SetObjectField(jretVal, refTVMValueFid, tvmRetValueToJava(env, retVal, retTypeCode)); env->SetObjectField(jretVal, refTVMValueFid, tvmRetValueToJava(env, retVal, retTypeCode));
...@@ -237,7 +237,7 @@ extern "C" int funcInvokeCallback(TVMValue *args, ...@@ -237,7 +237,7 @@ extern "C" int funcInvokeCallback(TVMValue *args,
CHECK(jniStatus == JNI_OK); CHECK(jniStatus == JNI_OK);
} }
jclass tvmValueCls = env->FindClass("ml/dmlc/tvm/TVMValue"); jclass tvmValueCls = env->FindClass("org/apache/tvm/TVMValue");
jobjectArray jargs = env->NewObjectArray(numArgs, tvmValueCls, 0); jobjectArray jargs = env->NewObjectArray(numArgs, tvmValueCls, 0);
for (int i = 0; i < numArgs; ++i) { for (int i = 0; i < numArgs; ++i) {
TVMValue arg = args[i]; TVMValue arg = args[i];
...@@ -249,9 +249,9 @@ extern "C" int funcInvokeCallback(TVMValue *args, ...@@ -249,9 +249,9 @@ extern "C" int funcInvokeCallback(TVMValue *args,
env->SetObjectArrayElement(jargs, i, jarg); env->SetObjectArrayElement(jargs, i, jarg);
} }
jclass clsFunc = env->FindClass("ml/dmlc/tvm/Function"); jclass clsFunc = env->FindClass("org/apache/tvm/Function");
jmethodID invokeRegisteredCbFunc = env->GetStaticMethodID(clsFunc, "invokeRegisteredCbFunc", jmethodID invokeRegisteredCbFunc = env->GetStaticMethodID(clsFunc, "invokeRegisteredCbFunc",
"(Lml/dmlc/tvm/Function$Callback;[Lml/dmlc/tvm/TVMValue;)Ljava/lang/Object;"); "(Lorg/apache/tvm/Function$Callback;[Lorg/apache/tvm/TVMValue;)Ljava/lang/Object;");
jmethodID pushArgToStack = env->GetStaticMethodID(clsFunc, "pushArgToStack", jmethodID pushArgToStack = env->GetStaticMethodID(clsFunc, "pushArgToStack",
"(Ljava/lang/Object;)V"); "(Ljava/lang/Object;)V");
...@@ -313,7 +313,7 @@ extern "C" void funcFreeCallback(void *resourceHandle) { ...@@ -313,7 +313,7 @@ extern "C" void funcFreeCallback(void *resourceHandle) {
env->DeleteGlobalRef(reinterpret_cast<jobject>(resourceHandle)); env->DeleteGlobalRef(reinterpret_cast<jobject>(resourceHandle));
} }
JNIEXPORT jint JNICALL Java_ml_dmlc_tvm_LibInfo_tvmFuncCreateFromCFunc( JNIEXPORT jint JNICALL Java_org_apache_tvm_LibInfo_tvmFuncCreateFromCFunc(
JNIEnv *env, jobject obj, jobject jfunction, jobject jretHandle) { JNIEnv *env, jobject obj, jobject jfunction, jobject jretHandle) {
TVMFunctionHandle out; TVMFunctionHandle out;
int ret = TVMFuncCreateFromCFunc(reinterpret_cast<TVMPackedCFunc>(&funcInvokeCallback), int ret = TVMFuncCreateFromCFunc(reinterpret_cast<TVMPackedCFunc>(&funcInvokeCallback),
...@@ -324,7 +324,7 @@ JNIEXPORT jint JNICALL Java_ml_dmlc_tvm_LibInfo_tvmFuncCreateFromCFunc( ...@@ -324,7 +324,7 @@ JNIEXPORT jint JNICALL Java_ml_dmlc_tvm_LibInfo_tvmFuncCreateFromCFunc(
return ret; return ret;
} }
JNIEXPORT jint JNICALL Java_ml_dmlc_tvm_LibInfo_tvmFuncRegisterGlobal( JNIEXPORT jint JNICALL Java_org_apache_tvm_LibInfo_tvmFuncRegisterGlobal(
JNIEnv *env, jobject obj, jstring jname, jlong jhandle, jint joverride) { JNIEnv *env, jobject obj, jstring jname, jlong jhandle, jint joverride) {
const char *name = env->GetStringUTFChars(jname, 0); const char *name = env->GetStringUTFChars(jname, 0);
int ret = TVMFuncRegisterGlobal( int ret = TVMFuncRegisterGlobal(
...@@ -334,18 +334,18 @@ JNIEXPORT jint JNICALL Java_ml_dmlc_tvm_LibInfo_tvmFuncRegisterGlobal( ...@@ -334,18 +334,18 @@ JNIEXPORT jint JNICALL Java_ml_dmlc_tvm_LibInfo_tvmFuncRegisterGlobal(
} }
// Module // Module
JNIEXPORT jint JNICALL Java_ml_dmlc_tvm_LibInfo_tvmModFree( JNIEXPORT jint JNICALL Java_org_apache_tvm_LibInfo_tvmModFree(
JNIEnv *env, jobject obj, jlong jhandle) { JNIEnv *env, jobject obj, jlong jhandle) {
return TVMModFree(reinterpret_cast<TVMModuleHandle>(jhandle)); return TVMModFree(reinterpret_cast<TVMModuleHandle>(jhandle));
} }
JNIEXPORT jint JNICALL Java_ml_dmlc_tvm_LibInfo_tvmModImport( JNIEXPORT jint JNICALL Java_org_apache_tvm_LibInfo_tvmModImport(
JNIEnv *env, jobject obj, jlong jmod, jlong jdep) { JNIEnv *env, jobject obj, jlong jmod, jlong jdep) {
return TVMModImport(reinterpret_cast<TVMModuleHandle>(jmod), return TVMModImport(reinterpret_cast<TVMModuleHandle>(jmod),
reinterpret_cast<TVMModuleHandle>(jdep)); reinterpret_cast<TVMModuleHandle>(jdep));
} }
JNIEXPORT jint JNICALL Java_ml_dmlc_tvm_LibInfo_tvmModGetFunction( JNIEXPORT jint JNICALL Java_org_apache_tvm_LibInfo_tvmModGetFunction(
JNIEnv *env, jobject obj, jlong jhandle, jstring jname, jint jimport, jobject jret) { JNIEnv *env, jobject obj, jlong jhandle, jstring jname, jint jimport, jobject jret) {
TVMFunctionHandle retFunc; TVMFunctionHandle retFunc;
...@@ -362,12 +362,12 @@ JNIEXPORT jint JNICALL Java_ml_dmlc_tvm_LibInfo_tvmModGetFunction( ...@@ -362,12 +362,12 @@ JNIEXPORT jint JNICALL Java_ml_dmlc_tvm_LibInfo_tvmModGetFunction(
} }
// NDArray // NDArray
JNIEXPORT jint JNICALL Java_ml_dmlc_tvm_LibInfo_tvmArrayFree( JNIEXPORT jint JNICALL Java_org_apache_tvm_LibInfo_tvmArrayFree(
JNIEnv *env, jobject obj, jlong jhandle) { JNIEnv *env, jobject obj, jlong jhandle) {
return TVMArrayFree(reinterpret_cast<TVMArrayHandle>(jhandle)); return TVMArrayFree(reinterpret_cast<TVMArrayHandle>(jhandle));
} }
JNIEXPORT jint JNICALL Java_ml_dmlc_tvm_LibInfo_tvmArrayAlloc( JNIEXPORT jint JNICALL Java_org_apache_tvm_LibInfo_tvmArrayAlloc(
JNIEnv *env, jobject obj, jlongArray jshape, jint jdtypeCode, JNIEnv *env, jobject obj, jlongArray jshape, jint jdtypeCode,
jint jdtypeBits, jint jdtypeLanes, jint jdeviceType, jint jdeviceId, jobject jret) { jint jdtypeBits, jint jdtypeLanes, jint jdeviceType, jint jdeviceId, jobject jret) {
int ndim = static_cast<int>(env->GetArrayLength(jshape)); int ndim = static_cast<int>(env->GetArrayLength(jshape));
...@@ -391,7 +391,7 @@ JNIEXPORT jint JNICALL Java_ml_dmlc_tvm_LibInfo_tvmArrayAlloc( ...@@ -391,7 +391,7 @@ JNIEXPORT jint JNICALL Java_ml_dmlc_tvm_LibInfo_tvmArrayAlloc(
return ret; return ret;
} }
JNIEXPORT jint JNICALL Java_ml_dmlc_tvm_LibInfo_tvmArrayGetShape( JNIEXPORT jint JNICALL Java_org_apache_tvm_LibInfo_tvmArrayGetShape(
JNIEnv *env, jobject obj, jlong jhandle, jobject jshape) { JNIEnv *env, jobject obj, jlong jhandle, jobject jshape) {
TVMArray *array = reinterpret_cast<TVMArray *>(jhandle); TVMArray *array = reinterpret_cast<TVMArray *>(jhandle);
int64_t *shape = array->shape; int64_t *shape = array->shape;
...@@ -414,13 +414,13 @@ JNIEXPORT jint JNICALL Java_ml_dmlc_tvm_LibInfo_tvmArrayGetShape( ...@@ -414,13 +414,13 @@ JNIEXPORT jint JNICALL Java_ml_dmlc_tvm_LibInfo_tvmArrayGetShape(
return 0; return 0;
} }
JNIEXPORT jint JNICALL Java_ml_dmlc_tvm_LibInfo_tvmArrayCopyFromTo( JNIEXPORT jint JNICALL Java_org_apache_tvm_LibInfo_tvmArrayCopyFromTo(
JNIEnv *env, jobject obj, jlong jfrom, jlong jto) { JNIEnv *env, jobject obj, jlong jfrom, jlong jto) {
return TVMArrayCopyFromTo(reinterpret_cast<TVMArrayHandle>(jfrom), return TVMArrayCopyFromTo(reinterpret_cast<TVMArrayHandle>(jfrom),
reinterpret_cast<TVMArrayHandle>(jto), NULL); reinterpret_cast<TVMArrayHandle>(jto), NULL);
} }
JNIEXPORT jint JNICALL Java_ml_dmlc_tvm_LibInfo_tvmArrayCopyFromJArray( JNIEXPORT jint JNICALL Java_org_apache_tvm_LibInfo_tvmArrayCopyFromJArray(
JNIEnv *env, jobject obj, jbyteArray jarr, jlong jfrom, jlong jto) { JNIEnv *env, jobject obj, jbyteArray jarr, jlong jfrom, jlong jto) {
jbyte *data = env->GetByteArrayElements(jarr, NULL); jbyte *data = env->GetByteArrayElements(jarr, NULL);
...@@ -436,7 +436,7 @@ JNIEXPORT jint JNICALL Java_ml_dmlc_tvm_LibInfo_tvmArrayCopyFromJArray( ...@@ -436,7 +436,7 @@ JNIEXPORT jint JNICALL Java_ml_dmlc_tvm_LibInfo_tvmArrayCopyFromJArray(
return ret; return ret;
} }
JNIEXPORT jint JNICALL Java_ml_dmlc_tvm_LibInfo_tvmArrayCopyToJArray( JNIEXPORT jint JNICALL Java_org_apache_tvm_LibInfo_tvmArrayCopyToJArray(
JNIEnv *env, jobject obj, jlong jfrom, jbyteArray jarr) { JNIEnv *env, jobject obj, jlong jfrom, jbyteArray jarr) {
TVMArray *from = reinterpret_cast<TVMArray *>(jfrom); TVMArray *from = reinterpret_cast<TVMArray *>(jfrom);
int size = static_cast<int>(env->GetArrayLength(jarr)); int size = static_cast<int>(env->GetArrayLength(jarr));
...@@ -450,7 +450,7 @@ JNIEXPORT jint JNICALL Java_ml_dmlc_tvm_LibInfo_tvmArrayCopyToJArray( ...@@ -450,7 +450,7 @@ JNIEXPORT jint JNICALL Java_ml_dmlc_tvm_LibInfo_tvmArrayCopyToJArray(
} }
// Context // Context
JNIEXPORT jint JNICALL Java_ml_dmlc_tvm_LibInfo_tvmSynchronize( JNIEXPORT jint JNICALL Java_org_apache_tvm_LibInfo_tvmSynchronize(
JNIEnv *env, jint deviceType, jint deviceId) { JNIEnv *env, jint deviceType, jint deviceId) {
return TVMSynchronize(static_cast<int>(deviceType), static_cast<int>(deviceId), NULL); return TVMSynchronize(static_cast<int>(deviceType), static_cast<int>(deviceId), NULL);
} }
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>ml.dmlc.tvm</groupId> <groupId>org.apache.tvm</groupId>
<artifactId>tvm4j-parent</artifactId> <artifactId>tvm4j-parent</artifactId>
<version>0.0.1-SNAPSHOT</version> <version>0.0.1-SNAPSHOT</version>
<name>TVM4J Package - Parent</name> <name>TVM4J Package - Parent</name>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment