Skip to content

Commit 6d47ee3

Browse files
committed
Expose hw feature : isClOnly()
Signed-off-by: ZhangXiang <Xiang.Zhang@verisilicon.com>
1 parent 090f3f2 commit 6d47ee3

File tree

5 files changed

+14
-3
lines changed

5 files changed

+14
-3
lines changed

include/tim/vx/context.h

+4-1
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,12 @@ class Graph;
3434
class Context {
3535
public:
3636
virtual ~Context() {}
37-
static std::shared_ptr<Context> Create();
3837
virtual std::shared_ptr<Graph> CreateGraph() = 0;
3938
virtual std::shared_ptr<Graph> CreateGraph(const CompileOption& options) = 0;
39+
40+
virtual bool isClOnly() = 0;
41+
42+
static std::shared_ptr<Context> Create();
4043
};
4144

4245
} // namespace vx

src/tim/vx/context.cc

+4
Original file line numberDiff line numberDiff line change
@@ -54,5 +54,9 @@ std::shared_ptr<Graph> ContextImpl::CreateGraph(const CompileOption& options) {
5454
return std::make_shared<GraphImpl>(this, options);
5555
}
5656

57+
bool ContextImpl::isClOnly() {
58+
return VSI_NN_HW_EVIS_NONE == context_->config.evis.ver;
59+
}
60+
5761
} // namespace vx
5862
} // namespace tim

src/tim/vx/context_private.h

+1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ class ContextImpl : public Context {
3636
vsi_nn_context_t context();
3737
std::shared_ptr<Graph> CreateGraph() override;
3838
std::shared_ptr<Graph> CreateGraph(const CompileOption&) override;
39+
bool isClOnly() override;
3940

4041
protected:
4142
vsi_nn_context_t context_;

src/tim/vx/ops/gather_test.cc

+3-1
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,14 @@
2424
#include "tim/vx/context.h"
2525
#include "tim/vx/graph.h"
2626
#include "tim/vx/ops/gather.h"
27-
#include <iostream>
27+
2828
#include "gtest/gtest.h"
2929
#include "test_utils.h"
3030

3131
TEST(Gather, shape_5_3_2_2_int32_axis_1_batchdims_1) {
3232
auto ctx = tim::vx::Context::Create();
33+
34+
if (ctx->isClOnly()) GTEST_SKIP();
3335
auto graph = ctx->CreateGraph();
3436

3537
tim::vx::ShapeType in_shape({5, 3, 2, 2});

src/tim/vx/ops/reduce_sum_test.cc

+2-1
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,9 @@ TEST(Reduce_sum, NotKeepDims) {
8080

8181
TEST(Reduce_sum, KeepDims) {
8282
auto ctx = tim::vx::Context::Create();
83-
auto graph = ctx->CreateGraph();
83+
if (ctx->isClOnly()) GTEST_SKIP();
8484

85+
auto graph = ctx->CreateGraph();
8586
tim::vx::ShapeType input_shape({2, 3});
8687
tim::vx::ShapeType output_shape({1, 3});
8788
tim::vx::Quantization quant_in(tim::vx::QuantType::ASYMMETRIC, 0.00784313772,

0 commit comments

Comments
 (0)