diff --git a/impl/sort/topk/topk_common_utils.h b/impl/sort/topk/topk_common_utils.h index e999ed4113860394fb5a562f9554cef4d361769b..2d5a1aba25812149c3c67dacc5760f8628ec6fbe 100644 --- a/impl/sort/topk/topk_common_utils.h +++ b/impl/sort/topk/topk_common_utils.h @@ -53,10 +53,13 @@ struct TopKInfo { int32_t n; // actual length of the tensor }; +#ifndef ASCC_ENUM_TOPKMODE +#define ASCC_ENUM_TOPKMODE enum class TopKMode { TOPK_NORMAL, TOPK_NSMALL, }; +#endif } #endif diff --git a/lib/matmul/matmul_tiling_base.h b/lib/matmul/matmul_tiling_base.h index b6708ce5ee31cc1af0bdb5de6e443f9f44166940..05828030f0468bca986efa0504ee0d3644a5bee5 100644 --- a/lib/matmul/matmul_tiling_base.h +++ b/lib/matmul/matmul_tiling_base.h @@ -21,7 +21,9 @@ #include "tiling/platform/platform_ascendc.h" namespace matmul_tiling { +#ifndef __ASCC_DEVICE__ using half = double; +#endif constexpr int32_t UINT8_BYTES = 1; constexpr int32_t INT8_BYTES = 1; constexpr int32_t FP32_BYTES = 4; @@ -66,12 +68,14 @@ enum class DataType : int32_t { DT_MAX = 34 // Mark the boundaries of data types }; +#ifndef __ASCC_DEVICE__ const std::map DTYPE_BYTE_TAB = { {DataType::DT_FLOAT, 4}, {DataType::DT_FLOAT16, 2}, {DataType::DT_INT8, 1}, {DataType::DT_INT16, 2}, {DataType::DT_UINT16, 2}, {DataType::DT_UINT8, 1}, {DataType::DT_INT32, 4}, {DataType::DT_INT64, 8}, {DataType::DT_UINT32, 4}, {DataType::DT_UINT64, 8}, {DataType::DT_BF16, 2}, {DataType::DT_BFLOAT16, 2}, {DataType::DT_INT4, 1} }; +#endif // __ASCC_DEVICE__ const std::map DTYPE_BIT_TAB = { {DataType::DT_FLOAT, 32}, {DataType::DT_FLOAT16, 16}, {DataType::DT_INT8, 8}, {DataType::DT_INT16, 16}, diff --git a/lib/sort/topk_tiling.h b/lib/sort/topk_tiling.h index 07e36dbbfde70517691d0f9b7a7b41a3f483d62e..b224737b93179578823d40759955220d7d3a4fb1 100644 --- a/lib/sort/topk_tiling.h +++ b/lib/sort/topk_tiling.h @@ -13,12 +13,16 @@ #include "tiling/platform/platform_ascendc.h" namespace AscendC { +#ifndef ASCC_ENUM_TOPKMODE +#define ASCC_ENUM_TOPKMODE enum class TopKMode { TOPK_NORMAL, TOPK_NSMALL, }; +#endif + /* * @ingroup GetTopKMaxMinTmpSize * @brief Get TopK api calculate need max and min temporary local space size. diff --git a/lib/transpose/confusion_transpose_tiling.h b/lib/transpose/confusion_transpose_tiling.h index d91742ee8d0b1b5659f35c1e94ceeb7c92db3c33..ae4a59bc21d1a944037c33c300bef47c59d1cb40 100644 --- a/lib/transpose/confusion_transpose_tiling.h +++ b/lib/transpose/confusion_transpose_tiling.h @@ -18,9 +18,42 @@ #include "confusion_transpose_tilingdata.h" namespace AscendC { constexpr uint32_t TWO_TIMES = 2; +#ifndef __ASCC_DEVICE__ + +#ifndef ASCC_PARAM_BLOCK_CUBE + +#define ASCC_PARAM_BLOCK_CUBE constexpr uint32_t BLOCK_CUBE = 16; +#endif + +#ifndef ASCC_PARAM_ONE_BLK_SIZE +#define ASCC_PARAM_ONE_BLK_SIZE constexpr uint32_t ONE_BLK_SIZE = 32; +#endif + +#ifndef ASCC_PARAM_CUBE_MAX_SIZE +#define ASCC_PARAM_CUBE_MAX_SIZE constexpr int32_t CUBE_MAX_SIZE = 256; +#endif + +#else // #ifdef __ASCC_DEVICE__ + +#ifndef ASCC_PARAM_BLOCK_CUBE +#define ASCC_PARAM_BLOCK_CUBE +const int32_t BLOCK_CUBE = 16; +#endif + +#ifndef ASCC_PARAM_ONE_BLK_SIZE +#define ASCC_PARAM_ONE_BLK_SIZE +const uint16_t ONE_BLK_SIZE = 32; +#endif + +#ifndef ASCC_PARAM_CUBE_MAX_SIZE +#define ASCC_PARAM_CUBE_MAX_SIZE +const int32_t CUBE_MAX_SIZE = 256; +#endif + +#endif // __ASCC_DEVICE__ /*! * \brief calculate max and min tmp buffer size for ConfusionTranspose interface. tmp buffer size is a input for GetConfusionTransposeTilingInfo