Skip to content

Commit

Permalink
Remove redundant code
Browse files Browse the repository at this point in the history
1. remove threshold_opencv_kernel
2. typo ASCENDC_KERNELS_H
3. add ALIGN_UP macro
  • Loading branch information
MengqingCao committed Feb 21, 2024
1 parent 927aff6 commit 09ed18d
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 10 deletions.
8 changes: 0 additions & 8 deletions modules/cannops/ascendc_kernels/threshold_opencv_kernel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -377,11 +377,3 @@ extern "C" __global__ __aicore__ void threshold_opencv(GM_ADDR tilingGM, GM_ADDR
// Clear tiling GM cache manually. (cce compiler bug)
dcci(tilingGM, 1);
}

#ifndef __CCE_KT_TEST__
void threshold_opencv_kernel(uint32_t blockDim, void* l2ctrl, void* stream, uint8_t* tiling,
uint8_t* x, uint8_t* y)
{
threshold_opencv<<<blockDim, l2ctrl, stream>>>(tiling, x, y);
}
#endif
2 changes: 1 addition & 1 deletion modules/cannops/include/opencv2/ascendc_kernels.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef ASCENDC_KERNELS_H
#define KERNEL_TILINASCENDC_KERNELS_HG_H
#define ASCENDC_KERNELS_H

#include "../../ascendc_kernels/kernel_tiling_types.h"
#include "aclrtlaunch_threshold_opencv.h"
Expand Down
2 changes: 1 addition & 1 deletion modules/cannops/src/element_operations.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ double threshold(const AscendMat& src, AscendMat& dst, double thresh, double max
tiling.thresh = thresh;
// AscendMat memory will be align to 32B, it's safe to set totalLengh a little bigger.
size_t totalBytes = src.rows * src.cols * src.channels();
tiling.totalLength = ((totalBytes + 32) & ~31);
tiling.totalLength = ALIGN_UP(totalBytes, 32);
tiling.threshType = type;
tiling.dtype = src.depth();

Expand Down
1 change: 1 addition & 0 deletions modules/cannops/src/precomp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@
#include "opencv2/cann_interface.hpp"
#include "opencv2/cann_private.hpp"
#include "opencv2/ascendc_kernels.hpp"
#define ALIGN_UP(num, align) (((num) + (align) - 1) & ~((align) - 1))

#endif /* __OPENCV_PRECOMP_H__ */

0 comments on commit 09ed18d

Please sign in to comment.