Add BUILD_WITH_BAZEL option, marco of VSI_FEAT_OP_XXX should behind headers now.
This commit is contained in:
parent
d723ffaf51
commit
8cd5bd93ce
15
BUILD
15
BUILD
|
|
@ -18,8 +18,22 @@ cc_library(
|
||||||
strip_include_prefix = "include"
|
strip_include_prefix = "include"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
genrule(
|
||||||
|
name = "gen_vsi_feat_ops_def",
|
||||||
|
srcs = ["//src/tim/vx/internal:include/interface/ops.def"],
|
||||||
|
outs = ["vsi_feat_ops_def.h"],
|
||||||
|
cmd = "./$(location gen_vsi_feat_ops_def.sh) $(SRCS) > \"$(OUTS)\"",
|
||||||
|
tools = ["gen_vsi_feat_ops_def.sh"]
|
||||||
|
)
|
||||||
|
|
||||||
|
cc_library(
|
||||||
|
name = "vsi_feat_ops_def",
|
||||||
|
hdrs = [":gen_vsi_feat_ops_def"]
|
||||||
|
)
|
||||||
|
|
||||||
cc_library(
|
cc_library(
|
||||||
name = "tim-vx_interface",
|
name = "tim-vx_interface",
|
||||||
|
defines = ["BUILD_WITH_BAZEL"],
|
||||||
copts = ["-std=c++14", "-Werror", "-fvisibility=default", "-pthread"],
|
copts = ["-std=c++14", "-Werror", "-fvisibility=default", "-pthread"],
|
||||||
includes = [
|
includes = [
|
||||||
"include",
|
"include",
|
||||||
|
|
@ -64,6 +78,7 @@ cc_library(
|
||||||
], exclude = ["src/tim/vx/ops/*_test.cc"]
|
], exclude = ["src/tim/vx/ops/*_test.cc"]
|
||||||
) + glob(["src/tim/transform/ops/*.*"]),
|
) + glob(["src/tim/transform/ops/*.*"]),
|
||||||
deps = [
|
deps = [
|
||||||
|
":vsi_feat_ops_def",
|
||||||
"//src/tim/vx/internal:ovxlibimpl",
|
"//src/tim/vx/internal:ovxlibimpl",
|
||||||
],
|
],
|
||||||
linkstatic = True,
|
linkstatic = True,
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,10 @@
|
||||||
|
# generate macro ops define for vsi feature ops
|
||||||
|
|
||||||
|
for line in `cat $1`
|
||||||
|
do
|
||||||
|
if [[ $line =~ "DEF_OP" ]]
|
||||||
|
then
|
||||||
|
x=${line#*(}
|
||||||
|
echo "#define VSI_FEAT_OP_${x%)*}"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
@ -24,6 +24,10 @@
|
||||||
#ifndef TIM_VX_GRAPH_H_
|
#ifndef TIM_VX_GRAPH_H_
|
||||||
#define TIM_VX_GRAPH_H_
|
#define TIM_VX_GRAPH_H_
|
||||||
|
|
||||||
|
#ifdef BUILD_WITH_BAZEL
|
||||||
|
#include "vsi_feat_ops_def.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,11 +21,13 @@
|
||||||
* DEALINGS IN THE SOFTWARE.
|
* DEALINGS IN THE SOFTWARE.
|
||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
#ifdef VSI_FEAT_OP_CUMSUM
|
|
||||||
#ifndef TIM_VX_OPS_CUMSUM_H_
|
#ifndef TIM_VX_OPS_CUMSUM_H_
|
||||||
#define TIM_VX_OPS_CUMSUM_H_
|
#define TIM_VX_OPS_CUMSUM_H_
|
||||||
|
|
||||||
#include "tim/vx/builtin_op.h"
|
#include "tim/vx/builtin_op.h"
|
||||||
|
|
||||||
|
#ifdef VSI_FEAT_OP_CUMSUM
|
||||||
|
|
||||||
namespace tim {
|
namespace tim {
|
||||||
namespace vx {
|
namespace vx {
|
||||||
namespace ops {
|
namespace ops {
|
||||||
|
|
@ -60,5 +62,5 @@ class CumSum : public BuiltinOp {
|
||||||
} // namespace ops
|
} // namespace ops
|
||||||
} // namespace vx
|
} // namespace vx
|
||||||
} // namespace tim
|
} // namespace tim
|
||||||
#endif /* TIM_VX_OPS_CUMSUM_H_ */
|
|
||||||
#endif //(VSI_FEAT_OP_CUMSUM)
|
#endif //(VSI_FEAT_OP_CUMSUM)
|
||||||
|
#endif /* TIM_VX_OPS_CUMSUM_H_ */
|
||||||
|
|
|
||||||
|
|
@ -21,13 +21,15 @@
|
||||||
* DEALINGS IN THE SOFTWARE.
|
* DEALINGS IN THE SOFTWARE.
|
||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
#ifdef VSI_FEAT_OP_MAX_POOL3D
|
|
||||||
#ifndef TIM_VX_OPS_MAX_POOL3D_H_
|
#ifndef TIM_VX_OPS_MAX_POOL3D_H_
|
||||||
#define TIM_VX_OPS_MAX_POOL3D_H_
|
#define TIM_VX_OPS_MAX_POOL3D_H_
|
||||||
|
|
||||||
#include "tim/vx/builtin_op.h"
|
#include "tim/vx/builtin_op.h"
|
||||||
#include "tim/vx/types.h"
|
#include "tim/vx/types.h"
|
||||||
#include <array>
|
#include <array>
|
||||||
|
|
||||||
|
#ifdef VSI_FEAT_OP_MAX_POOL3D
|
||||||
|
|
||||||
namespace tim {
|
namespace tim {
|
||||||
namespace vx {
|
namespace vx {
|
||||||
namespace ops {
|
namespace ops {
|
||||||
|
|
@ -73,5 +75,5 @@ class MaxPool3d : public BuiltinOp {
|
||||||
} // namespace vx
|
} // namespace vx
|
||||||
} // namespace tim
|
} // namespace tim
|
||||||
|
|
||||||
|
#endif //(VSI_FEAT_OP_MAX_POOL3D)
|
||||||
#endif /* TIM_VX_OPS_MAX_POOL3D_H_ */
|
#endif /* TIM_VX_OPS_MAX_POOL3D_H_ */
|
||||||
#endif //(VSI_FEAT_OP_MAX_POOL3D)
|
|
||||||
|
|
@ -21,13 +21,14 @@
|
||||||
* DEALINGS IN THE SOFTWARE.
|
* DEALINGS IN THE SOFTWARE.
|
||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
#ifdef VSI_FEAT_OP_MAXPOOLWITHARGMAX
|
|
||||||
|
|
||||||
#ifndef TIM_VX_OPS_MAXPOOLGRAD_H_
|
#ifndef TIM_VX_OPS_MAXPOOLGRAD_H_
|
||||||
#define TIM_VX_OPS_MAXPOOLGRAD_H_
|
#define TIM_VX_OPS_MAXPOOLGRAD_H_
|
||||||
|
|
||||||
#include "tim/vx/operation.h"
|
#include "tim/vx/operation.h"
|
||||||
#include <array>
|
#include <array>
|
||||||
|
|
||||||
|
#ifdef VSI_FEAT_OP_MAXPOOLWITHARGMAX
|
||||||
|
|
||||||
namespace tim {
|
namespace tim {
|
||||||
namespace vx {
|
namespace vx {
|
||||||
namespace ops {
|
namespace ops {
|
||||||
|
|
@ -70,5 +71,5 @@ class MaxpoolGrad: public Operation {
|
||||||
} // namespace vx
|
} // namespace vx
|
||||||
} // namespace tim
|
} // namespace tim
|
||||||
|
|
||||||
#endif /*TIM_VX_OPS_MAXPOOLGRAD_H_*/
|
#endif //(VSI_FEAT_OP_MAXPOOLWITHARGMAX)
|
||||||
#endif
|
#endif /* TIM_VX_OPS_MAXPOOLGRAD_H_ */
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,6 @@
|
||||||
* DEALINGS IN THE SOFTWARE.
|
* DEALINGS IN THE SOFTWARE.
|
||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
#ifdef VSI_FEAT_OP_MAXPOOLWITHARGMAX
|
|
||||||
#ifndef TIM_VX_OPS_MAXPOOLWITHARGMAX2_H_
|
#ifndef TIM_VX_OPS_MAXPOOLWITHARGMAX2_H_
|
||||||
#define TIM_VX_OPS_MAXPOOLWITHARGMAX2_H_
|
#define TIM_VX_OPS_MAXPOOLWITHARGMAX2_H_
|
||||||
|
|
||||||
|
|
@ -30,6 +29,8 @@
|
||||||
#include "tim/vx/builtin_op.h"
|
#include "tim/vx/builtin_op.h"
|
||||||
#include "tim/vx/types.h"
|
#include "tim/vx/types.h"
|
||||||
|
|
||||||
|
#ifdef VSI_FEAT_OP_MAXPOOLWITHARGMAX
|
||||||
|
|
||||||
namespace tim {
|
namespace tim {
|
||||||
namespace vx {
|
namespace vx {
|
||||||
namespace ops {
|
namespace ops {
|
||||||
|
|
@ -66,6 +67,5 @@ class MaxpoolWithArgmax2 : public BuiltinOp {
|
||||||
} // namespace vx
|
} // namespace vx
|
||||||
} // namespace tim
|
} // namespace tim
|
||||||
|
|
||||||
#endif /* TIM_VX_OPS_MAXPOOLWITHARGMAX2_H_ */
|
|
||||||
|
|
||||||
#endif //(VSI_FEAT_OP_MAXPOOLWITHARGMAX)
|
#endif //(VSI_FEAT_OP_MAXPOOLWITHARGMAX)
|
||||||
|
#endif /* TIM_VX_OPS_MAXPOOLWITHARGMAX2_H_ */
|
||||||
|
|
|
||||||
|
|
@ -21,11 +21,13 @@
|
||||||
* DEALINGS IN THE SOFTWARE.
|
* DEALINGS IN THE SOFTWARE.
|
||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
#ifdef VSI_FEAT_OP_MOD
|
|
||||||
#ifndef TIM_VX_OPS_MOD_H_
|
#ifndef TIM_VX_OPS_MOD_H_
|
||||||
#define TIM_VX_OPS_MOD_H_
|
#define TIM_VX_OPS_MOD_H_
|
||||||
|
|
||||||
#include "tim/vx/builtin_op.h"
|
#include "tim/vx/builtin_op.h"
|
||||||
|
|
||||||
|
#ifdef VSI_FEAT_OP_MOD
|
||||||
|
|
||||||
namespace tim {
|
namespace tim {
|
||||||
namespace vx {
|
namespace vx {
|
||||||
namespace ops {
|
namespace ops {
|
||||||
|
|
@ -57,5 +59,5 @@ class Mod : public BuiltinOp {
|
||||||
} // namespace vx
|
} // namespace vx
|
||||||
} // namespace tim
|
} // namespace tim
|
||||||
|
|
||||||
|
#endif //(VSI_FEAT_OP_MOD)
|
||||||
#endif /* TIM_VX_OPS_MOD_H_ */
|
#endif /* TIM_VX_OPS_MOD_H_ */
|
||||||
#endif //(VSI_FEAT_OP_MOD)
|
|
||||||
|
|
@ -21,11 +21,13 @@
|
||||||
* DEALINGS IN THE SOFTWARE.
|
* DEALINGS IN THE SOFTWARE.
|
||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
#ifdef VSI_FEAT_OP_CUMSUM
|
|
||||||
#include "tim/vx/ops/cumsum.h"
|
#include "tim/vx/ops/cumsum.h"
|
||||||
|
|
||||||
#include "builtin_op_impl.h"
|
#include "builtin_op_impl.h"
|
||||||
#include "vsi_nn_pub.h"
|
#include "vsi_nn_pub.h"
|
||||||
|
|
||||||
|
#ifdef VSI_FEAT_OP_CUMSUM
|
||||||
|
|
||||||
namespace tim {
|
namespace tim {
|
||||||
namespace vx {
|
namespace vx {
|
||||||
namespace ops {
|
namespace ops {
|
||||||
|
|
|
||||||
|
|
@ -21,13 +21,14 @@
|
||||||
* DEALINGS IN THE SOFTWARE.
|
* DEALINGS IN THE SOFTWARE.
|
||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
#ifdef VSI_FEAT_OP_CUMSUM
|
|
||||||
#include "tim/vx/context.h"
|
#include "tim/vx/context.h"
|
||||||
#include "tim/vx/graph.h"
|
#include "tim/vx/graph.h"
|
||||||
#include "tim/vx/ops/cumsum.h"
|
#include "tim/vx/ops/cumsum.h"
|
||||||
|
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
|
|
||||||
|
#ifdef VSI_FEAT_OP_CUMSUM
|
||||||
|
|
||||||
TEST(CumSum, shape_4_2_fp32_axis_0_exclusive_0_reverse_0) {
|
TEST(CumSum, shape_4_2_fp32_axis_0_exclusive_0_reverse_0) {
|
||||||
auto ctx = tim::vx::Context::Create();
|
auto ctx = tim::vx::Context::Create();
|
||||||
auto graph = ctx->CreateGraph();
|
auto graph = ctx->CreateGraph();
|
||||||
|
|
|
||||||
|
|
@ -21,12 +21,13 @@
|
||||||
* DEALINGS IN THE SOFTWARE.
|
* DEALINGS IN THE SOFTWARE.
|
||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
#ifdef VSI_FEAT_OP_MAX_POOL3D
|
|
||||||
#include "tim/vx/ops/max_pool3d.h"
|
#include "tim/vx/ops/max_pool3d.h"
|
||||||
#include "type_utils.h"
|
#include "type_utils.h"
|
||||||
#include "builtin_op_impl.h"
|
#include "builtin_op_impl.h"
|
||||||
#include "vsi_nn_pub.h"
|
#include "vsi_nn_pub.h"
|
||||||
|
|
||||||
|
#ifdef VSI_FEAT_OP_MAX_POOL3D
|
||||||
|
|
||||||
namespace tim {
|
namespace tim {
|
||||||
namespace vx {
|
namespace vx {
|
||||||
namespace ops {
|
namespace ops {
|
||||||
|
|
@ -62,4 +63,4 @@ std::shared_ptr<Operation> MaxPool3d::Clone(std::shared_ptr<Graph>& graph) const
|
||||||
} // namespace vx
|
} // namespace vx
|
||||||
} // namespace tim
|
} // namespace tim
|
||||||
|
|
||||||
#endif //(VSI_FEAT_OP_MAX_POOL3D)
|
#endif //(VSI_FEAT_OP_MAX_POOL3D)
|
||||||
|
|
|
||||||
|
|
@ -21,13 +21,13 @@
|
||||||
* DEALINGS IN THE SOFTWARE.
|
* DEALINGS IN THE SOFTWARE.
|
||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
#ifdef VSI_FEAT_OP_MAX_POOL3D
|
|
||||||
|
|
||||||
#include "tim/vx/ops/max_pool3d.h"
|
#include "tim/vx/ops/max_pool3d.h"
|
||||||
#include "tim/vx/context.h"
|
#include "tim/vx/context.h"
|
||||||
#include "tim/vx/graph.h"
|
#include "tim/vx/graph.h"
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
|
|
||||||
|
#ifdef VSI_FEAT_OP_MAX_POOL3D
|
||||||
|
|
||||||
TEST(MaxPool3d, shape_3_2_2_2_1_fp32_kernel_2_2_2_stride_1_1_1_VALID) {
|
TEST(MaxPool3d, shape_3_2_2_2_1_fp32_kernel_2_2_2_stride_1_1_1_VALID) {
|
||||||
auto ctx = tim::vx::Context::Create();
|
auto ctx = tim::vx::Context::Create();
|
||||||
auto graph = ctx->CreateGraph();
|
auto graph = ctx->CreateGraph();
|
||||||
|
|
|
||||||
|
|
@ -21,12 +21,14 @@
|
||||||
* DEALINGS IN THE SOFTWARE.
|
* DEALINGS IN THE SOFTWARE.
|
||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
#ifdef VSI_FEAT_OP_MAXPOOLWITHARGMAX
|
|
||||||
#include "tim/vx/ops.h"
|
#include "tim/vx/ops.h"
|
||||||
#include "vsi_nn_pub.h"
|
#include "vsi_nn_pub.h"
|
||||||
#include "op_impl.h"
|
#include "op_impl.h"
|
||||||
|
|
||||||
#include <array>
|
#include <array>
|
||||||
|
|
||||||
|
#ifdef VSI_FEAT_OP_MAXPOOLWITHARGMAX
|
||||||
|
|
||||||
namespace tim {
|
namespace tim {
|
||||||
namespace vx {
|
namespace vx {
|
||||||
namespace ops {
|
namespace ops {
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,6 @@
|
||||||
* DEALINGS IN THE SOFTWARE.
|
* DEALINGS IN THE SOFTWARE.
|
||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
#ifdef VSI_FEAT_OP_MAXPOOLWITHARGMAX
|
|
||||||
#include "tim/vx/context.h"
|
#include "tim/vx/context.h"
|
||||||
#include "tim/vx/graph.h"
|
#include "tim/vx/graph.h"
|
||||||
#include "tim/vx/ops/maxpoolgrad.h"
|
#include "tim/vx/ops/maxpoolgrad.h"
|
||||||
|
|
@ -30,6 +29,8 @@
|
||||||
|
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
|
|
||||||
|
#ifdef VSI_FEAT_OP_MAXPOOLWITHARGMAX
|
||||||
|
|
||||||
TEST(Fuse_MaxpoolGrad, without_overlay) {
|
TEST(Fuse_MaxpoolGrad, without_overlay) {
|
||||||
auto ctx = tim::vx::Context::Create();
|
auto ctx = tim::vx::Context::Create();
|
||||||
auto graph = ctx->CreateGraph();
|
auto graph = ctx->CreateGraph();
|
||||||
|
|
|
||||||
|
|
@ -21,13 +21,14 @@
|
||||||
* DEALINGS IN THE SOFTWARE.
|
* DEALINGS IN THE SOFTWARE.
|
||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
#ifdef VSI_FEAT_OP_MAXPOOLWITHARGMAX
|
|
||||||
#include "tim/vx/ops/maxpoolwithargmax2.h"
|
#include "tim/vx/ops/maxpoolwithargmax2.h"
|
||||||
|
|
||||||
#include "builtin_op_impl.h"
|
#include "builtin_op_impl.h"
|
||||||
#include "type_utils.h"
|
#include "type_utils.h"
|
||||||
#include "vsi_nn_pub.h"
|
#include "vsi_nn_pub.h"
|
||||||
|
|
||||||
|
#ifdef VSI_FEAT_OP_MAXPOOLWITHARGMAX
|
||||||
|
|
||||||
namespace tim {
|
namespace tim {
|
||||||
namespace vx {
|
namespace vx {
|
||||||
namespace ops {
|
namespace ops {
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@
|
||||||
* DEALINGS IN THE SOFTWARE.
|
* DEALINGS IN THE SOFTWARE.
|
||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
#ifdef VSI_FEAT_OP_MAXPOOLWITHARGMAX
|
|
||||||
#include "tim/vx/context.h"
|
#include "tim/vx/context.h"
|
||||||
#include "tim/vx/graph.h"
|
#include "tim/vx/graph.h"
|
||||||
#include "tim/vx/ops/maxpoolwithargmax2.h"
|
#include "tim/vx/ops/maxpoolwithargmax2.h"
|
||||||
|
|
@ -30,6 +30,8 @@
|
||||||
|
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
|
|
||||||
|
#ifdef VSI_FEAT_OP_MAXPOOLWITHARGMAX
|
||||||
|
|
||||||
TEST(MaxpoolWithArgmax2, without_overlay) {
|
TEST(MaxpoolWithArgmax2, without_overlay) {
|
||||||
auto ctx = tim::vx::Context::Create();
|
auto ctx = tim::vx::Context::Create();
|
||||||
auto graph = ctx->CreateGraph();
|
auto graph = ctx->CreateGraph();
|
||||||
|
|
|
||||||
|
|
@ -21,11 +21,13 @@
|
||||||
* DEALINGS IN THE SOFTWARE.
|
* DEALINGS IN THE SOFTWARE.
|
||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
#ifdef VSI_FEAT_OP_MOD
|
|
||||||
#include "tim/vx/ops/mod.h"
|
#include "tim/vx/ops/mod.h"
|
||||||
|
|
||||||
#include "builtin_op_impl.h"
|
#include "builtin_op_impl.h"
|
||||||
#include "vsi_nn_pub.h"
|
#include "vsi_nn_pub.h"
|
||||||
|
|
||||||
|
#ifdef VSI_FEAT_OP_MOD
|
||||||
|
|
||||||
namespace tim {
|
namespace tim {
|
||||||
namespace vx {
|
namespace vx {
|
||||||
namespace ops {
|
namespace ops {
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,6 @@
|
||||||
* DEALINGS IN THE SOFTWARE.
|
* DEALINGS IN THE SOFTWARE.
|
||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
#ifdef VSI_FEAT_OP_MOD
|
|
||||||
#include "tim/vx/ops/mod.h"
|
#include "tim/vx/ops/mod.h"
|
||||||
|
|
||||||
#include "tim/vx/context.h"
|
#include "tim/vx/context.h"
|
||||||
|
|
@ -29,6 +28,9 @@
|
||||||
#include "tim/vx/types.h"
|
#include "tim/vx/types.h"
|
||||||
#include "test_utils.h"
|
#include "test_utils.h"
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
|
|
||||||
|
#ifdef VSI_FEAT_OP_MOD
|
||||||
|
|
||||||
TEST(Mod, shape_2_2_3_1_fp32_fmod_0) {
|
TEST(Mod, shape_2_2_3_1_fp32_fmod_0) {
|
||||||
auto ctx = tim::vx::Context::Create();
|
auto ctx = tim::vx::Context::Create();
|
||||||
auto graph = ctx->CreateGraph();
|
auto graph = ctx->CreateGraph();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue