Skip to content

Commit

Permalink
Switch to foxi (#2449)
Browse files Browse the repository at this point in the history
* switch to foxi

* only include the header instead of link

* update the doc
  • Loading branch information
houseroad authored and Yinghai Lu committed Feb 27, 2019
1 parent 8e455a6 commit 37ebe41
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 7 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Expand Up @@ -10,3 +10,6 @@
[submodule "tests/OutputCheck"]
path = tests/OutputCheck
url = https://github.com/stp/OutputCheck.git
[submodule "thirdparty/foxi"]
path = thirdparty/foxi
url = https://github.com/houseroad/foxi.git
4 changes: 4 additions & 0 deletions CMakeLists.txt
Expand Up @@ -100,6 +100,10 @@ if(NOT EXISTS "${GLOW_THIRDPARTY_DIR}/onnx")
message(FATAL_ERROR "No onnx git submodule. Run: git submodule update --init --recursive")
endif()

if(NOT EXISTS "${GLOW_THIRDPARTY_DIR}/foxi")
message(FATAL_ERROR "No foxi git submodule. Run: git submodule update --init --recursive")
endif()

if(NOT EXISTS "${GLOW_THIRDPARTY_DIR}/fp16")
message(FATAL_ERROR "No fp16 git submodule. Run: git submodule update --init --recursive")
else()
Expand Down
2 changes: 2 additions & 0 deletions docs/Onnxifi.md
Expand Up @@ -2,6 +2,8 @@

[ONNXIFI](https://github.com/onnx/onnx/blob/master/docs/ONNXIFI.md) is an
interface that allows PyTorch/Caffe2 to use Glow as an execution backend.
Right now, [FOXI](https://github.com/houseroad/foxi) (i.e., ONNXIFI with
Facebook Extension) is used to support more features.

Setting up a Caffe2 environment to use Glow via ONNXIFI can be tricky the first
time. The steps in this walkthrough show how to build all the required
Expand Down
2 changes: 1 addition & 1 deletion include/glow/Importer/CommonOperatorLoader.h
Expand Up @@ -17,7 +17,7 @@
#ifndef GLOW_IMPORTER_COMMONOPERATORLOADER_H
#define GLOW_IMPORTER_COMMONOPERATORLOADER_H

#include "onnx/onnxifi.h"
#include "foxi/onnxifi.h"

#include "glow/Importer/ProtobufLoader.h"

Expand Down
2 changes: 1 addition & 1 deletion include/glow/Importer/ONNXIFIModelLoader.h
Expand Up @@ -17,7 +17,7 @@
#ifndef GLOW_IMPORTER_ONNXIFIMODELLOADER_H
#define GLOW_IMPORTER_ONNXIFIMODELLOADER_H

#include "onnx/onnxifi.h"
#include "foxi/onnxifi.h"

#include "glow/Importer/ONNXModelLoader.h"

Expand Down
4 changes: 2 additions & 2 deletions lib/Importer/CMakeLists.txt
Expand Up @@ -9,7 +9,7 @@ if(NOT TARGET onnx_proto)
set(ONNX_NAMESPACE "glow_onnx")
endif()
add_definitions("-DONNX_NAMESPACE=${ONNX_NAMESPACE}")
add_subdirectory(${GLOW_THIRDPARTY_DIR}/onnx EXCLUDE_FROM_ALL build)
add_subdirectory(${GLOW_THIRDPARTY_DIR}/onnx EXCLUDE_FROM_ALL build_onnx)
endif()

find_package(Protobuf REQUIRED)
Expand Down Expand Up @@ -37,7 +37,7 @@ add_library(Importer
ONNXIFIModelLoader.cpp
${CAFFE_SRCS}
${GLOW_BINARY_DIR}/caffe2/proto/caffe2.pb.h)
target_include_directories(Importer PUBLIC ${ONNX_INCLUDE_DIRS})
target_include_directories(Importer PUBLIC ${ONNX_INCLUDE_DIRS} ${GLOW_THIRDPARTY_DIR}/foxi)
target_compile_definitions(Importer
INTERFACE
-DGOOGLE_PROTOBUF_NO_RTTI)
Expand Down
4 changes: 2 additions & 2 deletions lib/Onnxifi/Base.h
Expand Up @@ -21,8 +21,8 @@
#include "glow/Importer/ONNXIFIModelLoader.h"
#include "glow/Support/ThreadPool.h"

#include "onnx/onnxifi.h"
#include "onnx/onnxifi_ext.h"
#include "foxi/onnxifi.h"
#include "foxi/onnxifi_ext.h"

#include <atomic>
#include <condition_variable>
Expand Down
2 changes: 1 addition & 1 deletion lib/Onnxifi/onnxifiGlow.cpp
Expand Up @@ -31,7 +31,7 @@
* Documentation on the functions implementing onnxifi interface in
* this file is very shallow.
* Please see more documentation on functions that need to be
* implemented: https://github.com/onnx/onnx/blob/master/onnx/onnxifi.h.
* implemented: https://github.com/houseroad/foxi/blob/master/foxi/onnxifi.h.
*/

/// Return stable IDs of available backends on the system.
Expand Down
1 change: 1 addition & 0 deletions thirdparty/foxi
Submodule foxi added at 398135

0 comments on commit 37ebe41

Please sign in to comment.