Skip to content

Commit 09ed18d

Browse files
committed
Remove redundant code
1. remove threshold_opencv_kernel 2. typo ASCENDC_KERNELS_H 3. add ALIGN_UP macro
1 parent 927aff6 commit 09ed18d

File tree

4 files changed

+3
-10
lines changed

4 files changed

+3
-10
lines changed

modules/cannops/ascendc_kernels/threshold_opencv_kernel.cpp

-8
Original file line numberDiff line numberDiff line change
@@ -377,11 +377,3 @@ extern "C" __global__ __aicore__ void threshold_opencv(GM_ADDR tilingGM, GM_ADDR
377377
// Clear tiling GM cache manually. (cce compiler bug)
378378
dcci(tilingGM, 1);
379379
}
380-
381-
#ifndef __CCE_KT_TEST__
382-
void threshold_opencv_kernel(uint32_t blockDim, void* l2ctrl, void* stream, uint8_t* tiling,
383-
uint8_t* x, uint8_t* y)
384-
{
385-
threshold_opencv<<<blockDim, l2ctrl, stream>>>(tiling, x, y);
386-
}
387-
#endif

modules/cannops/include/opencv2/ascendc_kernels.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#ifndef ASCENDC_KERNELS_H
2-
#define KERNEL_TILINASCENDC_KERNELS_HG_H
2+
#define ASCENDC_KERNELS_H
33

44
#include "../../ascendc_kernels/kernel_tiling_types.h"
55
#include "aclrtlaunch_threshold_opencv.h"

modules/cannops/src/element_operations.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,7 @@ double threshold(const AscendMat& src, AscendMat& dst, double thresh, double max
444444
tiling.thresh = thresh;
445445
// AscendMat memory will be align to 32B, it's safe to set totalLengh a little bigger.
446446
size_t totalBytes = src.rows * src.cols * src.channels();
447-
tiling.totalLength = ((totalBytes + 32) & ~31);
447+
tiling.totalLength = ALIGN_UP(totalBytes, 32);
448448
tiling.threshType = type;
449449
tiling.dtype = src.depth();
450450

modules/cannops/src/precomp.hpp

+1
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,6 @@
1111
#include "opencv2/cann_interface.hpp"
1212
#include "opencv2/cann_private.hpp"
1313
#include "opencv2/ascendc_kernels.hpp"
14+
#define ALIGN_UP(num, align) (((num) + (align) - 1) & ~((align) - 1))
1415

1516
#endif /* __OPENCV_PRECOMP_H__ */

0 commit comments

Comments
 (0)