diff --git a/include/tim/vx/context.h b/include/tim/vx/context.h index 684e890..1859ac6 100644 --- a/include/tim/vx/context.h +++ b/include/tim/vx/context.h @@ -34,9 +34,12 @@ class Graph; class Context { public: virtual ~Context() {} - static std::shared_ptr Create(); virtual std::shared_ptr CreateGraph() = 0; virtual std::shared_ptr CreateGraph(const CompileOption& options) = 0; + + virtual bool isClOnly() = 0; + + static std::shared_ptr Create(); }; } // namespace vx diff --git a/src/tim/vx/context.cc b/src/tim/vx/context.cc index 4d10ca1..cb3d957 100644 --- a/src/tim/vx/context.cc +++ b/src/tim/vx/context.cc @@ -54,5 +54,9 @@ std::shared_ptr ContextImpl::CreateGraph(const CompileOption& options) { return std::make_shared(this, options); } +bool ContextImpl::isClOnly() { + return VSI_NN_HW_EVIS_NONE == context_->config.evis.ver; +} + } // namespace vx } // namespace tim \ No newline at end of file diff --git a/src/tim/vx/context_private.h b/src/tim/vx/context_private.h index 3c3ebe5..2225919 100644 --- a/src/tim/vx/context_private.h +++ b/src/tim/vx/context_private.h @@ -36,6 +36,7 @@ class ContextImpl : public Context { vsi_nn_context_t context(); std::shared_ptr CreateGraph() override; std::shared_ptr CreateGraph(const CompileOption&) override; + bool isClOnly() override; protected: vsi_nn_context_t context_; diff --git a/src/tim/vx/ops/gather_test.cc b/src/tim/vx/ops/gather_test.cc index 3f35768..1e317c1 100644 --- a/src/tim/vx/ops/gather_test.cc +++ b/src/tim/vx/ops/gather_test.cc @@ -24,12 +24,14 @@ #include "tim/vx/context.h" #include "tim/vx/graph.h" #include "tim/vx/ops/gather.h" -#include + #include "gtest/gtest.h" #include "test_utils.h" TEST(Gather, shape_5_3_2_2_int32_axis_1_batchdims_1) { auto ctx = tim::vx::Context::Create(); + + if (ctx->isClOnly()) GTEST_SKIP(); auto graph = ctx->CreateGraph(); tim::vx::ShapeType in_shape({5, 3, 2, 2}); diff --git a/src/tim/vx/ops/reduce_sum_test.cc b/src/tim/vx/ops/reduce_sum_test.cc index b344983..c524c5d 100644 --- a/src/tim/vx/ops/reduce_sum_test.cc +++ b/src/tim/vx/ops/reduce_sum_test.cc @@ -80,8 +80,9 @@ TEST(Reduce_sum, NotKeepDims) { TEST(Reduce_sum, KeepDims) { auto ctx = tim::vx::Context::Create(); - auto graph = ctx->CreateGraph(); + if (ctx->isClOnly()) GTEST_SKIP(); + auto graph = ctx->CreateGraph(); tim::vx::ShapeType input_shape({2, 3}); tim::vx::ShapeType output_shape({1, 3}); tim::vx::Quantization quant_in(tim::vx::QuantType::ASYMMETRIC, 0.00784313772,