Skip to content

Commit

Permalink
clean build scripts, java frontend and others #2
Browse files Browse the repository at this point in the history
  • Loading branch information
Valery Chernov committed Feb 11, 2022
1 parent d9358d0 commit 68c998d
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 29 deletions.
6 changes: 3 additions & 3 deletions cmake/onnxruntime_unittests.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -1288,11 +1288,11 @@ if (NOT onnxruntime_MINIMAL_BUILD AND NOT onnxruntime_EXTENDED_MINIMAL_BUILD
endif()

if (onnxruntime_USE_TVM)
# find_library(STVM_LIBS NAMES libtvm.so PATHS ${onnxruntime_TVM_HOME}/lib)
# link_directories(onnxruntime_test_all ${STVM_LIBS})
# find_library(TVM_LIBS NAMES libtvm.so PATHS ${onnxruntime_TVM_HOME}/lib)
# link_directories(onnxruntime_test_all ${TVM_LIBS})
find_library(PYTHON_LIBS NAMES libpython PATHS /usr/local/lib)
#target_link_libraries(onnxruntime_test_all PRIVATE ${PYTHON_LIBRARIES} -lutil)
# set(CMAKE_SHARED_LINKER_FLAGS "-Wl,-rpath,${STVM_LIBS}")
# set(CMAKE_SHARED_LINKER_FLAGS "-Wl,-rpath,${TVM_LIBS}")
endif()

include(onnxruntime_fuzz_test.cmake)
14 changes: 7 additions & 7 deletions csharp/src/Microsoft.ML.OnnxRuntime/SessionOptions.shared.cs
Original file line number Diff line number Diff line change
Expand Up @@ -150,15 +150,15 @@ public static SessionOptions MakeSessionOptionWithNupharProvider(String settings
}

/// <summary>
/// A helper method to construct a SessionOptions object for Stvm execution.
/// A helper method to construct a SessionOptions object for TVM execution.
/// Use only if you have the onnxruntime package specific to this Execution Provider.
/// </summary>
/// <param name="settings">settings string, comprises of comma separated key:value pairs. default is empty</param>
/// <returns>A SessionsOptions() object configured for execution with Stvm</returns>
public static SessionOptions MakeSessionOptionWithStvmProvider(String settings = "")
/// <returns>A SessionsOptions() object configured for execution with TVM</returns>
public static SessionOptions MakeSessionOptionWithTvmProvider(String settings = "")
{
SessionOptions options = new SessionOptions();
options.AppendExecutionProvider_Stvm(settings);
options.AppendExecutionProvider_Tvm(settings);

return options;
}
Expand Down Expand Up @@ -360,11 +360,11 @@ public void AppendExecutionProvider_Nuphar(string settings = "")
/// <summary>
/// Use only if you have the onnxruntime package specific to this Execution Provider.
/// </summary>
/// <param name="settings">string with Stvm specific settings</param>
public void AppendExecutionProvider_Stvm(string settings = "")
/// <param name="settings">string with TVM specific settings</param>
public void AppendExecutionProvider_Tvm(string settings = "")
{
#if __MOBILE__
throw new NotSupportedException("The Stvm Execution Provider is not supported in this build");
throw new NotSupportedException("The TVM Execution Provider is not supported in this build");
#else
var settingsPinned = GCHandle.Alloc(NativeOnnxValueHelper.StringToZeroTerminatedUtf8(settings), GCHandleType.Pinned);
using (var pinnedSettingsName = new PinnedGCHandle(settingsPinned))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public void TestSessionOptions()
#endif

#if USE_TVM
opt.AppendExecutionProvider_Stvm("Vulkan -device=amd_apu");
opt.AppendExecutionProvider_Tvm("Vulkan -device=amd_apu");
#endif

#if USE_NUPHAR
Expand Down
12 changes: 6 additions & 6 deletions docs/python/inference/notebooks/onnxruntime-stvm-tutorial.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
"id": "72476497",
"metadata": {},
"source": [
"# ONNX Runtime: Tutorial for STVM execution provider\n",
"# ONNX Runtime: Tutorial for TVM execution provider\n",
"\n",
"This notebook shows a simple example for model inference with STVM EP.\n",
"This notebook shows a simple example for model inference with TVM EP.\n",
"\n",
"\n",
"#### Tutorial Roadmap:\n",
"1. Prerequistes\n",
"2. Accuracy check for STVM EP\n",
"2. Accuracy check for TVM EP\n",
"3. Configuration options"
]
},
Expand Down Expand Up @@ -72,7 +72,7 @@
"source": [
"import tvm.testing\n",
"from tvm.contrib.download import download_testdata\n",
"import onnxruntime.providers.stvm # nessesary to register tvm_onnx_import_and_compile and others"
"import onnxruntime.providers.tvm # nessesary to register tvm_onnx_import_and_compile and others"
]
},
{
Expand Down Expand Up @@ -254,7 +254,7 @@
"id": "90fb7c5c",
"metadata": {},
"source": [
"## 2. Accuracy check for STVM EP \n",
"## 2. Accuracy check for TVM EP \n",
"\n",
"This section will check the accuracy. The check will be to compare the output tensors for `CPUExecutionProvider` and `TvmExecutionProvider`. See the description of `verify_with_ort_with_inputs` function used above.\n",
"\n",
Expand Down Expand Up @@ -424,7 +424,7 @@
"source": [
"## 3. Configuration options\n",
"\n",
"This section shows how you can configure STVM EP using custom options. For more details on the options used, see the corresponding section of the documentation."
"This section shows how you can configure TVM EP using custom options. For more details on the options used, see the corresponding section of the documentation."
]
},
{
Expand Down
8 changes: 4 additions & 4 deletions java/src/main/java/ai/onnxruntime/OrtSession.java
Original file line number Diff line number Diff line change
Expand Up @@ -890,14 +890,14 @@ public void addNuphar(boolean allowUnalignedBuffers, String settings) throws Ort
}

/**
* Adds Stvm as an execution backend.
* Adds TVM as an execution backend.
*
* @param settings See the documentation for valid settings strings.
* @throws OrtException If there was an error in native code.
*/
public void addStvm(String settings) throws OrtException {
public void addTvm(String settings) throws OrtException {
checkClosed();
addStvm(OnnxRuntime.ortApiHandle, nativeHandle, settings);
addTvm(OnnxRuntime.ortApiHandle, nativeHandle, settings);
}

/**
Expand Down Expand Up @@ -1045,7 +1045,7 @@ private native void addNuphar(
long apiHandle, long nativeHandle, int allowUnalignedBuffers, String settings)
throws OrtException;

private native void addStvm(
private native void addTvm(
long apiHandle, long nativeHandle, String settings)
throws OrtException;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -466,19 +466,19 @@ JNIEXPORT void JNICALL Java_ai_onnxruntime_OrtSession_00024SessionOptions_addNup

/*
* Class:: ai_onnxruntime_OrtSession_SessionOptions
* Method: addStvm
* Method: addTvm
* Signature: (JILjava/lang/String)V
*/
JNIEXPORT void JNICALL Java_ai_onnxruntime_OrtSession_00024SessionOptions_addStvm
JNIEXPORT void JNICALL Java_ai_onnxruntime_OrtSession_00024SessionOptions_addTvm
(JNIEnv * jniEnv, jobject jobj, jlong apiHandle, jlong handle, jstring settingsString) {
(void)jobj;
#ifdef USE_TVM
const char* settings = (*jniEnv)->GetStringUTFChars(jniEnv, settingsString, NULL);
checkOrtStatus(jniEnv,(const OrtApi*)apiHandle,OrtSessionOptionsAppendExecutionProvider_Tvm((OrtSessionOptions*) handle, settings));
(*jniEnv)->ReleaseStringUTFChars(jniEnv,settingsString,settings);
#else
(void)apiHandle;(void)handle;(void)settingsString; // Parameters used when Stvm is defined.
throwOrtException(jniEnv,convertErrorCode(ORT_INVALID_ARGUMENT),"This binary was not compiled with Stvm support.");
(void)apiHandle;(void)handle;(void)settingsString; // Parameters used when TVM is defined.
throwOrtException(jniEnv,convertErrorCode(ORT_INVALID_ARGUMENT),"This binary was not compiled with TVM support.");
#endif
}

Expand Down
2 changes: 1 addition & 1 deletion onnxruntime/core/session/provider_stubs.cc
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ ORT_API_STATUS_IMPL(OrtSessionOptionsAppendExecutionProvider_Tvm,
_In_ OrtSessionOptions* options, _In_ const char* settings) {
ORT_UNUSED_PARAMETER(options);
ORT_UNUSED_PARAMETER(settings);
return CreateNotEnabledStatus("Stvm");
return CreateNotEnabledStatus("Tvm");
}
#endif

Expand Down
6 changes: 3 additions & 3 deletions onnxruntime/python/onnxruntime_pybind_state_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ struct OrtStatus {
char msg[1]; // a null-terminated string
};

#define BACKEND_DEVICE BACKEND_PROC BACKEND_DNNL BACKEND_OPENVINO BACKEND_NUPHAR BACKEND_STVM BACKEND_OPENBLAS BACKEND_MIGRAPHX BACKEND_ACL BACKEND_ARMNN BACKEND_DML
#define BACKEND_DEVICE BACKEND_PROC BACKEND_DNNL BACKEND_OPENVINO BACKEND_NUPHAR BACKEND_TVM BACKEND_OPENBLAS BACKEND_MIGRAPHX BACKEND_ACL BACKEND_ARMNN BACKEND_DML
#include "core/session/onnxruntime_cxx_api.h"
#include "core/providers/providers.h"
#include "core/providers/cpu/cpu_execution_provider.h"
Expand Down Expand Up @@ -87,9 +87,9 @@ struct OrtStatus {
#endif

#ifdef USE_TVM
#define BACKEND_STVM "-STVM"
#define BACKEND_TVM "-TVM"
#else
#define BACKEND_STVM ""
#define BACKEND_TVM ""
#endif

#if USE_VITISAI
Expand Down

0 comments on commit 68c998d

Please sign in to comment.