a new pass for remove cast operator when The third input of JaggedToPaddedDense max_length comes from cast
3 file(s) changed+251-0
Afusion_pass/cast_remove_pass/CMakeLists.txt+68-0
| @@ -0,0 +1,68 @@ | |||
| 1 | +# -*- coding: utf-8 -*- | ||
| 2 | +# Copyright (c) Huawei Technologies Co., Ltd. 2026. All rights reserved. | ||
| 3 | + | ||
| 4 | +# Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 5 | +# you may not use this file except in compliance with the License. | ||
| 6 | +# You may obtain a copy of the License at | ||
| 7 | + | ||
| 8 | +# http://www.apache.org/licenses/LICENSE-2.0 | ||
| 9 | + | ||
| 10 | +# Unless required by applicable law or agreed to in writing, software | ||
| 11 | +# distributed under the License is distributed on an "AS IS" BASIS, | ||
| 12 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 13 | +# See the License for the specific language governing permissions and | ||
| 14 | +# limitations under the License. | ||
| 15 | +# ============================================================================== | ||
| 16 | +cmake_minimum_required(VERSION 3.5.1) | ||
| 17 | +project(jagged_max_length_cast_remove_pass) | ||
| 18 | + | ||
| 19 | +set(CMAKE_SKIP_INSTALL_ALL_DEPENDENCY TRUE) | ||
| 20 | + | ||
| 21 | +if (DEFINED ENV{ASCEND_INSTALL_PATH}) | ||
| 22 | + set(ASCEND_PATH $ENV{ASCEND_INSTALL_PATH}) | ||
| 23 | +else () | ||
| 24 | + set(ASCEND_PATH /usr/local/Ascend/ascend-toolkit/latest) | ||
| 25 | +endif() | ||
| 26 | + | ||
| 27 | +aux_source_directory(${PROJECT_SOURCE_DIR}/src SRC_LIST) | ||
| 28 | + | ||
| 29 | +set(common_compile_options | ||
| 30 | + -std=c++11 | ||
| 31 | + -Wall | ||
| 32 | +) | ||
| 33 | + | ||
| 34 | +set(common_compile_definitions | ||
| 35 | + _GLIBCXX_USE_CXX11_ABI=0 | ||
| 36 | +) | ||
| 37 | + | ||
| 38 | +############ libjagged_max_length_cast_remove_pass.so ############ | ||
| 39 | +add_library(${PROJECT_NAME} SHARED ${SRC_LIST}) | ||
| 40 | + | ||
| 41 | +set_target_properties(${PROJECT_NAME} PROPERTIES output_name ${PROJECT_NAME}) | ||
| 42 | + | ||
| 43 | +target_compile_options(${PROJECT_NAME} PRIVATE | ||
| 44 | + ${common_compile_options} | ||
| 45 | +) | ||
| 46 | + | ||
| 47 | +target_compile_definitions(${PROJECT_NAME} PRIVATE | ||
| 48 | + ${common_compile_definitions} | ||
| 49 | +) | ||
| 50 | + | ||
| 51 | +target_include_directories(${PROJECT_NAME} PRIVATE | ||
| 52 | + ${ASCEND_PATH}/opp/built-in/op_proto/inc | ||
| 53 | + ${ASCEND_PATH}/include/graph | ||
| 54 | + ${ASCEND_PATH}/include/ge | ||
| 55 | + ${ASCEND_PATH}/include/register | ||
| 56 | + ${ASCEND_PATH}/include | ||
| 57 | +) | ||
| 58 | + | ||
| 59 | +target_link_directories(${PROJECT_NAME} PRIVATE | ||
| 60 | + ${ASCEND_PATH}/lib64 | ||
| 61 | +) | ||
| 62 | + | ||
| 63 | +target_link_libraries(${PROJECT_NAME} PRIVATE | ||
| 64 | + -Wl,--no-as-needed | ||
| 65 | + graph | ||
| 66 | + register | ||
| 67 | + -Wl,--as-needed | ||
| 68 | +) | ||
Afusion_pass/cast_remove_pass/README.md+36-0
Afusion_pass/cast_remove_pass/src/jagged_max_length_cast_remove_pass.cpp+147-0
Comments
Sign in to comment