fix code of bang conv (#76)

* fix code of bang conv

* test: 向 master push 时也执行 ci

Signed-off-by: YdrMaster <ydrml@hotmail.com>

---------

Signed-off-by: YdrMaster <ydrml@hotmail.com>
Co-authored-by: wanghailu <wanghailu@qiyuanlab.com>
Co-authored-by: YdrMaster <ydrml@hotmail.com>
This commit is contained in:
Hardy 2023-03-29 15:47:32 +08:00 committed by GitHub
parent 823e66a9ff
commit fe1afe38fa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 13 additions and 9 deletions

View File

@ -1,5 +1,7 @@
name: Build and test cpu name: Build and test cpu
on: on:
push:
branch: 'master'
pull_request: pull_request:
paths-ignore: paths-ignore:
- '**.md' - '**.md'

View File

@ -1,5 +1,7 @@
name: clang-format Check name: clang-format Check
on: on:
push:
branch: 'master'
pull_request: pull_request:
paths-ignore: paths-ignore:
- '**.md' - '**.md'

View File

@ -12,12 +12,12 @@ class BangRuntimeObj : public RuntimeObj {
public: public:
BangRuntimeObj() : RuntimeObj(Device::BANG) { BangRuntimeObj() : RuntimeObj(Device::BANG) {
checkBangError(cnrtInit(0)); cnInit(0);
cnrtDev_t dev; CNdev dev;
checkBangError(cnrtGetDeviceHandle(&dev, 0)); cnDeviceGet(&dev, 0);
checkBangError(cnrtSetCurrentDevice(dev)); checkBangError(cnrtSetDevice(dev));
cnrtQueue_t queue; cnrtQueue_t queue;
checkBangError(cnrtCreateQueue(&queue)); checkBangError(cnrtQueueCreate(&queue));
checkCnnlError(cnnlCreate(&cnnl)); checkCnnlError(cnnlCreate(&cnnl));
checkCnnlError(cnnlSetQueue(cnnl, queue)); checkCnnlError(cnnlSetQueue(cnnl, queue));

View File

@ -14,7 +14,7 @@ double getPerfConvCnnl(int n, int c, int h, int w, int f, int r, int s,
int padh, int padw, int strideh, int stridew, int padh, int padw, int strideh, int stridew,
int dilationh, int dilationw, int group, int dilationh, int dilationw, int group,
const char *name) { const char *name) {
Runtime cpu = CpuRuntimeObj::getInstance(); // CPUruntime is singleton Runtime cpu = NativeCpuRuntimeObj::getInstance(); // CPUruntime is singleton
Graph gCpu = make_ref<GraphObj>(cpu); Graph gCpu = make_ref<GraphObj>(cpu);
Runtime bang = make_ref<BangRuntimeObj>(); Runtime bang = make_ref<BangRuntimeObj>();
Graph gBang = make_ref<GraphObj>(bang); Graph gBang = make_ref<GraphObj>(bang);
@ -42,7 +42,7 @@ double getPerfConvCnnl(int n, int c, int h, int w, int f, int r, int s,
} }
double getPerfMatmulCnnl(int b, int m, int n, int k, const char *name) { double getPerfMatmulCnnl(int b, int m, int n, int k, const char *name) {
Runtime cpu = CpuRuntimeObj::getInstance(); // CPUruntime is singleton Runtime cpu = NativeCpuRuntimeObj::getInstance(); // CPUruntime is singleton
Graph gCpu = make_ref<GraphObj>(cpu); Graph gCpu = make_ref<GraphObj>(cpu);
Runtime bang = make_ref<BangRuntimeObj>(); Runtime bang = make_ref<BangRuntimeObj>();
Graph gBang = make_ref<GraphObj>(bang); Graph gBang = make_ref<GraphObj>(bang);

View File

@ -13,7 +13,7 @@ void testConv(const std::function<void(void *, size_t, DataType)> &generatorA,
const std::function<void(void *, size_t, DataType)> &generatorB, const std::function<void(void *, size_t, DataType)> &generatorB,
const Shape &shapeA, const Shape &shapeB) { const Shape &shapeA, const Shape &shapeB) {
// Runtime // Runtime
Runtime cpuRuntime = CpuRuntimeObj::getInstance(); Runtime cpuRuntime = NativeCpuRuntimeObj::getInstance();
auto bangRuntime = make_ref<BangRuntimeObj>(); auto bangRuntime = make_ref<BangRuntimeObj>();
// Build input data on CPU // Build input data on CPU

View File

@ -14,7 +14,7 @@ void testMatmul(const std::function<void(void *, size_t, DataType)> &generatorA,
bool transA, bool transB, const Shape &shapeA, bool transA, bool transB, const Shape &shapeA,
const Shape &shapeB) { const Shape &shapeB) {
// Runtime // Runtime
Runtime cpuRuntime = CpuRuntimeObj::getInstance(); Runtime cpuRuntime = NativeCpuRuntimeObj::getInstance();
auto bangRuntime = make_ref<BangRuntimeObj>(); auto bangRuntime = make_ref<BangRuntimeObj>();
// Build input data on CPU // Build input data on CPU