88 echo " [build_aclnn] $* "
99}
1010
11+ setup_catlass_dependency () {
12+ local catlass_path=" ${ROOT_DIR} /csrc/third_party/catlass/include"
13+ local catlass_commit
14+ local absolute_catlass_path
15+
16+ git config --global --add safe.directory " $ROOT_DIR "
17+ catlass_commit=$( git config -f " ${ROOT_DIR} /.gitmodules" --get submodule.csrc/third_party/catlass.commit)
18+ if [[ ! -d " ${catlass_path} " ]]; then
19+ echo " dependency catlass is missing, try to fetch it..."
20+ git submodule sync
21+ if ! git submodule update --init --recursive; then
22+ log " fetch failed"
23+ exit 1
24+ fi
25+ cd " ${ROOT_DIR} /csrc/third_party/catlass" || exit 1
26+ git fetch origin
27+ git checkout " ${catlass_commit} " || exit 1
28+ cd - || exit 1
29+ fi
30+ absolute_catlass_path=$( cd " ${catlass_path} " && pwd)
31+ export CPATH=" ${absolute_catlass_path}${CPATH: +: ${CPATH} } "
32+ log " catlass include=${absolute_catlass_path} "
33+ }
34+
1135resolve_op_dir () {
1236 local op_name=$1
1337 local candidate_dir
@@ -54,6 +78,9 @@ log "env: ASCEND_HOME_PATH=${ASCEND_HOME_PATH:-<unset>} ASCEND_TOOLKIT_HOME=${AS
5478if [[ " $SOC_VERSION " =~ ^ascend310 ]]; then
5579 log " matched SOC branch: ascend310"
5680 # ASCEND310P series
81+ # dependency: catlass
82+ setup_catlass_dependency
83+
5784 CUSTOM_OPS_ARRAY=(
5885 " causal_conv1d_v310"
5986 " recurrent_gated_delta_rule_v310"
@@ -66,24 +93,7 @@ elif [[ "$SOC_VERSION" =~ ^ascend910b ]]; then
6693 log " matched SOC branch: ascend910b"
6794 # ASCEND910B (A2) series
6895 # dependency: catlass
69- git config --global --add safe.directory " $ROOT_DIR "
70- CATLASS_PATH=${ROOT_DIR} /csrc/third_party/catlass/include
71- CATLASS_COMMIT=$( git config -f " ${ROOT_DIR} /.gitmodules" --get submodule.csrc/third_party/catlass.commit)
72- if [[ ! -d " ${CATLASS_PATH} " ]]; then
73- echo " dependency catlass is missing, try to fetch it..."
74- git submodule sync
75- if ! git submodule update --init --recursive; then
76- echo " fetch failed"
77- exit 1
78- fi
79- cd " ${ROOT_DIR} /csrc/third_party/catlass" || exit 1
80- git fetch origin
81- git checkout " ${CATLASS_COMMIT} " || exit 1
82- cd - || exit 1
83- fi
84- ABSOLUTE_CATLASS_PATH=$( cd " ${CATLASS_PATH} " && pwd)
85- export CPATH=" ${ABSOLUTE_CATLASS_PATH}${CPATH: +: ${CPATH} } "
86- log " catlass include=${ABSOLUTE_CATLASS_PATH} "
96+ setup_catlass_dependency
8797
8898 CUSTOM_OPS_ARRAY=(
8999 " scatter_nd_update_v2"
@@ -131,21 +141,8 @@ elif [[ "$SOC_VERSION" =~ ^ascend910_93 ]]; then
131141 log " matched SOC branch: ascend910_93"
132142 # ASCEND910C (A3) series
133143 # dependency: catlass
134- git config --global --add safe.directory " $ROOT_DIR "
135- CATLASS_PATH=${ROOT_DIR} /csrc/third_party/catlass/include
136- CATLASS_COMMIT=$( git config -f " ${ROOT_DIR} /.gitmodules" --get submodule.csrc/third_party/catlass.commit)
137- if [[ ! -d " ${CATLASS_PATH} " ]]; then
138- echo " dependency catlass is missing, try to fetch it..."
139- git submodule sync
140- if ! git submodule update --init --recursive; then
141- echo " fetch failed"
142- exit 1
143- fi
144- cd " ${ROOT_DIR} /csrc/third_party/catlass" || exit 1
145- git fetch origin
146- git checkout " ${CATLASS_COMMIT} " || exit 1
147- cd - || exit 1
148- fi
144+ setup_catlass_dependency
145+
149146 CUSTOM_OPS_ARRAY=(
150147 " scatter_nd_update_v2"
151148 " grouped_matmul_swiglu_quant_weight_nz_tensor_list"
@@ -194,24 +191,7 @@ elif [[ "$SOC_VERSION" =~ ^ascend950 ]]; then
194191 log " matched SOC branch: ascend950"
195192 # ASCEND950 (A5) series
196193 # dependency: catlass
197- git config --global --add safe.directory " $ROOT_DIR "
198- CATLASS_PATH=${ROOT_DIR} /csrc/third_party/catlass/include
199- CATLASS_COMMIT=$( git config -f " ${ROOT_DIR} /.gitmodules" --get submodule.csrc/third_party/catlass.commit)
200- if [[ ! -d " ${CATLASS_PATH} " ]]; then
201- echo " dependency catlass is missing, try to fetch it..."
202- git submodule sync
203- if ! git submodule update --init --recursive; then
204- echo " fetch failed"
205- exit 1
206- fi
207- cd " ${ROOT_DIR} /csrc/third_party/catlass" || exit 1
208- git fetch origin
209- git checkout " ${CATLASS_COMMIT} " || exit 1
210- cd - || exit 1
211- fi
212- ABSOLUTE_CATLASS_PATH=$( cd " ${CATLASS_PATH} " && pwd)
213- export CPATH=" ${ABSOLUTE_CATLASS_PATH}${CPATH: +: ${CPATH} } "
214- log " catlass include=${ABSOLUTE_CATLASS_PATH} "
194+ setup_catlass_dependency
215195
216196 CUSTOM_OPS_ARRAY=(
217197 " moe_gating_top_k_hash"
0 commit comments