已合并
【PR】: 【质量加固】修复完善readme一致性,主要包括tensorflow和superkernel #1734
loading-zzq创建于 8月14日
【PR】: 【质量加固】修复完善readme一致性,主要包括tensorflow和superkernel #1734
已合并
共 16 个文件变更+143-104
| @@ -26,22 +26,29 @@ Graph-autofusion 是一个面向昇腾(Ascend)芯片的轻量级、解耦式 | |||
| 26 | ## 🔍目录结构 | 26 | ## 🔍目录结构 |
| 27 | 27 | ||
| 28 | ```text | 28 | ```text |
| 29 | -├── autofuse # Autofuse 组件,Autofuse 源代码、测试、文档均在该子目录中 | 29 | +graph-autofusion/ |
| 30 | -├── build.sh # 一键式项目工程编译脚本 | 30 | +├── autofuse # Autofuse 组件,Autofuse 源代码、测试、文档均在该子目录中 |
| 31 | -├── cmake # 项目工程编译目录 | 31 | +├── build.sh # 一键式项目工程编译脚本 |
| 32 | -├── CMakeLists.txt # 项目 CMakeLists | 32 | +├── cmake # 项目工程编译目录 |
| 33 | -├── docs # 项目整体文档 | 33 | +├── CMakeLists.txt # 项目 CMakeLists |
| 34 | -│ ├── zh # 中文文档 | 34 | +├── docs # 项目整体文档 |
| 35 | -│ │ ├── build.md # 一键式构建脚本文档 | 35 | +│ ├── zh # 中文文档 |
| 36 | -│ │ └── ... # 其他中文文档 | 36 | +│ │ ├── build.md # 一键式构建脚本文档 |
| 37 | -│ ├── en # 英文文档 | 37 | +│ │ └── ... # 其他中文文档 |
| 38 | -│ │ ├── build.md # 一键式构建脚本文档 | 38 | +│ └── en # 英文文档 |
| 39 | -│ │ └── ... # 其他英文文档 | 39 | +│ ├── build.md # 一键式构建脚本文档 |
| 40 | -├── super_kernel # SuperKernel 组件,SuperKernel 源代码、测试、文档均在该子目录中 | 40 | +│ └── ... # 其他英文文档 |
| 41 | -├── ... # 未来规划的组件 | 41 | +├── scripts # 构建、环境安装和测试脚本 |
| 42 | -├── README.md # graph-autofusion项目整体功能介绍 | 42 | +│ ├── env_install # 环境安装脚本 |
| 43 | -├── scripts # 脚本路径 | 43 | +│ ├── package # 打包脚本 |
| 44 | - └── package | 44 | +│ ├── test # 测试脚本 |
| 45 | +│ ├── check_env.sh # 环境检查脚本 | ||
| 46 | +│ ├── init_env.sh # 环境初始化脚本 | ||
| 47 | +│ ├── oat_check.sh # OAT 合规性检查脚本 | ||
| 48 | +│ └── support_multiple_versions_of_lcov.sh # 多版本 lcov 兼容脚本 | ||
| 49 | +├── super_kernel # SuperKernel 组件,SuperKernel 源代码、测试、文档均在该子目录中 | ||
| 50 | +├── README.md # graph-autofusion 项目整体功能介绍 | ||
| 51 | +└── README_en.md # graph-autofusion 项目英文介绍 | ||
| 45 | ``` | 52 | ``` |
| 46 | 53 | ||
| 47 | ## 📝相关信息 | 54 | ## 📝相关信息 |
| @@ -49,4 +56,3 @@ Graph-autofusion 是一个面向昇腾(Ascend)芯片的轻量级、解耦式 | |||
| 49 | - [贡献指南](CONTRIBUTING.md) | 56 | - [贡献指南](CONTRIBUTING.md) |
| 50 | - [安全声明](SECURITY.md) | 57 | - [安全声明](SECURITY.md) |
| 51 | - [许可证](LICENSE) | 58 | - [许可证](LICENSE) |
| 52 | - | ||
| @@ -25,26 +25,33 @@ Component features: | |||
| 25 | ## 🔍Directory Structure | 25 | ## 🔍Directory Structure |
| 26 | 26 | ||
| 27 | ```text | 27 | ```text |
| 28 | -├── autofuse # Autofuse component. Autofuse source code, tests, and documentation are in this subdirectory. | 28 | +graph-autofusion/ |
| 29 | -├── build.sh # One-click project build script | 29 | +├── autofuse # Autofuse component. Autofuse source code, tests, and documentation are in this subdirectory. |
| 30 | -├── cmake # Project build directory | 30 | +├── build.sh # One-click project build script |
| 31 | -├── CMakeLists.txt # Project CMakeLists | 31 | +├── cmake # Project build directory |
| 32 | -├── docs # Project overall documentation | 32 | +├── CMakeLists.txt # Project CMakeLists |
| 33 | -│ ├── zh # Chinese documentation | 33 | +├── docs # Project documentation |
| 34 | -│ │ ├── build.md # One-click build script documentation | 34 | +│ ├── zh # Chinese documentation |
| 35 | -│ │ └── ... # Other Chinese documentation | 35 | +│ │ ├── build.md # One-click build script documentation |
| 36 | -│ ├── en # English documentation | 36 | +│ │ └── ... # Other Chinese documentation |
| 37 | -│ │ ├── build.md # One-click build script documentation | 37 | +│ └── en # English documentation |
| 38 | -│ │ └── ... # Other English documentation | 38 | +│ ├── build.md # One-click build script documentation |
| 39 | -├── super_kernel # SuperKernel component. SuperKernel source code, tests, and documentation are in this subdirectory. | 39 | +│ └── ... # Other English documentation |
| 40 | -├── ... # Planned future components | 40 | +├── scripts # Build, environment installation, and test scripts |
| 41 | -├── README.md # graph-autofusion project overall functionality introduction | 41 | +│ ├── env_install # Environment installation scripts |
| 42 | -├── scripts # Script path | 42 | +│ ├── package # Packaging scripts |
| 43 | - └── package | 43 | +│ ├── test # Test scripts |
| 44 | +│ ├── check_env.sh # Environment check script | ||
| 45 | +│ ├── init_env.sh # Environment initialization script | ||
| 46 | +│ ├── oat_check.sh # OAT compliance check script | ||
| 47 | +│ └── support_multiple_versions_of_lcov.sh # Multi-version lcov compatibility script | ||
| 48 | +├── super_kernel # SuperKernel component. SuperKernel source code, tests, and documentation are in this subdirectory. | ||
| 49 | +├── README.md # Chinese graph-autofusion project introduction | ||
| 50 | +└── README_en.md # English graph-autofusion project introduction | ||
| 44 | ``` | 51 | ``` |
| 45 | 52 | ||
| 46 | ## 📝Related Information | 53 | ## 📝Related Information |
| 47 | 54 | ||
| 48 | - [Contributing Guide](CONTRIBUTING_en.md) | 55 | - [Contributing Guide](CONTRIBUTING_en.md) |
| 49 | - [Security Statement](SECURITY_en.md) | 56 | - [Security Statement](SECURITY_en.md) |
| 50 | -- [License](LICENSE) | 57 | +- [License](LICENSE) |
| @@ -20,10 +20,13 @@ autofuse/ | |||
| 20 | ├── inc # 供 GE 调用接口 | 20 | ├── inc # 供 GE 调用接口 |
| 21 | ├── optimize # 调度切分 模块 | 21 | ├── optimize # 调度切分 模块 |
| 22 | ├── scripts # 脚本路径 | 22 | ├── scripts # 脚本路径 |
| 23 | +├── tests # 测试用例与测试框架 | ||
| 24 | +├── tools # 调试与分析工具 | ||
| 23 | ├── v35 # 昇腾950 芯片相关优化 | 25 | ├── v35 # 昇腾950 芯片相关优化 |
| 24 | ├── CMakeLists.txt # CMake 配置文件 | 26 | ├── CMakeLists.txt # CMake 配置文件 |
| 25 | ├── blacklist.txt # 工程配置文件 | 27 | ├── blacklist.txt # 工程配置文件 |
| 26 | -├── README.md | 28 | +├── README.md # 中文说明文档 |
| 29 | +└── README_en.md # 英文说明文档 | ||
| 27 | ``` | 30 | ``` |
| 28 | 31 | ||
| 29 | ## 构建与安装 | 32 | ## 构建与安装 |
| @@ -22,10 +22,13 @@ autofuse/ | |||
| 22 | ├── inc # Interfaces provided for GE | 22 | ├── inc # Interfaces provided for GE |
| 23 | ├── optimize # Scheduling and partitioning module | 23 | ├── optimize # Scheduling and partitioning module |
| 24 | ├── scripts # Script directory | 24 | ├── scripts # Script directory |
| 25 | +├── tests # Test cases and test framework | ||
| 26 | +├── tools # Debugging and analysis tools | ||
| 25 | ├── v35 # Ascend 950 chip-related optimizations | 27 | ├── v35 # Ascend 950 chip-related optimizations |
| 26 | ├── CMakeLists.txt # CMake configuration file | 28 | ├── CMakeLists.txt # CMake configuration file |
| 27 | ├── blacklist.txt # Project configuration file | 29 | ├── blacklist.txt # Project configuration file |
| 28 | -├── README.md | 30 | +├── README.md # Chinese documentation |
| 31 | +└── README_en.md # English documentation | ||
| 29 | ``` | 32 | ``` |
| 30 | 33 | ||
| 31 | ## Build and Installation | 34 | ## Build and Installation |
| @@ -12,7 +12,7 @@ | |||
| 12 | 12 | ||
| 13 | 注:当前暂不支持gather融合能力,等待[ issue175 ](https://gitcode.com/cann/graph-autofusion/issues/175)这个issue完成后gather可以和add进行融合。 | 13 | 注:当前暂不支持gather融合能力,等待[ issue175 ](https://gitcode.com/cann/graph-autofusion/issues/175)这个issue完成后gather可以和add进行融合。 |
| 14 | 14 | ||
| 15 | -三个用例均开启 NPU Profiling,可通过生成的性能分析文件查看融合后的 Kernel。 | 15 | +三个用例均开启 NPU Profiling,可通过生成的性能分析文件查看算子执行情况和融合结果。 |
| 16 | 16 | ||
| 17 | ## 目录结构 | 17 | ## 目录结构 |
| 18 | 18 | ||
| @@ -12,7 +12,7 @@ The following three examples are currently provided: | |||
| 12 | 12 | ||
| 13 | > **Note:** Gather fusion is not currently supported. After [issue175](https://gitcode.com/cann/graph-autofusion/issues/175) is resolved, `gather` will be able to fuse with `add`. | 13 | > **Note:** Gather fusion is not currently supported. After [issue175](https://gitcode.com/cann/graph-autofusion/issues/175) is resolved, `gather` will be able to fuse with `add`. |
| 14 | 14 | ||
| 15 | -NPU Profiling is enabled in all three examples. You can inspect the generated profiling data to view the fused kernels. | 15 | +NPU Profiling is enabled in all three examples. You can inspect the generated profiling data to review operator execution and fusion results. |
| 16 | 16 | ||
| 17 | ## Directory Structure | 17 | ## Directory Structure |
| 18 | 18 | ||
| @@ -19,6 +19,8 @@ | |||
| 19 | 19 | ||
| 20 | 运行本用例前,需依次完成以下步骤: | 20 | 运行本用例前,需依次完成以下步骤: |
| 21 | 21 | ||
| 22 | +> 以下命令均在 graph-autofusion 仓库根目录执行。 | ||
| 23 | + | ||
| 22 | 1. 通过 [安装指导](../../../docs/zh/quick_install.md) 正确安装 toolkit 和 ops 包,并配置环境变量 | 24 | 1. 通过 [安装指导](../../../docs/zh/quick_install.md) 正确安装 toolkit 和 ops 包,并配置环境变量 |
| 23 | 2. 通过 [环境编译部署](../../../docs/env_install/tensorflow/env_tf.md) 搭建 TensorFlow 环境(x86_64 可直接 pip 安装,aarch64 需源码编译) | 25 | 2. 通过 [环境编译部署](../../../docs/env_install/tensorflow/env_tf.md) 搭建 TensorFlow 环境(x86_64 可直接 pip 安装,aarch64 需源码编译) |
| 24 | 3. 也可使用一键配置脚本自动搭建环境(**仅 x86_64 架构可用**): | 26 | 3. 也可使用一键配置脚本自动搭建环境(**仅 x86_64 架构可用**): |
| @@ -30,9 +32,9 @@ | |||
| 30 | 脚本完成后激活环境: | 32 | 脚本完成后激活环境: |
| 31 | 33 | ||
| 32 | ```bash | 34 | ```bash |
| 33 | - source scripts/env_install/env/activate_tf1.sh # TF 1.15 | 35 | + source scripts/env_install/tensorflow/env/activate_tf1.sh # TF 1.15 |
| 34 | # 或 | 36 | # 或 |
| 35 | - source scripts/env_install/env/activate_tf2.sh # TF 2.6.5 | 37 | + source scripts/env_install/tensorflow/env/activate_tf2.sh # TF 2.6.5 |
| 36 | ``` | 38 | ``` |
| 37 | 39 | ||
| 38 | > **aarch64 架构不支持此脚本**:aarch64 请按 [aarch64 架构 TF 源码编译](../../../docs/env_install/tensorflow/build_tf_aarch64.md) 手动编译。 | 40 | > **aarch64 架构不支持此脚本**:aarch64 请按 [aarch64 架构 TF 源码编译](../../../docs/env_install/tensorflow/build_tf_aarch64.md) 手动编译。 |
| @@ -57,18 +59,16 @@ export AUTOFUSE_FLAGS="--enable_autofuse=true" | |||
| 57 | ## 执行用例 | 59 | ## 执行用例 |
| 58 | 60 | ||
| 59 | ```bash | 61 | ```bash |
| 60 | -cd af_tf_eleandele | ||
| 61 | - | ||
| 62 | # TF 1.15 环境 | 62 | # TF 1.15 环境 |
| 63 | -python3 test_abs_relu_exp.py --mode tf1 | 63 | +python3 autofuse/examples/tensorflow/af_tf_eleandele/test_abs_relu_exp.py --mode tf1 |
| 64 | 64 | ||
| 65 | # TF 2.6.5 环境(兼容模式) | 65 | # TF 2.6.5 环境(兼容模式) |
| 66 | -python3 test_abs_relu_exp.py --mode tf2-compat | 66 | +python3 autofuse/examples/tensorflow/af_tf_eleandele/test_abs_relu_exp.py --mode tf2-compat |
| 67 | ``` | 67 | ``` |
| 68 | 68 | ||
| 69 | ## 预期执行结果 | 69 | ## 预期执行结果 |
| 70 | 70 | ||
| 71 | -脚本执行 100 步推理,无报错即表示融合算子执行成功。可通过 Dump 图或 Profiling 进一步验证融合效果。 | 71 | +脚本执行 100 步推理,无报错表示用例执行成功;是否发生融合,需要通过 Dump 图或 Profiling 进一步确认。 |
| 72 | 72 | ||
| 73 | ## 参考 | 73 | ## 参考 |
| 74 | 74 | ||
| @@ -19,6 +19,8 @@ Use AutoFuse to perform operator fusion in TensorFlow networks. The AutoFuse fus | |||
| 19 | 19 | ||
| 20 | Before running this example, complete the following steps in sequence: | 20 | Before running this example, complete the following steps in sequence: |
| 21 | 21 | ||
| 22 | +> Run all the following commands from the graph-autofusion repository root. | ||
| 23 | + | ||
| 22 | 1. Follow the [Installation Guide](../../../docs/en/quick_install.md) to correctly install the Toolkit and Ops packages and configure the environment variables. | 24 | 1. Follow the [Installation Guide](../../../docs/en/quick_install.md) to correctly install the Toolkit and Ops packages and configure the environment variables. |
| 23 | 2. Follow [Environment Build and Deployment](../../../docs/env_install/tensorflow/env_tf.md) to set up the TensorFlow environment. On x86_64, TensorFlow can be installed directly using pip. On aarch64, TensorFlow must be built from source. | 25 | 2. Follow [Environment Build and Deployment](../../../docs/env_install/tensorflow/env_tf.md) to set up the TensorFlow environment. On x86_64, TensorFlow can be installed directly using pip. On aarch64, TensorFlow must be built from source. |
| 24 | 3. Alternatively, use the one-click configuration script to automatically set up the environment. This script is available only for the **x86_64 architecture**: | 26 | 3. Alternatively, use the one-click configuration script to automatically set up the environment. This script is available only for the **x86_64 architecture**: |
| @@ -30,9 +32,9 @@ Before running this example, complete the following steps in sequence: | |||
| 30 | After the script is complete, activate the environment: | 32 | After the script is complete, activate the environment: |
| 31 | 33 | ||
| 32 | ```bash | 34 | ```bash |
| 33 | - source scripts/env_install/env/activate_tf1.sh # TensorFlow 1.15 | 35 | + source scripts/env_install/tensorflow/env/activate_tf1.sh # TensorFlow 1.15 |
| 34 | # Or | 36 | # Or |
| 35 | - source scripts/env_install/env/activate_tf2.sh # TensorFlow 2.6.5 | 37 | + source scripts/env_install/tensorflow/env/activate_tf2.sh # TensorFlow 2.6.5 |
| 36 | ``` | 38 | ``` |
| 37 | 39 | ||
| 38 | > **This script does not support the aarch64 architecture.** On aarch64, follow [Building TensorFlow from Source on aarch64](../../../docs/env_install/tensorflow/build_tf_aarch64.md) to perform the build manually. | 40 | > **This script does not support the aarch64 architecture.** On aarch64, follow [Building TensorFlow from Source on aarch64](../../../docs/env_install/tensorflow/build_tf_aarch64.md) to perform the build manually. |
| @@ -59,18 +61,16 @@ export AUTOFUSE_FLAGS="--enable_autofuse=true" | |||
| 59 | ## Run the Example | 61 | ## Run the Example |
| 60 | 62 | ||
| 61 | ```bash | 63 | ```bash |
| 62 | -cd af_tf_eleandele | ||
| 63 | - | ||
| 64 | # TensorFlow 1.15 environment | 64 | # TensorFlow 1.15 environment |
| 65 | -python3 test_abs_relu_exp.py --mode tf1 | 65 | +python3 autofuse/examples/tensorflow/af_tf_eleandele/test_abs_relu_exp.py --mode tf1 |
| 66 | 66 | ||
| 67 | # TensorFlow 2.6.5 environment in compatibility mode | 67 | # TensorFlow 2.6.5 environment in compatibility mode |
| 68 | -python3 test_abs_relu_exp.py --mode tf2-compat | 68 | +python3 autofuse/examples/tensorflow/af_tf_eleandele/test_abs_relu_exp.py --mode tf2-compat |
| 69 | ``` | 69 | ``` |
| 70 | 70 | ||
| 71 | ## Expected Result | 71 | ## Expected Result |
| 72 | 72 | ||
| 73 | -The script performs 100 inference steps. If no error is reported, the fused operator has been executed successfully. You can further verify the fusion result using graph dump files or Profiling data. | 73 | +The script performs 100 inference steps. If no errors occur, the sample is considered to have run successfully. Whether operator fusion has occurred should be further verified using graph dumps or profiling data. |
| 74 | 74 | ||
| 75 | ## References | 75 | ## References |
| 76 | 76 | ||
| @@ -13,18 +13,20 @@ autofuse 融合 `abs + relu + exp` 三个 elementwise 算子。脚本通过 `--m | |||
| 13 | 13 | ||
| 14 | ## 执行命令 | 14 | ## 执行命令 |
| 15 | 15 | ||
| 16 | +以下命令均在 graph-autofusion 仓库根目录执行。 | ||
| 17 | + | ||
| 16 | ```bash | 18 | ```bash |
| 17 | # TF 1.15 环境 | 19 | # TF 1.15 环境 |
| 18 | -source scripts/env_install/env/activate_tf1.sh | 20 | +source scripts/env_install/tensorflow/env/activate_tf1.sh |
| 19 | -python3 test_abs_relu_exp.py --mode tf1 | 21 | +python3 autofuse/examples/tensorflow/af_tf_eleandele/test_abs_relu_exp.py --mode tf1 |
| 20 | 22 | ||
| 21 | # TF 2.6.5 环境(兼容模式) | 23 | # TF 2.6.5 环境(兼容模式) |
| 22 | -source scripts/env_install/env/activate_tf2.sh | 24 | +source scripts/env_install/tensorflow/env/activate_tf2.sh |
| 23 | -python3 test_abs_relu_exp.py --mode tf2-compat | 25 | +python3 autofuse/examples/tensorflow/af_tf_eleandele/test_abs_relu_exp.py --mode tf2-compat |
| 24 | ``` | 26 | ``` |
| 25 | 27 | ||
| 26 | ## 预期执行结果 | 28 | ## 预期执行结果 |
| 27 | 29 | ||
| 28 | 脚本构造 `abs → relu → exp` 计算图,在 NPU 上执行 100 步推理,无报错即表示融合成功。三个算子被融合为一个 `AscBackend` 类型的融合算子 `autofuse_pointwise_0_Abs_Relu_Exp`,在 NPU 上以单个 kernel 执行。 | 30 | 脚本构造 `abs → relu → exp` 计算图,在 NPU 上执行 100 步推理,无报错即表示融合成功。三个算子被融合为一个 `AscBackend` 类型的融合算子 `autofuse_pointwise_0_Abs_Relu_Exp`,在 NPU 上以单个 kernel 执行。 |
| 29 | 31 | ||
| 30 | -如需查看融合效果,可开启 profiling(脚本已内置 profiling 配置),执行完成后在 `./profiling` 目录下查看 `PROF_*/mindstudio_profiler_output/op_summary_*.csv`,此时仅有算子名为 `autofuse_pointwise_0_Abs_Relu_Exp` 的 kernel,表示三个算子已融合为一个融合算子。 | 32 | +如需查看融合效果,可开启 profiling(脚本已内置 profiling 配置),执行完成后在仓库根目录的 `./profiling` 目录下查看 `PROF_*/mindstudio_profiler_output/op_summary_*.csv`,此时 Profiling 中存在 autofuse_pointwise_0_Abs_Relu_Exp,且不再出现独立的 Abs、Relu、Exp Kernel,表示三个算子已融合为一个融合算子。 |
| @@ -11,18 +11,20 @@ AutoFuse fuses the three elementwise operators `abs + relu + exp`. The script us | |||
| 11 | 11 | ||
| 12 | ## Execution Commands | 12 | ## Execution Commands |
| 13 | 13 | ||
| 14 | +Run all the following commands from the graph-autofusion repository root. | ||
| 15 | + | ||
| 14 | ```bash | 16 | ```bash |
| 15 | # TensorFlow 1.15 environment | 17 | # TensorFlow 1.15 environment |
| 16 | -source scripts/env_install/env/activate_tf1.sh | 18 | +source scripts/env_install/tensorflow/env/activate_tf1.sh |
| 17 | -python3 test_abs_relu_exp.py --mode tf1 | 19 | +python3 autofuse/examples/tensorflow/af_tf_eleandele/test_abs_relu_exp.py --mode tf1 |
| 18 | 20 | ||
| 19 | # TensorFlow 2.6.5 environment (compatibility mode) | 21 | # TensorFlow 2.6.5 environment (compatibility mode) |
| 20 | -source scripts/env_install/env/activate_tf2.sh | 22 | +source scripts/env_install/tensorflow/env/activate_tf2.sh |
| 21 | -python3 test_abs_relu_exp.py --mode tf2-compat | 23 | +python3 autofuse/examples/tensorflow/af_tf_eleandele/test_abs_relu_exp.py --mode tf2-compat |
| 22 | ``` | 24 | ``` |
| 23 | 25 | ||
| 24 | ## Expected Result | 26 | ## Expected Result |
| 25 | 27 | ||
| 26 | The script constructs an `abs → relu → exp` computation graph and performs 100 inference steps on the NPU. If no error is reported, the fusion is successful. The three operators are fused into an `AscBackend`-type fused operator named `autofuse_pointwise_0_Abs_Relu_Exp`, which is executed as a single Kernel on the NPU. | 28 | The script constructs an `abs → relu → exp` computation graph and performs 100 inference steps on the NPU. If no error is reported, the fusion is successful. The three operators are fused into an `AscBackend`-type fused operator named `autofuse_pointwise_0_Abs_Relu_Exp`, which is executed as a single Kernel on the NPU. |
| 27 | 29 | ||
| 28 | -To view the fusion result, enable Profiling, which is already configured in the script. After execution is complete, check `PROF_*/mindstudio_profiler_output/op_summary_*.csv` in the `./profiling` directory. If the only Kernel is named `autofuse_pointwise_0_Abs_Relu_Exp`, the three operators have been fused into a single fused operator. | 30 | +To view the fusion result, enable profiling (the script already includes the profiling configuration). After execution, check `PROF_*/mindstudio_profiler_output/op_summary_*.csv` under the `./profiling` directory in the repository root. If `autofuse_pointwise_0_Abs_Relu_Exp` appears in the profiling data and the standalone `Abs`, `Relu`, and `Exp` kernels no longer appear, it indicates that the three operators have been fused into a single fused operator. |
| @@ -56,16 +56,23 @@ | |||
| 56 | super_kernel/ | 56 | super_kernel/ |
| 57 | ├── docs # 文档介绍 | 57 | ├── docs # 文档介绍 |
| 58 | ├── examples # 示例脚本或 Notebook,演示典型用法 | 58 | ├── examples # 示例脚本或 Notebook,演示典型用法 |
| 59 | +├── include # SuperKernel 对外头文件 | ||
| 60 | +├── kernel # 设备侧 Kernel 实现 | ||
| 59 | ├── scripts # 脚本路径 | 61 | ├── scripts # 脚本路径 |
| 60 | -├── src # 业务代码入口,后续根据功能划分模块 | 62 | +├── src # SuperKernel 业务代码 |
| 61 | -│ └── superkernel # SuperKernel 业务代码 | 63 | +│ ├── aot # AOT 编译与优化实现 |
| 64 | +│ └── jit # JIT 编译实现 | ||
| 62 | ├── tests # 测试工程目录 | 65 | ├── tests # 测试工程目录 |
| 66 | +│ ├── aot # AOT 测试 | ||
| 67 | +│ ├── fixtures # 共享测试数据与夹具 | ||
| 63 | │ ├── st # System Test | 68 | │ ├── st # System Test |
| 64 | │ ├── ut # Unit Test | 69 | │ ├── ut # Unit Test |
| 65 | -│ └── utils # 通用校验与工具函数 | 70 | +│ ├── utils # 通用校验与工具函数 |
| 71 | +│ └── conftest.py # pytest 公共配置 | ||
| 66 | ├── CMakeLists.txt # CMake 配置文件 | 72 | ├── CMakeLists.txt # CMake 配置文件 |
| 67 | ├── pyproject.toml # 项目元信息与打包配置 | 73 | ├── pyproject.toml # 项目元信息与打包配置 |
| 68 | -├── README.md | 74 | +├── README.md # 中文说明文档 |
| 75 | +├── README_en.md # 英文说明文档 | ||
| 69 | └── requirements-dev.txt # python 依赖配置文件 | 76 | └── requirements-dev.txt # python 依赖配置文件 |
| 70 | ``` | 77 | ``` |
| 71 | 78 | ||
| @@ -48,19 +48,26 @@ Additionally, SuperKernel supports memory semantics-based Notify and Wait events | |||
| 48 | 48 | ||
| 49 | ```text | 49 | ```text |
| 50 | super_kernel/ | 50 | super_kernel/ |
| 51 | -├── docs # documentation introduction | 51 | +├── docs # Documentation |
| 52 | -├── examples # example scripts or Notebooks demonstrating typical usage | 52 | +├── examples # Example scripts or notebooks demonstrating typical usage |
| 53 | -├── scripts # script path | 53 | +├── include # Public SuperKernel headers |
| 54 | -├── src # business code entry, modules divided by function | 54 | +├── kernel # Device-side kernel implementations |
| 55 | -│ └── superkernel # SuperKernel business code | 55 | +├── scripts # Scripts |
| 56 | -├── tests # test project directory | 56 | +├── src # SuperKernel source code |
| 57 | -│ ├── st # System Test | 57 | +│ ├── aot # AOT compilation and optimization implementation |
| 58 | -│ ├── ut # Unit Test | 58 | +│ └── jit # JIT compilation implementation |
| 59 | -│ └── utils # common validation and utility functions | 59 | +├── tests # Test project directory |
| 60 | +│ ├── aot # AOT tests | ||
| 61 | +│ ├── fixtures # Shared test data and fixtures | ||
| 62 | +│ ├── st # System tests | ||
| 63 | +│ ├── ut # Unit tests | ||
| 64 | +│ ├── utils # Common validation and utility functions | ||
| 65 | +│ └── conftest.py # Shared pytest configuration | ||
| 60 | ├── CMakeLists.txt # CMake configuration file | 66 | ├── CMakeLists.txt # CMake configuration file |
| 61 | -├── pyproject.toml # project metadata and packaging configuration | 67 | +├── pyproject.toml # Project metadata and packaging configuration |
| 62 | -├── README.md | 68 | +├── README.md # Chinese documentation |
| 63 | -└── requirements-dev.txt # python dependency configuration file | 69 | +├── README_en.md # English documentation |
| 70 | +└── requirements-dev.txt # Python dependency configuration file | ||
| 64 | ``` | 71 | ``` |
| 65 | 72 | ||
| 66 | ## Build and Installation | 73 | ## Build and Installation |
| @@ -6,12 +6,13 @@ | |||
| 6 | 6 | ||
| 7 | ## 目录结构 | 7 | ## 目录结构 |
| 8 | ```text | 8 | ```text |
| 9 | -├── super_kernel_base # 基础功能的样例 | 9 | +examples/ |
| 10 | -│ └── superkernel_scope.py # 通过super_kernel完成算子融合 | 10 | +├── super_kernel_base # 基础功能的样例 |
| 11 | -└── super_kernel_profiling # 展示profiling的样例 | 11 | +│ └── superkernel_scope.py # 通过super_kernel完成算子融合 |
| 12 | - └── superkernel_compare.py # 使用super_kernel与不使用super_kernel的数据进行对比 | 12 | +├── super_kernel_profiling # 展示profiling的样例 |
| 13 | -└── super_kernel_runtime_ascendc_only # 极简super_kernel样例 | 13 | +│ └── superkernel_compare.py # 使用super_kernel与不使用super_kernel的数据进行对比 |
| 14 | - └── superkernel_runtime_ascendc_basic.py # 通过ascendc编译super_kernel完成算子融合,并使用runtime运行时环境执行 | 14 | +└── super_kernel_runtime_ascendc_only # 极简super_kernel样例 |
| 15 | + └── superkernel_runtime_ascendc_basic.py # 通过ascendc编译super_kernel完成算子融合,并使用runtime运行时环境执行 | ||
| 15 | ``` | 16 | ``` |
| 16 | ## 前置说明 | 17 | ## 前置说明 |
| 17 | 请务必参考[《源码构建指南》](../../docs/zh/build.md)完成前置环境准备。 | 18 | 请务必参考[《源码构建指南》](../../docs/zh/build.md)完成前置环境准备。 |
| @@ -6,12 +6,13 @@ Use super_kernel to complete operator fusion. | |||
| 6 | 6 | ||
| 7 | ## Directory Structure | 7 | ## Directory Structure |
| 8 | ```text | 8 | ```text |
| 9 | -├── super_kernel_base # basic functionality sample | 9 | +examples/ |
| 10 | -│ └── superkernel_scope.py # complete operator fusion through super_kernel | 10 | +├── super_kernel_base # basic functionality sample |
| 11 | -└── super_kernel_profiling # profiling demonstration sample | 11 | +│ └── superkernel_scope.py # complete operator fusion through super_kernel |
| 12 | - └── superkernel_compare.py # compare data using super_kernel vs not using super_kernel | 12 | +├── super_kernel_profiling # profiling demonstration sample |
| 13 | -└── super_kernel_runtime_ascendc_only # minimal super_kernel sample | 13 | +│ └── superkernel_compare.py # compare data using super_kernel vs not using super_kernel |
| 14 | - └── superkernel_runtime_ascendc_basic.py # compile super_kernel through ascendc for operator fusion, execute using runtime environment | 14 | +└── super_kernel_runtime_ascendc_only # minimal super_kernel sample |
| 15 | + └── superkernel_runtime_ascendc_basic.py # compile super_kernel through ascendc for operator fusion, execute using runtime environment | ||
| 15 | ``` | 16 | ``` |
| 16 | 17 | ||
| 17 | ## Prerequisites | 18 | ## Prerequisites |
| @@ -35,4 +36,4 @@ pip3 install -r requirements.txt | |||
| 35 | 36 | ||
| 36 | ## Reference | 37 | ## Reference |
| 37 | 38 | ||
| 38 | -Please refer to relevant content in "[Ascend Extension for PyTorch](https://www.hiascend.com/document/redirect/pytorchuserguide)" under "Suite and Third-party Libraries > PyTorch Graph Mode Usage (TorchAir) > API Reference > torchair.scope > super_kernel". | 39 | +Please refer to relevant content in "[Ascend Extension for PyTorch](https://www.hiascend.com/document/redirect/pytorchuserguide)" under "Suite and Third-party Libraries > PyTorch Graph Mode Usage (TorchAir) > API Reference > torchair.scope > super_kernel". |
| @@ -8,11 +8,12 @@ | |||
| 8 | 8 | ||
| 9 | ## 目录结构 | 9 | ## 目录结构 |
| 10 | ```text | 10 | ```text |
| 11 | -├── super_kernel_runtime_ascendc_only # 目录 | 11 | +super_kernel_runtime_ascendc_only/ |
| 12 | - └── superkernel_runtime_ascendc_basic.py # 主入口,流程上包含子kernel编译、superkernel编译、内存分配、加载执行等 | 12 | +├── README.md # 中文说明文档 |
| 13 | - └── compile_sk.py # 编译sub_kernel、super_kernel算子 | 13 | +├── README_en.md # 英文说明文档 |
| 14 | - └── utils.py # 工具函数 | 14 | +├── compile_sk.py # 编译sub_kernel、super_kernel算子 |
| 15 | - | 15 | +├── superkernel_runtime_ascendc_basic.py # 主入口,流程上包含子kernel编译、superkernel编译、内存分配、加载执行等 |
| 16 | +└── utils.py # 工具函数 | ||
| 16 | ``` | 17 | ``` |
| 17 | 18 | ||
| 18 | ## 用例介绍 | 19 | ## 用例介绍 |
| @@ -23,7 +24,6 @@ graph TB | |||
| 23 | input1[input1] --> sk[superkernel] | 24 | input1[input1] --> sk[superkernel] |
| 24 | input2[input2] --> sk | 25 | input2[input2] --> sk |
| 25 | sk --> output[output] | 26 | sk --> output[output] |
| 26 | - | ||
| 27 | %% 放大的内部视图:用子图展示superkernel内部结构 | 27 | %% 放大的内部视图:用子图展示superkernel内部结构 |
| 28 | subgraph superkernel内部结构 | 28 | subgraph superkernel内部结构 |
| 29 | inner1_in(inner_input1) --> pow(pow) | 29 | inner1_in(inner_input1) --> pow(pow) |
| @@ -9,11 +9,12 @@ Core features: | |||
| 9 | 9 | ||
| 10 | ## Directory Structure | 10 | ## Directory Structure |
| 11 | ```text | 11 | ```text |
| 12 | -├── super_kernel_runtime_ascendc_only # directory | 12 | +super_kernel_runtime_ascendc_only/ |
| 13 | - └── superkernel_runtime_ascendc_basic.py # main entry, flow includes sub-kernel compilation, superkernel compilation, memory allocation, loading execution, and so on | 13 | +├── README.md # Chinese documentation |
| 14 | - └── compile_sk.py # compile sub_kernel, super_kernel operators | 14 | +├── README_en.md # English documentation |
| 15 | - └── utils.py # utility functions | 15 | +├── compile_sk.py # Compile sub-kernel and SuperKernel operators |
| 16 | - | 16 | +├── superkernel_runtime_ascendc_basic.py # Main entry for sub-kernel compilation, SuperKernel compilation, memory allocation, loading, and execution |
| 17 | +└── utils.py # Utility functions | ||
| 17 | ``` | 18 | ``` |
| 18 | 19 | ||
| 19 | ## Use Case Introduction | 20 | ## Use Case Introduction |
| @@ -24,7 +25,6 @@ graph TB | |||
| 24 | input1[input1] --> sk[superkernel] | 25 | input1[input1] --> sk[superkernel] |
| 25 | input2[input2] --> sk | 26 | input2[input2] --> sk |
| 26 | sk --> output[output] | 27 | sk --> output[output] |
| 27 | - | ||
| 28 | %% Enlarged internal view: subgraph shows superkernel internal structure | 28 | %% Enlarged internal view: subgraph shows superkernel internal structure |
| 29 | subgraph superkernel_internal_structure | 29 | subgraph superkernel_internal_structure |
| 30 | inner1_in(inner_input1) --> pow(pow) | 30 | inner1_in(inner_input1) --> pow(pow) |
| @@ -59,4 +59,4 @@ python3 superkernel_runtime_ascendc_basic.py | |||
| 59 | After execution, print shows success: | 59 | After execution, print shows success: |
| 60 | ```text | 60 | ```text |
| 61 | execute sample success | 61 | execute sample success |
| 62 | -``` | 62 | +``` |