已合并
【fix】constexpr函数内部调用函数加__callee__支撑编译器修改 #4977
好好说话95号创建于 8月10日
【fix】constexpr函数内部调用函数加__callee__支撑编译器修改 #4977
已合并
好好说话95号创建于 8月10日
15 个文件变更+68-47
@@ -387,14 +387,14 @@ __aicore__ constexpr int32_t GetTypeSize()
387}387}
388 388 
389template <typename T>389template <typename T>
390-__aicore__ inline T Ceil(T num1, T num2)390+__aicore__ inline constexpr T Ceil(T num1, T num2)
391{391{
392- ASCENDC_ASSERT((num2 > 0), { KERNEL_LOG(KERNEL_ERROR, "num2 is %d , which should be larger than 0", num2); });392+ ASCENDC_DEBUG_ASSERT((num2 > 0), { KERNEL_LOG(KERNEL_ERROR, "num2 is %d , which should be larger than 0", num2); });
393 return (num1 + num2 - 1) / num2;393 return (num1 + num2 - 1) / num2;
394}394}
395 395 
396template <typename T>396template <typename T>
397-__aicore__ inline T CeilAlign(T num1, T num2)397+__aicore__ inline constexpr T CeilAlign(T num1, T num2)
398{398{
399 ASSERT(num2 > 0);399 ASSERT(num2 > 0);
400 return Ceil(num1, num2) * num2;400 return Ceil(num1, num2) * num2;
@@ -547,12 +547,12 @@ __aicore__ inline void CopyTiling(const __gm__ TCubeTiling* gmCubeTiling, TCubeT
547}547}
548#endif548#endif
549template <typename A_TYPE, const auto& MM_CFG>549template <typename A_TYPE, const auto& MM_CFG>
550-constexpr bool isNormEnableScheduler = DoMatmulNorm(MM_CFG) && (A_TYPE::layout == LayoutMode::NONE) &&550+constexpr bool isNormEnableScheduler =
551- !ToMatmulConfig(MM_CFG).intraBlockPartSum;551+ DoMatmulNorm(MM_CFG) && (A_TYPE::layout == LayoutMode::NONE) && !ToMatmulConfig(MM_CFG).intraBlockPartSum;
552 552 
553template <typename A_TYPE, const auto& MM_CFG>553template <typename A_TYPE, const auto& MM_CFG>
554-constexpr bool isNormDisableScheduler = DoMatmulNorm(MM_CFG) && ((A_TYPE::layout != LayoutMode::NONE) ||554+constexpr bool isNormDisableScheduler =
555- ToMatmulConfig(MM_CFG).intraBlockPartSum);555+ DoMatmulNorm(MM_CFG) && ((A_TYPE::layout != LayoutMode::NONE) || ToMatmulConfig(MM_CFG).intraBlockPartSum);
556 556 
557template <const auto& MM_CFG>557template <const auto& MM_CFG>
558constexpr bool IsBasicBlockEnable = DoMatmulBasicBlock(MM_CFG) || DoMatmulSpecialBasicBlock(MM_CFG);558constexpr bool IsBasicBlockEnable = DoMatmulBasicBlock(MM_CFG) || DoMatmulSpecialBasicBlock(MM_CFG);
@@ -42,7 +42,7 @@ __aicore__ constexpr inline uint32_t AlignUp(uint32_t a, uint32_t b) { return Di
42 42 
43__aicore__ constexpr inline uint32_t ConstCeil(uint32_t a, uint32_t b) { return (a + b - 1) / b; }43__aicore__ constexpr inline uint32_t ConstCeil(uint32_t a, uint32_t b) { return (a + b - 1) / b; }
44 44 
45-__aicore__ inline uint32_t Ceil(uint32_t a, uint32_t b) { return (a + b - 1) / b; }45+__aicore__ constexpr inline uint32_t Ceil(uint32_t a, uint32_t b) { return (a + b - 1) / b; }
46 46 
47#if defined(__NPU_ARCH__) && \47#if defined(__NPU_ARCH__) && \
48 ((__NPU_ARCH__ == 3510) || (__NPU_ARCH__ == 5102) || (__NPU_ARCH__ == 3003) || (__NPU_ARCH__ == 3113)) || \48 ((__NPU_ARCH__ == 3510) || (__NPU_ARCH__ == 5102) || (__NPU_ARCH__ == 3003) || (__NPU_ARCH__ == 3113)) || \
@@ -222,7 +222,7 @@ template <typename T>
222constexpr __aicore__ inline uint64_t GetScalarBitcodeValue(T scalarValue)222constexpr __aicore__ inline uint64_t GetScalarBitcodeValue(T scalarValue)
223{223{
224 union ScalarBitcode {224 union ScalarBitcode {
225- __aicore__ ScalarBitcode() {}225+ __callee__ ScalarBitcode() {}
226 T input;226 T input;
227 uint64_t output;227 uint64_t output;
228 } data;228 } data;
@@ -235,7 +235,7 @@ template <typename T, typename U>
235constexpr __aicore__ inline U GetScalarBitcodeValue(T scalarValue)235constexpr __aicore__ inline U GetScalarBitcodeValue(T scalarValue)
236{236{
237 union ScalarBitcode {237 union ScalarBitcode {
238- __aicore__ ScalarBitcode() {}238+ __callee__ ScalarBitcode() {}
239 T input;239 T input;
240 U output;240 U output;
241 } data;241 } data;
@@ -248,7 +248,7 @@ template <typename T>
248constexpr __aicore__ inline half GetScalarBitcodeToHalf(T scalarValue)248constexpr __aicore__ inline half GetScalarBitcodeToHalf(T scalarValue)
249{249{
250 union ScalarBitcode {250 union ScalarBitcode {
251- __aicore__ ScalarBitcode() {}251+ __callee__ ScalarBitcode() {}
252 T input;252 T input;
253 half output;253 half output;
254 } data;254 } data;
@@ -23,7 +23,7 @@ template <typename T>
23constexpr __aicore__ inline uint64_t get_scalar_bitcode_value(T scalarValue)23constexpr __aicore__ inline uint64_t get_scalar_bitcode_value(T scalarValue)
24{24{
25 union ScalarBitcode {25 union ScalarBitcode {
26- __aicore__ ScalarBitcode() {}26+ __callee__ ScalarBitcode() {}
27 T input;27 T input;
28 uint64_t output;28 uint64_t output;
29 } data;29 } data;
@@ -36,7 +36,7 @@ template <typename T, typename U>
36constexpr __aicore__ inline U get_scalar_bitcode_value(T scalarValue)36constexpr __aicore__ inline U get_scalar_bitcode_value(T scalarValue)
37{37{
38 union ScalarBitcode {38 union ScalarBitcode {
39- __aicore__ ScalarBitcode() {}39+ __callee__ ScalarBitcode() {}
40 T input;40 T input;
41 U output;41 U output;
42 } data;42 } data;
@@ -53,13 +53,13 @@ constexpr uint32_t CONST_FP32_POS_INF = 0x7F800000;
53constexpr uint32_t CONST_FP32_NEG_INF = 0xFF800000;53constexpr uint32_t CONST_FP32_NEG_INF = 0xFF800000;
54constexpr uint32_t CONST_FP32_MAN_LEN = 23;54constexpr uint32_t CONST_FP32_MAN_LEN = 23;
55 55 
56-__aicore__ inline uint32_t fp32_constructor(uint32_t s, uint32_t e, uint32_t m)56+__aicore__ __callee__ inline uint32_t fp32_constructor(uint32_t s, uint32_t e, uint32_t m)
57{57{
58 constexpr uint32_t fp32_max_man = 0x7FFFFF;58 constexpr uint32_t fp32_max_man = 0x7FFFFF;
59 return (((s) << 31) | ((e) << 23) | ((m)&fp32_max_man));59 return (((s) << 31) | ((e) << 23) | ((m)&fp32_max_man));
60}60}
61 61 
62-__aicore__ inline uint32_t hif8_to_fp32(const uint8_t fpVal)62+__aicore__ __callee__ inline uint32_t hif8_to_fp32(const uint8_t fpVal)
63{63{
64 constexpr uint8_t hif8Nan = 0x80;64 constexpr uint8_t hif8Nan = 0x80;
65 constexpr uint8_t hif8PosInf = 0x6F;65 constexpr uint8_t hif8PosInf = 0x6F;
@@ -150,28 +150,28 @@ __aicore__ inline uint32_t hif8_to_fp32(const uint8_t fpVal)
150}150}
151 151 
152// FP8 (E5M2) -> Fp32152// FP8 (E5M2) -> Fp32
153-__aicore__ inline bool fp8e5m2_is_nan(const uint16_t& x)153+__aicore__ __callee__ inline bool fp8e5m2_is_nan(const uint16_t& x)
154{154{
155 constexpr int16_t fp8e5m2ExpMask = 0x7C;155 constexpr int16_t fp8e5m2ExpMask = 0x7C;
156 constexpr int16_t fp8e5m2ManMask = 0x3;156 constexpr int16_t fp8e5m2ManMask = 0x3;
157 return ((((x)&fp8e5m2ExpMask) == fp8e5m2ExpMask) && (((x)&fp8e5m2ManMask) != 0));157 return ((((x)&fp8e5m2ExpMask) == fp8e5m2ExpMask) && (((x)&fp8e5m2ManMask) != 0));
158}158}
159 159 
160-__aicore__ inline bool fp8e5m2_is_inf(const uint16_t& x)160+__aicore__ __callee__ inline bool fp8e5m2_is_inf(const uint16_t& x)
161{161{
162 return ((x == static_cast<uint8_t>(0x7C)) || (x == static_cast<uint8_t>(0xFC))) ? true : false;162 return ((x == static_cast<uint8_t>(0x7C)) || (x == static_cast<uint8_t>(0xFC))) ? true : false;
163}163}
164 164 
165-__aicore__ inline int8_t fp8e5m2_extract_sign(int8_t x) { return (((x) >> 7) & 0x1); }165+__aicore__ __callee__ inline int8_t fp8e5m2_extract_sign(int8_t x) { return (((x) >> 7) & 0x1); }
166 166 
167-__aicore__ inline int8_t fp8e5m2_extract_exp(int8_t x) { return (((x) >> 2) & 0x1F); }167+__aicore__ __callee__ inline int8_t fp8e5m2_extract_exp(int8_t x) { return (((x) >> 2) & 0x1F); }
168 168 
169-__aicore__ inline int8_t fp8e5m2_extract_man(uint8_t x)169+__aicore__ __callee__ inline int8_t fp8e5m2_extract_man(uint8_t x)
170{170{
171 return ((((x) >> 0) & 0x3) | (((((x) >> 2) & 0x1F) > 0 ? 1 : 0) * 0x4));171 return ((((x) >> 0) & 0x3) | (((((x) >> 2) & 0x1F) > 0 ? 1 : 0) * 0x4));
172}172}
173 173 
174-__aicore__ inline void extract_fp8e5m2(const int8_t val, uint8_t& s, int8_t& e, uint8_t& m)174+__aicore__ __callee__ inline void extract_fp8e5m2(const int8_t val, uint8_t& s, int8_t& e, uint8_t& m)
175{175{
176 constexpr uint32_t fp8e5m2ExpBias = 15;176 constexpr uint32_t fp8e5m2ExpBias = 15;
177 // 1.Extract177 // 1.Extract
@@ -185,7 +185,7 @@ __aicore__ inline void extract_fp8e5m2(const int8_t val, uint8_t& s, int8_t& e,
185 }185 }
186}186}
187 187 
188-__aicore__ inline uint32_t fp8e5m2_to_fp32(const uint8_t fpVal)188+__aicore__ __callee__ inline uint32_t fp8e5m2_to_fp32(const uint8_t fpVal)
189{189{
190 constexpr uint32_t fp8e5m2ExpBias = 15;190 constexpr uint32_t fp8e5m2ExpBias = 15;
191 constexpr uint32_t fp8e5m2ManLen = 2;191 constexpr uint32_t fp8e5m2ManLen = 2;
@@ -243,21 +243,21 @@ __aicore__ inline uint32_t fp8e5m2_to_fp32(const uint8_t fpVal)
243constexpr uint32_t CONST_FP8E4M3_EXP_BIAS = 7;243constexpr uint32_t CONST_FP8E4M3_EXP_BIAS = 7;
244constexpr uint32_t CONST_FP8E4M3_MAN_LEN = 3;244constexpr uint32_t CONST_FP8E4M3_MAN_LEN = 3;
245 245 
246-__aicore__ inline bool fp8e4m3_is_nan(const int8_t& x)246+__aicore__ __callee__ inline bool fp8e4m3_is_nan(const int8_t& x)
247{247{
248 return (((x == static_cast<int8_t>(0x7F)) || (x == static_cast<int8_t>(0xFF))) ? true : false);248 return (((x == static_cast<int8_t>(0x7F)) || (x == static_cast<int8_t>(0xFF))) ? true : false);
249}249}
250 250 
251-__aicore__ inline uint16_t fp8e4m3_extract_sign(uint8_t x) { return (((x) >> 7) & 0x1); }251+__aicore__ __callee__ inline uint16_t fp8e4m3_extract_sign(uint8_t x) { return (((x) >> 7) & 0x1); }
252 252 
253-__aicore__ inline uint16_t fp8e4m3_extract_exp(uint8_t x) { return (((x) >> CONST_FP8E4M3_MAN_LEN) & 0xF); }253+__aicore__ __callee__ inline uint16_t fp8e4m3_extract_exp(uint8_t x) { return (((x) >> CONST_FP8E4M3_MAN_LEN) & 0xF); }
254 254 
255-__aicore__ inline uint16_t fp8e4m3_extract_man(uint8_t x)255+__aicore__ __callee__ inline uint16_t fp8e4m3_extract_man(uint8_t x)
256{256{
257 return ((((x) >> 0) & 0x7) | (((((x) >> CONST_FP8E4M3_MAN_LEN) & 0xF) > 0 ? 1 : 0) * 0x8));257 return ((((x) >> 0) & 0x7) | (((((x) >> CONST_FP8E4M3_MAN_LEN) & 0xF) > 0 ? 1 : 0) * 0x8));
258}258}
259 259 
260-__aicore__ inline void extract_fp8(const int8_t val, uint8_t& s, int8_t& e, uint8_t& m)260+__aicore__ __callee__ inline void extract_fp8(const int8_t val, uint8_t& s, int8_t& e, uint8_t& m)
261{261{
262 // 1.Extract262 // 1.Extract
263 s = fp8e4m3_extract_sign(val);263 s = fp8e4m3_extract_sign(val);
@@ -270,7 +270,7 @@ __aicore__ inline void extract_fp8(const int8_t val, uint8_t& s, int8_t& e, uint
270 }270 }
271}271}
272 272 
273-__aicore__ inline uint32_t fp8e4m3_to_fp32(const int8_t fpVal)273+__aicore__ __callee__ inline uint32_t fp8e4m3_to_fp32(const int8_t fpVal)
274{274{
275 constexpr uint8_t fp8ManHideBit = 0x8;275 constexpr uint8_t fp8ManHideBit = 0x8;
276 uint32_t ret = 0;276 uint32_t ret = 0;
@@ -321,7 +321,7 @@ __aicore__ inline uint32_t fp8e4m3_to_fp32(const int8_t fpVal)
321}321}
322 322 
323// Fp4e2m1 -> Bf16323// Fp4e2m1 -> Bf16
324-__aicore__ inline bfloat16_t fp4e2m1_to_bfloat(const uint8_t fpVal)324+__aicore__ __callee__ inline bfloat16_t fp4e2m1_to_bfloat(const uint8_t fpVal)
325{325{
326 constexpr uint16_t fp4e2m1ToBf16[16] = {0x0, 0x3F00, 0x3F80, 0x3FC0, 0x4000, 0x4040, 0x4080, 0x40C0,326 constexpr uint16_t fp4e2m1ToBf16[16] = {0x0, 0x3F00, 0x3F80, 0x3FC0, 0x4000, 0x4040, 0x4080, 0x40C0,
327 0x8000, 0xBF00, 0xBF80, 0xBFC0, 0xC000, 0xC040, 0xC080, 0xC0C0};327 0x8000, 0xBF00, 0xBF80, 0xBFC0, 0xC000, 0xC040, 0xC080, 0xC0C0};
@@ -331,7 +331,7 @@ __aicore__ inline bfloat16_t fp4e2m1_to_bfloat(const uint8_t fpVal)
331}331}
332 332 
333// Fp4e1m2 -> Bf16333// Fp4e1m2 -> Bf16
334-__aicore__ inline bfloat16_t fp4e1m2_to_bfloat(const uint8_t fpVal)334+__aicore__ __callee__ inline bfloat16_t fp4e1m2_to_bfloat(const uint8_t fpVal)
335{335{
336 constexpr uint16_t fp4e1m2ToBf16[16] = {0x0, 0x3E80, 0x3F00, 0x3F40, 0x3F80, 0x3FA0, 0x3FC0, 0x3FE0,336 constexpr uint16_t fp4e1m2ToBf16[16] = {0x0, 0x3E80, 0x3F00, 0x3F40, 0x3F80, 0x3FA0, 0x3FC0, 0x3FE0,
337 0x8000, 0xBE80, 0xBF00, 0xBF40, 0xBF80, 0xBFA0, 0xBFC0, 0xBFE0};337 0x8000, 0xBE80, 0xBF00, 0xBF40, 0xBF80, 0xBFA0, 0xBFC0, 0xBFE0};
@@ -340,7 +340,7 @@ __aicore__ inline bfloat16_t fp4e1m2_to_bfloat(const uint8_t fpVal)
340 return get_scalar_bitcode_value<uint16_t, bfloat16_t>(ret);340 return get_scalar_bitcode_value<uint16_t, bfloat16_t>(ret);
341}341}
342 342 
343-__aicore__ inline float bf16_to_fp32(const bfloat16_t& bVal)343+__aicore__ __callee__ inline float bf16_to_fp32(const bfloat16_t& bVal)
344{344{
345 bfloat16_t bNum = bVal;345 bfloat16_t bNum = bVal;
346 uint32_t uiNum = (get_scalar_bitcode_value<bfloat16_t, uint32_t>(bNum)) << 16;346 uint32_t uiNum = (get_scalar_bitcode_value<bfloat16_t, uint32_t>(bNum)) << 16;
@@ -35,7 +35,7 @@ namespace Std {
35constexpr uint32_t ASCENDC_STD_TUPLE_STACK_DEPTH = 64;35constexpr uint32_t ASCENDC_STD_TUPLE_STACK_DEPTH = 64;
36 36 
37template <size_t N = 0, typename... Tps>37template <size_t N = 0, typename... Tps>
38-ASCENDC_HOST_AICORE inline void tuple_static_assert()38+ASCENDC_HOST_AICORE inline constexpr void tuple_static_assert()
39{39{
40 static_assert(N < ASCENDC_STD_TUPLE_STACK_DEPTH, "Index overflow. The index must be smaller than 64!");40 static_assert(N < ASCENDC_STD_TUPLE_STACK_DEPTH, "Index overflow. The index must be smaller than 64!");
41 static_assert(sizeof...(Tps) <= ASCENDC_STD_TUPLE_STACK_DEPTH, "The number of template elements must be <= 64!");41 static_assert(sizeof...(Tps) <= ASCENDC_STD_TUPLE_STACK_DEPTH, "The number of template elements must be <= 64!");
@@ -56,12 +56,13 @@ struct tuple_constraints {
56template <typename Tp, typename... Tps>56template <typename Tp, typename... Tps>
57class tuple<Tp, Tps...> : public tuple<Tps...> {57class tuple<Tp, Tps...> : public tuple<Tps...> {
58public:58public:
59- ASCENDC_HOST_AICORE inline tuple() : tuple<Tps...>(), value() { tuple_static_assert<0, Tp, Tps...>(); }59+ ASCENDC_HOST_AICORE inline constexpr tuple() : tuple<Tps...>(), value() { tuple_static_assert<0, Tp, Tps...>(); }
60 60 
61 template <61 template <
62 typename Constraints = tuple_constraints<Tp, Tps...>,62 typename Constraints = tuple_constraints<Tp, Tps...>,
63 enable_if_t<Constraints::variadic_copy_constructible, int> = 0>63 enable_if_t<Constraints::variadic_copy_constructible, int> = 0>
64- ASCENDC_HOST_AICORE inline tuple(const Tp& val, const Tps&... params) : tuple<Tps...>(params...), value(val)64+ ASCENDC_HOST_AICORE inline constexpr tuple(const Tp& val, const Tps&... params)
65+ : tuple<Tps...>(params...), value(val)
65 {66 {
66 tuple_static_assert<0, Tp, Tps...>();67 tuple_static_assert<0, Tp, Tps...>();
67 }68 }
@@ -69,15 +70,15 @@ public:
69 template <70 template <
70 typename Constraints = tuple_constraints<Tp, Tps...>,71 typename Constraints = tuple_constraints<Tp, Tps...>,
71 enable_if_t<!Constraints::variadic_copy_constructible, int> = 0>72 enable_if_t<!Constraints::variadic_copy_constructible, int> = 0>
72- ASCENDC_HOST_AICORE inline tuple(Tp&& val, Tps&&... params)73+ ASCENDC_HOST_AICORE inline constexpr tuple(Tp&& val, Tps&&... params)
73 : tuple<Tps...>(forward<Tps>(params)...), value(forward<Tp>(val))74 : tuple<Tps...>(forward<Tps>(params)...), value(forward<Tp>(val))
74 {75 {
75 tuple_static_assert<0, Tp, Tps...>();76 tuple_static_assert<0, Tp, Tps...>();
76 }77 }
77 78 
78- ASCENDC_HOST_AICORE inline Tp& GetValue() noexcept { return value; }79+ ASCENDC_HOST_AICORE inline constexpr Tp& GetValue() noexcept { return value; }
79 80 
80- ASCENDC_HOST_AICORE inline const Tp& GetValue() const noexcept { return value; }81+ ASCENDC_HOST_AICORE inline constexpr const Tp& GetValue() const noexcept { return value; }
81 82 
82 template <typename Head, typename... Args>83 template <typename Head, typename... Args>
83 ASCENDC_HOST_AICORE inline tuple<Tp, Tps...>& operator=(const tuple<Head, Args...>& t)84 ASCENDC_HOST_AICORE inline tuple<Tp, Tps...>& operator=(const tuple<Head, Args...>& t)
@@ -185,7 +186,7 @@ ASCENDC_HOST_AICORE inline constexpr tuple<Tps&&...> forward_as_tuple(Tps&&... a
185 186 
186// get187// get
187template <size_t N, typename... Tps>188template <size_t N, typename... Tps>
188-ASCENDC_HOST_AICORE inline typename tuple_element<N, tuple<Tps...>>::type& get(tuple<Tps...>& t) noexcept189+ASCENDC_HOST_AICORE inline constexpr typename tuple_element<N, tuple<Tps...>>::type& get(tuple<Tps...>& t) noexcept
189{190{
190 tuple_static_assert<N, Tps...>();191 tuple_static_assert<N, Tps...>();
191 using type = typename tuple_element<N, tuple<Tps...>>::type;192 using type = typename tuple_element<N, tuple<Tps...>>::type;
@@ -194,7 +195,8 @@ ASCENDC_HOST_AICORE inline typename tuple_element<N, tuple<Tps...>>::type& get(t
194}195}
195 196 
196template <size_t N, typename... Tps>197template <size_t N, typename... Tps>
197-ASCENDC_HOST_AICORE inline const typename tuple_element<N, tuple<Tps...>>::type& get(const tuple<Tps...>& t) noexcept198+ASCENDC_HOST_AICORE inline constexpr const typename tuple_element<N, tuple<Tps...>>::type& get(
199+ const tuple<Tps...>& t) noexcept
198{200{
199 tuple_static_assert<N, Tps...>();201 tuple_static_assert<N, Tps...>();
200 using type = const typename tuple_element<N, tuple<Tps...>>::type;202 using type = const typename tuple_element<N, tuple<Tps...>>::type;
@@ -203,14 +205,15 @@ ASCENDC_HOST_AICORE inline const typename tuple_element<N, tuple<Tps...>>::type&
203}205}
204 206 
205template <size_t N, typename... Tps>207template <size_t N, typename... Tps>
206-ASCENDC_HOST_AICORE inline typename tuple_element<N, tuple<Tps...>>::type&& get(tuple<Tps...>&& t) noexcept208+ASCENDC_HOST_AICORE inline constexpr typename tuple_element<N, tuple<Tps...>>::type&& get(tuple<Tps...>&& t) noexcept
207{209{
208 using type = typename tuple_element<N, tuple<Tps...>>::type;210 using type = typename tuple_element<N, tuple<Tps...>>::type;
209 return static_cast<type&&>(get<N, Tps...>(static_cast<tuple<Tps...>&>(t)));211 return static_cast<type&&>(get<N, Tps...>(static_cast<tuple<Tps...>&>(t)));
210}212}
211 213 
212template <size_t N, typename... Tps>214template <size_t N, typename... Tps>
213-ASCENDC_HOST_AICORE inline const typename tuple_element<N, tuple<Tps...>>::type&& get(const tuple<Tps...>&& t) noexcept215+ASCENDC_HOST_AICORE inline constexpr const typename tuple_element<N, tuple<Tps...>>::type&& get(
216+ const tuple<Tps...>&& t) noexcept
214{217{
215 using type = const typename tuple_element<N, tuple<Tps...>>::type;218 using type = const typename tuple_element<N, tuple<Tps...>>::type;
216 return static_cast<type&&>(get<N, Tps...>(static_cast<const tuple<Tps...>&>(t)));219 return static_cast<type&&>(get<N, Tps...>(static_cast<const tuple<Tps...>&>(t)));
@@ -51,16 +51,16 @@ ASCENDC_HOST_AICORE inline constexpr tuple<Tps& ...> tie(Tps& ...args) noexcept;
51 51 
52// get52// get
53template <size_t N, typename ...Tps>53template <size_t N, typename ...Tps>
54-ASCENDC_HOST_AICORE inline typename tuple_element<N, tuple<Tps...> >::type& get(tuple<Tps...>& t) noexcept;54+ASCENDC_HOST_AICORE inline constexpr typename tuple_element<N, tuple<Tps...> >::type& get(tuple<Tps...>& t) noexcept;
55 55 
56template <size_t N, typename ...Tps>56template <size_t N, typename ...Tps>
57-ASCENDC_HOST_AICORE inline const typename tuple_element<N, tuple<Tps...> >::type& get(const tuple<Tps...>& t) noexcept;57+ASCENDC_HOST_AICORE inline constexpr const typename tuple_element<N, tuple<Tps...> >::type& get(const tuple<Tps...>& t) noexcept;
58 58 
59template <size_t N, typename ...Tps>59template <size_t N, typename ...Tps>
60-ASCENDC_HOST_AICORE inline typename tuple_element<N, tuple<Tps...> >::type&& get(tuple<Tps...>&& t) noexcept;60+ASCENDC_HOST_AICORE inline constexpr typename tuple_element<N, tuple<Tps...> >::type&& get(tuple<Tps...>&& t) noexcept;
61 61 
62template <size_t N, typename ...Tps>62template <size_t N, typename ...Tps>
63-ASCENDC_HOST_AICORE inline const typename tuple_element<N, tuple<Tps...> >::type&& get(const tuple<Tps...>&& t) noexcept;63+ASCENDC_HOST_AICORE inline constexpr const typename tuple_element<N, tuple<Tps...> >::type&& get(const tuple<Tps...>&& t) noexcept;
64 64 
65}65}
66}66}
@@ -496,6 +496,7 @@ foreach(product_type ${PRODUCT_TYPE_LIST})
496 $<$<STREQUAL:${product_type},Kirin9030_AIV>:__NPU_ARCH__=3113;__DAV_L311__;__DAV_L311_VEC__;__DAV_L311_VEC__>496 $<$<STREQUAL:${product_type},Kirin9030_AIV>:__NPU_ARCH__=3113;__DAV_L311__;__DAV_L311_VEC__;__DAV_L311_VEC__>
497 $<$<STREQUAL:${product_type},ascend310B1>:__NPU_ARCH__=3002;__DAV_M300__>497 $<$<STREQUAL:${product_type},ascend310B1>:__NPU_ARCH__=3002;__DAV_M300__>
498 __disable_kernel_type_autoinfer__=498 __disable_kernel_type_autoinfer__=
499+ __callee__=
499 )500 )
500 501 
501 target_include_directories(ascendc_ut_adv_api_kernel_${product_type} PRIVATE502 target_include_directories(ascendc_ut_adv_api_kernel_${product_type} PRIVATE
@@ -202,6 +202,7 @@ foreach(product_type ${BASIC_UT_PRODUCT_TYPE_LIST})
202 $<$<STREQUAL:${product_type},mc62cm12aa_BASIC>:__NPU_ARCH__=5102>202 $<$<STREQUAL:${product_type},mc62cm12aa_BASIC>:__NPU_ARCH__=5102>
203 $<$<STREQUAL:${product_type},mc62cm12aa_FRAMEWORK>:__NPU_ARCH__=5102>203 $<$<STREQUAL:${product_type},mc62cm12aa_FRAMEWORK>:__NPU_ARCH__=5102>
204 __disable_kernel_type_autoinfer__=204 __disable_kernel_type_autoinfer__=
205+ __callee__=
205 )206 )
206 207 
207 target_include_directories(ascendc_ut_basic_api_${product_type} PRIVATE208 target_include_directories(ascendc_ut_basic_api_${product_type} PRIVATE
@@ -144,7 +144,7 @@ function(create_check_targets NPU_MODE MODE_SUFFIX MODE_DEFINES)
144 set(ALL_DEFINES ${MODE_DEFINES} ${CONFIG_DEFS})144 set(ALL_DEFINES ${MODE_DEFINES} ${CONFIG_DEFS})
145 set(ARCH_FLAG "--cce-aicore-arch=${CONFIG_NAME}")145 set(ARCH_FLAG "--cce-aicore-arch=${CONFIG_NAME}")
146 else()146 else()
147- set(ALL_DEFINES ${MODE_DEFINES} ${CONFIG_DEFS} "-D__NPU_ARCH__=${CONFIG_ARCH}" "-DASCENDC_CPU_DEBUG=1")147+ set(ALL_DEFINES ${MODE_DEFINES} ${CONFIG_DEFS} "-D__NPU_ARCH__=${CONFIG_ARCH}" "-DASCENDC_CPU_DEBUG=1" "-D__callee__=")
148 set(ARCH_FLAG "")148 set(ARCH_FLAG "")
149 endif()149 endif()
150 150 
@@ -25,8 +25,14 @@ set(ASCENDC_UT_HEADER
25 ${CMAKE_CURRENT_LIST_DIR}/..25 ${CMAKE_CURRENT_LIST_DIR}/..
26 ${ASCENDC_DIR}26 ${ASCENDC_DIR}
27 ${ASCENDC_DIR}/include27 ${ASCENDC_DIR}/include
28+ ${ASCENDC_DIR}/include/basic_api
28 ${ASCENDC_DIR}/include/c_api29 ${ASCENDC_DIR}/include/c_api
30+ ${ASCENDC_DIR}/include/simt_api
31+ ${ASCENDC_DIR}/include/utils
32+ ${ASCENDC_DIR}/impl
33+ ${ASCENDC_DIR}/impl/basic_api
29 ${ASCENDC_DIR}/impl/c_api34 ${ASCENDC_DIR}/impl/c_api
35+ ${ASCENDC_DIR}/impl/simt_api
30 ${ASCENDC_DIR}/36 ${ASCENDC_DIR}/
31)37)
32 38 
@@ -87,6 +93,7 @@ foreach(product_type ${ASCENDC_UT_PRODUCT_TYPE_LIST})
87 $<$<STREQUAL:${product_type},ascend950pr_9599_AIC>:__NPU_ARCH__=3510;__DAV_C310__;__DAV_C310_CUBE__;__DAV_CUBE__>93 $<$<STREQUAL:${product_type},ascend950pr_9599_AIC>:__NPU_ARCH__=3510;__DAV_C310__;__DAV_C310_CUBE__;__DAV_CUBE__>
88 $<$<STREQUAL:${product_type},ascend950pr_9599_AIV>:__NPU_ARCH__=3510;__DAV_C310__;__DAV_C310_VEC__;__DAV_VEC__>94 $<$<STREQUAL:${product_type},ascend950pr_9599_AIV>:__NPU_ARCH__=3510;__DAV_C310__;__DAV_C310_VEC__;__DAV_VEC__>
89 __disable_kernel_type_autoinfer__=95 __disable_kernel_type_autoinfer__=
96+ __callee__=
90 )97 )
91 98 
92 target_include_directories(ascendc_ut_c_api_${product_type} PRIVATE99 target_include_directories(ascendc_ut_c_api_${product_type} PRIVATE
@@ -53,6 +53,7 @@ foreach(product_type ${MICRO_PRODUCT_TYPE_LIST})
53 ASCENDC_DUMP=053 ASCENDC_DUMP=0
54 $<$<STREQUAL:${product_type},ascend950pr_9599>:__NPU_ARCH__=3510;__DAV_C310__;__DAV_C310_VEC__>54 $<$<STREQUAL:${product_type},ascend950pr_9599>:__NPU_ARCH__=3510;__DAV_C310__;__DAV_C310_VEC__>
55 $<$<STREQUAL:${product_type},mc62cm12aa>:__NPU_ARCH__=5102>55 $<$<STREQUAL:${product_type},mc62cm12aa>:__NPU_ARCH__=5102>
56+ __callee__=
56 )57 )
57 58 
58 target_include_directories(ascendc_ut_reg_compute_${product_type} PRIVATE59 target_include_directories(ascendc_ut_reg_compute_${product_type} PRIVATE
@@ -138,7 +138,7 @@ function(create_check_targets NPU_MODE MODE_SUFFIX MODE_DEFINES)
138 set(ALL_DEFINES ${MODE_DEFINES} ${CONFIG_DEFS})138 set(ALL_DEFINES ${MODE_DEFINES} ${CONFIG_DEFS})
139 set(ARCH_FLAG "--cce-aicore-arch=${CONFIG_NAME}")139 set(ARCH_FLAG "--cce-aicore-arch=${CONFIG_NAME}")
140 else()140 else()
141- set(ALL_DEFINES ${MODE_DEFINES} ${CONFIG_DEFS} "-D__NPU_ARCH__=${CONFIG_ARCH}" "-DASCENDC_CPU_DEBUG=1")141+ set(ALL_DEFINES ${MODE_DEFINES} ${CONFIG_DEFS} "-D__NPU_ARCH__=${CONFIG_ARCH}" "-DASCENDC_CPU_DEBUG=1" "-D__callee__=")
142 set(ARCH_FLAG "")142 set(ARCH_FLAG "")
143 endif()143 endif()
144 144 
@@ -85,6 +85,7 @@ foreach(product_type ${SIMT_PRODUCT_TYPE_LIST})
85 target_compile_definitions(ascendc_ut_simt_api_${product_type} PRIVATE85 target_compile_definitions(ascendc_ut_simt_api_${product_type} PRIVATE
86 $<$<STREQUAL:${product_type},ascend950pr_9599>:__NPU_ARCH__=3510;__DAV_C310__;__DAV_C310_VEC__>86 $<$<STREQUAL:${product_type},ascend950pr_9599>:__NPU_ARCH__=3510;__DAV_C310__;__DAV_C310_VEC__>
87 $<$<STREQUAL:${product_type},mc62cm12aa>:__NPU_ARCH__=5102>87 $<$<STREQUAL:${product_type},mc62cm12aa>:__NPU_ARCH__=5102>
88+ __callee__=
88 )89 )
89 90 
90 target_link_libraries(ascendc_ut_simt_api_${product_type} PRIVATE91 target_link_libraries(ascendc_ut_simt_api_${product_type} PRIVATE
@@ -124,6 +125,7 @@ foreach(product_type ${SIMT_PRODUCT_TYPE_LIST})
124 __NPU_ARCH__=3510125 __NPU_ARCH__=3510
125 __DAV_C310__126 __DAV_C310__
126 __DAV_C310_VEC__127 __DAV_C310_VEC__
128+ __callee__=
127 )129 )
128 130 
129 if("${target_name}" MATCHES "_ftz_true_")131 if("${target_name}" MATCHES "_ftz_true_")
@@ -23,10 +23,14 @@ set(ASCENDC_UT_HEADER
23 ${CMAKE_CURRENT_LIST_DIR}/..23 ${CMAKE_CURRENT_LIST_DIR}/..
24 ${ASCENDC_DIR}/24 ${ASCENDC_DIR}/
25 ${ASCENDC_DIR}/include25 ${ASCENDC_DIR}/include
26+ ${ASCENDC_DIR}/include/basic_api
26 ${ASCENDC_DIR}/include/c_api27 ${ASCENDC_DIR}/include/c_api
28+ ${ASCENDC_DIR}/include/simt_api
27 ${ASCENDC_DIR}/include/utils29 ${ASCENDC_DIR}/include/utils
28 ${ASCENDC_DIR}/impl30 ${ASCENDC_DIR}/impl
31+ ${ASCENDC_DIR}/impl/basic_api
29 ${ASCENDC_DIR}/impl/c_api32 ${ASCENDC_DIR}/impl/c_api
33+ ${ASCENDC_DIR}/impl/simt_api
30)34)
31 35 
32file(GLOB CONFIGURE_DEPENDS ASCENDC_UT_COMMON_SRC36file(GLOB CONFIGURE_DEPENDS ASCENDC_UT_COMMON_SRC
@@ -65,6 +69,7 @@ foreach(product_type ${ASCENDC_UT_PRODUCT_TYPE_LIST})
65 $<$<STREQUAL:${product_type},NPU_ARCH_3510_AIC>:__NPU_ARCH__=3510>69 $<$<STREQUAL:${product_type},NPU_ARCH_3510_AIC>:__NPU_ARCH__=3510>
66 $<$<STREQUAL:${product_type},NPU_ARCH_3510_AIV>:__NPU_ARCH__=3510>70 $<$<STREQUAL:${product_type},NPU_ARCH_3510_AIV>:__NPU_ARCH__=3510>
67 __disable_kernel_type_autoinfer__=71 __disable_kernel_type_autoinfer__=
72+ __callee__=
68 )73 )
69 74 
70 target_include_directories(ascendc_ut_tensor_api_${product_type} PRIVATE75 target_include_directories(ascendc_ut_tensor_api_${product_type} PRIVATE
@@ -51,6 +51,7 @@ foreach(product_type ${ASCENDC_UT_PRODUCT_TYPE_LIST})
51 $<$<STREQUAL:${product_type},ascend910B1>:__NPU_ARCH__=2201>51 $<$<STREQUAL:${product_type},ascend910B1>:__NPU_ARCH__=2201>
52 $<$<STREQUAL:${product_type},ascend950pr_9599>:__NPU_ARCH__=3510>52 $<$<STREQUAL:${product_type},ascend950pr_9599>:__NPU_ARCH__=3510>
53 __disable_kernel_type_autoinfer__=53 __disable_kernel_type_autoinfer__=
54+ __callee__=
54 )55 )
55 56 
56 target_compile_options(ascendc_ut_std_api_${product_type} PRIVATE57 target_compile_options(ascendc_ut_std_api_${product_type} PRIVATE