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
|
||||
on:
|
||||
push:
|
||||
branch: 'master'
|
||||
pull_request:
|
||||
paths-ignore:
|
||||
- '**.md'
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
name: clang-format Check
|
||||
on:
|
||||
push:
|
||||
branch: 'master'
|
||||
pull_request:
|
||||
paths-ignore:
|
||||
- '**.md'
|
||||
|
|
|
@ -12,12 +12,12 @@ class BangRuntimeObj : public RuntimeObj {
|
|||
|
||||
public:
|
||||
BangRuntimeObj() : RuntimeObj(Device::BANG) {
|
||||
checkBangError(cnrtInit(0));
|
||||
cnrtDev_t dev;
|
||||
checkBangError(cnrtGetDeviceHandle(&dev, 0));
|
||||
checkBangError(cnrtSetCurrentDevice(dev));
|
||||
cnInit(0);
|
||||
CNdev dev;
|
||||
cnDeviceGet(&dev, 0);
|
||||
checkBangError(cnrtSetDevice(dev));
|
||||
cnrtQueue_t queue;
|
||||
checkBangError(cnrtCreateQueue(&queue));
|
||||
checkBangError(cnrtQueueCreate(&queue));
|
||||
|
||||
checkCnnlError(cnnlCreate(&cnnl));
|
||||
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 dilationh, int dilationw, int group,
|
||||
const char *name) {
|
||||
Runtime cpu = CpuRuntimeObj::getInstance(); // CPUruntime is singleton
|
||||
Runtime cpu = NativeCpuRuntimeObj::getInstance(); // CPUruntime is singleton
|
||||
Graph gCpu = make_ref<GraphObj>(cpu);
|
||||
Runtime bang = make_ref<BangRuntimeObj>();
|
||||
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) {
|
||||
Runtime cpu = CpuRuntimeObj::getInstance(); // CPUruntime is singleton
|
||||
Runtime cpu = NativeCpuRuntimeObj::getInstance(); // CPUruntime is singleton
|
||||
Graph gCpu = make_ref<GraphObj>(cpu);
|
||||
Runtime bang = make_ref<BangRuntimeObj>();
|
||||
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 Shape &shapeA, const Shape &shapeB) {
|
||||
// Runtime
|
||||
Runtime cpuRuntime = CpuRuntimeObj::getInstance();
|
||||
Runtime cpuRuntime = NativeCpuRuntimeObj::getInstance();
|
||||
auto bangRuntime = make_ref<BangRuntimeObj>();
|
||||
|
||||
// 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,
|
||||
const Shape &shapeB) {
|
||||
// Runtime
|
||||
Runtime cpuRuntime = CpuRuntimeObj::getInstance();
|
||||
Runtime cpuRuntime = NativeCpuRuntimeObj::getInstance();
|
||||
auto bangRuntime = make_ref<BangRuntimeObj>();
|
||||
|
||||
// Build input data on CPU
|
||||
|
|
Loading…
Reference in New Issue