forked from jiuyuan/InfiniTensor
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:
parent
823e66a9ff
commit
fe1afe38fa
|
@ -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'
|
||||||
|
|
|
@ -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'
|
||||||
|
|
|
@ -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));
|
||||||
|
|
|
@ -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);
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue