Open
9201接口适配 #7445
9201接口适配 #7445
Open
treefeiAdd on 11 days ago
Total: 54 files changed+2253-252
@@ -0,0 +1,72 @@
1+/**
2+ * Copyright (c) 2026 Huawei Technologies Co., Ltd.
3+ * This program is free software, you can redistribute it and/or modify it under the terms and conditions of
4+ * CANN Open Software License Agreement Version 2.0 (the "License").
5+ * Please refer to the License for details. You may not use this file except in compliance with the License.
6+ * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
7+ * INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
8+ * See LICENSE in the root of the software repository for the full text of the License.
9+ */
10+ 
11+#ifndef CAST_DATA_UTILS_H
12+#define CAST_DATA_UTILS_H
13+ 
14+#include <fcntl.h>
15+#include <sys/stat.h>
16+#include <unistd.h>
17+#include <fstream>
18+ 
19+#define ERROR_LOG(fmt, args...) fprintf(stdout, "[ERROR] " fmt "\n", ##args)
20+ 
21+bool read_file(const std::string& file_path, size_t& file_size, void* buffer, size_t buffer_size)
22+{
23+ struct stat stat_buffer;
24+ if (stat(file_path.data(), &stat_buffer) == -1) {
25+ ERROR_LOG("failed to get file");
26+ return false;
27+ }
28+ if (S_ISREG(stat_buffer.st_mode) == 0) {
29+ ERROR_LOG("%s is not a file, please enter a file", file_path.c_str());
30+ return false;
31+ }
32+ 
33+ std::ifstream file(file_path, std::ios::binary);
34+ if (!file.is_open()) {
35+ ERROR_LOG("Open file failed. path = %s", file_path.c_str());
36+ return false;
37+ }
38+ 
39+ std::filebuf* buf = file.rdbuf();
40+ size_t size = buf->pubseekoff(0, std::ios::end, std::ios::in);
41+ if (size == 0 || size > buffer_size) {
42+ ERROR_LOG("invalid file size");
43+ return false;
44+ }
45+ buf->pubseekpos(0, std::ios::in);
46+ buf->sgetn(static_cast<char*>(buffer), size);
47+ file_size = size;
48+ return true;
49+}
50+ 
51+bool write_file(const std::string& file_path, const void* buffer, size_t size)
52+{
53+ if (buffer == nullptr) {
54+ ERROR_LOG("Write file failed. buffer is nullptr");
55+ return false;
56+ }
57+ 
58+ int fd = open(file_path.c_str(), O_RDWR | O_CREAT | O_TRUNC, S_IRUSR | S_IWRITE);
59+ if (fd < 0) {
60+ ERROR_LOG("Open file failed. path = %s", file_path.c_str());
61+ return false;
62+ }
63+ size_t write_size = write(fd, buffer, size);
64+ (void)close(fd);
65+ if (write_size != size) {
66+ ERROR_LOG("Write file failed.");
67+ return false;
68+ }
69+ return true;
70+}
71+ 
72+#endif // CAST_DATA_UTILS_H
@@ -124,16 +124,6 @@ template <typename T>
124inline constexpr bool supports_xor_v =124inline constexpr bool supports_xor_v =
125 ::AscendC::Std::is_one_of_v<T, bool, int8_t, uint8_t, int16_t, uint16_t, int32_t, uint32_t>;125 ::AscendC::Std::is_one_of_v<T, bool, int8_t, uint8_t, int16_t, uint16_t, int32_t, uint32_t>;
126 126 
127-template <typename T>
128-inline constexpr bool supports_shift_v =
129- ::AscendC::Std::is_one_of_v<T, int8_t, uint8_t, int16_t, uint16_t, int32_t, uint32_t>;
130- 
131-template <typename T, typename ShiftType>
132-inline constexpr bool supports_shift_pair_v =
133- (::AscendC::Std::is_one_of_v<T, int8_t, uint8_t> && ::AscendC::Std::is_same_v<ShiftType, int8_t>) ||
134- (::AscendC::Std::is_one_of_v<T, int16_t, uint16_t> && ::AscendC::Std::is_same_v<ShiftType, int16_t>) ||
135- (::AscendC::Std::is_one_of_v<T, int32_t, uint32_t> && ::AscendC::Std::is_same_v<ShiftType, int32_t>);
136- 
137template <typename T>127template <typename T>
138inline constexpr bool supports_axpy_v = ::AscendC::Std::is_one_of_v<T, half, float>;128inline constexpr bool supports_axpy_v = ::AscendC::Std::is_one_of_v<T, half, float>;
139 129 
Mimpl/tensor_api/experimental/arch/vector/basic_arithmetic_impl.h+15-9File content is under review, please try again later
Mimpl/tensor_api/experimental/arch/vector/logical_compute_impl.h+81-16File content is under review, please try again later
Aimpl/tensor_api/experimental/arch/vector/npu_arch_9201/composite_compute_impl.h+66-0File content is under review, please try again later
Aimpl/tensor_api/experimental/arch/vector/npu_arch_9201/data_reorder_impl.h+53-0File content is under review, please try again later
Aimpl/tensor_api/experimental/arch/vector/npu_arch_9201/mask_reg_compute_impl.h+66-0File content is under review, please try again later
Aimpl/tensor_api/experimental/arch/vector/npu_arch_9201/reduction_compute_impl.h+133-0File content is under review, please try again later
Aimpl/tensor_api/experimental/arch/vector/npu_arch_9201/reg_compute_sel_impl.h+53-0File content is under review, please try again later
@@ -54,6 +54,19 @@ struct pack_dst_type<int32_t> {
54 using type = uint16_t;54 using type = uint16_t;
55};55};
56 56 
57+#if defined(__NPU_ARCH__) && (__NPU_ARCH__ == 9201) && defined(ASC_DEVKIT_VERSION_NUM) && \
58+ (ASC_DEVKIT_VERSION_NUM >= 90300000)
59+template <>
60+struct pack_dst_type<uint64_t> {
61+ using type = uint32_t;
62+};
63+ 
64+template <>
65+struct pack_dst_type<int64_t> {
66+ using type = uint32_t;
67+};
68+#endif
69+ 
57template <typename T>70template <typename T>
58using pack_dst_t = typename pack_dst_type<T>::type;71using pack_dst_t = typename pack_dst_type<T>::type;
59 72 
@@ -152,8 +165,9 @@ __simd_callee__ inline decltype(auto) pack(reg_tensor<T> src)
152 part == high_low_part::low || part == high_low_part::high,165 part == high_low_part::low || part == high_low_part::high,
153 "pack only supports high_low_part::low and high_low_part::high");166 "pack only supports high_low_part::low and high_low_part::high");
154 static_assert(167 static_assert(
155- detail::is_pack_support_type_v<T>, "pack with reg_tensor<T> only supports "168+ detail::is_pack_support_type_v<T>,
156- "bool, uint16_t, int16_t, uint32_t and int32_t.");169+ "pack with reg_tensor<T> only supports bool, uint16_t, int16_t, uint32_t and int32_t; "
170+ "uint64_t and int64_t additionally require 9201 and devkit version 90300000 or later.");
157 171 
158 using dst_type = detail::pack_dst_t<T>;172 using dst_type = detail::pack_dst_t<T>;
159 reg_tensor<dst_type> dst;173 reg_tensor<dst_type> dst;
@@ -162,7 +176,7 @@ __simd_callee__ inline decltype(auto) pack(reg_tensor<T> src)
162 } else if constexpr (part == high_low_part::high) {176 } else if constexpr (part == high_low_part::high) {
163 asc_pack_to_high(dst.reg, src.reg);177 asc_pack_to_high(dst.reg, src.reg);
164 }178 }
165- dst.with_mask(all_mask<dst_type>());179+ dst.mask = all_mask<dst_type>().reg;
166 return dst;180 return dst;
167}181}
168 182 
@@ -183,7 +197,7 @@ __simd_callee__ inline decltype(auto) unpack(reg_tensor<T> src)
183 } else if constexpr (part == high_low_part::high) {197 } else if constexpr (part == high_low_part::high) {
184 asc_unpack_upper(dst.reg, src.reg);198 asc_unpack_upper(dst.reg, src.reg);
185 }199 }
186- dst.with_mask(all_mask<dst_type>());200+ dst.mask = all_mask<dst_type>().reg;
187 return dst;201 return dst;
188}202}
189 203 
@@ -211,7 +225,7 @@ __simd_callee__ inline reg_tensor<T> expand(reg_tensor<bool> mask)
211 225 
212 reg_tensor<T> dst;226 reg_tensor<T> dst;
213 asc_unsqueeze(dst.reg, mask.reg);227 asc_unsqueeze(dst.reg, mask.reg);
214- dst.with_mask(all_mask<T>());228+ dst.mask = all_mask<T>().reg;
215 return dst;229 return dst;
216}230}
217} // namespace experimental231} // namespace experimental
Mimpl/tensor_api/experimental/arch/vector/type_conversion_table.h+35-1File content is under review, please try again later
@@ -125,6 +125,17 @@ struct type_get<fp4x2_e1m2_t> {
125 using type = vector_fp4x2_e1m2_t;125 using type = vector_fp4x2_e1m2_t;
126};126};
127 127 
128+#if defined(__NPU_ARCH__) && (__NPU_ARCH__ == 9201) && (ASC_DEVKIT_VERSION_NUM >= 90300000)
129+template <>
130+struct type_get<fp8_e6m2_t> {
131+ using type = vector_fp8_e6m2_t;
132+};
133+ 
134+template <>
135+struct type_get<hifloat4x2_t> {
136+ using type = vector_hifloat4x2_t;
137+};
138+#endif
128} // namespace detail139} // namespace detail
129} // namespace experimental140} // namespace experimental
130} // namespace te141} // namespace te
Minclude/tensor_api/experimental/arch/vector/basic_arithmetic.h+34-34File content is under review, please try again later
@@ -26,7 +26,7 @@ namespace experimental {
26 * @brief Compares two register tensors for element-wise equality.26 * @brief Compares two register tensors for element-wise equality.
27 *27 *
28 * @override_id te_experimental_operator_eq__const_reg_tensor_T_R_const_reg_tensor_T_R__template_T28 * @override_id te_experimental_operator_eq__const_reg_tensor_T_R_const_reg_tensor_T_R__template_T
29- * @archs 351029+ * @archs 3510, 9201
30 * @return A boolean register tensor containing the equality results.30 * @return A boolean register tensor containing the equality results.
31 * @param [in] src0 First source tensor.31 * @param [in] src0 First source tensor.
32 * @param [in] src1 Second source tensor.32 * @param [in] src1 Second source tensor.
@@ -39,7 +39,7 @@ __simd_callee__ inline reg_tensor<bool> operator==(const reg_tensor<T>& src0, co
39 * @brief Compares register tensor elements with a scalar for equality.39 * @brief Compares register tensor elements with a scalar for equality.
40 *40 *
41 * @override_id te_experimental_operator_eq__const_reg_tensor_T_R_const_T_R__template_T41 * @override_id te_experimental_operator_eq__const_reg_tensor_T_R_const_T_R__template_T
42- * @archs 351042+ * @archs 3510, 9201
43 * @return A boolean register tensor containing the equality results.43 * @return A boolean register tensor containing the equality results.
44 * @param [in] src0 Source tensor.44 * @param [in] src0 Source tensor.
45 * @param [in] src1 Scalar value to compare with each tensor element.45 * @param [in] src1 Scalar value to compare with each tensor element.
@@ -52,7 +52,7 @@ __simd_callee__ inline reg_tensor<bool> operator==(const reg_tensor<T>& src0, co
52 * @brief Compares a scalar with register tensor elements for equality.52 * @brief Compares a scalar with register tensor elements for equality.
53 *53 *
54 * @override_id te_experimental_operator_eq__const_T_R_const_reg_tensor_T_R__template_T54 * @override_id te_experimental_operator_eq__const_T_R_const_reg_tensor_T_R__template_T
55- * @archs 351055+ * @archs 3510, 9201
56 * @return A boolean register tensor containing the equality results.56 * @return A boolean register tensor containing the equality results.
57 * @param [in] src0 Scalar value to compare with each tensor element.57 * @param [in] src0 Scalar value to compare with each tensor element.
58 * @param [in] src1 Source tensor.58 * @param [in] src1 Source tensor.
@@ -65,7 +65,7 @@ __simd_callee__ inline reg_tensor<bool> operator==(const T& src0, const reg_tens
65 * @brief Compares two register tensors for element-wise inequality.65 * @brief Compares two register tensors for element-wise inequality.
66 *66 *
67 * @override_id te_experimental_operator_ne__const_reg_tensor_T_R_const_reg_tensor_T_R__template_T67 * @override_id te_experimental_operator_ne__const_reg_tensor_T_R_const_reg_tensor_T_R__template_T
68- * @archs 351068+ * @archs 3510, 9201
69 * @return A boolean register tensor containing the inequality results.69 * @return A boolean register tensor containing the inequality results.
70 * @param [in] src0 First source tensor.70 * @param [in] src0 First source tensor.
71 * @param [in] src1 Second source tensor.71 * @param [in] src1 Second source tensor.
@@ -78,7 +78,7 @@ __simd_callee__ inline reg_tensor<bool> operator!=(const reg_tensor<T>& src0, co
78 * @brief Compares register tensor elements with a scalar for inequality.78 * @brief Compares register tensor elements with a scalar for inequality.
79 *79 *
80 * @override_id te_experimental_operator_ne__const_reg_tensor_T_R_const_T_R__template_T80 * @override_id te_experimental_operator_ne__const_reg_tensor_T_R_const_T_R__template_T
81- * @archs 351081+ * @archs 3510, 9201
82 * @return A boolean register tensor containing the inequality results.82 * @return A boolean register tensor containing the inequality results.
83 * @param [in] src0 Source tensor.83 * @param [in] src0 Source tensor.
84 * @param [in] src1 Scalar value to compare with each tensor element.84 * @param [in] src1 Scalar value to compare with each tensor element.
@@ -91,7 +91,7 @@ __simd_callee__ inline reg_tensor<bool> operator!=(const reg_tensor<T>& src0, co
91 * @brief Compares a scalar with register tensor elements for inequality.91 * @brief Compares a scalar with register tensor elements for inequality.
92 *92 *
93 * @override_id te_experimental_operator_ne__const_T_R_const_reg_tensor_T_R__template_T93 * @override_id te_experimental_operator_ne__const_T_R_const_reg_tensor_T_R__template_T
94- * @archs 351094+ * @archs 3510, 9201
95 * @return A boolean register tensor containing the inequality results.95 * @return A boolean register tensor containing the inequality results.
96 * @param [in] src0 Scalar value to compare with each tensor element.96 * @param [in] src0 Scalar value to compare with each tensor element.
97 * @param [in] src1 Source tensor.97 * @param [in] src1 Source tensor.
@@ -104,7 +104,7 @@ __simd_callee__ inline reg_tensor<bool> operator!=(const T& src0, const reg_tens
104 * @brief Compares whether elements in one register tensor are less than those in another.104 * @brief Compares whether elements in one register tensor are less than those in another.
105 *105 *
106 * @override_id te_experimental_operator_lt__const_reg_tensor_T_R_const_reg_tensor_T_R__template_T106 * @override_id te_experimental_operator_lt__const_reg_tensor_T_R_const_reg_tensor_T_R__template_T
107- * @archs 3510107+ * @archs 3510, 9201
108 * @return A boolean register tensor containing the less-than results.108 * @return A boolean register tensor containing the less-than results.
109 * @param [in] src0 First source tensor.109 * @param [in] src0 First source tensor.
110 * @param [in] src1 Second source tensor.110 * @param [in] src1 Second source tensor.
@@ -117,7 +117,7 @@ __simd_callee__ inline reg_tensor<bool> operator<(const reg_tensor<T>& src0, con
117 * @brief Compares whether register tensor elements are less than a scalar.117 * @brief Compares whether register tensor elements are less than a scalar.
118 *118 *
119 * @override_id te_experimental_operator_lt__const_reg_tensor_T_R_const_T_R__template_T119 * @override_id te_experimental_operator_lt__const_reg_tensor_T_R_const_T_R__template_T
120- * @archs 3510120+ * @archs 3510, 9201
121 * @return A boolean register tensor containing the less-than results.121 * @return A boolean register tensor containing the less-than results.
122 * @param [in] src0 Source tensor.122 * @param [in] src0 Source tensor.
123 * @param [in] src1 Scalar value to compare with each tensor element.123 * @param [in] src1 Scalar value to compare with each tensor element.
@@ -130,7 +130,7 @@ __simd_callee__ inline reg_tensor<bool> operator<(const reg_tensor<T>& src0, con
130 * @brief Compares whether a scalar is less than register tensor elements.130 * @brief Compares whether a scalar is less than register tensor elements.
131 *131 *
132 * @override_id te_experimental_operator_lt__const_T_R_const_reg_tensor_T_R__template_T132 * @override_id te_experimental_operator_lt__const_T_R_const_reg_tensor_T_R__template_T
133- * @archs 3510133+ * @archs 3510, 9201
134 * @return A boolean register tensor containing the less-than results.134 * @return A boolean register tensor containing the less-than results.
135 * @param [in] src0 Scalar value to compare with each tensor element.135 * @param [in] src0 Scalar value to compare with each tensor element.
136 * @param [in] src1 Source tensor.136 * @param [in] src1 Source tensor.
@@ -143,7 +143,7 @@ __simd_callee__ inline reg_tensor<bool> operator<(const T& src0, const reg_tenso
143 * @brief Compares whether elements in one register tensor are less than or equal to those in another.143 * @brief Compares whether elements in one register tensor are less than or equal to those in another.
144 *144 *
145 * @override_id te_experimental_operator_le__const_reg_tensor_T_R_const_reg_tensor_T_R__template_T145 * @override_id te_experimental_operator_le__const_reg_tensor_T_R_const_reg_tensor_T_R__template_T
146- * @archs 3510146+ * @archs 3510, 9201
147 * @return A boolean register tensor containing the less-than-or-equal results.147 * @return A boolean register tensor containing the less-than-or-equal results.
148 * @param [in] src0 First source tensor.148 * @param [in] src0 First source tensor.
149 * @param [in] src1 Second source tensor.149 * @param [in] src1 Second source tensor.
@@ -156,7 +156,7 @@ __simd_callee__ inline reg_tensor<bool> operator<=(const reg_tensor<T>& src0, co
156 * @brief Compares whether register tensor elements are less than or equal to a scalar.156 * @brief Compares whether register tensor elements are less than or equal to a scalar.
157 *157 *
158 * @override_id te_experimental_operator_le__const_reg_tensor_T_R_const_T_R__template_T158 * @override_id te_experimental_operator_le__const_reg_tensor_T_R_const_T_R__template_T
159- * @archs 3510159+ * @archs 3510, 9201
160 * @return A boolean register tensor containing the less-than-or-equal results.160 * @return A boolean register tensor containing the less-than-or-equal results.
161 * @param [in] src0 Source tensor.161 * @param [in] src0 Source tensor.
162 * @param [in] src1 Scalar value to compare with each tensor element.162 * @param [in] src1 Scalar value to compare with each tensor element.
@@ -169,7 +169,7 @@ __simd_callee__ inline reg_tensor<bool> operator<=(const reg_tensor<T>& src0, co
169 * @brief Compares whether a scalar is less than or equal to register tensor elements.169 * @brief Compares whether a scalar is less than or equal to register tensor elements.
170 *170 *
171 * @override_id te_experimental_operator_le__const_T_R_const_reg_tensor_T_R__template_T171 * @override_id te_experimental_operator_le__const_T_R_const_reg_tensor_T_R__template_T
172- * @archs 3510172+ * @archs 3510, 9201
173 * @return A boolean register tensor containing the less-than-or-equal results.173 * @return A boolean register tensor containing the less-than-or-equal results.
174 * @param [in] src0 Scalar value to compare with each tensor element.174 * @param [in] src0 Scalar value to compare with each tensor element.
175 * @param [in] src1 Source tensor.175 * @param [in] src1 Source tensor.
@@ -182,7 +182,7 @@ __simd_callee__ inline reg_tensor<bool> operator<=(const T& src0, const reg_tens
182 * @brief Compares whether elements in one register tensor are greater than those in another.182 * @brief Compares whether elements in one register tensor are greater than those in another.
183 *183 *
184 * @override_id te_experimental_operator_gt__const_reg_tensor_T_R_const_reg_tensor_T_R__template_T184 * @override_id te_experimental_operator_gt__const_reg_tensor_T_R_const_reg_tensor_T_R__template_T
185- * @archs 3510185+ * @archs 3510, 9201
186 * @return A boolean register tensor containing the greater-than results.186 * @return A boolean register tensor containing the greater-than results.
187 * @param [in] src0 First source tensor.187 * @param [in] src0 First source tensor.
188 * @param [in] src1 Second source tensor.188 * @param [in] src1 Second source tensor.
@@ -195,7 +195,7 @@ __simd_callee__ inline reg_tensor<bool> operator>(const reg_tensor<T>& src0, con
195 * @brief Compares whether register tensor elements are greater than a scalar.195 * @brief Compares whether register tensor elements are greater than a scalar.
196 *196 *
197 * @override_id te_experimental_operator_gt__const_reg_tensor_T_R_const_T_R__template_T197 * @override_id te_experimental_operator_gt__const_reg_tensor_T_R_const_T_R__template_T
198- * @archs 3510198+ * @archs 3510, 9201
199 * @return A boolean register tensor containing the greater-than results.199 * @return A boolean register tensor containing the greater-than results.
200 * @param [in] src0 Source tensor.200 * @param [in] src0 Source tensor.
201 * @param [in] src1 Scalar value to compare with each tensor element.201 * @param [in] src1 Scalar value to compare with each tensor element.
@@ -208,7 +208,7 @@ __simd_callee__ inline reg_tensor<bool> operator>(const reg_tensor<T>& src0, con
208 * @brief Compares whether a scalar is greater than register tensor elements.208 * @brief Compares whether a scalar is greater than register tensor elements.
209 *209 *
210 * @override_id te_experimental_operator_gt__const_T_R_const_reg_tensor_T_R__template_T210 * @override_id te_experimental_operator_gt__const_T_R_const_reg_tensor_T_R__template_T
211- * @archs 3510211+ * @archs 3510, 9201
212 * @return A boolean register tensor containing the greater-than results.212 * @return A boolean register tensor containing the greater-than results.
213 * @param [in] src0 Scalar value to compare with each tensor element.213 * @param [in] src0 Scalar value to compare with each tensor element.
214 * @param [in] src1 Source tensor.214 * @param [in] src1 Source tensor.
@@ -221,7 +221,7 @@ __simd_callee__ inline reg_tensor<bool> operator>(const T& src0, const reg_tenso
221 * @brief Compares whether elements in one register tensor are greater than or equal to those in another.221 * @brief Compares whether elements in one register tensor are greater than or equal to those in another.
222 *222 *
223 * @override_id te_experimental_operator_ge__const_reg_tensor_T_R_const_reg_tensor_T_R__template_T223 * @override_id te_experimental_operator_ge__const_reg_tensor_T_R_const_reg_tensor_T_R__template_T
224- * @archs 3510224+ * @archs 3510, 9201
225 * @return A boolean register tensor containing the greater-than-or-equal results.225 * @return A boolean register tensor containing the greater-than-or-equal results.
226 * @param [in] src0 First source tensor.226 * @param [in] src0 First source tensor.
227 * @param [in] src1 Second source tensor.227 * @param [in] src1 Second source tensor.
@@ -234,7 +234,7 @@ __simd_callee__ inline reg_tensor<bool> operator>=(const reg_tensor<T>& src0, co
234 * @brief Compares whether register tensor elements are greater than or equal to a scalar.234 * @brief Compares whether register tensor elements are greater than or equal to a scalar.
235 *235 *
236 * @override_id te_experimental_operator_ge__const_reg_tensor_T_R_const_T_R__template_T236 * @override_id te_experimental_operator_ge__const_reg_tensor_T_R_const_T_R__template_T
237- * @archs 3510237+ * @archs 3510, 9201
238 * @return A boolean register tensor containing the greater-than-or-equal results.238 * @return A boolean register tensor containing the greater-than-or-equal results.
239 * @param [in] src0 Source tensor.239 * @param [in] src0 Source tensor.
240 * @param [in] src1 Scalar value to compare with each tensor element.240 * @param [in] src1 Scalar value to compare with each tensor element.
@@ -247,7 +247,7 @@ __simd_callee__ inline reg_tensor<bool> operator>=(const reg_tensor<T>& src0, co
247 * @brief Compares whether a scalar is greater than or equal to register tensor elements.247 * @brief Compares whether a scalar is greater than or equal to register tensor elements.
248 *248 *
249 * @override_id te_experimental_operator_ge__const_T_R_const_reg_tensor_T_R__template_T249 * @override_id te_experimental_operator_ge__const_T_R_const_reg_tensor_T_R__template_T
250- * @archs 3510250+ * @archs 3510, 9201
251 * @return A boolean register tensor containing the greater-than-or-equal results.251 * @return A boolean register tensor containing the greater-than-or-equal results.
252 * @param [in] src0 Scalar value to compare with each tensor element.252 * @param [in] src0 Scalar value to compare with each tensor element.
253 * @param [in] src1 Source tensor.253 * @param [in] src1 Source tensor.
@@ -260,13 +260,14 @@ __simd_callee__ inline reg_tensor<bool> operator>=(const T& src0, const reg_tens
260 * @brief Selects elements from two register tensors according to a condition tensor.260 * @brief Selects elements from two register tensors according to a condition tensor.
261 *261 *
262 * @override_id te_experimental_select__const_reg_tensor_bool_R_const_reg_tensor_T_R_const_reg_tensor_T_R__template_T262 * @override_id te_experimental_select__const_reg_tensor_bool_R_const_reg_tensor_T_R_const_reg_tensor_T_R__template_T
263- * @archs 3510263+ * @archs 3510, 9201
264 * @return A register tensor containing the selected elements.264 * @return A register tensor containing the selected elements.
265 * @param [in] condition Per-element selection condition.265 * @param [in] condition Per-element selection condition.
266 * @param [in] src0 Source tensor selected when the corresponding condition is true.266 * @param [in] src0 Source tensor selected when the corresponding condition is true.
267 * @param [in] src1 Source tensor selected when the corresponding condition is false.267 * @param [in] src1 Source tensor selected when the corresponding condition is false.
268 * @note A condition value of 1 selects the corresponding element from src0; a value of 0 selects it from src1. This268 * @note A condition value of 1 selects the corresponding element from src0; a value of 0 selects it from src1. This
269 * condition does not zero unselected elements. The result preserves src0.mask.269 * condition does not zero unselected elements. The result preserves src0.mask.
270+ * @note Selection uses condition.reg; condition.mask and src1.mask do not select participating lanes.
270 */271 */
271template <typename T>272template <typename T>
272__simd_callee__ inline reg_tensor<T> select(273__simd_callee__ inline reg_tensor<T> select(
@@ -275,7 +276,7 @@ __simd_callee__ inline reg_tensor<T> select(
275} // namespace te276} // namespace te
276} // namespace asc277} // namespace asc
277 278 
278-#if defined(__NPU_ARCH__) && (__NPU_ARCH__ == 3510)279+#if defined(__NPU_ARCH__) && ((__NPU_ARCH__ == 3510) || (__NPU_ARCH__ == 9201))
279#include "impl/tensor_api/experimental/arch/vector/compare_and_select_impl.h"280#include "impl/tensor_api/experimental/arch/vector/compare_and_select_impl.h"
280#endif281#endif
281 282 
Minclude/tensor_api/experimental/arch/vector/composite_compute.h+67-10File content is under review, please try again later
Minclude/tensor_api/experimental/arch/vector/data_padding.h+12-7File content is under review, please try again later
Minclude/tensor_api/experimental/arch/vector/data_reorder.h+25-3File content is under review, please try again later
@@ -31,10 +31,16 @@ namespace experimental {
31 *31 *
32 * @override_id32 * @override_id
33 * te_experimental_gather__const_reg_tensor_DataType_R_const_reg_tensor_IndexType_R__template_DataType_IndexType33 * te_experimental_gather__const_reg_tensor_DataType_R_const_reg_tensor_IndexType_R__template_DataType_IndexType
34- * @archs 351034+ * @archs 3510, 9201
35- * @tparam DataType Element type of the source and result register tensors.35+ * @tparam DataType Element type of the source and result register tensors. Supported types are int8_t, uint8_t,
36- * @tparam IndexType Element type of the index register tensor.36+ * fp8_e4m3fn_t, hifloat8_t, fp8_e5m2_t, fp8_e8m0_t, int16_t, uint16_t, half, bfloat16_t, int32_t, uint32_t, and float.
37+ * @tparam IndexType Unsigned integer type with the same element width as DataType: uint8_t, uint16_t, or uint32_t.
37 * @return A register tensor containing the gathered data with an all-active result mask.38 * @return A register tensor containing the gathered data with an all-active result mask.
39+ * @note Indexes are element positions, not byte offsets. Each result lane is src.reg[index.reg[i] % VL_T], where
40+ * VL_T is the number of DataType elements in one vector register.
41+ * @note Neither src.mask nor index.mask selects participating lanes. All index lanes and all referenced source
42+ * elements must be initialized. Bind a new result mask before consuming only part of the result.
43+ * @note This operation is effective only on AIV.
38 * @param [in] src Source register tensor.44 * @param [in] src Source register tensor.
39 * @param [in] index Register tensor containing per-lane source indexes.45 * @param [in] index Register tensor containing per-lane source indexes.
40 */46 */
@@ -45,7 +51,7 @@ __simd_callee__ inline reg_tensor<DataType> gather(const reg_tensor<DataType>& s
45} // namespace te51} // namespace te
46} // namespace asc52} // namespace asc
47 53 
48-#if defined(__NPU_ARCH__) && (__NPU_ARCH__ == 3510)54+#if defined(__NPU_ARCH__) && ((__NPU_ARCH__ == 3510) || (__NPU_ARCH__ == 9201))
49#include "impl/tensor_api/experimental/arch/vector/reg_gather_impl.h"55#include "impl/tensor_api/experimental/arch/vector/reg_gather_impl.h"
50#endif56#endif
51 57 
Minclude/tensor_api/experimental/arch/vector/histogram_compute.h+1-1File content is under review, please try again later
Minclude/tensor_api/experimental/arch/vector/logical_compute.h+7-7File content is under review, please try again later
Minclude/tensor_api/experimental/arch/vector/mask_reg_compute.h+30-7File content is under review, please try again later
Minclude/tensor_api/experimental/arch/vector/reduction_compute.h+96-4File content is under review, please try again later
Minclude/tensor_api/experimental/arch/vector/reg_compute_sel.h+31-5File content is under review, please try again later
@@ -32,7 +32,7 @@ namespace experimental {
32 * @brief Extracts bits from a selected data block of a register tensor and expands them into a register mask.32 * @brief Extracts bits from a selected data block of a register tensor and expands them into a register mask.
33 *33 *
34 * @override_id te_experimental_move_mask__const_reg_tensor_T_R__template_Offset_T34 * @override_id te_experimental_move_mask__const_reg_tensor_T_R__template_Offset_T
35- * @archs 351035+ * @archs 3510, 9201
36 * @return A register mask containing the extracted and expanded bits.36 * @return A register mask containing the extracted and expanded bits.
37 * @note Offset selects the source data block. Its valid range is [0, 15] for uint16_t and [0, 31] for uint32_t.37 * @note Offset selects the source data block. Its valid range is [0, 15] for uint16_t and [0, 31] for uint32_t.
38 * @note T must be uint16_t or uint32_t.38 * @note T must be uint16_t or uint32_t.
@@ -46,7 +46,7 @@ __simd_callee__ inline reg_tensor<bool> move_mask(const reg_tensor<T>& src);
46 * @brief Copies active register elements selected by the source register tensor's mask in merging mode.46 * @brief Copies active register elements selected by the source register tensor's mask in merging mode.
47 *47 *
48 * @override_id te_experimental_move__reg_tensor_T_R_const_reg_tensor_T_R__template_T48 * @override_id te_experimental_move__reg_tensor_T_R_const_reg_tensor_T_R__template_T
49- * @archs 351049+ * @archs 3510, 9201
50 * @return The destination register tensor after the copy. Its mask remains unchanged.50 * @return The destination register tensor after the copy. Its mask remains unchanged.
51 * @note T must be one of uint8_t, int8_t, uint16_t, int16_t, half, bfloat16_t, uint32_t, int32_t, or float.51 * @note T must be one of uint8_t, int8_t, uint16_t, int16_t, half, bfloat16_t, uint32_t, int32_t, or float.
52 * @param [in,out] dst Destination register tensor. Inactive elements and its mask retain their original values.52 * @param [in,out] dst Destination register tensor. Inactive elements and its mask retain their original values.
@@ -60,7 +60,7 @@ __simd_callee__ inline reg_tensor<T> move(reg_tensor<T>& dst, const reg_tensor<T
60 * @brief Copies active bits selected by the source register tensor's mask in zeroing mode.60 * @brief Copies active bits selected by the source register tensor's mask in zeroing mode.
61 *61 *
62 * @override_id te_experimental_move__const_reg_tensor_bool_R62 * @override_id te_experimental_move__const_reg_tensor_bool_R
63- * @archs 351063+ * @archs 3510, 9201
64 * @return A register tensor containing the copied bits. Inactive bits are set to zero, and its mask is copied from64 * @return A register tensor containing the copied bits. Inactive bits are set to zero, and its mask is copied from
65 * src.mask.65 * src.mask.
66 * @param [in] src Source register tensor. Its mask selects the active bits to copy.66 * @param [in] src Source register tensor. Its mask selects the active bits to copy.
@@ -70,7 +70,7 @@ __simd_callee__ inline reg_tensor<bool> move(const reg_tensor<bool>& src);
70} // namespace te70} // namespace te
71} // namespace asc71} // namespace asc
72 72 
73-#if defined(__NPU_ARCH__) && (__NPU_ARCH__ == 3510)73+#if defined(__NPU_ARCH__) && ((__NPU_ARCH__ == 3510) || (__NPU_ARCH__ == 9201))
74#include "impl/tensor_api/experimental/arch/vector/reg_data_copy_impl.h"74#include "impl/tensor_api/experimental/arch/vector/reg_data_copy_impl.h"
75#endif75#endif
76 76 
Minclude/tensor_api/experimental/arch/vector/reg_data_load.h+7-7File content is under review, please try again later
Minclude/tensor_api/experimental/arch/vector/reg_data_store.h+7-7File content is under review, please try again later
@@ -33,7 +33,7 @@ namespace experimental {
33 * @brief Creates an arithmetic lane-index register from a scalar start value.33 * @brief Creates an arithmetic lane-index register from a scalar start value.
34 *34 *
35 * @override_id te_experimental_iota__const_T_R__template_order_T35 * @override_id te_experimental_iota__const_T_R__template_order_T
36- * @archs 351036+ * @archs 3510, 9201
37 * @tparam order Sequence order. increase generates ascending lane values; decrease generates descending lane values.37 * @tparam order Sequence order. increase generates ascending lane values; decrease generates descending lane values.
38 * @tparam T Type of the scalar start value and generated lane values.38 * @tparam T Type of the scalar start value and generated lane values.
39 * @return A register tensor containing the generated lane-index sequence with an all-active result mask.39 * @return A register tensor containing the generated lane-index sequence with an all-active result mask.
@@ -46,7 +46,7 @@ __simd_callee__ inline reg_tensor<Std::remove_cvref_t<T>> iota(const T& start);
46} // namespace te46} // namespace te
47} // namespace asc47} // namespace asc
48 48 
49-#if defined(__NPU_ARCH__) && (__NPU_ARCH__ == 3510)49+#if defined(__NPU_ARCH__) && ((__NPU_ARCH__ == 3510) || (__NPU_ARCH__ == 9201))
50#include "impl/tensor_api/experimental/arch/vector/reg_index_impl.h"50#include "impl/tensor_api/experimental/arch/vector/reg_index_impl.h"
51#endif51#endif
52 52 
@@ -30,7 +30,7 @@ namespace experimental {
30 * @brief Synchronizes UB accesses between two pipelines in a SIMD VF.30 * @brief Synchronizes UB accesses between two pipelines in a SIMD VF.
31 *31 *
32 * @override_id te_experimental_mem_bar__void__template_src_dst32 * @override_id te_experimental_mem_bar__void__template_src_dst
33- * @archs 351033+ * @archs 3510, 9201
34 * @tparam src Source pipeline whose preceding UB accesses must complete.34 * @tparam src Source pipeline whose preceding UB accesses must complete.
35 * @tparam dst Destination pipeline whose subsequent UB accesses wait for the source pipeline.35 * @tparam dst Destination pipeline whose subsequent UB accesses wait for the source pipeline.
36 * @note Only the source/destination combinations documented for this interface are supported. This interface does not36 * @note Only the source/destination combinations documented for this interface are supported. This interface does not
@@ -42,7 +42,7 @@ __simd_callee__ inline void mem_bar();
42} // namespace te42} // namespace te
43} // namespace asc43} // namespace asc
44 44 
45-#if defined(__NPU_ARCH__) && (__NPU_ARCH__ == 3510)45+#if defined(__NPU_ARCH__) && ((__NPU_ARCH__ == 3510) || (__NPU_ARCH__ == 9201))
46#include "impl/tensor_api/experimental/arch/vector/reg_sync_control_impl.h"46#include "impl/tensor_api/experimental/arch/vector/reg_sync_control_impl.h"
47#endif47#endif
48 48 
@@ -20,7 +20,7 @@
20#ifndef INCLUDE_TENSOR_API_EXPERIMENTAL_ARCH_VECTOR_REG_TENSOR_H20#ifndef INCLUDE_TENSOR_API_EXPERIMENTAL_ARCH_VECTOR_REG_TENSOR_H
21#define INCLUDE_TENSOR_API_EXPERIMENTAL_ARCH_VECTOR_REG_TENSOR_H21#define INCLUDE_TENSOR_API_EXPERIMENTAL_ARCH_VECTOR_REG_TENSOR_H
22 22 
23-#include "tensor_api/utils/utils.h"23+#include "tensor_api/tensor/tensor_interface.h"
24#include "impl/tensor_api/experimental/arch/vector/type_get.h"24#include "impl/tensor_api/experimental/arch/vector/type_get.h"
25 25 
26namespace asc {26namespace asc {
@@ -44,7 +44,7 @@ struct reg_tensor {
44 * @brief Default-constructs a register tensor.44 * @brief Default-constructs a register tensor.
45 *45 *
46 * @override_id te_experimental_reg_tensor_reg_tensor__void46 * @override_id te_experimental_reg_tensor_reg_tensor__void
47- * @archs 351047+ * @archs 3510, 9201
48 */48 */
49 __simd_callee__ reg_tensor() = default;49 __simd_callee__ reg_tensor() = default;
50 50 
@@ -53,7 +53,7 @@ struct reg_tensor {
53 * @brief Constructs a register tensor with the specified active-lane mask.53 * @brief Constructs a register tensor with the specified active-lane mask.
54 *54 *
55 * @override_id te_experimental_reg_tensor_reg_tensor__const_vector_bool_R55 * @override_id te_experimental_reg_tensor_reg_tensor__const_vector_bool_R
56- * @archs 351056+ * @archs 3510, 9201
57 * @param [in] maskValue Raw vector predicate used as the active-lane mask.57 * @param [in] maskValue Raw vector predicate used as the active-lane mask.
58 * @note A mask value of 1 enables the corresponding element; a value of 0 disables it. Setting the mask does not58 * @note A mask value of 1 enables the corresponding element; a value of 0 disables it. Setting the mask does not
59 * modify the underlying register data.59 * modify the underlying register data.
@@ -65,7 +65,7 @@ struct reg_tensor {
65 * @brief Sets the active-lane mask from a Boolean register tensor.65 * @brief Sets the active-lane mask from a Boolean register tensor.
66 *66 *
67 * @override_id te_experimental_reg_tensor_with_mask__const_reg_tensor_bool_R67 * @override_id te_experimental_reg_tensor_with_mask__const_reg_tensor_bool_R
68- * @archs 351068+ * @archs 3510, 9201
69 * @return A reference to this register tensor.69 * @return A reference to this register tensor.
70 * @param [in] maskReg Register tensor whose register value supplies the mask.70 * @param [in] maskReg Register tensor whose register value supplies the mask.
71 * @note A mask value of 1 enables the corresponding element; a value of 0 disables it. Setting the mask does not71 * @note A mask value of 1 enables the corresponding element; a value of 0 disables it. Setting the mask does not
@@ -116,7 +116,7 @@ struct reg_pair {
116} // namespace te116} // namespace te
117} // namespace asc117} // namespace asc
118 118 
119-#if defined(__NPU_ARCH__) && (__NPU_ARCH__ == 3510)119+#if defined(__NPU_ARCH__) && ((__NPU_ARCH__ == 3510) || (__NPU_ARCH__ == 9201))
120#include "impl/tensor_api/experimental/arch/vector/reg_tensor_impl.h"120#include "impl/tensor_api/experimental/arch/vector/reg_tensor_impl.h"
121#endif121#endif
122 122 
Minclude/tensor_api/experimental/arch/vector/type_conversion.h+4-3File content is under review, please try again later
Mscripts/presmoke/cases/01_simd_cpp_api/01_utilities/08_simulator/run.sh+1-1File content is under review, please try again later
Mscripts/presmoke/cases/03_simt_api/01_utilities/07_simulator/run.sh+1-1File content is under review, please try again later
Mscripts/presmoke/generate_case_runners.py+2-0File content is under review, please try again later
Mscripts/presmoke/reports/case_runner_manifest.json+162-75File content is under review, please try again later
Mtests/api/tensor_api/CMakeLists.txt+7-0File content is under review, please try again later
Mtests/api/tensor_api/ascendc_tensor_api_header_checker/CMakeLists.txt+11-1File content is under review, please try again later
Atests/api/tensor_api/ascendc_tensor_api_header_checker/tensor_api_reg_data_copy.cpp+62-0File content is under review, please try again later
Atests/api/tensor_api/ascendc_tensor_api_header_checker/tensor_api_reg_data_load.cpp+115-0File content is under review, please try again later
Atests/api/tensor_api/ascendc_tensor_api_header_checker/tensor_api_reg_data_reorder.cpp+77-0File content is under review, please try again later
Atests/api/tensor_api/ascendc_tensor_api_header_checker/tensor_api_reg_data_store.cpp+96-0File content is under review, please try again later
Atests/api/tensor_api/ascendc_tensor_api_header_checker/tensor_api_reg_index_compute.cpp+43-0File content is under review, please try again later
Atests/api/tensor_api/ascendc_tensor_api_header_checker/tensor_api_reg_tensor.cpp+53-0File content is under review, please try again later
Mtests/api/tensor_api/npu_arch_3510/aiv/test_tensor_api_logical_compute.cpp+48-0File content is under review, please try again later
Atests/api/tensor_api/npu_arch_9201/aiv/test_tensor_api_vector_compute.cpp+71-0File content is under review, please try again later
Mtests/api/tensor_api/stub/cce_stub.h+1-1File content is under review, please try again later