Expose hw feature : isClOnly()

Signed-off-by: ZhangXiang <Xiang.Zhang@verisilicon.com>
This commit is contained in:
ZhangXiang 2022-08-02 13:22:10 +08:00 committed by Sven
parent 090f3f21d6
commit 6d47ee3ac1
5 changed files with 14 additions and 3 deletions

View File

@ -34,9 +34,12 @@ class Graph;
class Context {
public:
virtual ~Context() {}
static std::shared_ptr<Context> Create();
virtual std::shared_ptr<Graph> CreateGraph() = 0;
virtual std::shared_ptr<Graph> CreateGraph(const CompileOption& options) = 0;
virtual bool isClOnly() = 0;
static std::shared_ptr<Context> Create();
};
} // namespace vx

View File

@ -54,5 +54,9 @@ std::shared_ptr<Graph> ContextImpl::CreateGraph(const CompileOption& options) {
return std::make_shared<GraphImpl>(this, options);
}
bool ContextImpl::isClOnly() {
return VSI_NN_HW_EVIS_NONE == context_->config.evis.ver;
}
} // namespace vx
} // namespace tim

View File

@ -36,6 +36,7 @@ class ContextImpl : public Context {
vsi_nn_context_t context();
std::shared_ptr<Graph> CreateGraph() override;
std::shared_ptr<Graph> CreateGraph(const CompileOption&) override;
bool isClOnly() override;
protected:
vsi_nn_context_t context_;

View File

@ -24,12 +24,14 @@
#include "tim/vx/context.h"
#include "tim/vx/graph.h"
#include "tim/vx/ops/gather.h"
#include <iostream>
#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});

View File

@ -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,