Skip to content

Commit 2258c1e

Browse files
Chamberlain0w0YdrMaster
authored andcommitted
fix: 解决一些warning,并把sync操作从算子内部移除
1 parent 8bde8c1 commit 2258c1e

File tree

35 files changed

+67
-65
lines changed

35 files changed

+67
-65
lines changed

src/04kernel/src/kernels/batch_normalization/cnnl_kernel.cc

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,8 @@ namespace refactor::kernel {
128128
auto y = outputs[0];
129129

130130
void *xTrans = workspace;
131-
void *yTrans = xTrans + xTransSize;
132-
void *cursor = yTrans + xTransSize;
131+
void *yTrans = reinterpret_cast<uint8_t *>(xTrans) + xTransSize;
132+
void *cursor = reinterpret_cast<uint8_t *>(yTrans) + xTransSize;
133133

134134
// transpose NCHW input to NHWC
135135
CNNL_ASSERT(cnnlTranspose_v2(handle, d->NCHW2NHWC, d->inDesc, x,
@@ -147,7 +147,6 @@ namespace refactor::kernel {
147147
CNNL_ASSERT(cnnlTranspose_v2(handle, d->NHWC2NCHW, d->inDescTrans, yTrans,
148148
d->inDesc, y, cursor, workspaceSize));
149149

150-
BANG_ASSERT(cnrtQueueSync(res.fetchOrStore<CnnlContext>()->queue));
151150
};
152151

153152
return {std::move(routine), totalWorkspaceSize};

src/04kernel/src/kernels/cast/cnnl_kernel.cc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ namespace refactor::kernel {
6565
return [d = std::move(d)](Resources &res, void *workspace, void const *const *inputs, void *const *outputs) {
6666
CNNL_ASSERT(cnnlCastDataType(res.fetchOrStore<CnnlContext>()->handle,
6767
d->inDesc, inputs[0], d->cast, d->outDesc, outputs[0]));
68-
// BANG_ASSERT(cnrtQueueSync(res.fetchOrStore<CnnlContext>()->queue));
6968
};
7069
}
7170

src/04kernel/src/kernels/clip/cnnl_kernel.cc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ namespace refactor::kernel {
5757
CNNL_POINTER_MODE_DEVICE, d->t,
5858
inputs[0], inputs[1], hasMax ? inputs[2] : nullptr,
5959
d->t, outputs[0]));
60-
BANG_ASSERT(cnrtQueueSync(res.fetchOrStore<CnnlContext>()->queue));
6160
};
6261
}
6362

src/04kernel/src/kernels/concat/cnnl_kernel.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ namespace refactor::kernel {
5252
}
5353
~Descriptors() noexcept(false) {
5454
CNNL_ASSERT(cnnlDestroyTensorDescriptor(in));
55-
for (auto i = 0; i < out.size(); i++) {
55+
for (size_t i = 0; i < out.size(); i++) {
5656
CNNL_ASSERT(cnnlDestroyTensorDescriptor(out[i]));
5757
}
5858
}
@@ -62,7 +62,7 @@ namespace refactor::kernel {
6262
};
6363
auto d = std::make_shared<Descriptors>(info.num, info.dataType != DT::F64);
6464
setCnnlTensor(d->in, info.dataType, slice(info.inDim.data(), info.inDim.size()));
65-
for (auto i = 0; i < info.outDims.size(); i++) {
65+
for (size_t i = 0; i < info.outDims.size(); i++) {
6666
setCnnlTensor(d->out[i], info.dataType, slice(info.outDims[i].data(), info.outDims[i].size()));
6767
}
6868

src/04kernel/src/kernels/conv/cnnl_kernel.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -209,9 +209,9 @@ namespace refactor::kernel {
209209
// }
210210

211211
void *xTrans = workspace;
212-
void *wTrans = xTrans + xTransSize;
213-
void *yTrans = wTrans + wTransSize;
214-
void *opWorkspace = yTrans + yTransSize;
212+
void *wTrans = reinterpret_cast<uint8_t *>(xTrans) + xTransSize;
213+
void *yTrans = reinterpret_cast<uint8_t *>(wTrans) + wTransSize;
214+
void *opWorkspace = reinterpret_cast<uint8_t *>(yTrans) + yTransSize;
215215

216216
// transpose NCHW input to NHWC
217217
CNNL_ASSERT(cnnlTranspose_v2(handle, d->NCHW2NHWC, d->x, x,

src/04kernel/src/kernels/expand/cnnl_kernel.cc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ namespace refactor::kernel {
6060
return [d = std::move(d)](Resources &res, void *workspace, void const *const *inputs, void *const *outputs) {
6161
CNNL_ASSERT(cnnlExpand(res.fetchOrStore<CnnlContext>()->handle,
6262
d->inDesc, inputs[0], d->outDesc, outputs[0]));
63-
// BANG_ASSERT(cnrtQueueSync(res.fetchOrStore<CnnlContext>()->queue));
6463
};
6564
}
6665
#endif

src/04kernel/src/kernels/gather/cnnl_kernel.cc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ namespace refactor::kernel {
7979
d->inDesc, inputs[0], reinterpret_cast<const int *>(workspace),
8080
d->indexDesc, reinterpret_cast<const int *>(inputs[1]),
8181
d->outDesc, outputs[0]));
82-
BANG_ASSERT(cnrtQueueSync(res.fetchOrStore<CnnlContext>()->queue));
8382
};
8483

8584
return {std::move(routine), workspaceSize};

src/04kernel/src/kernels/mat_mul/cnnl_kernel.cc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,6 @@ namespace refactor::kernel {
141141
workspace, algoWorkspaceSize));
142142
}
143143

144-
BANG_ASSERT(cnrtQueueSync(res.fetchOrStore<CnnlContext>()->queue));
145144
};
146145

147146
return {std::move(routine), algoWorkspaceSize};

src/04kernel/src/kernels/pool/cnnl_kernel.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ namespace refactor::kernel {
130130
auto handle = res.fetchOrStore<CnnlContext>()->handle;
131131

132132
void *extraInputDev = workspace;
133-
void *poolWorkSpace = workspace + extraInputSize;
133+
void *poolWorkSpace = reinterpret_cast<uint8_t *>(workspace) + extraInputSize;
134134

135135
void *extraInputHost = malloc(extraInputSize);
136136
CNNL_ASSERT(cnnlInitPoolingExtraInput(handle, d->pooling, d->x, d->y, extraInputHost));
@@ -145,7 +145,7 @@ namespace refactor::kernel {
145145
&b, extraInputDev, d->y, outputs[0],
146146
poolWorkSpace, workspaceSize));
147147

148-
BANG_ASSERT(cnrtQueueSync(res.fetchOrStore<CnnlContext>()->queue));
148+
res.fetchOrStore<CnnlContext>()->queueSync();
149149

150150
free(extraInputHost);
151151
};

src/04kernel/src/kernels/simple_binary/binary_cnnl.cc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,6 @@ namespace refactor::kernel {
180180
workspace, workspaceSize));
181181
}
182182

183-
BANG_ASSERT(cnrtQueueSync(res.fetchOrStore<CnnlContext>()->queue));
184183
};
185184

186185
return {std::move(routine), workspaceSize};

0 commit comments

Comments
 (0)