Merged
refactor(ccu): 重构 CCU 对外接口并统一命名空间与安装布局 #395
DragonBornHD84Add on 18 days ago
refactor(ccu): 重构 CCU 对外接口并统一命名空间与安装布局 #395
Merged
DragonBornHD84Add on 18 days ago
Total: 424 files changed+6256-5084
@@ -177,7 +177,7 @@ function build () {
177 177 
178function run_ccu_ut() {178function run_ccu_ut() {
179 local ut_build_dir="$1"179 local ut_build_dir="$1"
180- local ccu_ctest_dir="${ut_build_dir}/ccu_hcomm"180+ local ccu_ctest_dir="${ut_build_dir}/ccu_api"
181 181 
182 if [[ ! -f "${ccu_ctest_dir}/CTestTestfile.cmake" ]]; then182 if [[ ! -f "${ccu_ctest_dir}/CTestTestfile.cmake" ]]; then
183 log "ERROR" "CCU CTest registration not found: ${ccu_ctest_dir}"183 log "ERROR" "CCU CTest registration not found: ${ccu_ctest_dir}"
@@ -25,7 +25,7 @@
25 25 
26## Function Description26## Function Description
27 27 
28-Header file: `#include "ccu/hcomm/ccu_primitives.hpp"`28+Header file: `#include <ccu/asc_ccu.h>`
29 29 
30Reads one or more `uint64_t` values from an on-chip memory address and writes them to a variable within a CCU kernel.30Reads one or more `uint64_t` values from an on-chip memory address and writes them to a variable within a CCU kernel.
31 31 
@@ -43,25 +43,25 @@ The immediate address is determined at compile time and is immutable during the
43- Immediate address -> single variable43- Immediate address -> single variable
44 44 
45 ```cpp45 ```cpp
46- CcuResult load(uint64_t addr, variable v);46+ ccu_result load(uint64_t addr, variable v);
47 ```47 ```
48 48 
49- Immediate address -> variable array49- Immediate address -> variable array
50 50 
51 ```cpp51 ```cpp
52- CcuResult load(uint64_t addr, array<variable>& v_arr, uint32_t num);52+ ccu_result load(uint64_t addr, array<variable>& v_arr, uint32_t num);
53 ```53 ```
54 54 
55- Variable address (indirect addressing) -> single variable55- Variable address (indirect addressing) -> single variable
56 56 
57 ```cpp57 ```cpp
58- CcuResult load(variable addr_var, variable v);58+ ccu_result load(variable addr_var, variable v);
59 ```59 ```
60 60 
61- Variable address (indirect addressing) -> variable array61- Variable address (indirect addressing) -> variable array
62 62 
63 ```cpp63 ```cpp
64- CcuResult load(variable addr_var, array<variable>& v_arr, uint32_t num);64+ ccu_result load(variable addr_var, array<variable>& v_arr, uint32_t num);
65 ```65 ```
66 66 
67## Parameters67## Parameters
@@ -76,20 +76,20 @@ The immediate address is determined at compile time and is immutable during the
76 76 
77## Return Value77## Return Value
78 78 
79-[`CcuResult`](https://gitcode.com/cann/hcomm/blob/master/docs/en/api_ref/comm_opdev/datatype_definition/CcuResult.md): The API returns `CCU_SUCCESS` on success, and other values on failure.79+`ccu_result`: The API returns `ccu_result::CCU_SUCCESS` on success, and other values on failure.
80 80 
81| Return Value | Description |81| Return Value | Description |
82| --- | --- |82| --- | --- |
83-| `CCU_SUCCESS` | The operation is successful. |83+| `ccu_result::CCU_SUCCESS` | The operation is successful. |
84-| `CCU_E_PARA` | Parameter error: `num` is 0 or greater than `v_arr.size()`; or when `num>1`, the elements of `v_arr` are physically non-contiguous. |84+| `ccu_result::CCU_E_PARA` | Parameter error: `num` is 0 or greater than `v_arr.size()`; or when `num>1`, the elements of `v_arr` are physically non-contiguous. |
85-| `CCU_E_PTR` | The API is called outside the compile phase. |85+| `ccu_result::CCU_E_PTR` | The API is called outside the compile phase. |
86-| `CCU_E_NOT_FOUND` | The passed `v`/`v_arr` handle (or the adjacent handles of `v_arr[1..num-1]`) is not created in the current kernel. |86+| `ccu_result::CCU_E_NOT_FOUND` | The passed `v`/`v_arr` handle (or the adjacent handles of `v_arr[1..num-1]`) is not created in the current kernel. |
87 87 
88## Usage Constraints88## Usage Constraints
89 89 
90- `addr` must be a physical address accessible to the CCU or a tokenized VA. Directly passing a non-tokenized process virtual address will trigger a driver error.90- `addr` must be a physical address accessible to the CCU or a tokenized VA. Directly passing a non-tokenized process virtual address will trigger a driver error.
91-- `num` must satisfy `1 ≤ num ≤ v_arr.size()`. This API performs this check before accessing `v_arr[0]`; passing **0** or a value exceeding `v_arr.size()` returns `CCU_E_PARA` without reaching the underlying API. For an empty `array` (where `v_arr.size()` is 0), passing any `num` also returns `CCU_E_PARA`.91+- `num` must satisfy `1 ≤ num ≤ v_arr.size()`. This API performs this check before accessing `v_arr[0]`; passing **0** or a value exceeding `v_arr.size()` returns `ccu_result::CCU_E_PARA` without reaching the underlying API. For an empty `array` (where `v_arr.size()` is 0), passing any `num` also returns `ccu_result::CCU_E_PARA`.
92-- When `num>1` (variable array path), `v_arr` must point to a physically contiguous array of `variable` objects, which must be allocated through `ccu::array<variable>`. Declaring multiple `variable` objects separately does not guarantee physical contiguity. If this requirement is violated, `CCU_E_PARA` is returned at the `load(...)` call site.92+- When `num>1` (variable array path), `v_arr` must point to a physically contiguous array of `variable` objects, which must be allocated through `ccu::array<variable>`. Declaring multiple `variable` objects separately does not guarantee physical contiguity. If this requirement is violated, `ccu_result::CCU_E_PARA` is returned at the `load(...)` call site.
93- `addr_var` (variable address path) must have been assigned a valid address value (through `load_arg`, immediate assignment, or arithmetic operations) before this API is called.93- `addr_var` (variable address path) must have been assigned a valid address value (through `load_arg`, immediate assignment, or arithmetic operations) before this API is called.
94- The immediate address path is determined at compile time and immutable during the delivery phase; use the variable address path when a runtime dynamic address is required.94- The immediate address path is determined at compile time and immutable during the delivery phase; use the variable address path when a runtime dynamic address is required.
95 95 
@@ -97,27 +97,27 @@ The immediate address is determined at compile time and is immutable during the
97 97 
98```cpp98```cpp
99// For simplicity, return value reception and error handling are omitted.99// For simplicity, return value reception and error handling are omitted.
100-using namespace AscendC::ccu;100+using namespace asc::ccu;
101 101 
102// Scenario 1: Load one variable from an immediate address (immediate address -> single variable).102// Scenario 1: Load one variable from an immediate address (immediate address -> single variable).
103-CcuResult my_kernel(ccu_kernel_arg arg) {103+ccu_result my_kernel(ccu_kernel_arg arg) {
104 variable v;104 variable v;
105 load(0x10000000ULL, v);105 load(0x10000000ULL, v);
106- return CCU_SUCCESS;106+ return ccu_result::CCU_SUCCESS;
107}107}
108 108 
109// Scenario 2: Load four variables in batch from an immediate address (immediate address -> variable array).109// Scenario 2: Load four variables in batch from an immediate address (immediate address -> variable array).
110-CcuResult my_kernel2(ccu_kernel_arg arg) {110+ccu_result my_kernel2(ccu_kernel_arg arg) {
111 array<variable> v_arr(4); // Four physically contiguous variables.111 array<variable> v_arr(4); // Four physically contiguous variables.
112 load(0x80000000ULL, v_arr, 4);112 load(0x80000000ULL, v_arr, 4);
113- return CCU_SUCCESS;113+ return ccu_result::CCU_SUCCESS;
114}114}
115 115 
116// Scenario 3: Load indirectly from a variable address (variable address -> single variable, where the address is computed in the previous step).116// Scenario 3: Load indirectly from a variable address (variable address -> single variable, where the address is computed in the previous step).
117-CcuResult my_kernel3(ccu_kernel_arg arg) {117+ccu_result my_kernel3(ccu_kernel_arg arg) {
118 variable src_addr, v;118 variable src_addr, v;
119 load_arg(src_addr, 0); // Address passed in by the host.119 load_arg(src_addr, 0); // Address passed in by the host.
120 load(src_addr, v); // Indirect addressing at runtime.120 load(src_addr, v); // Indirect addressing at runtime.
121- return CCU_SUCCESS;121+ return ccu_result::CCU_SUCCESS;
122}122}
123```123```
@@ -25,7 +25,7 @@
25 25 
26## Function Description26## Function Description
27 27 
28-The header file is `#include "ccu/hcomm/ccu_primitives.hpp"`28+The header file is `#include <ccu/asc_ccu.h>`
29 29 
30`load_arg` is called inside the kernel function body to load parameters passed from the host into a `variable`. Each time the host dispatches a kernel through `<<<>>>`, it passes parameters through the `taskArgs` array. Before the kernel starts executing, the hardware writes the value of `taskArgs[arg_id]` into the register corresponding to the target `variable` as its initial value.30`load_arg` is called inside the kernel function body to load parameters passed from the host into a `variable`. Each time the host dispatches a kernel through `<<<>>>`, it passes parameters through the `taskArgs` array. Before the kernel starts executing, the hardware writes the value of `taskArgs[arg_id]` into the register corresponding to the target `variable` as its initial value.
31 31 
@@ -34,11 +34,11 @@ This API only records the declaration at compile time and does not perform the l
34## Function Prototype34## Function Prototype
35 35 
36```cpp36```cpp
37-namespace AscendC {37+namespace asc {
38namespace ccu {38namespace ccu {
39-CcuResult load_arg(variable v, uint32_t arg_id);39+ccu_result load_arg(variable v, uint32_t arg_id);
40} // namespace ccu40} // namespace ccu
41-} // namespace AscendC41+} // namespace asc
42```42```
43 43 
44## Parameters44## Parameters
@@ -50,20 +50,20 @@ CcuResult load_arg(variable v, uint32_t arg_id);
50 50 
51## Return Value51## Return Value
52 52 
53-[`CcuResult`](https://gitcode.com/cann/hcomm/blob/master/docs/en/api_ref/comm_opdev/datatype_definition/CcuResult.md): The API returns `CCU_SUCCESS` on success, and other values on failure.53+`ccu_result`: The API returns `ccu_result::CCU_SUCCESS` on success, and other values on failure.
54 54 
55| Return Value | Description |55| Return Value | Description |
56| --- | --- |56| --- | --- |
57-| `CCU_SUCCESS` | The operation is successful. |57+| `ccu_result::CCU_SUCCESS` | The operation is successful. |
58-| `CCU_E_PTR` | The API was called outside the compile phase. |58+| `ccu_result::CCU_E_PTR` | The API was called outside the compile phase. |
59-| `CCU_E_NOT_FOUND` | The `v` handle passed in was not created in the current kernel. |59+| `ccu_result::CCU_E_NOT_FOUND` | The `v` handle passed in was not created in the current kernel. |
60 60 
61> [!NOTE] Note61> [!NOTE] Note
62-> This API does not return `CCU_E_PARA`. Constraint errors related to `arg_id` are not returned by this API. Instead, they are uniformly validated by `<<<>>>`, which returns `CCU_E_INTERNAL`. For details, see [Usage Constraints](#usage-constraints).62+> This API does not return `ccu_result::CCU_E_PARA`. Constraint errors related to `arg_id` are not returned by this API. Instead, they are uniformly validated by `<<<>>>`, which returns `ccu_result::CCU_E_INTERNAL`. For details, see [Usage Constraints](#usage-constraints).
63 63 
64## Usage Constraints64## Usage Constraints
65 65 
66-- Within the same kernel, the `arg_id` values of all `load_arg` calls must be numbered consecutively starting from 0 (0, 1, 2, ...), must not be duplicated, and the total count must be exactly equal to the `argNum` of `<<<>>>`. Load instructions are mapped to task parameter slots in ascending order of `arg_id`. Skipped, out-of-order, or duplicated numbers prevent parameters from being correctly mapped to slots. All of the above are uniformly validated by `<<<>>>`, which returns `CCU_E_INTERNAL` on violation.66+- Within the same kernel, the `arg_id` values of all `load_arg` calls must be numbered consecutively starting from 0 (0, 1, 2, ...), must not be duplicated, and the total count must be exactly equal to the `argNum` of `<<<>>>`. Load instructions are mapped to task parameter slots in ascending order of `arg_id`. Skipped, out-of-order, or duplicated numbers prevent parameters from being correctly mapped to slots. All of the above are uniformly validated by `<<<>>>`, which returns `ccu_result::CCU_E_INTERNAL` on violation.
67- `argNum` represents the number of elements, not the number of bytes. For example, for three `load_arg` calls with `arg_id` values 0, 1, and 2, `argNum` must be `3`, and `taskArgs` must contain at least three `uint64_t` elements.67- `argNum` represents the number of elements, not the number of bytes. For example, for three `load_arg` calls with `arg_id` values 0, 1, and 2, `argNum` must be `3`, and `taskArgs` must contain at least three `uint64_t` elements.
68- `arg_id` ranges from 0 to 12, because a CCU task descriptor carries at most 13 parameters.68- `arg_id` ranges from 0 to 12, because a CCU task descriptor carries at most 13 parameters.
69- `load_arg` only sets the initial value of `v`: if the kernel function body assigns a value to the same `v` again, the assignment overwrites the injected initial value. When mixing the two, read out the injected value first and then reassign it.69- `load_arg` only sets the initial value of `v`: if the kernel function body assigns a value to the same `v` again, the assignment overwrites the injected initial value. When mixing the two, read out the injected value first and then reassign it.
@@ -72,10 +72,10 @@ CcuResult load_arg(variable v, uint32_t arg_id);
72 72 
73```cpp73```cpp
74// For simplicity, the return value handling and error handling are omitted.74// For simplicity, the return value handling and error handling are omitted.
75-using namespace AscendC::ccu;75+using namespace asc::ccu;
76 76 
77// Scenario: the loop count n and the start offset are declared at compile time and passed by the host at launch.77// Scenario: the loop count n and the start offset are declared at compile time and passed by the host at launch.
78-CcuResult my_kernel(ccu_kernel_arg arg) {78+ccu_result my_kernel(ccu_kernel_arg arg) {
79 variable n, offset;79 variable n, offset;
80 80 
81 load_arg(n, 0); // taskArgs[0] → n on each dispatch81 load_arg(n, 0); // taskArgs[0] → n on each dispatch
@@ -83,7 +83,7 @@ CcuResult my_kernel(ccu_kernel_arg arg) {
83 83 
84 // Use n and offset for the loop and address calculation later.84 // Use n and offset for the loop and address calculation later.
85 // ...85 // ...
86- return CCU_SUCCESS;86+ return ccu_result::CCU_SUCCESS;
87}87}
88 88 
89// Corresponding <<<>>> on the host side (illustrative):89// Corresponding <<<>>> on the host side (illustrative):
@@ -25,7 +25,7 @@
25 25 
26## Function Description26## Function Description
27 27 
28-The header file is `#include "ccu/hcomm/ccu_primitives.hpp"`28+The header file is `#include <ccu/asc_ccu.h>`
29 29 
30Writes the `uint64_t` value of one or more variables to an on-chip memory address in a CCU kernel.30Writes the `uint64_t` value of one or more variables to an on-chip memory address in a CCU kernel.
31 31 
@@ -43,25 +43,25 @@ The immediate address is determined at compile time and is immutable during the
43- Single variable -> immediate address43- Single variable -> immediate address
44 44 
45 ```cpp45 ```cpp
46- CcuResult store(uint64_t addr, variable v);46+ ccu_result store(uint64_t addr, variable v);
47 ```47 ```
48 48 
49- variable array -> immediate address49- variable array -> immediate address
50 50 
51 ```cpp51 ```cpp
52- CcuResult store(uint64_t addr, array<variable>& v_arr, uint32_t num);52+ ccu_result store(uint64_t addr, array<variable>& v_arr, uint32_t num);
53 ```53 ```
54 54 
55- single variable -> variable address (indirect addressing)55- single variable -> variable address (indirect addressing)
56 56 
57 ```cpp57 ```cpp
58- CcuResult store(variable addr_var, variable v);58+ ccu_result store(variable addr_var, variable v);
59 ```59 ```
60 60 
61- variable array -> variable address (indirect addressing)61- variable array -> variable address (indirect addressing)
62 62 
63 ```cpp63 ```cpp
64- CcuResult store(variable addr_var, array<variable>& v_arr, uint32_t num);64+ ccu_result store(variable addr_var, array<variable>& v_arr, uint32_t num);
65 ```65 ```
66 66 
67## Parameters67## Parameters
@@ -76,20 +76,20 @@ The immediate address is determined at compile time and is immutable during the
76 76 
77## Return Value77## Return Value
78 78 
79-[`CcuResult`](https://gitcode.com/cann/hcomm/blob/master/docs/en/api_ref/comm_opdev/datatype_definition/CcuResult.md): The API returns `CCU_SUCCESS` on success, and other values on failure.79+`ccu_result`: The API returns `ccu_result::CCU_SUCCESS` on success, and other values on failure.
80 80 
81| Return Value | Description |81| Return Value | Description |
82| --- | --- |82| --- | --- |
83-| `CCU_SUCCESS` | The operation is successful. |83+| `ccu_result::CCU_SUCCESS` | The operation is successful. |
84-| `CCU_E_PARA` | Parameter error: `num` is **0** or greater than `v_arr.size()`; or when `num>1`, the elements of `v_arr` are physically non-contiguous. |84+| `ccu_result::CCU_E_PARA` | Parameter error: `num` is **0** or greater than `v_arr.size()`; or when `num>1`, the elements of `v_arr` are physically non-contiguous. |
85-| `CCU_E_PTR` | The API is called outside the compile phase. |85+| `ccu_result::CCU_E_PTR` | The API is called outside the compile phase. |
86-| `CCU_E_NOT_FOUND` | The passed `v`/`v_arr` handle (or the adjacent handles of `v_arr[1..num-1]`) is not created in the current kernel. |86+| `ccu_result::CCU_E_NOT_FOUND` | The passed `v`/`v_arr` handle (or the adjacent handles of `v_arr[1..num-1]`) is not created in the current kernel. |
87 87 
88## Usage Constraints88## Usage Constraints
89 89 
90- `addr` must be a physical address accessible to the CCU or a tokenized VA. Directly passing a non-tokenized process virtual address will trigger a driver error.90- `addr` must be a physical address accessible to the CCU or a tokenized VA. Directly passing a non-tokenized process virtual address will trigger a driver error.
91-- `num` must satisfy `1 ≤ num ≤ v_arr.size()`. This API performs this check before accessing `v_arr[0]`; passing 0 or a value exceeding `v_arr.size()` returns `CCU_E_PARA` without reaching the underlying API. For an empty `array` (where `v_arr.size()` is 0), passing any `num` also returns `CCU_E_PARA`.91+- `num` must satisfy `1 ≤ num ≤ v_arr.size()`. This API performs this check before accessing `v_arr[0]`; passing 0 or a value exceeding `v_arr.size()` returns `ccu_result::CCU_E_PARA` without reaching the underlying API. For an empty `array` (where `v_arr.size()` is 0), passing any `num` also returns `ccu_result::CCU_E_PARA`.
92-- When `num>1` (variable array path), `v_arr` must point to a physically contiguous array of `variable` objects, which must be allocated through `ccu::array<variable>`. Declaring multiple `variable` objects separately does not guarantee physical contiguity. If this requirement is violated, `CCU_E_PARA` is returned at the `store(...)` call site.92+- When `num>1` (variable array path), `v_arr` must point to a physically contiguous array of `variable` objects, which must be allocated through `ccu::array<variable>`. Declaring multiple `variable` objects separately does not guarantee physical contiguity. If this requirement is violated, `ccu_result::CCU_E_PARA` is returned at the `store(...)` call site.
93- `addr_var` (variable address path) must have been assigned a valid address value (through `load_arg`, immediate assignment, or arithmetic operations) before this API is called.93- `addr_var` (variable address path) must have been assigned a valid address value (through `load_arg`, immediate assignment, or arithmetic operations) before this API is called.
94- The immediate address path is determined at compile time and immutable during the delivery phase; use the variable address path when a runtime dynamic address is required.94- The immediate address path is determined at compile time and immutable during the delivery phase; use the variable address path when a runtime dynamic address is required.
95 95 
@@ -97,30 +97,30 @@ The immediate address is determined at compile time and is immutable during the
97 97 
98```cpp98```cpp
99// For simplicity, return value reception and error handling are omitted.99// For simplicity, return value reception and error handling are omitted.
100-using namespace AscendC::ccu;100+using namespace asc::ccu;
101 101 
102// Scenario 1: Store one variable to an immediate address (single variable -> immediate address).102// Scenario 1: Store one variable to an immediate address (single variable -> immediate address).
103-CcuResult my_kernel(ccu_kernel_arg arg) {103+ccu_result my_kernel(ccu_kernel_arg arg) {
104 variable result;104 variable result;
105 // ... Compute result ...105 // ... Compute result ...
106 store(0x20000000ULL, result);106 store(0x20000000ULL, result);
107- return CCU_SUCCESS;107+ return ccu_result::CCU_SUCCESS;
108}108}
109 109 
110// Scenario 2: Store four variables in batch to an immediate address (variable array -> immediate address).110// Scenario 2: Store four variables in batch to an immediate address (variable array -> immediate address).
111-CcuResult my_kernel2(ccu_kernel_arg arg) {111+ccu_result my_kernel2(ccu_kernel_arg arg) {
112 array<variable> v_arr(4); // Four physically contiguous variables.112 array<variable> v_arr(4); // Four physically contiguous variables.
113 // ... Compute v_arr ...113 // ... Compute v_arr ...
114 store(0x80000000ULL, v_arr, 4);114 store(0x80000000ULL, v_arr, 4);
115- return CCU_SUCCESS;115+ return ccu_result::CCU_SUCCESS;
116}116}
117 117 
118// Scenario 3: Store a variable to the address specified by a variable (single variable -> variable address).118// Scenario 3: Store a variable to the address specified by a variable (single variable -> variable address).
119-CcuResult my_kernel3(ccu_kernel_arg arg) {119+ccu_result my_kernel3(ccu_kernel_arg arg) {
120 variable dst_addr, result;120 variable dst_addr, result;
121 load_arg(dst_addr, 0); // The host passes in the destination address.121 load_arg(dst_addr, 0); // The host passes in the destination address.
122 // ... Compute result ...122 // ... Compute result ...
123 store(dst_addr, result); // Write through indirect addressing at runtime.123 store(dst_addr, result); // Write through indirect addressing at runtime.
124- return CCU_SUCCESS;124+ return ccu_result::CCU_SUCCESS;
125}125}
126```126```
@@ -25,7 +25,7 @@
25 25 
26## Function Description26## Function Description
27 27 
28-The header file is `#include "ccu/hcomm/ccu_primitives.hpp"`.28+The header file is `#include <ccu/asc_ccu.h>`.
29 29 
30Supports asynchronous data copy between local on-chip memory and local CCU Buffer. The data remains unchanged during transfer, and the hardware automatically sets the flag bit corresponding to `mask` in `evt` to 1 when the copy is complete.30Supports asynchronous data copy between local on-chip memory and local CCU Buffer. The data remains unchanged during transfer, and the hardware automatically sets the flag bit corresponding to `mask` in `evt` to 1 when the copy is complete.
31 31 
@@ -43,21 +43,21 @@ The supported data paths are:
43- Local on-chip memory -> local on-chip memory43- Local on-chip memory -> local on-chip memory
44 44 
45 ```cpp45 ```cpp
46- CcuResult local_copy(local_addr dst, local_addr src, variable len,46+ ccu_result local_copy(local_addr dst, local_addr src, variable len,
47 event evt, uint16_t mask = 1);47 event evt, uint16_t mask = 1);
48 ```48 ```
49 49 
50- Local on-chip memory -> local CCU Buffer50- Local on-chip memory -> local CCU Buffer
51 51 
52 ```cpp52 ```cpp
53- CcuResult local_copy(ccu_buffer dst, local_addr src, variable len,53+ ccu_result local_copy(ccu_buffer dst, local_addr src, variable len,
54 event evt, uint16_t mask = 1);54 event evt, uint16_t mask = 1);
55 ```55 ```
56 56 
57- Local CCU Buffer -> local on-chip memory57- Local CCU Buffer -> local on-chip memory
58 58 
59 ```cpp59 ```cpp
60- CcuResult local_copy(local_addr dst, ccu_buffer src, variable len,60+ ccu_result local_copy(local_addr dst, ccu_buffer src, variable len,
61 event evt, uint16_t mask = 1);61 event evt, uint16_t mask = 1);
62 ```62 ```
63 63 
@@ -73,13 +73,13 @@ The supported data paths are:
73 73 
74## Return Value74## Return Value
75 75 
76-[`CcuResult`](https://gitcode.com/cann/hcomm/blob/master/docs/en/api_ref/comm_opdev/datatype_definition/CcuResult.md): The API returns `CCU_SUCCESS` on success, and other values on failure.76+`ccu_result`: The API returns `ccu_result::CCU_SUCCESS` on success, and other values on failure.
77 77 
78| Return Value | Description |78| Return Value | Description |
79| --- | --- |79| --- | --- |
80-| `CCU_SUCCESS` | The operation is successful. |80+| `ccu_result::CCU_SUCCESS` | The operation is successful. |
81-| `CCU_E_PTR` | The API is called outside the compilation stage. |81+| `ccu_result::CCU_E_PTR` | The API is called outside the compilation stage. |
82-| `CCU_E_NOT_FOUND` | The passed `dst`/`src`/`len`/`event` handle is not created in the current kernel. |82+| `ccu_result::CCU_E_NOT_FOUND` | The passed `dst`/`src`/`len`/`event` handle is not created in the current kernel. |
83 83 
84## Usage Constraints84## Usage Constraints
85 85 
@@ -92,21 +92,21 @@ The supported data paths are:
92 92 
93```cpp93```cpp
94// For simplicity, the return value reception and error handling are omitted.94// For simplicity, the return value reception and error handling are omitted.
95-using namespace AscendC::ccu;95+using namespace asc::ccu;
96 96 
97// Scenario 1: local on-chip memory -> local on-chip memory copy97// Scenario 1: local on-chip memory -> local on-chip memory copy
98-CcuResult my_kernel(ccu_kernel_arg arg) {98+ccu_result my_kernel(ccu_kernel_arg arg) {
99 local_addr src, dst;99 local_addr src, dst;
100 variable len;100 variable len;
101 event evt;101 event evt;
102 102 
103 local_copy(dst, src, len, evt); // mask defaults to 0x1.103 local_copy(dst, src, len, evt); // mask defaults to 0x1.
104 event_wait(evt);104 event_wait(evt);
105- return CCU_SUCCESS;105+ return ccu_result::CCU_SUCCESS;
106}106}
107 107 
108// Scenario 2: local on-chip memory → local CCU Buffer copy108// Scenario 2: local on-chip memory → local CCU Buffer copy
109-CcuResult my_kernel2(ccu_kernel_arg arg) {109+ccu_result my_kernel2(ccu_kernel_arg arg) {
110 ccu_buffer buf;110 ccu_buffer buf;
111 local_addr src;111 local_addr src;
112 variable len;112 variable len;
@@ -114,11 +114,11 @@ CcuResult my_kernel2(ccu_kernel_arg arg) {
114 114 
115 local_copy(buf, src, len, evt);115 local_copy(buf, src, len, evt);
116 event_wait(evt);116 event_wait(evt);
117- return CCU_SUCCESS;117+ return ccu_result::CCU_SUCCESS;
118}118}
119 119 
120// Scenario 3: local CCU Buffer → local on-chip memory copy120// Scenario 3: local CCU Buffer → local on-chip memory copy
121-CcuResult my_kernel3(ccu_kernel_arg arg) {121+ccu_result my_kernel3(ccu_kernel_arg arg) {
122 local_addr dst;122 local_addr dst;
123 ccu_buffer buf;123 ccu_buffer buf;
124 variable len;124 variable len;
@@ -126,6 +126,6 @@ CcuResult my_kernel3(ccu_kernel_arg arg) {
126 126 
127 local_copy(dst, buf, len, evt);127 local_copy(dst, buf, len, evt);
128 event_wait(evt);128 event_wait(evt);
129- return CCU_SUCCESS;129+ return ccu_result::CCU_SUCCESS;
130}130}
131```131```
@@ -25,7 +25,7 @@
25 25 
26## Function Description26## Function Description
27 27 
28-Header file: `#include "ccu/hcomm/ccu_primitives.hpp"`28+Header file: `#include <ccu/asc_ccu.h>`
29 29 
30Merges the source data with the destination memory or multiple ccu_buffers using the specified operator (asynchronous). When the hardware completes, the flag bit corresponding to `mask` in `evt` is automatically set to **1**.30Merges the source data with the destination memory or multiple ccu_buffers using the specified operator (asynchronous). When the hardware completes, the flag bit corresponding to `mask` in `evt` is automatically set to **1**.
31 31 
@@ -39,7 +39,7 @@ The supported data paths are:
39- Local on-chip memory -> local on-chip memory39- Local on-chip memory -> local on-chip memory
40 40 
41 ```cpp41 ```cpp
42- CcuResult local_reduce(local_addr dst, local_addr src, variable len,42+ ccu_result local_reduce(local_addr dst, local_addr src, variable len,
43 HcclDataType data_type, HcclReduceOp op_type,43 HcclDataType data_type, HcclReduceOp op_type,
44 event evt, uint16_t mask = 1);44 event evt, uint16_t mask = 1);
45 ```45 ```
@@ -47,7 +47,7 @@ The supported data paths are:
47- N local CCU Buffers -> `buffers[0]` (2 ≤ count ≤ 8)47- N local CCU Buffers -> `buffers[0]` (2 ≤ count ≤ 8)
48 48 
49 ```cpp49 ```cpp
50- CcuResult local_reduce(ccu_buffer* buffers, uint32_t count,50+ ccu_result local_reduce(ccu_buffer* buffers, uint32_t count,
51 HcclDataType data_type, HcclDataType output_data_type,51 HcclDataType data_type, HcclDataType output_data_type,
52 HcclReduceOp op_type,52 HcclReduceOp op_type,
53 variable len, event evt, uint16_t mask = 1);53 variable len, event evt, uint16_t mask = 1);
@@ -60,9 +60,9 @@ The supported data paths are:
60| dst | Input/Output | Destination on-chip memory address (`local_addr`, local on-chip memory -> local on-chip memory). A valid initial value must be written before the call; it is updated to the reduction result after the hardware completes. |60| dst | Input/Output | Destination on-chip memory address (`local_addr`, local on-chip memory -> local on-chip memory). A valid initial value must be written before the call; it is updated to the reduction result after the hardware completes. |
61| src | Input | Source on-chip memory address (`local_addr`, local on-chip memory -> local on-chip memory). |61| src | Input | Source on-chip memory address (`local_addr`, local on-chip memory -> local on-chip memory). |
62| buffers | Input/Output | Base address of the ccu_buffer array (`ccu_buffer*`, N local CCU Buffers -> `buffers[0]`). It must not be `nullptr`. You are advised to allocate it through `ccu::array<ccu_buffer>` to ensure physical contiguity. `buffers[0]` is the output location of the reduction result, and a valid initial value must be written before the call. In the precision expansion scenario (low-precision input + SUM promoted-precision output, for example, when INT8→FP32, the output elements are 4× the input), the passed ccu_buffer array must cover both the input and the expanded output footprint (for example, for 2-path INT8 input promoted to FP32 output, 4 ccu_buffers must be reserved instead of 2); insufficient reservation causes hardware read/write out-of-bounds and undefined behavior. |62| buffers | Input/Output | Base address of the ccu_buffer array (`ccu_buffer*`, N local CCU Buffers -> `buffers[0]`). It must not be `nullptr`. You are advised to allocate it through `ccu::array<ccu_buffer>` to ensure physical contiguity. `buffers[0]` is the output location of the reduction result, and a valid initial value must be written before the call. In the precision expansion scenario (low-precision input + SUM promoted-precision output, for example, when INT8→FP32, the output elements are 4× the input), the passed ccu_buffer array must cover both the input and the expanded output footprint (for example, for 2-path INT8 input promoted to FP32 output, 4 ccu_buffers must be reserved instead of 2); insufficient reservation causes hardware read/write out-of-bounds and undefined behavior. |
63-| count | Input | Number of ccu_buffers (N local CCU Buffers -> `buffers[0]`). The value range is `[2, 8]` (exceeding the upper limit throws an exception with an error code). `count == 0` is rejected directly and returns `CCU_E_PARA`; `count == 1` is not rejected but the hardware behavior is undefined. For a single ccu_buffer scenario, use the "local on-chip memory -> local on-chip memory" path. `count` must equal the actual length of the `buffers` array. |63+| count | Input | Number of ccu_buffers (N local CCU Buffers -> `buffers[0]`). The value range is `[2, 8]` (exceeding the upper limit throws an exception with an error code). `count == 0` is rejected directly and returns `ccu_result::CCU_E_PARA`; `count == 1` is not rejected but the hardware behavior is undefined. For a single ccu_buffer scenario, use the "local on-chip memory -> local on-chip memory" path. `count` must equal the actual length of the `buffers` array. |
64| data_type | Input | Input data type. For values, see the `HcclDataType` enumeration. Only the following six types are supported: `HCCL_DATA_TYPE_UINT8`, `HCCL_DATA_TYPE_INT16`, `HCCL_DATA_TYPE_INT32`, `HCCL_DATA_TYPE_FP16`, `HCCL_DATA_TYPE_FP32`, and `HCCL_DATA_TYPE_BFP16`. Other values are rejected and an exception is thrown (with an error code). |64| data_type | Input | Input data type. For values, see the `HcclDataType` enumeration. Only the following six types are supported: `HCCL_DATA_TYPE_UINT8`, `HCCL_DATA_TYPE_INT16`, `HCCL_DATA_TYPE_INT32`, `HCCL_DATA_TYPE_FP16`, `HCCL_DATA_TYPE_FP32`, and `HCCL_DATA_TYPE_BFP16`. Other values are rejected and an exception is thrown (with an error code). |
65-| output_data_type | Input | Output data type (only for the "N local CCU Buffers -> `buffers[0]`" path). For values, see the `HcclDataType` enumeration. Two combinations are supported: ① same precision - the value is the same as `data_type`; ② promoted precision - supported only when `op_type == HCCL_REDUCE_SUM`, which reduces low-precision inputs and then promotes them to high-precision output (for example, `HCCL_DATA_TYPE_INT8` → `HCCL_DATA_TYPE_FP32`; see "Call Example - Scenario 2"). Other `data_type`/`output_data_type` combinations return `CCU_E_NOT_SUPPORT` (see the return value table). In the promoted-precision scenario, `buffers` must reserve ccu_buffers according to the precision expansion ratio. For details, see the `buffers` parameter description. |65+| output_data_type | Input | Output data type (only for the "N local CCU Buffers -> `buffers[0]`" path). For values, see the `HcclDataType` enumeration. Two combinations are supported: ① same precision - the value is the same as `data_type`; ② promoted precision - supported only when `op_type == HCCL_REDUCE_SUM`, which reduces low-precision inputs and then promotes them to high-precision output (for example, `HCCL_DATA_TYPE_INT8` → `HCCL_DATA_TYPE_FP32`; see "Call Example - Scenario 2"). Other `data_type`/`output_data_type` combinations return `ccu_result::CCU_E_NOT_SUPPORT` (see the return value table). In the promoted-precision scenario, `buffers` must reserve ccu_buffers according to the precision expansion ratio. For details, see the `buffers` parameter description. |
66| op_type | Input | Reduction operator. For values, see the `HcclReduceOp` enumeration. Only `HCCL_REDUCE_SUM`, `HCCL_REDUCE_MAX`, and `HCCL_REDUCE_MIN` are supported; `HCCL_REDUCE_PROD` is not supported and is rejected with an exception (carrying an error code) when passed. |66| op_type | Input | Reduction operator. For values, see the `HcclReduceOp` enumeration. Only `HCCL_REDUCE_SUM`, `HCCL_REDUCE_MAX`, and `HCCL_REDUCE_MIN` are supported; `HCCL_REDUCE_PROD` is not supported and is rejected with an exception (carrying an error code) when passed. |
67| len | Input | Number of bytes to operate on, of type `variable`. The actual value is taken from the corresponding general-purpose register at the dispatch stage.<br>&bull;Local on-chip memory -> local on-chip memory: total number of bytes to operate on.<br>&bull;N local CCU Buffers -> `buffers[0]`: number of bytes of each ccu_buffer participating in the reduction, which must not exceed the size of a single slice (4096 bytes). |67| len | Input | Number of bytes to operate on, of type `variable`. The actual value is taken from the corresponding general-purpose register at the dispatch stage.<br>&bull;Local on-chip memory -> local on-chip memory: total number of bytes to operate on.<br>&bull;N local CCU Buffers -> `buffers[0]`: number of bytes of each ccu_buffer participating in the reduction, which must not exceed the size of a single slice (4096 bytes). |
68| evt | Input | Completion event object. When the hardware reduction completes, the flag bit corresponding to `mask` in `evt` is automatically set to 1, and the downstream calls `event_wait(evt, mask)` to wait. |68| evt | Input | Completion event object. When the hardware reduction completes, the flag bit corresponding to `mask` in `evt` is automatically set to 1, and the downstream calls `event_wait(evt, mask)` to wait. |
@@ -70,19 +70,19 @@ The supported data paths are:
70 70 
71## Return Value71## Return Value
72 72 
73-[`CcuResult`](https://gitcode.com/cann/hcomm/blob/master/docs/en/api_ref/comm_opdev/datatype_definition/CcuResult.md): The API returns `CCU_SUCCESS` on success, and other values on failure.73+`ccu_result`: The API returns `ccu_result::CCU_SUCCESS` on success, and other values on failure.
74 74 
75| Return Value | Description |75| Return Value | Description |
76| --- | --- |76| --- | --- |
77-| `CCU_SUCCESS` | The operation is successful. |77+| `ccu_result::CCU_SUCCESS` | The operation is successful. |
78-| `CCU_E_PARA` | Parameter error, including `buffers` being `nullptr` or `count` being 0. |78+| `ccu_result::CCU_E_PARA` | Parameter error, including `buffers` being `nullptr` or `count` being 0. |
79-| `CCU_E_NOT_SUPPORT` | Only for the "N Local End CCU Buffers -> `buffers[0]`" path: the `data_type`/`output_data_type` combination does not satisfy the higher-precision/same-precision constraint (see the `output_data_type` description for details). |79+| `ccu_result::CCU_E_NOT_SUPPORT` | Only for the "N Local End CCU Buffers -> `buffers[0]`" path: the `data_type`/`output_data_type` combination does not satisfy the higher-precision/same-precision constraint (see the `output_data_type` description for details). |
80 80 
81## Usage Constraints81## Usage Constraints
82 82 
83- The reduction is an in-place operation. Before the call, `dst` (for the "Local On-Chip Memory -> Local On-Chip Memory" path) or `buffers[0]` (for the "N Local End CCU Buffers -> `buffers[0]`" path) must already contain a valid initial value; otherwise, the reduction result is undefined.83- The reduction is an in-place operation. Before the call, `dst` (for the "Local On-Chip Memory -> Local On-Chip Memory" path) or `buffers[0]` (for the "N Local End CCU Buffers -> `buffers[0]`" path) must already contain a valid initial value; otherwise, the reduction result is undefined.
84- For the "N Local End CCU Buffers -> `buffers[0]`" path, `buffers` must point to a physically contiguous `ccu_buffer` array. It is recommended to allocate it using `ccu::array<ccu_buffer>`.84- For the "N Local End CCU Buffers -> `buffers[0]`" path, `buffers` must point to a physically contiguous `ccu_buffer` array. It is recommended to allocate it using `ccu::array<ccu_buffer>`.
85-- For the "N Local End CCU Buffers -> `buffers[0]`" path, `count` ranges from `[2, 8]`. When `count > 8`, an exception is thrown (carrying an error code). When `count == 0`, `CCU_E_PARA` is returned directly. When `count == 1`, it is not rejected, but the hardware behavior is undefined (use the "Local On-Chip Memory -> Local On-Chip Memory" path instead).85+- For the "N Local End CCU Buffers -> `buffers[0]`" path, `count` ranges from `[2, 8]`. When `count > 8`, an exception is thrown (carrying an error code). When `count == 0`, `ccu_result::CCU_E_PARA` is returned directly. When `count == 1`, it is not rejected, but the hardware behavior is undefined (use the "Local On-Chip Memory -> Local On-Chip Memory" path instead).
86- For the "N Local End CCU Buffers -> `buffers[0]`" path, in a precision expansion scenario (low-precision input + SUM higher-precision output), `buffers` must reserve additional ccu_buffer entries according to the expansion ratio to accommodate the expanded output; otherwise, the hardware reads/writes out of bounds and the behavior is undefined.86- For the "N Local End CCU Buffers -> `buffers[0]`" path, in a precision expansion scenario (low-precision input + SUM higher-precision output), `buffers` must reserve additional ccu_buffer entries according to the expansion ratio to accommodate the expanded output; otherwise, the hardware reads/writes out of bounds and the behavior is undefined.
87- For the "N Local End CCU Buffers -> `buffers[0]`" path, `len` must not exceed the size of a single `ccu_buffer` (4096 bytes). The caller must guarantee this upper limit; exceeding it results in undefined hardware behavior at runtime.87- For the "N Local End CCU Buffers -> `buffers[0]`" path, `len` must not exceed the size of a single `ccu_buffer` (4096 bytes). The caller must guarantee this upper limit; exceeding it results in undefined hardware behavior at runtime.
88- This API is asynchronous. You must wait for the reduction to complete by calling `event_wait(evt, mask)` before reading the result.88- This API is asynchronous. You must wait for the reduction to complete by calling `event_wait(evt, mask)` before reading the result.
@@ -91,10 +91,10 @@ The supported data paths are:
91 91 
92```cpp92```cpp
93// For simplicity, the return value reception and error handling are omitted.93// For simplicity, the return value reception and error handling are omitted.
94-using namespace AscendC::ccu;94+using namespace asc::ccu;
95 95 
96// Scenario 1: Local on-chip memory -> local on-chip memory reduction (FP16 SUM).96// Scenario 1: Local on-chip memory -> local on-chip memory reduction (FP16 SUM).
97-CcuResult my_kernel(ccu_kernel_arg arg) {97+ccu_result my_kernel(ccu_kernel_arg arg) {
98 local_addr dst, src;98 local_addr dst, src;
99 variable len;99 variable len;
100 event evt;100 event evt;
@@ -102,12 +102,12 @@ CcuResult my_kernel(ccu_kernel_arg arg) {
102 // dst must be pre-initialized with an initial value (for example, 0.0).102 // dst must be pre-initialized with an initial value (for example, 0.0).
103 local_reduce(dst, src, len, HCCL_DATA_TYPE_FP16, HCCL_REDUCE_SUM, evt);103 local_reduce(dst, src, len, HCCL_DATA_TYPE_FP16, HCCL_REDUCE_SUM, evt);
104 event_wait(evt);104 event_wait(evt);
105- return CCU_SUCCESS;105+ return ccu_result::CCU_SUCCESS;
106}106}
107 107 
108// Scenario 2: Reduce two ccu_buffers to buffers[0], with INT8 input promoted to FP32 output (a valid "input != output" combination;108// Scenario 2: Reduce two ccu_buffers to buffers[0], with INT8 input promoted to FP32 output (a valid "input != output" combination;
109// INT8 to FP32 = 4x expansion, so two input channels require reserving four ccu_buffers to hold the expanded output; see the `buffers` parameter description)109// INT8 to FP32 = 4x expansion, so two input channels require reserving four ccu_buffers to hold the expanded output; see the `buffers` parameter description)
110-CcuResult my_kernel2(ccu_kernel_arg arg) {110+ccu_result my_kernel2(ccu_kernel_arg arg) {
111 array<ccu_buffer> bufs(4); // Two input channels; reserve four physically contiguous ccu_buffers according to the expansion ratio111 array<ccu_buffer> bufs(4); // Two input channels; reserve four physically contiguous ccu_buffers according to the expansion ratio
112 variable len;112 variable len;
113 event evt;113 event evt;
@@ -118,11 +118,11 @@ CcuResult my_kernel2(ccu_kernel_arg arg) {
118 HCCL_DATA_TYPE_INT8, HCCL_DATA_TYPE_FP32,118 HCCL_DATA_TYPE_INT8, HCCL_DATA_TYPE_FP32,
119 HCCL_REDUCE_SUM, len, evt);119 HCCL_REDUCE_SUM, len, evt);
120 event_wait(evt);120 event_wait(evt);
121- return CCU_SUCCESS;121+ return ccu_result::CCU_SUCCESS;
122}122}
123 123 
124// Scenario 3: Regular reduction with the same input and output type (FP16 SUM)124// Scenario 3: Regular reduction with the same input and output type (FP16 SUM)
125-CcuResult my_kernel3(ccu_kernel_arg arg) {125+ccu_result my_kernel3(ccu_kernel_arg arg) {
126 array<ccu_buffer> bufs(4);126 array<ccu_buffer> bufs(4);
127 variable len;127 variable len;
128 event evt;128 event evt;
@@ -131,6 +131,6 @@ CcuResult my_kernel3(ccu_kernel_arg arg) {
131 HCCL_DATA_TYPE_FP16, HCCL_DATA_TYPE_FP16,131 HCCL_DATA_TYPE_FP16, HCCL_DATA_TYPE_FP16,
132 HCCL_REDUCE_SUM, len, evt);132 HCCL_REDUCE_SUM, len, evt);
133 event_wait(evt);133 event_wait(evt);
134- return CCU_SUCCESS;134+ return ccu_result::CCU_SUCCESS;
135}135}
136```136```
@@ -25,7 +25,7 @@
25 25 
26## Function Description26## Function Description
27 27 
28-Header file: `#include "ccu/hcomm/ccu_primitives.hpp"`28+Header file: `#include <ccu/asc_ccu.h>`
29 29 
30Asynchronously reads data from the peer on-chip memory to the local side through the established [`ChannelHandle`](https://gitcode.com/cann/hcomm/blob/master/docs/en/api_ref/comm_opdev/datatype_definition/ChannelHandle.md). When the hardware completes the operation, it automatically sets the flag bit corresponding to `mask` in `evt` to **1**.30Asynchronously reads data from the peer on-chip memory to the local side through the established [`ChannelHandle`](https://gitcode.com/cann/hcomm/blob/master/docs/en/api_ref/comm_opdev/datatype_definition/ChannelHandle.md). When the hardware completes the operation, it automatically sets the flag bit corresponding to `mask` in `evt` to **1**.
31 31 
@@ -39,14 +39,14 @@ The supported data paths are:
39- Remote on-chip memory -> local on-chip memory39- Remote on-chip memory -> local on-chip memory
40 40 
41 ```cpp41 ```cpp
42- CcuResult read(ChannelHandle ch, local_addr local, remote_addr remote,42+ ccu_result read(ChannelHandle ch, local_addr local, remote_addr remote,
43 variable len, event evt, uint16_t mask = 1);43 variable len, event evt, uint16_t mask = 1);
44 ```44 ```
45 45 
46- Remote on-chip memory -> local CCU Buffer46- Remote on-chip memory -> local CCU Buffer
47 47 
48 ```cpp48 ```cpp
49- CcuResult read(ChannelHandle ch, ccu_buffer local, remote_addr remote,49+ ccu_result read(ChannelHandle ch, ccu_buffer local, remote_addr remote,
50 variable len, event evt, uint16_t mask = 1);50 variable len, event evt, uint16_t mask = 1);
51 ```51 ```
52 52 
@@ -63,18 +63,18 @@ The supported data paths are:
63 63 
64## Return Value64## Return Value
65 65 
66-[`CcuResult`](https://gitcode.com/cann/hcomm/blob/master/docs/en/api_ref/comm_opdev/datatype_definition/CcuResult.md): The API returns `CCU_SUCCESS` on success, and other values on failure.66+`ccu_result`: The API returns `ccu_result::CCU_SUCCESS` on success, and other values on failure.
67 67 
68| Return Value | Description |68| Return Value | Description |
69| --- | --- |69| --- | --- |
70-| `CCU_SUCCESS` | The operation is successful. |70+| `ccu_result::CCU_SUCCESS` | The operation is successful. |
71-| `CCU_E_PTR` | The API is called outside the compilation phase. |71+| `ccu_result::CCU_E_PTR` | The API is called outside the compilation phase. |
72-| `CCU_E_NOT_FOUND` | The passed `local`/`remote`/`len`/`event` handle is not created in the current kernel. |72+| `ccu_result::CCU_E_NOT_FOUND` | The passed `local`/`remote`/`len`/`event` handle is not created in the current kernel. |
73 73 
74## Usage Constraints74## Usage Constraints
75 75 
76- The parameter order is destination first and source last: `read(ch, local, remote, ...)`, which is the opposite of `write`. Reversing the order causes a compile-time error due to type mismatch.76- The parameter order is destination first and source last: `read(ch, local, remote, ...)`, which is the opposite of `write`. Reversing the order causes a compile-time error due to type mismatch.
77-- All [`ChannelHandle`](https://gitcode.com/cann/hcomm/blob/master/docs/en/api_ref/comm_opdev/datatype_definition/ChannelHandle.md) objects in the same kernel must belong to the same die. Channels from different dies cannot be mixed in the same kernel. Die consistency is uniformly checked by `<<<>>>`, which returns `CCU_E_PARA` on mismatch instead of the return value of this API.77+- All [`ChannelHandle`](https://gitcode.com/cann/hcomm/blob/master/docs/en/api_ref/comm_opdev/datatype_definition/ChannelHandle.md) objects in the same kernel must belong to the same die. Channels from different dies cannot be mixed in the same kernel. Die consistency is uniformly checked by `<<<>>>`, which returns `ccu_result::CCU_E_PARA` on mismatch instead of the return value of this API.
78- For "remote on-chip memory -> local CCU Buffer", `len` must not exceed the size of a single `ccu_buffer` slice (4096 bytes). The caller must ensure this limit; exceeding it results in undefined runtime hardware behavior.78- For "remote on-chip memory -> local CCU Buffer", `len` must not exceed the size of a single `ccu_buffer` slice (4096 bytes). The caller must ensure this limit; exceeding it results in undefined runtime hardware behavior.
79- This API is an asynchronous operation. You must wait for the read to complete by calling `event_wait(evt, mask)` before accessing the target memory.79- This API is an asynchronous operation. You must wait for the read to complete by calling `event_wait(evt, mask)` before accessing the target memory.
80 80 
@@ -82,7 +82,7 @@ The supported data paths are:
82 82 
83```cpp83```cpp
84// For simplicity, the return value reception and error handling are omitted.84// For simplicity, the return value reception and error handling are omitted.
85-using namespace AscendC::ccu;85+using namespace asc::ccu;
86 86 
87// User-defined kernel argument struct, passed through the kernelArg of <<<>>> after the host side establishes the channel.87// User-defined kernel argument struct, passed through the kernelArg of <<<>>> after the host side establishes the channel.
88struct my_kernel_arg {88struct my_kernel_arg {
@@ -90,7 +90,7 @@ struct my_kernel_arg {
90};90};
91 91 
92// Scenario 1: Read from remote on-chip memory to local on-chip memory.92// Scenario 1: Read from remote on-chip memory to local on-chip memory.
93-CcuResult my_kernel(ccu_kernel_arg arg) {93+ccu_result my_kernel(ccu_kernel_arg arg) {
94 auto *params = static_cast<my_kernel_arg *>(arg); // ccu_kernel_arg is void*. Cast it to the user argument struct first.94 auto *params = static_cast<my_kernel_arg *>(arg); // ccu_kernel_arg is void*. Cast it to the user argument struct first.
95 ChannelHandle ch = params->channel_handle;95 ChannelHandle ch = params->channel_handle;
96 local_addr dst;96 local_addr dst;
@@ -100,11 +100,11 @@ CcuResult my_kernel(ccu_kernel_arg arg) {
100 100 
101 read(ch, dst, remote, len, evt); // local first, remote last.101 read(ch, dst, remote, len, evt); // local first, remote last.
102 event_wait(evt);102 event_wait(evt);
103- return CCU_SUCCESS;103+ return ccu_result::CCU_SUCCESS;
104}104}
105 105 
106// Scenario 2: Read from remote on-chip memory to the local CCU Buffer.106// Scenario 2: Read from remote on-chip memory to the local CCU Buffer.
107-CcuResult my_kernel2(ccu_kernel_arg arg) {107+ccu_result my_kernel2(ccu_kernel_arg arg) {
108 auto *params = static_cast<my_kernel_arg *>(arg); // ccu_kernel_arg is void*. Cast it to the user input parameter struct first.108 auto *params = static_cast<my_kernel_arg *>(arg); // ccu_kernel_arg is void*. Cast it to the user input parameter struct first.
109 ChannelHandle ch = params->channel_handle;109 ChannelHandle ch = params->channel_handle;
110 ccu_buffer buf;110 ccu_buffer buf;
@@ -114,6 +114,6 @@ CcuResult my_kernel2(ccu_kernel_arg arg) {
114 114 
115 read(ch, buf, remote, len, evt);115 read(ch, buf, remote, len, evt);
116 event_wait(evt);116 event_wait(evt);
117- return CCU_SUCCESS;117+ return ccu_result::CCU_SUCCESS;
118}118}
119```119```
@@ -25,14 +25,14 @@
25 25 
26## Function Description26## Function Description
27 27 
28-Header file: `#include "ccu/hcomm/ccu_primitives.hpp"`28+Header file: `#include <ccu/asc_ccu.h>`
29 29 
30Asynchronously reads data from the remote on-chip memory through the established [`ChannelHandle`](https://gitcode.com/cann/hcomm/blob/master/docs/en/api_ref/comm_opdev/datatype_definition/ChannelHandle.md) and merges it with the existing data in the local on-chip memory using the specified operator (`local = reduce(local, fetch_from_remote, op_type)`). When the hardware completes, the flag bit corresponding to `mask` in `evt` is automatically set to **1**.30Asynchronously reads data from the remote on-chip memory through the established [`ChannelHandle`](https://gitcode.com/cann/hcomm/blob/master/docs/en/api_ref/comm_opdev/datatype_definition/ChannelHandle.md) and merges it with the existing data in the local on-chip memory using the specified operator (`local = reduce(local, fetch_from_remote, op_type)`). When the hardware completes, the flag bit corresponding to `mask` in `evt` is automatically set to **1**.
31 31 
32## Function Prototype32## Function Prototype
33 33 
34```cpp34```cpp
35-CcuResult read_reduce(ChannelHandle ch, local_addr local, remote_addr remote,35+ccu_result read_reduce(ChannelHandle ch, local_addr local, remote_addr remote,
36 variable len, HcclDataType data_type, HcclReduceOp op_type,36 variable len, HcclDataType data_type, HcclReduceOp op_type,
37 event evt, uint16_t mask = 1);37 event evt, uint16_t mask = 1);
38```38```
@@ -52,18 +52,18 @@ CcuResult read_reduce(ChannelHandle ch, local_addr local, remote_addr remote,
52 52 
53## Return Value53## Return Value
54 54 
55-[`CcuResult`](https://gitcode.com/cann/hcomm/blob/master/docs/en/api_ref/comm_opdev/datatype_definition/CcuResult.md): The API returns `CCU_SUCCESS` on success, and other values on failure.55+`ccu_result`: The API returns `ccu_result::CCU_SUCCESS` on success, and other values on failure.
56 56 
57| Return Value | Description |57| Return Value | Description |
58| --- | --- |58| --- | --- |
59-| `CCU_SUCCESS` | The operation is successful. |59+| `ccu_result::CCU_SUCCESS` | The operation is successful. |
60-| `CCU_E_PTR` | The API was called outside the compilation stage. |60+| `ccu_result::CCU_E_PTR` | The API was called outside the compilation stage. |
61-| `CCU_E_NOT_FOUND` | The passed `local`/`remote`/`len`/`event` handle was not created in the current kernel. |61+| `ccu_result::CCU_E_NOT_FOUND` | The passed `local`/`remote`/`len`/`event` handle was not created in the current kernel. |
62 62 
63## Usage Constraints63## Usage Constraints
64 64 
65- The parameter order is destination first and source second: `read_reduce(ch, local, remote, ...)`, where `local` is also the accumulation side of the reduction.65- The parameter order is destination first and source second: `read_reduce(ch, local, remote, ...)`, where `local` is also the accumulation side of the reduction.
66-- All [`ChannelHandle`](https://gitcode.com/cann/hcomm/blob/master/docs/en/api_ref/comm_opdev/datatype_definition/ChannelHandle.md) objects in the same kernel must belong to the same die. Channels from different dies cannot be mixed in the same kernel. Die consistency is uniformly checked by `<<<>>>`; if inconsistent, `CCU_E_PARA` is returned instead of the return value of this API.66+- All [`ChannelHandle`](https://gitcode.com/cann/hcomm/blob/master/docs/en/api_ref/comm_opdev/datatype_definition/ChannelHandle.md) objects in the same kernel must belong to the same die. Channels from different dies cannot be mixed in the same kernel. Die consistency is uniformly checked by `<<<>>>`; if inconsistent, `ccu_result::CCU_E_PARA` is returned instead of the return value of this API.
67- `local` must have a valid initial value (such as 0 or negative infinity) written before the call; otherwise, the reduction result is undefined.67- `local` must have a valid initial value (such as 0 or negative infinity) written before the call; otherwise, the reduction result is undefined.
68- This API is asynchronous. You must wait for the reduction to complete by calling `event_wait(evt, mask)` before reading the result.68- This API is asynchronous. You must wait for the reduction to complete by calling `event_wait(evt, mask)` before reading the result.
69 69 
@@ -71,7 +71,7 @@ CcuResult read_reduce(ChannelHandle ch, local_addr local, remote_addr remote,
71 71 
72```cpp72```cpp
73// For simplicity, the return value reception and error handling are omitted.73// For simplicity, the return value reception and error handling are omitted.
74-using namespace AscendC::ccu;74+using namespace asc::ccu;
75 75 
76// User-defined kernel argument struct. After the link is established on the host, it is passed in through the kernelArg of <<<>>>.76// User-defined kernel argument struct. After the link is established on the host, it is passed in through the kernelArg of <<<>>>.
77struct my_kernel_arg {77struct my_kernel_arg {
@@ -79,7 +79,7 @@ struct my_kernel_arg {
79};79};
80 80 
81// Scenario: Read from the peer on-chip memory and perform FP16 SUM reduction with the local data.81// Scenario: Read from the peer on-chip memory and perform FP16 SUM reduction with the local data.
82-CcuResult my_kernel(ccu_kernel_arg arg) {82+ccu_result my_kernel(ccu_kernel_arg arg) {
83 auto *params = static_cast<my_kernel_arg *>(arg); // ccu_kernel_arg is void*, so first cast it to the user argument struct.83 auto *params = static_cast<my_kernel_arg *>(arg); // ccu_kernel_arg is void*, so first cast it to the user argument struct.
84 ChannelHandle ch = params->channel_handle;84 ChannelHandle ch = params->channel_handle;
85 local_addr dst; // dst must be pre-initialized with an initial value (for example, 0.0).85 local_addr dst; // dst must be pre-initialized with an initial value (for example, 0.0).
@@ -89,6 +89,6 @@ CcuResult my_kernel(ccu_kernel_arg arg) {
89 89 
90 read_reduce(ch, dst, remote, len, HCCL_DATA_TYPE_FP16, HCCL_REDUCE_SUM, evt);90 read_reduce(ch, dst, remote, len, HCCL_DATA_TYPE_FP16, HCCL_REDUCE_SUM, evt);
91 event_wait(evt);91 event_wait(evt);
92- return CCU_SUCCESS;92+ return ccu_result::CCU_SUCCESS;
93}93}
94```94```
@@ -25,7 +25,7 @@
25 25 
26## Function Description26## Function Description
27 27 
28-Header file: `#include "ccu/hcomm/ccu_primitives.hpp"`28+Header file: `#include <ccu/asc_ccu.h>`
29 29 
30Asynchronously writes local data to the remote on-chip memory through the established [`ChannelHandle`](https://gitcode.com/cann/hcomm/blob/master/docs/en/api_ref/comm_opdev/datatype_definition/ChannelHandle.md). When the hardware completes the operation, it automatically sets the flag bit corresponding to `mask` in `evt` to **1**.30Asynchronously writes local data to the remote on-chip memory through the established [`ChannelHandle`](https://gitcode.com/cann/hcomm/blob/master/docs/en/api_ref/comm_opdev/datatype_definition/ChannelHandle.md). When the hardware completes the operation, it automatically sets the flag bit corresponding to `mask` in `evt` to **1**.
31 31 
@@ -39,14 +39,14 @@ The supported data paths are:
39- Local on-chip memory -> remote on-chip memory39- Local on-chip memory -> remote on-chip memory
40 40 
41 ```cpp41 ```cpp
42- CcuResult write(ChannelHandle ch, remote_addr remote, local_addr local,42+ ccu_result write(ChannelHandle ch, remote_addr remote, local_addr local,
43 variable len, event evt, uint16_t mask = 1);43 variable len, event evt, uint16_t mask = 1);
44 ```44 ```
45 45 
46- Local CCU Buffer -> remote on-chip memory46- Local CCU Buffer -> remote on-chip memory
47 47 
48 ```cpp48 ```cpp
49- CcuResult write(ChannelHandle ch, remote_addr remote, ccu_buffer local,49+ ccu_result write(ChannelHandle ch, remote_addr remote, ccu_buffer local,
50 variable len, event evt, uint16_t mask = 1);50 variable len, event evt, uint16_t mask = 1);
51 ```51 ```
52 52 
@@ -63,13 +63,13 @@ The supported data paths are:
63 63 
64## Return Value64## Return Value
65 65 
66-[`CcuResult`](https://gitcode.com/cann/hcomm/blob/master/docs/en/api_ref/comm_opdev/datatype_definition/CcuResult.md): The API returns `CCU_SUCCESS` on success, and other values on failure.66+`ccu_result`: The API returns `ccu_result::CCU_SUCCESS` on success, and other values on failure.
67 67 
68| Return Value | Description |68| Return Value | Description |
69| --- | --- |69| --- | --- |
70-| `CCU_SUCCESS` | The operation is successful. |70+| `ccu_result::CCU_SUCCESS` | The operation is successful. |
71-| `CCU_E_PTR` | The API is called outside the compilation phase. |71+| `ccu_result::CCU_E_PTR` | The API is called outside the compilation phase. |
72-| `CCU_E_NOT_FOUND` | The passed `remote`/`local`/`len`/`event` handle is not created in the current kernel. |72+| `ccu_result::CCU_E_NOT_FOUND` | The passed `remote`/`local`/`len`/`event` handle is not created in the current kernel. |
73 73 
74## Usage Constraints74## Usage Constraints
75 75 
@@ -77,14 +77,14 @@ The supported data paths are:
77- `len` must be greater than 0; otherwise, the hardware exhibits undefined behavior. This constraint must be ensured by the caller.77- `len` must be greater than 0; otherwise, the hardware exhibits undefined behavior. This constraint must be ensured by the caller.
78- For "local on-chip memory -> remote on-chip memory", `len` must be less than 256 MB. This upper limit must be ensured by the caller; if exceeded, the hardware exhibits undefined behavior.78- For "local on-chip memory -> remote on-chip memory", `len` must be less than 256 MB. This upper limit must be ensured by the caller; if exceeded, the hardware exhibits undefined behavior.
79- For "local CCU Buffer -> remote on-chip memory", `len` must not exceed the size of a single `ccu_buffer` slice (4096 bytes). This upper limit must be ensured by the caller; if exceeded, the hardware exhibits undefined behavior.79- For "local CCU Buffer -> remote on-chip memory", `len` must not exceed the size of a single `ccu_buffer` slice (4096 bytes). This upper limit must be ensured by the caller; if exceeded, the hardware exhibits undefined behavior.
80-- All [`ChannelHandle`](https://gitcode.com/cann/hcomm/blob/master/docs/en/api_ref/comm_opdev/datatype_definition/ChannelHandle.md) objects in the same kernel must belong to the same die. Channels from different dies cannot be mixed in the same kernel. Die consistency is uniformly verified by `<<<>>>`; if inconsistent, `CCU_E_PARA` is returned instead of the return value of this API.80+- All [`ChannelHandle`](https://gitcode.com/cann/hcomm/blob/master/docs/en/api_ref/comm_opdev/datatype_definition/ChannelHandle.md) objects in the same kernel must belong to the same die. Channels from different dies cannot be mixed in the same kernel. Die consistency is uniformly verified by `<<<>>>`; if inconsistent, `ccu_result::CCU_E_PARA` is returned instead of the return value of this API.
81- This API is asynchronous. You must call `event_wait(evt, mask)` to wait for the write to complete before the remote data is guaranteed to be visible.81- This API is asynchronous. You must call `event_wait(evt, mask)` to wait for the write to complete before the remote data is guaranteed to be visible.
82 82 
83## Call Example83## Call Example
84 84 
85```cpp85```cpp
86// For simplicity, the return value reception and error handling are omitted.86// For simplicity, the return value reception and error handling are omitted.
87-using namespace AscendC::ccu;87+using namespace asc::ccu;
88 88 
89// User-defined kernel input parameter struct, passed through the kernelArg of <<<>>> after the host side establishes the link.89// User-defined kernel input parameter struct, passed through the kernelArg of <<<>>> after the host side establishes the link.
90struct my_kernel_arg {90struct my_kernel_arg {
@@ -92,7 +92,7 @@ struct my_kernel_arg {
92};92};
93 93 
94// Scenario 1: local on-chip memory -> remote on-chip memory94// Scenario 1: local on-chip memory -> remote on-chip memory
95-CcuResult my_kernel(ccu_kernel_arg arg) {95+ccu_result my_kernel(ccu_kernel_arg arg) {
96 auto *params = static_cast<my_kernel_arg *>(arg); // ccu_kernel_arg is void*, so first cast it to the user input parameter struct.96 auto *params = static_cast<my_kernel_arg *>(arg); // ccu_kernel_arg is void*, so first cast it to the user input parameter struct.
97 ChannelHandle ch = params->channel_handle;97 ChannelHandle ch = params->channel_handle;
98 remote_addr remote;98 remote_addr remote;
@@ -102,11 +102,11 @@ CcuResult my_kernel(ccu_kernel_arg arg) {
102 102 
103 write(ch, remote, src, len, evt); // remote comes first, local comes last.103 write(ch, remote, src, len, evt); // remote comes first, local comes last.
104 event_wait(evt);104 event_wait(evt);
105- return CCU_SUCCESS;105+ return ccu_result::CCU_SUCCESS;
106}106}
107 107 
108// Scenario 2: local CCU buffer -> remote on-chip memory108// Scenario 2: local CCU buffer -> remote on-chip memory
109-CcuResult my_kernel2(ccu_kernel_arg arg) {109+ccu_result my_kernel2(ccu_kernel_arg arg) {
110 auto *params = static_cast<my_kernel_arg *>(arg); // ccu_kernel_arg is void*, so first cast it to the user input parameter struct.110 auto *params = static_cast<my_kernel_arg *>(arg); // ccu_kernel_arg is void*, so first cast it to the user input parameter struct.
111 ChannelHandle ch = params->channel_handle;111 ChannelHandle ch = params->channel_handle;
112 remote_addr remote;112 remote_addr remote;
@@ -116,6 +116,6 @@ CcuResult my_kernel2(ccu_kernel_arg arg) {
116 116 
117 write(ch, remote, buf, len, evt);117 write(ch, remote, buf, len, evt);
118 event_wait(evt);118 event_wait(evt);
119- return CCU_SUCCESS;119+ return ccu_result::CCU_SUCCESS;
120}120}
121```121```
@@ -25,7 +25,7 @@
25 25 
26## Function Description26## Function Description
27 27 
28-Header file: `#include "ccu/hcomm/ccu_primitives.hpp"`28+Header file: `#include <ccu/asc_ccu.h>`
29 29 
30Asynchronously writes local data to the remote on-chip memory and, at the same time, reduces it with the existing remote data using the operator specified by `op_type`: `remote = reduce(remote, local, op_type)`. When the hardware completes, the flag bits corresponding to `mask` in `evt` are automatically set to **1**.30Asynchronously writes local data to the remote on-chip memory and, at the same time, reduces it with the existing remote data using the operator specified by `op_type`: `remote = reduce(remote, local, op_type)`. When the hardware completes, the flag bits corresponding to `mask` in `evt` are automatically set to **1**.
31 31 
@@ -36,13 +36,13 @@ The supported data paths are:
36## Function Prototype36## Function Prototype
37 37 
38```cpp38```cpp
39-namespace AscendC {39+namespace asc {
40namespace ccu {40namespace ccu {
41-CcuResult write_reduce(ChannelHandle ch, remote_addr remote, local_addr local,41+ccu_result write_reduce(ChannelHandle ch, remote_addr remote, local_addr local,
42 variable len, HcclDataType data_type, HcclReduceOp op_type,42 variable len, HcclDataType data_type, HcclReduceOp op_type,
43 event evt, uint16_t mask = 1);43 event evt, uint16_t mask = 1);
44} // namespace ccu44} // namespace ccu
45-} // namespace AscendC45+} // namespace asc
46```46```
47 47 
48## Parameters48## Parameters
@@ -60,13 +60,13 @@ CcuResult write_reduce(ChannelHandle ch, remote_addr remote, local_addr local,
60 60 
61## Return Value61## Return Value
62 62 
63-[`CcuResult`](https://gitcode.com/cann/hcomm/blob/master/docs/en/api_ref/comm_opdev/datatype_definition/CcuResult.md): The API returns `CCU_SUCCESS` on success, and other values on failure.63+`ccu_result`: The API returns `ccu_result::CCU_SUCCESS` on success, and other values on failure.
64 64 
65| Return Value | Description |65| Return Value | Description |
66| --- | --- |66| --- | --- |
67-| `CCU_SUCCESS` | The operation is successful. |67+| `ccu_result::CCU_SUCCESS` | The operation is successful. |
68-| `CCU_E_PTR` | The API is called outside the compilation stage. |68+| `ccu_result::CCU_E_PTR` | The API is called outside the compilation stage. |
69-| `CCU_E_NOT_FOUND` | The passed `remote`/`local`/`len`/`event` handle is not created in the current kernel. |69+| `ccu_result::CCU_E_NOT_FOUND` | The passed `remote`/`local`/`len`/`event` handle is not created in the current kernel. |
70 70 
71## Usage Constraints71## Usage Constraints
72 72 
@@ -74,7 +74,7 @@ CcuResult write_reduce(ChannelHandle ch, remote_addr remote, local_addr local,
74- The parameter order is destination-first, source-second: `write_reduce(ch, remote, local, ...)`. Reversing the order causes a compile-time error because the types differ.74- The parameter order is destination-first, source-second: `write_reduce(ch, remote, local, ...)`. Reversing the order causes a compile-time error because the types differ.
75- `len` must be greater than 0; otherwise, the hardware exhibits undefined behavior. The caller must ensure this constraint.75- `len` must be greater than 0; otherwise, the hardware exhibits undefined behavior. The caller must ensure this constraint.
76- `len` must be less than 256 MB. The caller must ensure this upper limit; if it is exceeded, the hardware exhibits undefined behavior. Overlong data must be split into multiple transfers.76- `len` must be less than 256 MB. The caller must ensure this upper limit; if it is exceeded, the hardware exhibits undefined behavior. Overlong data must be split into multiple transfers.
77-- All channels within the same kernel must belong to the same die. This constraint is uniformly checked by `<<<>>>`, and `CCU_E_PARA` is returned when it is violated.77+- All channels within the same kernel must belong to the same die. This constraint is uniformly checked by `<<<>>>`, and `ccu_result::CCU_E_PARA` is returned when it is violated.
78- `data_type` supports only `HCCL_DATA_TYPE_INT8`, `HCCL_DATA_TYPE_UINT8`, `HCCL_DATA_TYPE_INT16`, `HCCL_DATA_TYPE_UINT16`, `HCCL_DATA_TYPE_INT32`, `HCCL_DATA_TYPE_UINT32`, `HCCL_DATA_TYPE_FP16`, `HCCL_DATA_TYPE_BFP16`, and `HCCL_DATA_TYPE_FP32`.78- `data_type` supports only `HCCL_DATA_TYPE_INT8`, `HCCL_DATA_TYPE_UINT8`, `HCCL_DATA_TYPE_INT16`, `HCCL_DATA_TYPE_UINT16`, `HCCL_DATA_TYPE_INT32`, `HCCL_DATA_TYPE_UINT32`, `HCCL_DATA_TYPE_FP16`, `HCCL_DATA_TYPE_BFP16`, and `HCCL_DATA_TYPE_FP32`.
79- `op_type` supports only `HCCL_REDUCE_SUM`, `HCCL_REDUCE_MAX`, and `HCCL_REDUCE_MIN`.79- `op_type` supports only `HCCL_REDUCE_SUM`, `HCCL_REDUCE_MAX`, and `HCCL_REDUCE_MIN`.
80- When `data_type`/`op_type` is outside the supported range, an exception is thrown (carrying an error code), which is uniformly caught by `<<<>>>`.80- When `data_type`/`op_type` is outside the supported range, an exception is thrown (carrying an error code), which is uniformly caught by `<<<>>>`.
@@ -84,7 +84,7 @@ CcuResult write_reduce(ChannelHandle ch, remote_addr remote, local_addr local,
84 84 
85```cpp85```cpp
86// For simplicity, the return value reception and error handling are omitted.86// For simplicity, the return value reception and error handling are omitted.
87-using namespace AscendC::ccu;87+using namespace asc::ccu;
88 88 
89// User-defined kernel argument structure, passed through kernelArg of <<<>>> after the link is established on the host side.89// User-defined kernel argument structure, passed through kernelArg of <<<>>> after the link is established on the host side.
90struct my_kernel_arg {90struct my_kernel_arg {
@@ -92,7 +92,7 @@ struct my_kernel_arg {
92};92};
93 93 
94// Scenario: Write local FP16 data to the remote end and perform SUM reduction.94// Scenario: Write local FP16 data to the remote end and perform SUM reduction.
95-CcuResult my_kernel(ccu_kernel_arg arg) {95+ccu_result my_kernel(ccu_kernel_arg arg) {
96 auto *params = static_cast<my_kernel_arg *>(arg); // ccu_kernel_arg is void*. Cast it to the user input parameter struct first.96 auto *params = static_cast<my_kernel_arg *>(arg); // ccu_kernel_arg is void*. Cast it to the user input parameter struct first.
97 ChannelHandle ch = params->channel_handle;97 ChannelHandle ch = params->channel_handle;
98 remote_addr remote; // The remote end must write the initial value in advance.98 remote_addr remote; // The remote end must write the initial value in advance.
@@ -102,6 +102,6 @@ CcuResult my_kernel(ccu_kernel_arg arg) {
102 102 
103 write_reduce(ch, remote, src, len, HCCL_DATA_TYPE_FP16, HCCL_REDUCE_SUM, evt);103 write_reduce(ch, remote, src, len, HCCL_DATA_TYPE_FP16, HCCL_REDUCE_SUM, evt);
104 event_wait(evt);104 event_wait(evt);
105- return CCU_SUCCESS;105+ return ccu_result::CCU_SUCCESS;
106}106}
107```107```
@@ -25,7 +25,7 @@
25 25 
26## Function Description26## Function Description
27 27 
28-Header file: `#include "ccu/hcomm/ccu_primitives.hpp"`28+Header file: `#include <ccu/asc_ccu.h>`
29 29 
30Starts a do-while loop block in a CCU kernel: the body is executed at least once, and then the accompanying `CCU_WHILE` determines whether to continue.30Starts a do-while loop block in a CCU kernel: the body is executed at least once, and then the accompanying `CCU_WHILE` determines whether to continue.
31 31 
@@ -52,7 +52,7 @@ CCU_DO {
52 52 
53## Return Value53## Return Value
54 54 
55-`CCU_DO` is a preprocessor macro and does not return [`CcuResult`](https://gitcode.com/cann/hcomm/blob/master/docs/en/api_ref/comm_opdev/datatype_definition/CcuResult.md) itself; it does not fail under normal usage.55+`CCU_DO` is a preprocessor macro and does not return `ccu_result` itself; it does not fail under normal usage.
56 56 
57## Usage Constraints57## Usage Constraints
58 58 
@@ -64,10 +64,10 @@ CCU_DO {
64## Call Example64## Call Example
65 65 
66```cpp66```cpp
67-using namespace AscendC::ccu;67+using namespace asc::ccu;
68 68 
69// Scenario: do-while loop, where the body is executed at least once and then the condition determines whether to continue.69// Scenario: do-while loop, where the body is executed at least once and then the condition determines whether to continue.
70-CcuResult my_kernel(ccu_kernel_arg arg) {70+ccu_result my_kernel(ccu_kernel_arg arg) {
71 variable inner, one;71 variable inner, one;
72 inner = 0;72 inner = 0;
73 one = 1;73 one = 1;
@@ -77,6 +77,6 @@ CcuResult my_kernel(ccu_kernel_arg arg) {
77 inner = inner + one;77 inner = inner + one;
78 } CCU_WHILE(inner != 5ULL);78 } CCU_WHILE(inner != 5ULL);
79 79 
80- return CCU_SUCCESS;80+ return ccu_result::CCU_SUCCESS;
81}81}
82```82```
@@ -25,7 +25,7 @@
25 25 
26## Function Description26## Function Description
27 27 
28-Header file: `#include "ccu/hcomm/ccu_primitives.hpp"`28+Header file: `#include <ccu/asc_ccu.h>`
29 29 
30Starts the **else** branch of `CCU_IF` in a CCU kernel: this branch is executed when the `CCU_IF` condition is not met.30Starts the **else** branch of `CCU_IF` in a CCU kernel: this branch is executed when the `CCU_IF` condition is not met.
31 31 
@@ -52,7 +52,7 @@ For the complete usage, see [CCU_IF](CCU_IF.md).
52 52 
53## Return Value53## Return Value
54 54 
55-`CCU_ELSE` is a preprocessor macro and does not return [`CcuResult`](https://gitcode.com/cann/hcomm/blob/master/docs/en/api_ref/comm_opdev/datatype_definition/CcuResult.md) by itself; it does not fail under normal usage.55+`CCU_ELSE` is a preprocessor macro and does not return `ccu_result` by itself; it does not fail under normal usage.
56 56 
57## Usage Constraints57## Usage Constraints
58 58 
@@ -76,9 +76,9 @@ CCU_IF(v == 0) {
76## Call Example76## Call Example
77 77 
78```cpp78```cpp
79-using namespace AscendC::ccu;79+using namespace asc::ccu;
80 80 
81-CcuResult my_kernel(ccu_kernel_arg arg) {81+ccu_result my_kernel(ccu_kernel_arg arg) {
82 variable mode;82 variable mode;
83 load_arg(mode, 0);83 load_arg(mode, 0);
84 84 
@@ -92,6 +92,6 @@ CcuResult my_kernel(ccu_kernel_arg arg) {
92 result = 200;92 result = 200;
93 }93 }
94 94 
95- return CCU_SUCCESS;95+ return ccu_result::CCU_SUCCESS;
96}96}
97```97```
@@ -25,7 +25,7 @@
25 25 
26## Function Description26## Function Description
27 27 
28-Header file: `#include "ccu/hcomm/ccu_primitives.hpp"`28+Header file: `#include <ccu/asc_ccu.h>`
29 29 
30Starts a software conditional branch block inside a CCU kernel. The condition is computed by the CCU hardware during the dispatch phase. When the condition is met, the then code block is executed; otherwise, execution jumps to the exit of the **if** block.30Starts a software conditional branch block inside a CCU kernel. The condition is computed by the CCU hardware during the dispatch phase. When the condition is met, the then code block is executed; otherwise, execution jumps to the exit of the **if** block.
31 31 
@@ -41,11 +41,11 @@ CCU_IF(cond_expr) {
41 41 
42| Parameter | Input/Output | Description |42| Parameter | Input/Output | Description |
43| --- | --- | --- |43| --- | --- | --- |
44-| cond_expr | Input | Conditional expression of type `AscendC::ccu::cond_expr`. It is produced by `operator==(uint64_t)` or `operator!=(uint64_t)` of `ccu::variable`, for example, `v == 0` or `counter != 10`. |44+| cond_expr | Input | Conditional expression of type `asc::ccu::cond_expr`. It is produced by `operator==(uint64_t)` or `operator!=(uint64_t)` of `ccu::variable`, for example, `v == 0` or `counter != 10`. |
45 45 
46## Return Value46## Return Value
47 47 
48-`CCU_IF` is a preprocessor macro and does not return [`CcuResult`](https://gitcode.com/cann/hcomm/blob/master/docs/en/api_ref/comm_opdev/datatype_definition/CcuResult.md) by itself. After macro expansion, if an internal error occurs (such as a duplicate label or an invalid handle), `CCU_E_PARA`/`CCU_E_NOT_FOUND` may be produced. In this case, the macro does not throw an exception and does not block kernel generation: on failure, the code block is skipped and kernel generation still succeeds. Errors are not reported through a return value, so pay attention to them during debugging.48+`CCU_IF` is a preprocessor macro and does not return `ccu_result` by itself. After macro expansion, if an internal error occurs (such as a duplicate label or an invalid handle), `ccu_result::CCU_E_PARA`/`ccu_result::CCU_E_NOT_FOUND` may be produced. In this case, the macro does not throw an exception and does not block kernel generation: on failure, the code block is skipped and kernel generation still succeeds. Errors are not reported through a return value, so pay attention to them during debugging.
49 49 
50## Usage Constraints50## Usage Constraints
51 51 
@@ -58,10 +58,10 @@ CCU_IF(cond_expr) {
58## Call Example58## Call Example
59 59 
60```cpp60```cpp
61-using namespace AscendC::ccu;61+using namespace asc::ccu;
62 62 
63// Scenario: Select different execution paths based on the value of the stage variable.63// Scenario: Select different execution paths based on the value of the stage variable.
64-CcuResult my_kernel(ccu_kernel_arg arg) {64+ccu_result my_kernel(ccu_kernel_arg arg) {
65 variable flag;65 variable flag;
66 load_arg(flag, 0); // Load the flag value from taskArgs[0] on each dispatch.66 load_arg(flag, 0); // Load the flag value from taskArgs[0] on each dispatch.
67 67 
@@ -72,6 +72,6 @@ CcuResult my_kernel(ccu_kernel_arg arg) {
72 b = 20;72 b = 20;
73 }73 }
74 74 
75- return CCU_SUCCESS;75+ return ccu_result::CCU_SUCCESS;
76}76}
77```77```
@@ -25,7 +25,7 @@
25 25 
26## Function Description26## Function Description
27 27 
28-Header file: `#include "ccu/hcomm/ccu_primitives.hpp"`28+Header file: `#include <ccu/asc_ccu.h>`
29 29 
30`CCU_WHILE` is a preprocessor macro that supports two semantics, which are automatically distinguished by whether a `CCU_DO` precedes it:30`CCU_WHILE` is a preprocessor macro that supports two semantics, which are automatically distinguished by whether a `CCU_DO` precedes it:
31 31 
@@ -52,13 +52,13 @@ CCU_DO {
52 52 
53| Parameter | Description |53| Parameter | Description |
54| --- | --- |54| --- | --- |
55-| cond_expr | Conditional expression of the `AscendC::ccu::cond_expr` type. It is generated by `operator==(uint64_t)` or `operator!=(uint64_t)` of `ccu::variable`, for example, `counter == 10`. The condition is computed by the CCU hardware at the dispatch stage. |55+| cond_expr | Conditional expression of the `asc::ccu::cond_expr` type. It is generated by `operator==(uint64_t)` or `operator!=(uint64_t)` of `ccu::variable`, for example, `counter == 10`. The condition is computed by the CCU hardware at the dispatch stage. |
56 56 
57For the definition and generation of `cond_expr`, see [CCU_IF](CCU_IF.md#parameters).57For the definition and generation of `cond_expr`, see [CCU_IF](CCU_IF.md#parameters).
58 58 
59## Return Value59## Return Value
60 60 
61-`CCU_WHILE` is a preprocessor macro and does not return [`CcuResult`](https://gitcode.com/cann/hcomm/blob/master/docs/en/api_ref/comm_opdev/datatype_definition/CcuResult.md) by itself. If an internal error occurs after macro expansion (such as a duplicate label or an invalid handle), `CCU_E_PARA`/`CCU_E_NOT_FOUND` may be produced. In this case, the macro does not throw an exception and does not block kernel generation: on failure, the body is skipped, but kernel generation still succeeds, and the error is not reported through the return value, so pay attention to it during debugging.61+`CCU_WHILE` is a preprocessor macro and does not return `ccu_result` by itself. If an internal error occurs after macro expansion (such as a duplicate label or an invalid handle), `ccu_result::CCU_E_PARA`/`ccu_result::CCU_E_NOT_FOUND` may be produced. In this case, the macro does not throw an exception and does not block kernel generation: on failure, the body is skipped, but kernel generation still succeeds, and the error is not reported through the return value, so pay attention to it during debugging.
62 62 
63## Usage Constraints63## Usage Constraints
64 64 
@@ -72,10 +72,10 @@ For the definition and generation of `cond_expr`, see [CCU_IF](CCU_IF.md#paramet
72## Call Example72## Call Example
73 73 
74```cpp74```cpp
75-using namespace AscendC::ccu;75+using namespace asc::ccu;
76 76 
77// Scenario: a standalone while loop that iterates the counter 10 times.77// Scenario: a standalone while loop that iterates the counter 10 times.
78-CcuResult my_kernel(ccu_kernel_arg arg) {78+ccu_result my_kernel(ccu_kernel_arg arg) {
79 variable counter, one;79 variable counter, one;
80 counter = 0;80 counter = 0;
81 one = 1;81 one = 1;
@@ -85,6 +85,6 @@ CcuResult my_kernel(ccu_kernel_arg arg) {
85 counter = counter + one;85 counter = counter + one;
86 }86 }
87 87 
88- return CCU_SUCCESS;88+ return ccu_result::CCU_SUCCESS;
89}89}
90```90```
@@ -25,22 +25,22 @@
25 25 
26## Function Description26## Function Description
27 27 
28-Header file: `#include "ccu/hcomm/ccu_primitives.hpp"`28+Header file: `#include <ccu/asc_ccu.h>`
29 29 
30This API is used for calling function blocks. It is used together with [func](func.md). On the first call, `call_func<obj>(args...)` executes the lambda of `obj`, synthesizes the logic into a function block, and appends a jump instruction. Subsequent calls to the same `obj` only append a jump instruction and reuse the synthesized function block. For how to define a function block, see [func](func.md).30This API is used for calling function blocks. It is used together with [func](func.md). On the first call, `call_func<obj>(args...)` executes the lambda of `obj`, synthesizes the logic into a function block, and appends a jump instruction. Subsequent calls to the same `obj` only append a jump instruction and reuse the synthesized function block. For how to define a function block, see [func](func.md).
31 31 
32## Function Prototype32## Function Prototype
33 33 
34```cpp34```cpp
35-namespace AscendC {35+namespace asc {
36namespace ccu {36namespace ccu {
37 37 
38// obj must be a ccu::func object in namespace scope or with static storage, and each argument in args must be a ccu::variable.38// obj must be a ccu::func object in namespace scope or with static storage, and each argument in args must be a ccu::variable.
39template <func &obj, typename... args>39template <func &obj, typename... args>
40-CcuResult call_func(args... args_);40+ccu_result call_func(args... args_);
41 41 
42} // namespace ccu42} // namespace ccu
43-} // namespace AscendC43+} // namespace asc
44```44```
45 45 
46## Parameters46## Parameters
@@ -52,12 +52,12 @@ CcuResult call_func(args... args_);
52 52 
53## Return Value53## Return Value
54 54 
55-[`CcuResult`](https://gitcode.com/cann/hcomm/blob/master/docs/en/api_ref/comm_opdev/datatype_definition/CcuResult.md): The API returns `CCU_SUCCESS` on success, and other values on failure.55+`ccu_result`: The API returns `ccu_result::CCU_SUCCESS` on success, and other values on failure.
56 56 
57| Return Value | Description |57| Return Value | Description |
58| --- | --- |58| --- | --- |
59-| `CCU_SUCCESS` | The operation is successful. |59+| `ccu_result::CCU_SUCCESS` | The operation is successful. |
60-| `CCU_E_PARA` | The number of arguments does not match the number of lambda parameters of `obj`. |60+| `ccu_result::CCU_E_PARA` | The number of arguments does not match the number of lambda parameters of `obj`. |
61| Others | The corresponding error code returned when the jump instruction fails to be issued. |61| Others | The corresponding error code returned when the jump instruction fails to be issued. |
62 62 
63> [!NOTE] Note63> [!NOTE] Note
@@ -66,15 +66,15 @@ CcuResult call_func(args... args_);
66## Usage Constraints66## Usage Constraints
67 67 
68- `obj` must be a `ccu::func` object in namespace scope or with static storage, and cannot be a function-local variable: `call_func` uses a `func` object reference as the template parameter, which is a C++ language requirement. Violating this causes a compile-time error.68- `obj` must be a `ccu::func` object in namespace scope or with static storage, and cannot be a function-local variable: `call_func` uses a `func` object reference as the template parameter, which is a C++ language requirement. Violating this causes a compile-time error.
69-- Do not call it inside a hardware loop body; otherwise, an exception is thrown (error code `CCU_E_INTERNAL`).69+- Do not call it inside a hardware loop body; otherwise, an exception is thrown (error code `ccu_result::CCU_E_INTERNAL`).
70-- Nested calls are not allowed: `call_func` cannot be called again inside a lambda. Otherwise, an exception is thrown (error code `CCU_E_INTERNAL`).70+- Nested calls are not allowed: `call_func` cannot be called again inside a lambda. Otherwise, an exception is thrown (error code `ccu_result::CCU_E_INTERNAL`).
71- The function block is synthesized on the first call, and subsequent calls to the same `obj` reuse the existing function block. Different `ccu::func` objects synthesize independent function blocks even if their lambda content is identical.71- The function block is synthesized on the first call, and subsequent calls to the same `obj` reuse the existing function block. Different `ccu::func` objects synthesize independent function blocks even if their lambda content is identical.
72-- Thrown exceptions are uniformly caught by `<<<>>>`, which returns `CCU_E_INTERNAL` to the caller. The caller does not need to catch them.72+- Thrown exceptions are uniformly caught by `<<<>>>`, which returns `ccu_result::CCU_E_INTERNAL` to the caller. The caller does not need to catch them.
73 73 
74## Call Example74## Call Example
75 75 
76```cpp76```cpp
77-using namespace AscendC::ccu;77+using namespace asc::ccu;
78 78 
79// Declare a static object at namespace scope to satisfy the linkage requirement of the template parameter.79// Declare a static object at namespace scope to satisfy the linkage requirement of the template parameter.
80static func add_dbl([](variable x) {80static func add_dbl([](variable x) {
@@ -82,14 +82,14 @@ static func add_dbl([](variable x) {
82 tmp = x + x; // Double x.82 tmp = x + x; // Double x.
83});83});
84 84 
85-CcuResult my_kernel(ccu_kernel_arg arg) {85+ccu_result my_kernel(ccu_kernel_arg arg) {
86 variable a, b;86 variable a, b;
87 a = 2;87 a = 2;
88 b = 5;88 b = 5;
89 89 
90 // First call: synthesize the function block and append a jump instruction.90 // First call: synthesize the function block and append a jump instruction.
91- CcuResult ret = call_func<add_dbl>(a);91+ ccu_result ret = call_func<add_dbl>(a);
92- if (ret != CCU_SUCCESS) { return ret; }92+ if (ret != ccu_result::CCU_SUCCESS) { return ret; }
93 93 
94 // Second call: append only a jump instruction and reuse the synthesized function block.94 // Second call: append only a jump instruction and reuse the synthesized function block.
95 return call_func<add_dbl>(b);95 return call_func<add_dbl>(b);
@@ -25,7 +25,7 @@
25 25 
26## Function Description26## Function Description
27 27 
28-Header file: `#include "ccu/hcomm/ccu_primitives.hpp"`28+Header file: `#include <ccu/asc_ccu.h>`
29 29 
30`ccu::func` wraps a lambda into a reusable function block (FuncBlock): at construction, it only records the lambda without generating instructions; when first called through [call_func](call_func.md), it executes the lambda and synthesizes the logic into a single instruction block; each subsequent call only appends a jump instruction and reuses the same instruction block, thereby saving instruction space. The lambda has zero or more `ccu::variable` parameters, which are bound to arguments at calls, and returns `void`.30`ccu::func` wraps a lambda into a reusable function block (FuncBlock): at construction, it only records the lambda without generating instructions; when first called through [call_func](call_func.md), it executes the lambda and synthesizes the logic into a single instruction block; each subsequent call only appends a jump instruction and reuses the same instruction block, thereby saving instruction space. The lambda has zero or more `ccu::variable` parameters, which are bound to arguments at calls, and returns `void`.
31 31 
@@ -35,7 +35,7 @@ Header file: `#include "ccu/hcomm/ccu_primitives.hpp"`
35## Class Declaration35## Class Declaration
36 36 
37```cpp37```cpp
38-namespace AscendC {38+namespace asc {
39namespace ccu {39namespace ccu {
40 40 
41class func {41class func {
@@ -49,7 +49,7 @@ public:
49};49};
50 50 
51} // namespace ccu51} // namespace ccu
52-} // namespace AscendC52+} // namespace asc
53```53```
54 54 
55## Parameters55## Parameters
@@ -72,7 +72,7 @@ None.
72## Call Example72## Call Example
73 73 
74```cpp74```cpp
75-using namespace AscendC::ccu;75+using namespace asc::ccu;
76 76 
77static func add_dbl([](variable x) {77static func add_dbl([](variable x) {
78 variable tmp;78 variable tmp;
@@ -25,7 +25,7 @@
25 25 
26## Function Description26## Function Description
27 27 
28-Header file: `#include "ccu/hcomm/ccu_primitives.hpp"`28+Header file: `#include <ccu/asc_ccu.h>`
29 29 
30`ccu::loop` is a hardware loop class within the CCU kernel, used to describe a piece of copy logic that needs to be executed repeatedly.30`ccu::loop` is a hardware loop class within the CCU kernel, used to describe a piece of copy logic that needs to be executed repeatedly.
31 31 
@@ -37,7 +37,7 @@ Only one copy of the loop body instructions is recorded. During the delivery pha
37## Class Declaration37## Class Declaration
38 38 
39```cpp39```cpp
40-namespace AscendC {40+namespace asc {
41namespace ccu {41namespace ccu {
42 42 
43class loop {43class loop {
@@ -50,7 +50,7 @@ public:
50};50};
51 51 
52} // namespace ccu52} // namespace ccu
53-} // namespace AscendC53+} // namespace asc
54```54```
55 55 
56## Parameters56## Parameters
@@ -85,10 +85,10 @@ None. If construction fails, an exception is thrown and uniformly caught by `<<<
85 85 
86## Usage Constraints86## Usage Constraints
87 87 
88-- The lambda of the loop body must have no input parameters. If it has input parameters, `<<<>>>` throws the `CCU_E_PARA` exception.88+- The lambda of the loop body must have no input parameters. If it has input parameters, `<<<>>>` throws the `ccu_result::CCU_E_PARA` exception.
89- After construction is complete, no more content can be appended to this loop.89- After construction is complete, no more content can be appended to this loop.
90- API restrictions within the loop body:90- API restrictions within the loop body:
91- - [event_record](../synchronization/event_record.md) cannot be called. If called, it returns `CCU_E_NOT_SUPPORT`.91+ - [event_record](../synchronization/event_record.md) cannot be called. If called, it returns `ccu_result::CCU_E_NOT_SUPPORT`.
92 - Software branch macros such as [CCU_IF](CCU_IF.md) cannot be used. The code does not report an error, but the hardware exhibits undefined behavior.92 - Software branch macros such as [CCU_IF](CCU_IF.md) cannot be used. The code does not report an error, but the hardware exhibits undefined behavior.
93 - [notify_record](../synchronization/notify_record.md) and [write_variable_with_notify](../synchronization/write_variable_with_notify.md) do not report an error, but when the loop body is replicated into multiple copies for parallel execution, the signal is sent repeatedly. Avoid using them.93 - [notify_record](../synchronization/notify_record.md) and [write_variable_with_notify](../synchronization/write_variable_with_notify.md) do not report an error, but when the loop body is replicated into multiple copies for parallel execution, the signal is sent repeatedly. Avoid using them.
94- `ccu::loop` must be added to a `ccu::loop_group` to issue hardware loop instructions. Do not use it alone. For details, see [Function Description](#function-description).94- `ccu::loop` must be added to a `ccu::loop_group` to issue hardware loop instructions. Do not use it alone. For details, see [Function Description](#function-description).
@@ -97,11 +97,11 @@ None. If construction fails, an exception is thrown and uniformly caught by `<<<
97## Call Example97## Call Example
98 98 
99```cpp99```cpp
100-using namespace AscendC::ccu;100+using namespace asc::ccu;
101 101 
102// Scenario: Move four contiguous 4 KB data blocks from on-chip memory to the CCU Buffer in sequence.102// Scenario: Move four contiguous 4 KB data blocks from on-chip memory to the CCU Buffer in sequence.
103// The hardware loop updates the address by addr_offset each round, so no manual address increment is required.103// The hardware loop updates the address by addr_offset each round, so no manual address increment is required.
104-CcuResult my_kernel(ccu_kernel_arg arg) {104+ccu_result my_kernel(ccu_kernel_arg arg) {
105 variable r1, numA, numB;105 variable r1, numA, numB;
106 numA = 10;106 numA = 10;
107 numB = 20;107 numB = 20;
@@ -121,6 +121,6 @@ CcuResult my_kernel(ccu_kernel_arg arg) {
121 ccu_loop_group_config grp_cfg{}; // For a single-loop scenario, set all fields to 0.121 ccu_loop_group_config grp_cfg{}; // For a single-loop scenario, set all fields to 0.
122 loop_group g(grp_cfg, /*max_loop_num=*/1, {l});122 loop_group g(grp_cfg, /*max_loop_num=*/1, {l});
123 123 
124- return CCU_SUCCESS;124+ return ccu_result::CCU_SUCCESS;
125}125}
126```126```
@@ -25,7 +25,7 @@
25 25 
26## Function Description26## Function Description
27 27 
28-Header file: `#include "ccu/hcomm/ccu_primitives.hpp"`28+Header file: `#include <ccu/asc_ccu.h>`
29 29 
30A hardware **LoopGroup** class in the CCU kernel that organizes multiple `ccu::loop` objects into a group to share the same **LoopEngine** resource pool, preventing resource exhaustion caused by multiple independent `loop` objects each exclusively occupying the **LoopEngine**.30A hardware **LoopGroup** class in the CCU kernel that organizes multiple `ccu::loop` objects into a group to share the same **LoopEngine** resource pool, preventing resource exhaustion caused by multiple independent `loop` objects each exclusively occupying the **LoopEngine**.
31 31 
@@ -34,7 +34,7 @@ When constructing `ccu::loop_group`, each `loop` in the passed `loops` list is a
34## Class Declaration34## Class Declaration
35 35 
36```cpp36```cpp
37-namespace AscendC {37+namespace asc {
38namespace ccu {38namespace ccu {
39 39 
40class loop_group {40class loop_group {
@@ -49,7 +49,7 @@ public:
49};49};
50 50 
51} // namespace ccu51} // namespace ccu
52-} // namespace AscendC52+} // namespace asc
53```53```
54 54 
55## Parameters55## Parameters
@@ -96,13 +96,13 @@ Example: [47:41]=4, [54:48]=1, and [61:55]=3 indicate a total of 4 loop instruct
96 96 
97## Return Value97## Return Value
98 98 
99-None. If construction fails, an exception is thrown (carrying the [`CcuResult`](https://gitcode.com/cann/hcomm/blob/master/docs/en/api_ref/comm_opdev/datatype_definition/CcuResult.md) error code), which is uniformly caught by `<<<>>>` and returned as an error code. Common reasons:99+None. If construction fails, an exception is thrown (carrying the `ccu_result` error code), which is uniformly caught by `<<<>>>` and returned as an error code. Common reasons:
100 100 
101| Reason | Error Code |101| Reason | Error Code |
102| --- | --- |102| --- | --- |
103-| `max_loop_num` is 0, or the `variable` passed in var-based construction is invalid. | `CCU_E_PARA` |103+| `max_loop_num` is 0, or the `variable` passed in var-based construction is invalid. | `ccu_result::CCU_E_PARA` |
104-| The number of loops actually added exceeds `max_loop_num` (insufficient LoopEngine pool capacity). | `CCU_E_PARA` |104+| The number of loops actually added exceeds `max_loop_num` (insufficient LoopEngine pool capacity). | `ccu_result::CCU_E_PARA` |
105-| Insufficient physical resources. | `CCU_E_UNAVAIL`, etc. |105+| Insufficient physical resources. | `ccu_result::CCU_E_UNAVAIL`, etc. |
106 106 
107## Usage Constraints107## Usage Constraints
108 108 
@@ -110,18 +110,18 @@ None. If construction fails, an exception is thrown (carrying the [`CcuResult`](
110- The `ccu::loop` objects in the `loops` list must have been constructed before the `ccu::loop_group` is constructed, that is, the loop body has been recorded.110- The `ccu::loop` objects in the `loops` list must have been constructed before the `ccu::loop_group` is constructed, that is, the loop body has been recorded.
111- The same `ccu::loop` object should not be added to multiple `ccu::loop_group` objects.111- The same `ccu::loop` object should not be added to multiple `ccu::loop_group` objects.
112- The loop body constraints of each loop in a group are the same as those of an independent `ccu::loop` (see the constraints in [loop](loop.md)).112- The loop body constraints of each loop in a group are the same as those of an independent `ccu::loop` (see the constraints in [loop](loop.md)).
113-- `max_loop_num` must be greater than 0. If it is 0, construction fails directly (`CCU_E_PARA`).113+- `max_loop_num` must be greater than 0. If it is 0, construction fails directly (`ccu_result::CCU_E_PARA`).
114-- `max_loop_num` should be greater than or equal to the actual size of the `loops` list (that is, the number of loops that will actually be added to the group, including those reused by unrolling). If it is too small, adding loops later will fail due to insufficient LoopEngine pool capacity (`CCU_E_PARA`).114+- `max_loop_num` should be greater than or equal to the actual size of the `loops` list (that is, the number of loops that will actually be added to the group, including those reused by unrolling). If it is too small, adding loops later will fail due to insufficient LoopEngine pool capacity (`ccu_result::CCU_E_PARA`).
115 115 
116## Call Example116## Call Example
117 117 
118- config-based:118- config-based:
119 119 
120 ```cpp120 ```cpp
121- using namespace AscendC::ccu;121+ using namespace asc::ccu;
122 122 
123 // Scenario: two loops share the LoopEngine resource pool.123 // Scenario: two loops share the LoopEngine resource pool.
124- CcuResult my_kernel(ccu_kernel_arg arg) {124+ ccu_result my_kernel(ccu_kernel_arg arg) {
125 variable r1, r2, numA, numB;125 variable r1, r2, numA, numB;
126 numA = 10; numB = 20;126 numA = 10; numB = 20;
127 127 
@@ -147,7 +147,7 @@ None. If construction fails, an exception is thrown (carrying the [`CcuResult`](
147 grp_cfg.event_offset = 0;147 grp_cfg.event_offset = 0;
148 loop_group g(grp_cfg, /*max_loop_num=*/2, {l1, l2});148 loop_group g(grp_cfg, /*max_loop_num=*/2, {l1, l2});
149 149 
150- return CCU_SUCCESS;150+ return ccu_result::CCU_SUCCESS;
151 }151 }
152 ```152 ```
153 153 
@@ -160,7 +160,7 @@ None. If construction fails, an exception is thrown (carrying the [`CcuResult`](
160 uint64_t numB;160 uint64_t numB;
161 };161 };
162 162 
163- CcuResult my_kernel(ccu_kernel_arg arg)163+ ccu_result my_kernel(ccu_kernel_arg arg)
164 {164 {
165 using namespace ccu;165 using namespace ccu;
166 auto* args = static_cast<my_kernel_arg*>(arg); // ccu_kernel_arg is void*. Cast it to the user argument struct first.166 auto* args = static_cast<my_kernel_arg*>(arg); // ccu_kernel_arg is void*. Cast it to the user argument struct first.
@@ -194,6 +194,6 @@ None. If construction fails, an exception is thrown (carrying the [`CcuResult`](
194 194 
195 loop_group group(var_parallel, var_offset, /*max_loop_num=*/4, {loop1, loop2});195 loop_group group(var_parallel, var_offset, /*max_loop_num=*/4, {loop1, loop2});
196 196 
197- return CCU_SUCCESS;197+ return ccu_result::CCU_SUCCESS;
198 }198 }
199 ```199 ```
@@ -25,7 +25,7 @@
25 25 
26## Function Description26## Function Description
27 27 
28-Header file: `#include "ccu/hcomm/ccu_primitives.hpp"`.28+Header file: `#include <ccu/asc_ccu.h>`.
29 29 
30`ccu::address` is a C++ wrapper class for the address register in the CCU kernel. It stores address values and supports assignment and addition operations.30`ccu::address` is a C++ wrapper class for the address register in the CCU kernel. It stores address values and supports assignment and addition operations.
31 31 
@@ -41,7 +41,7 @@ Unlike [`variable`](variable.md), which stores scalar values, `address` specific
41## Class Declaration41## Class Declaration
42 42 
43```cpp43```cpp
44-namespace AscendC {44+namespace asc {
45namespace ccu {45namespace ccu {
46class address final {46class address final {
47public:47public:
@@ -64,7 +64,7 @@ public:
64// variable + address (commutative, global function)64// variable + address (commutative, global function)
65/*Internal expression object*/ operator+(const variable& var, const address& addr);65/*Internal expression object*/ operator+(const variable& var, const address& addr);
66} // namespace ccu66} // namespace ccu
67-} // namespace AscendC67+} // namespace asc
68```68```
69 69 
70## Constructor Description70## Constructor Description
@@ -94,8 +94,8 @@ public:
94 94 
95## Usage Constraints95## Usage Constraints
96 96 
97-- It can only be constructed during the compilation phase; constructing outside the compilation phase throws an exception carrying `CCU_E_PTR`.97+- It can only be constructed during the compilation phase; constructing outside the compilation phase throws an exception carrying `ccu_result::CCU_E_PTR`.
98-- The default constructor only requests a virtual handle and always succeeds without throwing an exception during the compilation phase; when `address` physical resources are insufficient, the compilation phase returns `CCU_E_UNAVAIL` instead of throwing at construction time.98+- The default constructor only requests a virtual handle and always succeeds without throwing an exception during the compilation phase; when `address` physical resources are insufficient, the compilation phase returns `ccu_result::CCU_E_UNAVAIL` instead of throwing at construction time.
99- The copy/move constructors only copy the `handle` field and do not request a new `address`; after `address a2 = a1;`, both objects point to the same address register. `operator=(const address&)` issues a device-side register assignment instruction. To obtain an independent `address`, you must explicitly use the default constructor.99- The copy/move constructors only copy the `handle` field and do not request a new `address`; after `address a2 = a1;`, both objects point to the same address register. `operator=(const address&)` issues a device-side register assignment instruction. To obtain an independent `address`, you must explicitly use the default constructor.
100- Do not save or compare the `handle` value outside the kernel; the handle becomes invalid after translation completes.100- Do not save or compare the `handle` value outside the kernel; the handle becomes invalid after translation completes.
101- `address` cannot be assigned to `variable`, that is, the `variable = address` operation is not provided.101- `address` cannot be assigned to `variable`, that is, the `variable = address` operation is not provided.
@@ -105,9 +105,9 @@ public:
105## Call Example105## Call Example
106 106 
107```cpp107```cpp
108-using namespace AscendC::ccu;108+using namespace asc::ccu;
109 109 
110-CcuResult my_kernel(ccu_kernel_arg arg) {110+ccu_result my_kernel(ccu_kernel_arg arg) {
111 address base, dst;111 address base, dst;
112 variable offset, stride;112 variable offset, stride;
113 113 
@@ -131,6 +131,6 @@ CcuResult my_kernel(ccu_kernel_arg arg) {
131 address result;131 address result;
132 result = base + dst;132 result = base + dst;
133 133 
134- return CCU_SUCCESS;134+ return ccu_result::CCU_SUCCESS;
135}135}
136```136```
@@ -25,7 +25,7 @@
25 25 
26## Function Description26## Function Description
27 27 
28-Header file: `#include "ccu/hcomm/ccu_primitives.hpp"`28+Header file: `#include <ccu/asc_ccu.h>`
29 29 
30`ccu::array<T>` is a C++ template class for batch holding of physically contiguous resources within a CCU kernel.30`ccu::array<T>` is a C++ template class for batch holding of physically contiguous resources within a CCU kernel.
31 31 
@@ -37,7 +37,7 @@ Header file: `#include "ccu/hcomm/ccu_primitives.hpp"`
37## Class Declaration37## Class Declaration
38 38 
39```cpp39```cpp
40-namespace AscendC {40+namespace asc {
41namespace ccu {41namespace ccu {
42template <typename T> // T supports only variable, event, and ccu_buffer.42template <typename T> // T supports only variable, event, and ccu_buffer.
43class array final {43class array final {
@@ -57,7 +57,7 @@ public:
57 array& operator=(array&& other) noexcept;57 array& operator=(array&& other) noexcept;
58};58};
59} // namespace ccu59} // namespace ccu
60-} // namespace AscendC60+} // namespace asc
61```61```
62 62 
63## Parameters63## Parameters
@@ -104,18 +104,18 @@ Currently, only the following three specialized types are supported:
104## Usage Constraints104## Usage Constraints
105 105 
106- `array(count)` and `array(acq_handle, count)` can only be constructed at compile time.106- `array(count)` and `array(acq_handle, count)` can only be constructed at compile time.
107-- `array(count)` always succeeds. When the resource pool cannot provide `count` contiguous physical resources, `CCU_E_UNAVAIL` is returned at compile time instead of being thrown at construction time.107+- `array(count)` always succeeds. When the resource pool cannot provide `count` contiguous physical resources, `ccu_result::CCU_E_UNAVAIL` is returned at compile time instead of being thrown at construction time.
108- `array<T>` is specialized only for the three types `variable`, `event`, and `ccu_buffer`. Reserved construction is available only for `variable` and `event`. Instantiating other types or using reserved construction for them fails at compile time.108- `array<T>` is specialized only for the three types `variable`, `event`, and `ccu_buffer`. Reserved construction is available only for `variable` and `event`. Instantiating other types or using reserved construction for them fails at compile time.
109-- When `count > 0`, `array(acq_handle, count)` validates the reserved handle and `count`. If the parameters are invalid, an exception is thrown, caught uniformly by `<<<>>>`, and `CCU_E_INTERNAL` is returned externally, aborting the current compilation round.109+- When `count > 0`, `array(acq_handle, count)` validates the reserved handle and `count`. If the parameters are invalid, an exception is thrown, caught uniformly by `<<<>>>`, and `ccu_result::CCU_E_INTERNAL` is returned externally, aborting the current compilation round.
110- `count` must not exceed the number of resources under the reserved handle. When `count` is 0, an empty `array` is constructed directly (`size() == 0`), with no resources bound and no validation of `acq_handle`.110- `count` must not exceed the number of resources under the reserved handle. When `count` is 0, an empty `array` is constructed directly (`size() == 0`), with no resources bound and no validation of `acq_handle`.
111- Do not save the `handle` value of an element outside the kernel. The handle becomes invalid after translation is complete.111- Do not save the `handle` value of an element outside the kernel. The handle becomes invalid after translation is complete.
112 112 
113## Call Example113## Call Example
114 114 
115```cpp115```cpp
116-using namespace AscendC::ccu;116+using namespace asc::ccu;
117 117 
118-CcuResult my_kernel(ccu_kernel_arg arg) {118+ccu_result my_kernel(ccu_kernel_arg arg) {
119 // Request four physically contiguous variables in a batch.119 // Request four physically contiguous variables in a batch.
120 array<variable> v_arr(4);120 array<variable> v_arr(4);
121 121 
@@ -125,14 +125,14 @@ CcuResult my_kernel(ccu_kernel_arg arg) {
125 // Access a single element by subscript.125 // Access a single element by subscript.
126 v_arr[0] = 1024; // Assign an immediate value to the 0th variable.126 v_arr[0] = 1024; // Assign an immediate value to the 0th variable.
127 127 
128- return CCU_SUCCESS;128+ return ccu_result::CCU_SUCCESS;
129}129}
130```130```
131 131 
132Usage of binding resources reserved on the host side:132Usage of binding resources reserved on the host side:
133 133 
134```cpp134```cpp
135-using namespace AscendC::ccu;135+using namespace asc::ccu;
136 136 
137// After the host reserves resources through asccomm_ccu_variable_alloc/asccomm_ccu_event_alloc,137// After the host reserves resources through asccomm_ccu_variable_alloc/asccomm_ccu_event_alloc,
138// put the reserved handles and counts into kernelArg and pass them to the kernel.138// put the reserved handles and counts into kernelArg and pass them to the kernel.
@@ -143,7 +143,7 @@ struct my_kernel_arg {
143 uint32_t event_num;143 uint32_t event_num;
144};144};
145 145 
146-CcuResult my_kernel(ccu_kernel_arg arg) {146+ccu_result my_kernel(ccu_kernel_arg arg) {
147 auto* args = static_cast<my_kernel_arg*>(arg);147 auto* args = static_cast<my_kernel_arg*>(arg);
148 148 
149 // Bind the var_num scalar registers reserved on the host without requesting new scalar registers. The bound variables are used in the same way as149 // Bind the var_num scalar registers reserved on the host without requesting new scalar registers. The bound variables are used in the same way as
@@ -159,6 +159,6 @@ CcuResult my_kernel(ccu_kernel_arg arg) {
159 event_record(events[i]);159 event_record(events[i]);
160 }160 }
161 161 
162- return CCU_SUCCESS;162+ return ccu_result::CCU_SUCCESS;
163}163}
164```164```
@@ -25,7 +25,7 @@
25 25 
26## Function Description26## Function Description
27 27 
28-Header file: `#include "ccu/hcomm/ccu_primitives.hpp"`28+Header file: `#include <ccu/asc_ccu.h>`
29 29 
30`ccu::ccu_buffer` is a C++ wrapper class for the on-chip CCU Buffer inside a CCU kernel. Each slice is fixed at 4096 bytes and is used to relay data between on-chip memory and the peer.30`ccu::ccu_buffer` is a C++ wrapper class for the on-chip CCU Buffer inside a CCU kernel. Each slice is fixed at 4096 bytes and is used to relay data between on-chip memory and the peer.
31 31 
@@ -38,7 +38,7 @@ Header file: `#include "ccu/hcomm/ccu_primitives.hpp"`
38## Class Declaration38## Class Declaration
39 39 
40```cpp40```cpp
41-namespace AscendC {41+namespace asc {
42namespace ccu {42namespace ccu {
43class ccu_buffer final {43class ccu_buffer final {
44public:44public:
@@ -46,7 +46,7 @@ public:
46 ccu_buffer_handle handle{0}; // Virtual handle.46 ccu_buffer_handle handle{0}; // Virtual handle.
47};47};
48} // namespace ccu48} // namespace ccu
49-} // namespace AscendC49+} // namespace asc
50```50```
51 51 
52## Constructor Description52## Constructor Description
@@ -57,8 +57,8 @@ public:
57 57 
58## Usage Constraints58## Usage Constraints
59 59 
60-- It can only be constructed during the compilation phase; constructing it outside the compilation phase throws an exception carrying `CCU_E_PTR`.60+- It can only be constructed during the compilation phase; constructing it outside the compilation phase throws an exception carrying `ccu_result::CCU_E_PTR`.
61-- The default constructor only requests a virtual handle and always succeeds without throwing an exception during the compilation phase; when CCU Buffer physical resources are insufficient, the compilation phase returns `CCU_E_UNAVAIL` instead of throwing an exception at construction time.61+- The default constructor only requests a virtual handle and always succeeds without throwing an exception during the compilation phase; when CCU Buffer physical resources are insufficient, the compilation phase returns `ccu_result::CCU_E_UNAVAIL` instead of throwing an exception at construction time.
62- The copy/move constructors only copy the `handle` field and do not request a new CCU Buffer slice. After `ccu_buffer b2 = b1;`, both objects point to the same slice. To obtain an independent `ccu_buffer`, you must explicitly use the default constructor or use [`array<ccu_buffer>`](array.md).62- The copy/move constructors only copy the `handle` field and do not request a new CCU Buffer slice. After `ccu_buffer b2 = b1;`, both objects point to the same slice. To obtain an independent `ccu_buffer`, you must explicitly use the default constructor or use [`array<ccu_buffer>`](array.md).
63- Do not save or compare the `handle` value outside the kernel; the handle becomes invalid once translation is complete.63- Do not save or compare the `handle` value outside the kernel; the handle becomes invalid once translation is complete.
64- Each `ccu_buffer` always represents a 4096-byte on-chip slice, and its size is not configurable.64- Each `ccu_buffer` always represents a 4096-byte on-chip slice, and its size is not configurable.
@@ -67,9 +67,9 @@ public:
67## Call Example67## Call Example
68 68 
69```cpp69```cpp
70-using namespace AscendC::ccu;70+using namespace asc::ccu;
71 71 
72-CcuResult my_kernel(ccu_kernel_arg arg) {72+ccu_result my_kernel(ccu_kernel_arg arg) {
73 ccu_buffer buf; // Request one 4 KB CCU Buffer slice.73 ccu_buffer buf; // Request one 4 KB CCU Buffer slice.
74 local_addr src;74 local_addr src;
75 variable len;75 variable len;
@@ -79,6 +79,6 @@ CcuResult my_kernel(ccu_kernel_arg arg) {
79 local_copy(buf, src, len, evt);79 local_copy(buf, src, len, evt);
80 event_wait(evt);80 event_wait(evt);
81 81 
82- return CCU_SUCCESS;82+ return ccu_result::CCU_SUCCESS;
83}83}
84```84```
@@ -25,7 +25,7 @@
25 25 
26## Function Description26## Function Description
27 27 
28-Header file: `#include "ccu/hcomm/ccu_primitives.hpp"`28+Header file: `#include <ccu/asc_ccu.h>`
29 29 
30`ccu::event` is a C++ wrapper class for synchronization register slots in the CCU kernel, used to mark the completion status of asynchronous operations (such as data transfers).30`ccu::event` is a C++ wrapper class for synchronization register slots in the CCU kernel, used to mark the completion status of asynchronous operations (such as data transfers).
31 31 
@@ -38,7 +38,7 @@ Header file: `#include "ccu/hcomm/ccu_primitives.hpp"`
38## Class Declaration38## Class Declaration
39 39 
40```cpp40```cpp
41-namespace AscendC {41+namespace asc {
42namespace ccu {42namespace ccu {
43class event final {43class event final {
44public:44public:
@@ -51,7 +51,7 @@ public:
51 ccu_event_handle handle{0}; // Virtual handle.51 ccu_event_handle handle{0}; // Virtual handle.
52};52};
53} // namespace ccu53} // namespace ccu
54-} // namespace AscendC54+} // namespace asc
55```55```
56 56 
57## Constructor Description57## Constructor Description
@@ -67,15 +67,15 @@ public:
67 | Parameter | Input/Output | Description |67 | Parameter | Input/Output | Description |
68 | --- | --- | --- |68 | --- | --- | --- |
69 | acq_handle | Input | Reservation handle, that is, the handle returned after the host side calls `asccomm_ccu_event_alloc` to reserve a segment of physical event slots from the instance resource pool in advance, and passes it to the kernel through `kernelArg`. |69 | acq_handle | Input | Reservation handle, that is, the handle returned after the host side calls `asccomm_ccu_event_alloc` to reserve a segment of physical event slots from the instance resource pool in advance, and passes it to the kernel through `kernelArg`. |
70- | index | Input | Index of the event slot to bind within the reserved segment. The default value is `0`, and the value range is `[0, num-1]` (`num` is the number of event slots reserved by `asccomm_ccu_event_alloc` on the host side). If the value is out of this range, a `CCU_E_PARA` exception is thrown. |70+ | index | Input | Index of the event slot to bind within the reserved segment. The default value is `0`, and the value range is `[0, num-1]` (`num` is the number of event slots reserved by `asccomm_ccu_event_alloc` on the host side). If the value is out of this range, a `ccu_result::CCU_E_PARA` exception is thrown. |
71 71 
72 Constructing multiple `event` objects with the same reservation handle and the same `index` makes them share the same physical event slot.72 Constructing multiple `event` objects with the same reservation handle and the same `index` makes them share the same physical event slot.
73 73 
74## Usage Constraints74## Usage Constraints
75 75 
76-- Construction is allowed only in the compile phase. Constructing outside the compile phase throws an exception carrying `CCU_E_PTR`.76+- Construction is allowed only in the compile phase. Constructing outside the compile phase throws an exception carrying `ccu_result::CCU_E_PTR`.
77-- The default constructor only requests a virtual handle and always succeeds without throwing an exception in the compile phase. When physical event slot resources are insufficient, the compile phase returns `CCU_E_UNAVAIL` instead of throwing an exception at construction time.77+- The default constructor only requests a virtual handle and always succeeds without throwing an exception in the compile phase. When physical event slot resources are insufficient, the compile phase returns `ccu_result::CCU_E_UNAVAIL` instead of throwing an exception at construction time.
78-- The reserved constructor validates the reservation handle and `index`. If `index` is out of the reserved segment range (`[0, num-1]`, where `num` is the number of event slots reserved on the host side), a `CCU_E_PARA` exception is thrown.78+- The reserved constructor validates the reservation handle and `index`. If `index` is out of the reserved segment range (`[0, num-1]`, where `num` is the number of event slots reserved on the host side), a `ccu_result::CCU_E_PARA` exception is thrown.
79- The copy/move constructors only copy the `handle` field and do not request a new event slot. After `event e2 = e1;`, the two objects are handles within the same kernel, and `event_record`/`event_wait` on either object operates on the same hardware status bit. To obtain an independent `event`, use the default constructor or [`array<event>`](array.md).79- The copy/move constructors only copy the `handle` field and do not request a new event slot. After `event e2 = e1;`, the two objects are handles within the same kernel, and `event_record`/`event_wait` on either object operates on the same hardware status bit. To obtain an independent `event`, use the default constructor or [`array<event>`](array.md).
80- Do not save or compare the `handle` value outside the kernel. The handle becomes invalid after translation is complete.80- Do not save or compare the `handle` value outside the kernel. The handle becomes invalid after translation is complete.
81- `event` has no `mask` field. `mask` is passed as a parameter in `event_record`/`event_wait` and data movement APIs, with a C++ default value of `1`. Different bits of the same `event` are independent of each other and can carry multiple pairs.81- `event` has no `mask` field. `mask` is passed as a parameter in `event_record`/`event_wait` and data movement APIs, with a C++ default value of `1`. Different bits of the same `event` are independent of each other and can carry multiple pairs.
@@ -83,9 +83,9 @@ public:
83## Call Example83## Call Example
84 84 
85```cpp85```cpp
86-using namespace AscendC::ccu;86+using namespace asc::ccu;
87 87 
88-CcuResult my_kernel(ccu_kernel_arg arg) {88+ccu_result my_kernel(ccu_kernel_arg arg) {
89 event evt; // Request one event slot.89 event evt; // Request one event slot.
90 90 
91 // When used with data transfer APIs: the flag bit corresponding to mask in evt is automatically set to 1 when hardware transfer completes.91 // When used with data transfer APIs: the flag bit corresponding to mask in evt is automatically set to 1 when hardware transfer completes.
@@ -94,6 +94,6 @@ CcuResult my_kernel(ccu_kernel_arg arg) {
94 local_copy(dst, src, len, evt); // mask defaults to 0x1.94 local_copy(dst, src, len, evt); // mask defaults to 0x1.
95 event_wait(evt); // Wait until bit 0 is set to 1.95 event_wait(evt); // Wait until bit 0 is set to 1.
96 96 
97- return CCU_SUCCESS;97+ return ccu_result::CCU_SUCCESS;
98}98}
99```99```
@@ -25,7 +25,7 @@
25 25 
26## Function Description26## Function Description
27 27 
28-Header file: `#include "ccu/hcomm/ccu_primitives.hpp"`28+Header file: `#include <ccu/asc_ccu.h>`
29 29 
30Obtains the handle to a channel-shared `variable` slot within a CCU kernel.30Obtains the handle to a channel-shared `variable` slot within a CCU kernel.
31 31 
@@ -36,7 +36,7 @@ Typical scenario: the remote rank writes a value into shared `variable` slot N o
36## Prototype36## Prototype
37 37 
38```cpp38```cpp
39-namespace AscendC {39+namespace asc {
40namespace ccu {40namespace ccu {
41template <typename T>41template <typename T>
42T get_res_by_channel(ChannelHandle channel, uint32_t index);42T get_res_by_channel(ChannelHandle channel, uint32_t index);
@@ -45,7 +45,7 @@ T get_res_by_channel(ChannelHandle channel, uint32_t index);
45template <>45template <>
46variable get_res_by_channel<variable>(ChannelHandle channel, uint32_t var_index);46variable get_res_by_channel<variable>(ChannelHandle channel, uint32_t var_index);
47} // namespace ccu47} // namespace ccu
48-} // namespace AscendC48+} // namespace asc
49```49```
50 50 
51## Parameters51## Parameters
@@ -55,7 +55,7 @@ The template parameter `T` is the type of the resource to obtain. Currently only
55| Parameter | Input/Output | Description |55| Parameter | Input/Output | Description |
56| --- | --- | --- |56| --- | --- | --- |
57| channel | Input | Cross-rank channel handle, of type [`ChannelHandle`](https://gitcode.com/cann/hcomm/blob/master/docs/en/api_ref/comm_opdev/datatype_definition/ChannelHandle.md), which must have completed link establishment. |57| channel | Input | Cross-rank channel handle, of type [`ChannelHandle`](https://gitcode.com/cann/hcomm/blob/master/docs/en/api_ref/comm_opdev/datatype_definition/ChannelHandle.md), which must have completed link establishment. |
58-| var_index | Input | Variable index within the channel (starting from 0), corresponding to one of the variable slots pre-allocated when the channel establishes a link. Each channel currently reserves 4 variable slots (`var_index` ranges from `[0, 3]`); values outside this range return `CCU_E_PARA`. |58+| var_index | Input | Variable index within the channel (starting from 0), corresponding to one of the variable slots pre-allocated when the channel establishes a link. Each channel currently reserves 4 variable slots (`var_index` ranges from `[0, 3]`); values outside this range return `ccu_result::CCU_E_PARA`. |
59 59 
60## Return Value60## Return Value
61 61 
@@ -65,8 +65,8 @@ If the call fails, an exception is thrown (carrying an error code). Common error
65 65 
66| Scenario | Error Code |66| Scenario | Error Code |
67| --- | --- |67| --- | --- |
68-| `channel == nullptr`, invalid channel type, or the API is called outside the compilation phase | `CCU_E_PTR` |68+| `channel == nullptr`, invalid channel type, or the API is called outside the compilation phase | `ccu_result::CCU_E_PTR` |
69-| `var_index` out of range (exceeding the size of the pre-allocated variable pool of the channel) | `CCU_E_PARA` |69+| `var_index` out of range (exceeding the size of the pre-allocated variable pool of the channel) | `ccu_result::CCU_E_PARA` |
70 70 
71## Usage Constraints71## Usage Constraints
72 72 
@@ -78,7 +78,7 @@ If the call fails, an exception is thrown (carrying an error code). Common error
78## Call Example78## Call Example
79 79 
80```cpp80```cpp
81-using namespace AscendC::ccu;81+using namespace asc::ccu;
82 82 
83// User-defined kernel argument structure, filled on the host side and passed in through kernelArg.83// User-defined kernel argument structure, filled on the host side and passed in through kernelArg.
84struct my_kernel_arg {84struct my_kernel_arg {
@@ -88,7 +88,7 @@ struct my_kernel_arg {
88// End-to-end scenario: the peer writes a value to shared variable slot 0 of the local channel through write_variable_with_notify.88// End-to-end scenario: the peer writes a value to shared variable slot 0 of the local channel through write_variable_with_notify.
89// The local kernel reads the value through get_res_by_channel.89// The local kernel reads the value through get_res_by_channel.
90 90 
91-CcuResult my_kernel(ccu_kernel_arg arg) { // arg is void*, pointing to my_kernel_arg passed from the host.91+ccu_result my_kernel(ccu_kernel_arg arg) { // arg is void*, pointing to my_kernel_arg passed from the host.
92 auto* params = static_cast<my_kernel_arg*>(arg);92 auto* params = static_cast<my_kernel_arg*>(arg);
93 ChannelHandle ch = params->channel_handle;93 ChannelHandle ch = params->channel_handle;
94 94 
@@ -102,6 +102,6 @@ CcuResult my_kernel(ccu_kernel_arg arg) { // arg is void*, pointing to my_kerne
102 variable result;102 variable result;
103 result = sync_var;103 result = sync_var;
104 104 
105- return CCU_SUCCESS;105+ return ccu_result::CCU_SUCCESS;
106}106}
107```107```
@@ -25,32 +25,32 @@
25 25 
26## Function Description26## Function Description
27 27 
28-Header file: `#include "ccu/hcomm/ccu_primitives.hpp"`28+Header file: `#include <ccu/asc_ccu.h>`
29 29 
30`ccu::local_addr` is a C++ wrapper class for the local on-chip memory address within a CCU kernel. It is a composite object of "address (`address`) + token (`variable`)".30`ccu::local_addr` is a C++ wrapper class for the local on-chip memory address within a CCU kernel. It is a composite object of "address (`address`) + token (`variable`)".
31 31 
32-- Allocation upon construction: The default constructor applies for two virtual handles, `address` and `variable`, at once, which are used for `addr_` and `token` respectively.32+- Allocation upon construction: The default constructor applies for two virtual handles, `address` and `variable`, at once, which are used for `addr` and `token` respectively.
33-No release upon destruction: Hardware resources are not released upon destruction. Physical resources are managed uniformly over the lifecycle of the CCU instance, and virtual handles become invalid after translation.33-No release upon destruction: Hardware resources are not released upon destruction. Physical resources are managed uniformly over the lifecycle of the CCU instance, and virtual handles become invalid after translation.
34 34 
35> [!NOTE] Note35> [!NOTE] Note
36> Resource allocation follows a two-phase "virtual first, physical later" model: the `local_addr()` constructor only produces virtual handles, while the actual physical resources are allocated uniformly during the compilation phase.36> Resource allocation follows a two-phase "virtual first, physical later" model: the `local_addr()` constructor only produces virtual handles, while the actual physical resources are allocated uniformly during the compilation phase.
37 37 
38-CCU hardware does not accept process virtual addresses. Accessing on-chip memory requires a token converted by `HcommCcuGetMemToken`. The `addr_` field of `local_addr` stores the physical address or the tokenized VA (Virtual Address), and the `token` field stores the matching security token value.38+CCU hardware does not accept process virtual addresses. Accessing on-chip memory requires a token converted by `HcommCcuGetMemToken`. The `addr` field of `local_addr` stores the physical address or the tokenized VA (Virtual Address), and the `token` field stores the matching security token value.
39 39 
40## Class Declaration40## Class Declaration
41 41 
42```cpp42```cpp
43-namespace AscendC {43+namespace asc {
44namespace ccu {44namespace ccu {
45class local_addr final {45class local_addr final {
46public:46public:
47 local_addr(); // Default constructor. Applies for two virtual handles, address and variable, at once.47 local_addr(); // Default constructor. Applies for two virtual handles, address and variable, at once.
48- address addr_; // Local on-chip memory address field (address register).48+ address addr; // Local on-chip memory address field (address register).
49 variable token; // Security token field (general-purpose register).49 variable token; // Security token field (general-purpose register).
50 ccu_local_addr_handle handle{0}; // Composite handle.50 ccu_local_addr_handle handle{0}; // Composite handle.
51};51};
52} // namespace ccu52} // namespace ccu
53-} // namespace AscendC53+} // namespace asc
54```54```
55 55 
56## Constructor Description56## Constructor Description
@@ -65,7 +65,7 @@ The parameters of the `local_addr` class are described as follows:
65 65 
66| Parameter | Type | Description |66| Parameter | Type | Description |
67| --- | --- | --- |67| --- | --- | --- |
68-| `addr_` | `address` | Local on-chip memory address. Assign a value through `la.addr_ = imm` (immediate value) or `la.addr_ = var` (variable). For operator semantics, see [address](address.md). |68+| `addr` | `address` | Local on-chip memory address. Assign a value through `la.addr = imm` (immediate value) or `la.addr = var` (variable). For operator semantics, see [address](address.md). |
69| `token` | `variable` | Security token value. After the host obtains it by calling `HcommCcuGetMemToken`, pass it into the kernel through `kernelArg` or `taskArgs`+`load_arg`, and then assign it to `la.token`. For operator semantics, see [variable](variable.md). |69| `token` | `variable` | Security token value. After the host obtains it by calling `HcommCcuGetMemToken`, pass it into the kernel through `kernelArg` or `taskArgs`+`load_arg`, and then assign it to `la.token`. For operator semantics, see [variable](variable.md). |
70 70 
71## Usage Constraints71## Usage Constraints
@@ -73,18 +73,18 @@ The parameters of the `local_addr` class are described as follows:
73> [!CAUTION] Caution73> [!CAUTION] Caution
74> `token` is security information. It must not be printed in host or device logs, and must not be passed across ranks in plaintext.74> `token` is security information. It must not be printed in host or device logs, and must not be passed across ranks in plaintext.
75 75 
76-- It can only be constructed during the compilation phase; constructing outside the compilation phase throws an exception carrying `CCU_E_PTR`.76+- It can only be constructed during the compilation phase; constructing outside the compilation phase throws an exception carrying `ccu_result::CCU_E_PTR`.
77-- The default constructor only requests virtual handles and always succeeds without throwing an exception during the compilation phase; when `address`/`variable` physical resources are insufficient, the compilation phase returns `CCU_E_UNAVAIL` instead of throwing an exception at construction time.77+- The default constructor only requests virtual handles and always succeeds without throwing an exception during the compilation phase; when `address`/`variable` physical resources are insufficient, the compilation phase returns `ccu_result::CCU_E_UNAVAIL` instead of throwing an exception at construction time.
78-- The copy/move constructors only copy the three fields `handle`, `addr_.handle`, and `token.handle`, and do not request new `address`/`variable`; after `local_addr l2 = l1;`, the two objects point to the same set of registers. In contrast, `operator=(const local_addr&)` emits two device-side register assignment instructions (moving the values of `other.addr_` and `other.token` over), so the two have asymmetric semantics.78+- The copy/move constructors only copy the three fields `handle`, `addr.handle`, and `token.handle`, and do not request new `address`/`variable`; after `local_addr l2 = l1;`, the two objects point to the same set of registers. In contrast, `operator=(const local_addr&)` emits two device-side register assignment instructions (moving the values of `other.addr` and `other.token` over), so the two have asymmetric semantics.
79- Do not save or compare the `handle` value outside the kernel; the handle becomes invalid after translation completes.79- Do not save or compare the `handle` value outside the kernel; the handle becomes invalid after translation completes.
80-- Do not separately call `address()`/`variable()` on the embedded `addr_`/`token` fields to construct new objects — `local_addr()` has already completed the allocation of all subfields at once.80+- Do not separately call `address()`/`variable()` on the embedded `addr`/`token` fields to construct new objects — `local_addr()` has already completed the allocation of all subfields at once.
81-- The `addr_` field must be assigned a physical address accessible to the CCU or a tokenized VA. Passing a process virtual address that has not been tokenized directly will trigger a driver error.81+- The `addr` field must be assigned a physical address accessible to the CCU or a tokenized VA. Passing a process virtual address that has not been tokenized directly will trigger a driver error.
82-- The `token` usually comes from the `HcommCcuGetMemToken` call on the host side, and must be paired with `addr_`. It must not be mixed with the remote token.82+- The `token` usually comes from the `HcommCcuGetMemToken` call on the host side, and must be paired with `addr`. It must not be mixed with the remote token.
83 83 
84## Call Example84## Call Example
85 85 
86```cpp86```cpp
87-using namespace AscendC::ccu;87+using namespace asc::ccu;
88 88 
89// User-defined kernel argument struct. The host fills it and passes it through kernelArg.89// User-defined kernel argument struct. The host fills it and passes it through kernelArg.
90// (src_addr is the local on-chip memory address, and src_token is obtained by the host through the HcommCcuGetMemToken call.)90// (src_addr is the local on-chip memory address, and src_token is obtained by the host through the HcommCcuGetMemToken call.)
@@ -93,12 +93,12 @@ struct my_kernel_arg {
93 uint64_t src_token; // Matching security token.93 uint64_t src_token; // Matching security token.
94};94};
95 95 
96-CcuResult my_kernel(ccu_kernel_arg arg) { // arg is void*, pointing to my_kernel_arg passed by the host.96+ccu_result my_kernel(ccu_kernel_arg arg) { // arg is void*, pointing to my_kernel_arg passed by the host.
97 auto* params = static_cast<my_kernel_arg*>(arg);97 auto* params = static_cast<my_kernel_arg*>(arg);
98 98 
99 local_addr src;99 local_addr src;
100 // Method 1: Assign from the kernelArg at compile time (fixed as an immediate value).100 // Method 1: Assign from the kernelArg at compile time (fixed as an immediate value).
101- src.addr_ = params->src_addr;101+ src.addr = params->src_addr;
102 src.token = params->src_token;102 src.token = params->src_token;
103 103 
104 // Method 2: Inject through taskArgs at the dispatch phase (more flexible).104 // Method 2: Inject through taskArgs at the dispatch phase (more flexible).
@@ -106,9 +106,9 @@ CcuResult my_kernel(ccu_kernel_arg arg) { // arg is void*, pointing to my_kerne
106 load_arg(addrVar, 0); // taskArgs[0] is the address.106 load_arg(addrVar, 0); // taskArgs[0] is the address.
107 load_arg(tokenVar, 1); // taskArgs[1] is the token.107 load_arg(tokenVar, 1); // taskArgs[1] is the token.
108 local_addr src2;108 local_addr src2;
109- src2.addr_ = addrVar; // Dynamic address in the dispatch phase.109+ src2.addr = addrVar; // Dynamic address in the dispatch phase.
110 src2.token = tokenVar;110 src2.token = tokenVar;
111 111 
112- return CCU_SUCCESS;112+ return ccu_result::CCU_SUCCESS;
113}113}
114```114```
@@ -25,11 +25,11 @@
25 25 
26## Function Description26## Function Description
27 27 
28-Header file: `#include "ccu/hcomm/ccu_primitives.hpp"`28+Header file: `#include <ccu/asc_ccu.h>`
29 29 
30`ccu::remote_addr` is a C++ wrapper class for the remote on-chip memory address within a CCU kernel. It is a composite object of "address (`address`) + token (`variable`)", and its structure is the same as that of [local_addr](local_addr.md).30`ccu::remote_addr` is a C++ wrapper class for the remote on-chip memory address within a CCU kernel. It is a composite object of "address (`address`) + token (`variable`)", and its structure is the same as that of [local_addr](local_addr.md).
31 31 
32-- Allocation upon construction: the default constructor applies for two virtual handles at once, `address` and `variable` (used for `addr_` and `token`, respectively).32+- Allocation upon construction: the default constructor applies for two virtual handles at once, `address` and `variable` (used for `addr` and `token`, respectively).
33-No release upon destruction: Hardware resources are not released upon destruction. Physical resources are managed uniformly over the CCU instance lifecycle, and the virtual handles become invalid after translation.33-No release upon destruction: Hardware resources are not released upon destruction. Physical resources are managed uniformly over the CCU instance lifecycle, and the virtual handles become invalid after translation.
34 34 
35> [!NOTE] Note35> [!NOTE] Note
@@ -40,17 +40,17 @@ Header file: `#include "ccu/hcomm/ccu_primitives.hpp"`
40## Class Declaration40## Class Declaration
41 41 
42```cpp42```cpp
43-namespace AscendC {43+namespace asc {
44namespace ccu {44namespace ccu {
45class remote_addr final {45class remote_addr final {
46public:46public:
47 remote_addr(); // Default constructor. Applies for one address and one variable virtual handle at once.47 remote_addr(); // Default constructor. Applies for one address and one variable virtual handle at once.
48- address addr_; // Remote on-chip memory address field (address register).48+ address addr; // Remote on-chip memory address field (address register).
49 variable token; // Remote security token field (general-purpose register).49 variable token; // Remote security token field (general-purpose register).
50 ccu_remote_addr_handle handle{0}; // Composite handle.50 ccu_remote_addr_handle handle{0}; // Composite handle.
51};51};
52} // namespace ccu52} // namespace ccu
53-} // namespace AscendC53+} // namespace asc
54```54```
55 55 
56## Constructor Description56## Constructor Description
@@ -63,25 +63,25 @@ public:
63 63 
64| Parameter | Type | Description |64| Parameter | Type | Description |
65| --- | --- | --- |65| --- | --- | --- |
66-| `addr_` | `address` | Remote on-chip memory target address. It must be filled with the remote rank's VA (Virtual Address) and token (the result of the remote `HcommCcuGetMemToken`). For operator semantics, see [address](address.md). |66+| `addr` | `address` | Remote on-chip memory target address. It must be filled with the remote rank's VA (Virtual Address) and token (the result of the remote `HcommCcuGetMemToken`). For operator semantics, see [address](address.md). |
67-| `token` | `variable` | Remote security token value. It must be paired with `addr_`, come from the remote rank, and must not be mixed with the local token. For operator semantics, see [variable](variable.md). |67+| `token` | `variable` | Remote security token value. It must be paired with `addr`, come from the remote rank, and must not be mixed with the local token. For operator semantics, see [variable](variable.md). |
68 68 
69## Usage Constraints69## Usage Constraints
70 70 
71> [!CAUTION] Caution71> [!CAUTION] Caution
72-> `token` is security information. It must not be printed in host or device logs, and must not be passed across ranks in plaintext. The `addr_` and `token` fields must be the values of the remote rank's target memory, and their source is completely different from that of the local `local_addr` field.72+> `token` is security information. It must not be printed in host or device logs, and must not be passed across ranks in plaintext. The `addr` and `token` fields must be the values of the remote rank's target memory, and their source is completely different from that of the local `local_addr` field.
73 73 
74-- It can only be constructed during the compilation phase. If constructed outside the compilation phase, an exception carrying `CCU_E_PTR` is thrown.74+- It can only be constructed during the compilation phase. If constructed outside the compilation phase, an exception carrying `ccu_result::CCU_E_PTR` is thrown.
75-- The default constructor only applies for virtual handles and always succeeds without throwing an exception during the compilation phase. When `address`/`variable` physical resources are insufficient, the compilation phase returns `CCU_E_UNAVAIL` instead of throwing an exception at construction time.75+- The default constructor only applies for virtual handles and always succeeds without throwing an exception during the compilation phase. When `address`/`variable` physical resources are insufficient, the compilation phase returns `ccu_result::CCU_E_UNAVAIL` instead of throwing an exception at construction time.
76-- The copy/move constructors only copy the three fields `handle`, `addr_.handle`, and `token.handle`, and do not apply for new `address`/`variable` resources. After `remote_addr r2 = r1;`, the two objects point to the same set of registers. `operator=(const remote_addr&)` executes a device-side register assignment instruction (with the same semantics as `local_addr`), so the two are asymmetric.76+- The copy/move constructors only copy the three fields `handle`, `addr.handle`, and `token.handle`, and do not apply for new `address`/`variable` resources. After `remote_addr r2 = r1;`, the two objects point to the same set of registers. `operator=(const remote_addr&)` executes a device-side register assignment instruction (with the same semantics as `local_addr`), so the two are asymmetric.
77- Do not save or compare the `handle` value outside the kernel. The handle becomes invalid after translation is complete.77- Do not save or compare the `handle` value outside the kernel. The handle becomes invalid after translation is complete.
78-- Do not call `address()`/`variable()` separately on the embedded `addr_`/`token` fields to construct new objects — `remote_addr()` has already allocated all subfields at once.78+- Do not call `address()`/`variable()` separately on the embedded `addr`/`token` fields to construct new objects — `remote_addr()` has already allocated all subfields at once.
79- `remote_addr` must be used together with [`ChannelHandle`](https://gitcode.com/cann/hcomm/blob/master/docs/en/api_ref/comm_opdev/datatype_definition/ChannelHandle.md) to perform cross-rank RDMA operations over an established channel. If it is used without a channel, the hardware exhibits undefined behavior.79- `remote_addr` must be used together with [`ChannelHandle`](https://gitcode.com/cann/hcomm/blob/master/docs/en/api_ref/comm_opdev/datatype_definition/ChannelHandle.md) to perform cross-rank RDMA operations over an established channel. If it is used without a channel, the hardware exhibits undefined behavior.
80 80 
81## Call Example81## Call Example
82 82 
83```cpp83```cpp
84-using namespace AscendC::ccu;84+using namespace asc::ccu;
85 85 
86// Obtain the address and token of the remote rank from the peer through inter-process communication (such as a message-passing framework),86// Obtain the address and token of the remote rank from the peer through inter-process communication (such as a message-passing framework),
87// and then pass them into the kernel through kernelArg or taskArgs+load_arg.87// and then pass them into the kernel through kernelArg or taskArgs+load_arg.
@@ -93,18 +93,18 @@ struct my_kernel_arg {
93 uint64_t local_token;93 uint64_t local_token;
94};94};
95 95 
96-CcuResult my_kernel(ccu_kernel_arg arg) {96+ccu_result my_kernel(ccu_kernel_arg arg) {
97 auto* params = static_cast<my_kernel_arg*>(arg); // ccu_kernel_arg is void*. Cast it to the user input parameter struct first.97 auto* params = static_cast<my_kernel_arg*>(arg); // ccu_kernel_arg is void*. Cast it to the user input parameter struct first.
98 98 
99 remote_addr remote;99 remote_addr remote;
100 // Assign from kernelArg at the compilation phase (fixed as an immediate value)100 // Assign from kernelArg at the compilation phase (fixed as an immediate value)
101- remote.addr_ = params->remote_addr;101+ remote.addr = params->remote_addr;
102 remote.token = params->remote_token;102 remote.token = params->remote_token;
103 103 
104 // Use with the cross-rank write/write_reduce APIs104 // Use with the cross-rank write/write_reduce APIs
105 ChannelHandle ch = params->channel_handle;105 ChannelHandle ch = params->channel_handle;
106 local_addr local;106 local_addr local;
107- local.addr_ = params->local_addr;107+ local.addr = params->local_addr;
108 local.token = params->local_token;108 local.token = params->local_token;
109 variable len;109 variable len;
110 event evt;110 event evt;
@@ -113,6 +113,6 @@ CcuResult my_kernel(ccu_kernel_arg arg) {
113 write(ch, remote, local, len, evt); // Write the local on-chip memory data to the peer on-chip memory113 write(ch, remote, local, len, evt); // Write the local on-chip memory data to the peer on-chip memory
114 event_wait(evt);114 event_wait(evt);
115 115 
116- return CCU_SUCCESS;116+ return ccu_result::CCU_SUCCESS;
117}117}
118```118```
@@ -25,7 +25,7 @@
25 25 
26## Function Description26## Function Description
27 27 
28-Header file: `#include "ccu/hcomm/ccu_primitives.hpp"`.28+Header file: `#include <ccu/asc_ccu.h>`.
29 29 
30`ccu::variable` is a C++ wrapper class for general-purpose registers in a CCU kernel. It stores scalar values and supports assignment, addition, and comparison operations used by control-flow macros such as `CCU_IF`/`CCU_WHILE`/`CCU_DO`.30`ccu::variable` is a C++ wrapper class for general-purpose registers in a CCU kernel. It stores scalar values and supports assignment, addition, and comparison operations used by control-flow macros such as `CCU_IF`/`CCU_WHILE`/`CCU_DO`.
31 31 
@@ -39,7 +39,7 @@ Header file: `#include "ccu/hcomm/ccu_primitives.hpp"`.
39## Class Declaration39## Class Declaration
40 40 
41```cpp41```cpp
42-namespace AscendC {42+namespace asc {
43namespace ccu {43namespace ccu {
44class variable final {44class variable final {
45public:45public:
@@ -63,7 +63,7 @@ public:
63 ccu_variable_handle handle{0}; // Virtual handle.63 ccu_variable_handle handle{0}; // Virtual handle.
64};64};
65} // namespace ccu65} // namespace ccu
66-} // namespace AscendC66+} // namespace asc
67```67```
68 68 
69## Constructor Description69## Constructor Description
@@ -79,7 +79,7 @@ public:
79 | Parameter | Input/Output | Description |79 | Parameter | Input/Output | Description |
80 | --- | --- | --- |80 | --- | --- | --- |
81 | var_handle | Input | Reserved handle, which is returned after the host side calls `asccomm_ccu_variable_alloc` to pre-allocate a segment of physical scalar registers from the instance resource pool, and is passed into the kernel through `kernelArg`. |81 | var_handle | Input | Reserved handle, which is returned after the host side calls `asccomm_ccu_variable_alloc` to pre-allocate a segment of physical scalar registers from the instance resource pool, and is passed into the kernel through `kernelArg`. |
82- | index | Input | Sequence number of the scalar register to be bound within the reserved segment. The default value is `0`, and the value range is `[0, num-1]` (`num` is the number of scalar registers reserved by `asccomm_ccu_variable_alloc` on the host side). If the value is out of range, a `CCU_E_PARA` exception is thrown. |82+ | index | Input | Sequence number of the scalar register to be bound within the reserved segment. The default value is `0`, and the value range is `[0, num-1]` (`num` is the number of scalar registers reserved by `asccomm_ccu_variable_alloc` on the host side). If the value is out of range, a `ccu_result::CCU_E_PARA` exception is thrown. |
83 83 
84 Constructing multiple `variable` objects with the same reserved handle and the same `index` makes them share the same physical scalar register.84 Constructing multiple `variable` objects with the same reserved handle and the same `index` makes them share the same physical scalar register.
85 85 
@@ -114,9 +114,9 @@ public:
114 114 
115## Usage Constraints115## Usage Constraints
116 116 
117-- It can only be constructed during the compile phase; constructing outside the compile phase throws an exception carrying `CCU_E_PTR`.117+- It can only be constructed during the compile phase; constructing outside the compile phase throws an exception carrying `ccu_result::CCU_E_PTR`.
118-- The default constructor only allocates a virtual handle and always succeeds without throwing an exception during the compile phase; when physical scalar register resources are insufficient, the compile phase returns `CCU_E_UNAVAIL` instead of throwing an exception at construction time.118+- The default constructor only allocates a virtual handle and always succeeds without throwing an exception during the compile phase; when physical scalar register resources are insufficient, the compile phase returns `ccu_result::CCU_E_UNAVAIL` instead of throwing an exception at construction time.
119-- The reserved constructor validates the reserved handle and `index`; when `index` is outside the reserved segment range (`[0, num-1]`, where `num` is the number of scalar registers reserved on the host side), it throws a `CCU_E_PARA` exception.119+- The reserved constructor validates the reserved handle and `index`; when `index` is outside the reserved segment range (`[0, num-1]`, where `num` is the number of scalar registers reserved on the host side), it throws a `ccu_result::CCU_E_PARA` exception.
120- The copy/move constructors only copy the `handle` field and do not allocate a new scalar register. After `variable v2 = v1;`, the two objects are the same in-kernel handle; if an independent `variable` is required, use the default constructor or [`array<variable>`](array.md).120- The copy/move constructors only copy the `handle` field and do not allocate a new scalar register. After `variable v2 = v1;`, the two objects are the same in-kernel handle; if an independent `variable` is required, use the default constructor or [`array<variable>`](array.md).
121- Do not save or compare the `handle` value outside the kernel; the handle becomes invalid after translation is complete.121- Do not save or compare the `handle` value outside the kernel; the handle becomes invalid after translation is complete.
122- Currently only addition is supported; subtraction, multiplication, division, bitwise logic, and shift operations are not supported.122- Currently only addition is supported; subtraction, multiplication, division, bitwise logic, and shift operations are not supported.
@@ -125,9 +125,9 @@ public:
125## Call Example125## Call Example
126 126 
127```cpp127```cpp
128-using namespace AscendC::ccu;128+using namespace asc::ccu;
129 129 
130-CcuResult my_kernel(ccu_kernel_arg arg) {130+ccu_result my_kernel(ccu_kernel_arg arg) {
131 variable n, i, one, step;131 variable n, i, one, step;
132 132 
133 // Assign an immediate value (determined during the compile phase).133 // Assign an immediate value (determined during the compile phase).
@@ -152,6 +152,6 @@ CcuResult my_kernel(ccu_kernel_arg arg) {
152 // ...152 // ...
153 }153 }
154 154 
155- return CCU_SUCCESS;155+ return ccu_result::CCU_SUCCESS;
156}156}
157```157```
@@ -25,7 +25,7 @@
25 25 
26## Function Description26## Function Description
27 27 
28-Header file: `#include "ccu/hcomm/ccu_primitives.hpp"`28+Header file: `#include <ccu/asc_ccu.h>`
29 29 
30Explicitly sets the event flag bit corresponding to `mask` in the local synchronization register to **1**, indicating that the current operation or phase is complete, so that [event_wait](event_wait.md) within the same kernel can read the completion signal.30Explicitly sets the event flag bit corresponding to `mask` in the local synchronization register to **1**, indicating that the current operation or phase is complete, so that [event_wait](event_wait.md) within the same kernel can read the completion signal.
31 31 
@@ -35,11 +35,11 @@ Explicitly sets the event flag bit corresponding to `mask` in the local synchron
35## Function Prototype35## Function Prototype
36 36 
37```cpp37```cpp
38-namespace AscendC {38+namespace asc {
39namespace ccu {39namespace ccu {
40-CcuResult event_record(event e, uint16_t mask = 1);40+ccu_result event_record(event e, uint16_t mask = 1);
41} // namespace ccu41} // namespace ccu
42-} // namespace AscendC42+} // namespace asc
43```43```
44 44 
45## Parameters45## Parameters
@@ -51,18 +51,18 @@ CcuResult event_record(event e, uint16_t mask = 1);
51 51 
52## Return Value52## Return Value
53 53 
54-[`CcuResult`](https://gitcode.com/cann/hcomm/blob/master/docs/en/api_ref/comm_opdev/datatype_definition/CcuResult.md): The API returns `CCU_SUCCESS` on success, and other values on failure.54+`ccu_result`: The API returns `ccu_result::CCU_SUCCESS` on success, and other values on failure.
55 55 
56| Return Value | Description |56| Return Value | Description |
57| --- | --- |57| --- | --- |
58-| `CCU_SUCCESS` | The operation is successful. |58+| `ccu_result::CCU_SUCCESS` | The operation is successful. |
59-| `CCU_E_PTR` | The API is called outside the compilation phase. |59+| `ccu_result::CCU_E_PTR` | The API is called outside the compilation phase. |
60-| `CCU_E_NOT_FOUND` | The passed `e` handle is not created in the current kernel. |60+| `ccu_result::CCU_E_NOT_FOUND` | The passed `e` handle is not created in the current kernel. |
61-| `CCU_E_NOT_SUPPORT` | Calling this API inside the loop body of a hardware loop is not supported. |61+| `ccu_result::CCU_E_NOT_SUPPORT` | Calling this API inside the loop body of a hardware loop is not supported. |
62 62 
63## Usage Constraints63## Usage Constraints
64 64 
65-- This API cannot be called inside the loop body of a hardware loop; otherwise, `CCU_E_NOT_SUPPORT` is returned. The loop body is replicated into multiple copies for parallel execution, and each copy executes `event_record` once, making the set semantics ambiguous.65+- This API cannot be called inside the loop body of a hardware loop; otherwise, `ccu_result::CCU_E_NOT_SUPPORT` is returned. The loop body is replicated into multiple copies for parallel execution, and each copy executes `event_record` once, making the set semantics ambiguous.
66- After the bit is set, an [event_wait](event_wait.md) must consume the signal; otherwise, this set operation is not used.66- After the bit is set, an [event_wait](event_wait.md) must consume the signal; otherwise, this set operation is not used.
67- The `mask` of `event_record` and `event_wait` must be consistent; otherwise, `event_wait` never receives the signal.67- The `mask` of `event_record` and `event_wait` must be consistent; otherwise, `event_wait` never receives the signal.
68 68 
@@ -70,10 +70,10 @@ CcuResult event_record(event e, uint16_t mask = 1);
70 70 
71```cpp71```cpp
72// For simplicity, return value reception and error handling are omitted.72// For simplicity, return value reception and error handling are omitted.
73-using namespace AscendC::ccu;73+using namespace asc::ccu;
74 74 
75// Inside the CCU kernel function body.75// Inside the CCU kernel function body.
76-CcuResult my_kernel(ccu_kernel_arg arg) {76+ccu_result my_kernel(ccu_kernel_arg arg) {
77 event evt;77 event evt;
78 78 
79 // After performing some operations, manually mark bit0 as complete.79 // After performing some operations, manually mark bit0 as complete.
@@ -81,6 +81,6 @@ CcuResult my_kernel(ccu_kernel_arg arg) {
81 81 
82 // The downstream waits for bit0 to be set.82 // The downstream waits for bit0 to be set.
83 event_wait(evt, 0x1);83 event_wait(evt, 0x1);
84- return CCU_SUCCESS;84+ return ccu_result::CCU_SUCCESS;
85}85}
86```86```
@@ -25,7 +25,7 @@
25 25 
26## Function Description26## Function Description
27 27 
28-Header file: `#include "ccu/hcomm/ccu_primitives.hpp"`.28+Header file: `#include <ccu/asc_ccu.h>`.
29 29 
30Blocks and waits for the `event` flag bits corresponding to `mask` in the local synchronization register until all of them are set to **1**, then continues execution and automatically clears these flag bits. These flag bits are set by [event_record](event_record.md) or the [data movement API](../data_movement/README.md) in the same kernel.30Blocks and waits for the `event` flag bits corresponding to `mask` in the local synchronization register until all of them are set to **1**, then continues execution and automatically clears these flag bits. These flag bits are set by [event_record](event_record.md) or the [data movement API](../data_movement/README.md) in the same kernel.
31 31 
@@ -35,11 +35,11 @@ Blocks and waits for the `event` flag bits corresponding to `mask` in the local
35## Function Prototype35## Function Prototype
36 36 
37```cpp37```cpp
38-namespace AscendC {38+namespace asc {
39namespace ccu {39namespace ccu {
40-CcuResult event_wait(event e, uint16_t mask = 1);40+ccu_result event_wait(event e, uint16_t mask = 1);
41} // namespace ccu41} // namespace ccu
42-} // namespace AscendC42+} // namespace asc
43```43```
44 44 
45## Parameters45## Parameters
@@ -51,13 +51,13 @@ CcuResult event_wait(event e, uint16_t mask = 1);
51 51 
52## Return Value52## Return Value
53 53 
54-[`CcuResult`](https://gitcode.com/cann/hcomm/blob/master/docs/en/api_ref/comm_opdev/datatype_definition/CcuResult.md): The API returns `CCU_SUCCESS` on success, and other values on failure.54+`ccu_result`: The API returns `ccu_result::CCU_SUCCESS` on success, and other values on failure.
55 55 
56| Return Value | Description |56| Return Value | Description |
57| --- | --- |57| --- | --- |
58-| `CCU_SUCCESS` | The operation is successful. |58+| `ccu_result::CCU_SUCCESS` | The operation is successful. |
59-| `CCU_E_PTR` | The API is called outside the compilation phase. |59+| `ccu_result::CCU_E_PTR` | The API is called outside the compilation phase. |
60-| `CCU_E_NOT_FOUND` | The passed `e` handle is not created in the current kernel. |60+| `ccu_result::CCU_E_NOT_FOUND` | The passed `e` handle is not created in the current kernel. |
61 61 
62## Usage Constraints62## Usage Constraints
63 63 
@@ -69,11 +69,11 @@ CcuResult event_wait(event e, uint16_t mask = 1);
69 69 
70```cpp70```cpp
71// For simplicity, return value reception and error handling are omitted.71// For simplicity, return value reception and error handling are omitted.
72-using namespace AscendC::ccu;72+using namespace asc::ccu;
73 73 
74// Scenario: Wait for the copy from the local on-chip memory to the on-chip memory to complete before continuing.74// Scenario: Wait for the copy from the local on-chip memory to the on-chip memory to complete before continuing.
75// Inside the CCU kernel function body.75// Inside the CCU kernel function body.
76-CcuResult my_kernel(ccu_kernel_arg arg) {76+ccu_result my_kernel(ccu_kernel_arg arg) {
77 local_addr src, dst;77 local_addr src, dst;
78 variable len;78 variable len;
79 event evt;79 event evt;
@@ -85,6 +85,6 @@ CcuResult my_kernel(ccu_kernel_arg arg) {
85 event_wait(evt, 0x1);85 event_wait(evt, 0x1);
86 86 
87 // After this, the data pointed to by dst can be safely used.87 // After this, the data pointed to by dst can be safely used.
88- return CCU_SUCCESS;88+ return ccu_result::CCU_SUCCESS;
89}89}
90```90```
@@ -25,18 +25,18 @@
25 25 
26## Function Description26## Function Description
27 27 
28-Header file: `#include "ccu/hcomm/ccu_primitives.hpp"`28+Header file: `#include <ccu/asc_ccu.h>`
29 29 
30Sends a cross-kernel synchronization signal within the same die in a CCU kernel. It is a producer-side API. Pairing is identified by a string tag: the producer and consumer sides with the same tag are automatically bound to the same synchronization resource.30Sends a cross-kernel synchronization signal within the same die in a CCU kernel. It is a producer-side API. Pairing is identified by a string tag: the producer and consumer sides with the same tag are automatically bound to the same synchronization resource.
31 31 
32> [!NOTE] Note32> [!NOTE] Note
33-> This API is implemented in C++ as the `AscendC::ccu::event_record(const char* notify_tag, uint16_t mask)` overload, which shares the same function name as `event_record(event, mask)` and is distinguished by the input parameter type. It applies to sequential synchronization between different kernels within the same die (cross-kernel on the same device), and does not apply to cross-die or cross-rank scenarios. For cross-die scenarios, use [notify_record](notify_record.md).33+> This API is implemented in C++ as the `asc::ccu::event_record(const char* notify_tag, uint16_t mask)` overload, which shares the same function name as `event_record(event, mask)` and is distinguished by the input parameter type. It applies to sequential synchronization between different kernels within the same die (cross-kernel on the same device), and does not apply to cross-die or cross-rank scenarios. For cross-die scenarios, use [notify_record](notify_record.md).
34 34 
35## Function Prototype35## Function Prototype
36 36 
37```cpp37```cpp
38// local_notify_record corresponds to the const char* overload of event_record.38// local_notify_record corresponds to the const char* overload of event_record.
39-CcuResult event_record(const char* notify_tag, uint16_t mask = 1);39+ccu_result event_record(const char* notify_tag, uint16_t mask = 1);
40```40```
41 41 
42## Parameters42## Parameters
@@ -48,17 +48,17 @@ CcuResult event_record(const char* notify_tag, uint16_t mask = 1);
48 48 
49## Return Value49## Return Value
50 50 
51-[`CcuResult`](https://gitcode.com/cann/hcomm/blob/master/docs/en/api_ref/comm_opdev/datatype_definition/CcuResult.md): The API returns `CCU_SUCCESS` on success, and other values on failure.51+`ccu_result`: The API returns `ccu_result::CCU_SUCCESS` on success, and other values on failure.
52 52 
53| Return Value | Description |53| Return Value | Description |
54| --- | --- |54| --- | --- |
55-| `CCU_SUCCESS` | The operation is successful. |55+| `ccu_result::CCU_SUCCESS` | The operation is successful. |
56-| `CCU_E_PTR` | `notify_tag` is a null pointer, or the API is called outside the compilation phase. |56+| `ccu_result::CCU_E_PTR` | `notify_tag` is a null pointer, or the API is called outside the compilation phase. |
57-| `CCU_E_NOT_SUPPORT` | Called inside a hardware loop body, which is not supported. |57+| `ccu_result::CCU_E_NOT_SUPPORT` | Called inside a hardware loop body, which is not supported. |
58 58 
59## Usage Constraints59## Usage Constraints
60 60 
61-- The API cannot be called inside a hardware loop body; otherwise, `CCU_E_NOT_SUPPORT` is returned. The loop body is expanded into N copies in parallel by the hardware, and the semantics of the notify record are not unique in a parallel environment.61+- The API cannot be called inside a hardware loop body; otherwise, `ccu_result::CCU_E_NOT_SUPPORT` is returned. The loop body is expanded into N copies in parallel by the hardware, and the semantics of the notify record are not unique in a parallel environment.
62- `notify_tag` must remain valid during the execution of the kernel function body. Use a string literal (such as `"phase1_done"`) or a `static char[]` inside the kernel. Do not use a temporary `char[]` on the stack.62- `notify_tag` must remain valid during the execution of the kernel function body. Use a string literal (such as `"phase1_done"`) or a `static char[]` inside the kernel. Do not use a temporary `char[]` on the stack.
63- The producer-side `local_notify_record` and the consumer-side `local_notify_wait` must use exactly the same `notify_tag` string content for pairing.63- The producer-side `local_notify_record` and the consumer-side `local_notify_wait` must use exactly the same `notify_tag` string content for pairing.
64- The same tag can carry multiple pairs, distinguished by different bits of `mask`. The `mask` on the waiting side must be consistent with the one here.64- The same tag can carry multiple pairs, distinguished by different bits of `mask`. The `mask` on the waiting side must be consistent with the one here.
@@ -70,24 +70,24 @@ CcuResult event_record(const char* notify_tag, uint16_t mask = 1);
70 70 
71```cpp71```cpp
72// For simplicity, the return value handling and error handling are omitted.72// For simplicity, the return value handling and error handling are omitted.
73-using namespace AscendC::ccu;73+using namespace asc::ccu;
74 74 
75// Scenario: On the same die, phase_producer_kernel notifies phase_consumer_kernel to continue after completing phase 1.75// Scenario: On the same die, phase_producer_kernel notifies phase_consumer_kernel to continue after completing phase 1.
76// Inside the CCU kernel function body on core 076// Inside the CCU kernel function body on core 0
77-CcuResult phase_producer_kernel(ccu_kernel_arg arg) {77+ccu_result phase_producer_kernel(ccu_kernel_arg arg) {
78 // ... Phase 1 operations ...78 // ... Phase 1 operations ...
79 79 
80 // Notify phase_consumer_kernel on the same die that phase 1 is complete (that is, the local_notify_record semantics).80 // Notify phase_consumer_kernel on the same die that phase 1 is complete (that is, the local_notify_record semantics).
81 event_record("phase1_done", 0x1);81 event_record("phase1_done", 0x1);
82- return CCU_SUCCESS;82+ return ccu_result::CCU_SUCCESS;
83}83}
84 84 
85// Inside the CCU kernel function body on core 185// Inside the CCU kernel function body on core 1
86-CcuResult phase_consumer_kernel(ccu_kernel_arg arg) {86+ccu_result phase_consumer_kernel(ccu_kernel_arg arg) {
87 // Wait for the phase 1 completion signal sent by phase_producer_kernel.87 // Wait for the phase 1 completion signal sent by phase_producer_kernel.
88 event_wait("phase1_done", 0x1);88 event_wait("phase1_done", 0x1);
89 89 
90 // The phase 1 result of phase_producer_kernel can now be used safely.90 // The phase 1 result of phase_producer_kernel can now be used safely.
91- return CCU_SUCCESS;91+ return ccu_result::CCU_SUCCESS;
92}92}
93```93```
@@ -25,18 +25,18 @@
25 25 
26## Function Description26## Function Description
27 27 
28-Header file: `#include "ccu/hcomm/ccu_primitives.hpp"`28+Header file: `#include <ccu/asc_ccu.h>`
29 29 
30Blocks and waits for a cross-kernel synchronization signal in the same die within the CCU kernel, with kernels paired by a string tag. It is a consumer-side API. When hardware execution reaches this point, it blocks until the corresponding bit is set.30Blocks and waits for a cross-kernel synchronization signal in the same die within the CCU kernel, with kernels paired by a string tag. It is a consumer-side API. When hardware execution reaches this point, it blocks until the corresponding bit is set.
31 31 
32> [!NOTE] Note32> [!NOTE] Note
33-> This API is implemented at the C++ layer as an overload of `AscendC::ccu::event_wait(const char* notify_tag, uint16_t mask)`. It shares the same function name as `event_wait(event, mask)` and is distinguished by the input parameter type. It applies to sequential synchronization between different kernels within the same die, but not to cross-die or cross-rank scenarios. For cross-die scenarios, use [notify_wait](notify_wait.md).33+> This API is implemented at the C++ layer as an overload of `asc::ccu::event_wait(const char* notify_tag, uint16_t mask)`. It shares the same function name as `event_wait(event, mask)` and is distinguished by the input parameter type. It applies to sequential synchronization between different kernels within the same die, but not to cross-die or cross-rank scenarios. For cross-die scenarios, use [notify_wait](notify_wait.md).
34 34 
35## Function Prototype35## Function Prototype
36 36 
37```cpp37```cpp
38// local_notify_wait corresponds to the const char* overload of event_wait.38// local_notify_wait corresponds to the const char* overload of event_wait.
39-CcuResult event_wait(const char* notify_tag, uint16_t mask = 1);39+ccu_result event_wait(const char* notify_tag, uint16_t mask = 1);
40```40```
41 41 
42## Parameters42## Parameters
@@ -48,12 +48,12 @@ CcuResult event_wait(const char* notify_tag, uint16_t mask = 1);
48 48 
49## Return Value49## Return Value
50 50 
51-[`CcuResult`](https://gitcode.com/cann/hcomm/blob/master/docs/en/api_ref/comm_opdev/datatype_definition/CcuResult.md): The API returns `CCU_SUCCESS` on success, and other values on failure.51+`ccu_result`: The API returns `ccu_result::CCU_SUCCESS` on success, and other values on failure.
52 52 
53| Return Value | Description |53| Return Value | Description |
54| --- | --- |54| --- | --- |
55-| `CCU_SUCCESS` | The operation is successful. |55+| `ccu_result::CCU_SUCCESS` | The operation is successful. |
56-| `CCU_E_PTR` | `notify_tag` is a null pointer, or the API is called outside the compilation phase. |56+| `ccu_result::CCU_E_PTR` | `notify_tag` is a null pointer, or the API is called outside the compilation phase. |
57 57 
58## Usage Constraints58## Usage Constraints
59 59 
@@ -68,16 +68,16 @@ CcuResult event_wait(const char* notify_tag, uint16_t mask = 1);
68 68 
69```cpp69```cpp
70// For simplicity, the return value reception and error handling are omitted.70// For simplicity, the return value reception and error handling are omitted.
71-using namespace AscendC::ccu;71+using namespace asc::ccu;
72 72 
73// Scenario: Within the same die, phase_consumer_kernel waits for phase_producer_kernel to complete phase 1 before starting phase 2.73// Scenario: Within the same die, phase_consumer_kernel waits for phase_producer_kernel to complete phase 1 before starting phase 2.
74// Inside the CCU kernel function body on core 1.74// Inside the CCU kernel function body on core 1.
75-CcuResult phase_consumer_kernel(ccu_kernel_arg arg) {75+ccu_result phase_consumer_kernel(ccu_kernel_arg arg) {
76 // Wait for bit0 of the "phase1_done" signal sent by phase_producer_kernel (that is, the local_notify_wait semantics).76 // Wait for bit0 of the "phase1_done" signal sent by phase_producer_kernel (that is, the local_notify_wait semantics).
77 event_wait("phase1_done", 0x1);77 event_wait("phase1_done", 0x1);
78 78 
79 // After this, the result of phase 1 of phase_producer_kernel can be safely used.79 // After this, the result of phase 1 of phase_producer_kernel can be safely used.
80 // ... Phase 2 operations ...80 // ... Phase 2 operations ...
81- return CCU_SUCCESS;81+ return ccu_result::CCU_SUCCESS;
82}82}
83```83```
@@ -25,7 +25,7 @@
25 25 
26## Function Description26## Function Description
27 27 
28-Header file: `#include "ccu/hcomm/ccu_primitives.hpp"`28+Header file: `#include <ccu/asc_ccu.h>`
29 29 
30Sends a completion signal to the peer die through a channel within the CCU kernel, setting the notify flag corresponding to `mask` in the peer synchronization register to 1 so that the peer's [notify_wait](notify_wait.md) can read the completion signal.30Sends a completion signal to the peer die through a channel within the CCU kernel, setting the notify flag corresponding to `mask` in the peer synchronization register to 1 so that the peer's [notify_wait](notify_wait.md) can read the completion signal.
31 31 
@@ -35,11 +35,11 @@ Sends a completion signal to the peer die through a channel within the CCU kerne
35## Function Prototype35## Function Prototype
36 36 
37```cpp37```cpp
38-namespace AscendC {38+namespace asc {
39namespace ccu {39namespace ccu {
40-CcuResult notify_record(ChannelHandle channel, uint32_t remote_notify_idx, uint16_t mask = 1);40+ccu_result notify_record(ChannelHandle channel, uint32_t remote_notify_idx, uint16_t mask = 1);
41} // namespace ccu41} // namespace ccu
42-} // namespace AscendC42+} // namespace asc
43```43```
44 44 
45## Parameters45## Parameters
@@ -52,17 +52,17 @@ CcuResult notify_record(ChannelHandle channel, uint32_t remote_notify_idx, uint1
52 52 
53## Return Value53## Return Value
54 54 
55-[`CcuResult`](https://gitcode.com/cann/hcomm/blob/master/docs/en/api_ref/comm_opdev/datatype_definition/CcuResult.md): The API returns `CCU_SUCCESS` on success, and other values on failure.55+`ccu_result`: The API returns `ccu_result::CCU_SUCCESS` on success, and other values on failure.
56 56 
57| Return Value | Description |57| Return Value | Description |
58| --- | --- |58| --- | --- |
59-| `CCU_SUCCESS` | The operation is successful. |59+| `ccu_result::CCU_SUCCESS` | The operation is successful. |
60-| `CCU_E_PTR` | The API is called outside the compilation phase. |60+| `ccu_result::CCU_E_PTR` | The API is called outside the compilation phase. |
61 61 
62## Usage Constraints62## Usage Constraints
63 63 
64- It cannot be called inside the loop body of a hardware loop. The loop body is replicated into multiple copies for parallel execution, and each copy executes `notify_record` once, making the set semantics ambiguous.64- It cannot be called inside the loop body of a hardware loop. The loop body is replicated into multiple copies for parallel execution, and each copy executes `notify_record` once, making the set semantics ambiguous.
65-- All channels within the same kernel must belong to the same die. Channels of different dies cannot be mixed into the same kernel. This constraint is uniformly checked by `<<<>>>`, and `CCU_E_PARA` is returned when it is violated.65+- All channels within the same kernel must belong to the same die. Channels of different dies cannot be mixed into the same kernel. This constraint is uniformly checked by `<<<>>>`, and `ccu_result::CCU_E_PARA` is returned when it is violated.
66- The `remote_notify_idx` of `notify_record` and the `local_notify_idx` of `notify_wait` have the same value.66- The `remote_notify_idx` of `notify_record` and the `local_notify_idx` of `notify_wait` have the same value.
67- `notify_record` and `notify_wait` use the same `mask`.67- `notify_record` and `notify_wait` use the same `mask`.
68- A single [`ChannelHandle`](https://gitcode.com/cann/hcomm/blob/master/docs/en/api_ref/comm_opdev/datatype_definition/ChannelHandle.md) provides at most 8 notify slots, so `remote_notify_idx` ranges from 0 to 7.68- A single [`ChannelHandle`](https://gitcode.com/cann/hcomm/blob/master/docs/en/api_ref/comm_opdev/datatype_definition/ChannelHandle.md) provides at most 8 notify slots, so `remote_notify_idx` ranges from 0 to 7.
@@ -71,7 +71,7 @@ CcuResult notify_record(ChannelHandle channel, uint32_t remote_notify_idx, uint1
71 71 
72```cpp72```cpp
73// For simplicity, return value reception and error handling are omitted.73// For simplicity, return value reception and error handling are omitted.
74-using namespace AscendC::ccu;74+using namespace asc::ccu;
75 75 
76// User-defined kernel argument struct, passed in through the kernelArg of <<<>>> after the host side establishes the link.76// User-defined kernel argument struct, passed in through the kernelArg of <<<>>> after the host side establishes the link.
77struct my_kernel_arg {77struct my_kernel_arg {
@@ -80,22 +80,22 @@ struct my_kernel_arg {
80 80 
81// Scenario: die A notifies die B that data can be read after completing the write operation.81// Scenario: die A notifies die B that data can be read after completing the write operation.
82// Inside the CCU kernel function body of die A.82// Inside the CCU kernel function body of die A.
83-CcuResult sender_kernel(ccu_kernel_arg arg) {83+ccu_result sender_kernel(ccu_kernel_arg arg) {
84 auto *params = static_cast<my_kernel_arg *>(arg); // ccu_kernel_arg is void*, so first cast it to the user argument struct.84 auto *params = static_cast<my_kernel_arg *>(arg); // ccu_kernel_arg is void*, so first cast it to the user argument struct.
85 // ... Perform the write operation to write data to the peer memory ...85 // ... Perform the write operation to write data to the peer memory ...
86 86 
87 // Notify slot 3 of die B that bit0 is complete.87 // Notify slot 3 of die B that bit0 is complete.
88 notify_record(params->channel, /*remote_notify_idx=*/3, 0x1);88 notify_record(params->channel, /*remote_notify_idx=*/3, 0x1);
89- return CCU_SUCCESS;89+ return ccu_result::CCU_SUCCESS;
90}90}
91 91 
92// Inside the CCU kernel function body of die B, corresponding to the kernel of die A.92// Inside the CCU kernel function body of die B, corresponding to the kernel of die A.
93-CcuResult receiver_kernel(ccu_kernel_arg arg) {93+ccu_result receiver_kernel(ccu_kernel_arg arg) {
94 auto *params = static_cast<my_kernel_arg *>(arg); // Cast ccu_kernel_arg, which is void*, to the user input parameter struct.94 auto *params = static_cast<my_kernel_arg *>(arg); // Cast ccu_kernel_arg, which is void*, to the user input parameter struct.
95 // Wait for the signal from die A, bit0 of the local notify slot 3.95 // Wait for the signal from die A, bit0 of the local notify slot 3.
96 notify_wait(params->channel, /*local_notify_idx=*/3, 0x1);96 notify_wait(params->channel, /*local_notify_idx=*/3, 0x1);
97 97 
98 // After this, the data written by die A can be safely read.98 // After this, the data written by die A can be safely read.
99- return CCU_SUCCESS;99+ return ccu_result::CCU_SUCCESS;
100}100}
101```101```
@@ -25,7 +25,7 @@
25 25 
26## Function Description26## Function Description
27 27 
28-Header file: `#include "ccu/hcomm/ccu_primitives.hpp"`.28+Header file: `#include <ccu/asc_ccu.h>`.
29 29 
30Blocks and waits for the notify flags corresponding to `mask` in the local synchronization register until all of them are set to 1, then continues execution. These flags are set by [notify_record](notify_record.md) on the peer die through the channel.30Blocks and waits for the notify flags corresponding to `mask` in the local synchronization register until all of them are set to 1, then continues execution. These flags are set by [notify_record](notify_record.md) on the peer die through the channel.
31 31 
@@ -35,11 +35,11 @@ Blocks and waits for the notify flags corresponding to `mask` in the local synch
35## Function Prototype35## Function Prototype
36 36 
37```cpp37```cpp
38-namespace AscendC {38+namespace asc {
39namespace ccu {39namespace ccu {
40-CcuResult notify_wait(ChannelHandle channel, uint32_t local_notify_idx, uint16_t mask = 1);40+ccu_result notify_wait(ChannelHandle channel, uint32_t local_notify_idx, uint16_t mask = 1);
41} // namespace ccu41} // namespace ccu
42-} // namespace AscendC42+} // namespace asc
43```43```
44 44 
45## Parameters45## Parameters
@@ -52,17 +52,17 @@ CcuResult notify_wait(ChannelHandle channel, uint32_t local_notify_idx, uint16_t
52 52 
53## Return Value53## Return Value
54 54 
55-[`CcuResult`](https://gitcode.com/cann/hcomm/blob/master/docs/en/api_ref/comm_opdev/datatype_definition/CcuResult.md): The API returns `CCU_SUCCESS` on success, and other values on failure.55+`ccu_result`: The API returns `ccu_result::CCU_SUCCESS` on success, and other values on failure.
56 56 
57| Return Value | Description |57| Return Value | Description |
58| --- | --- |58| --- | --- |
59-| `CCU_SUCCESS` | The operation is successful. |59+| `ccu_result::CCU_SUCCESS` | The operation is successful. |
60-| `CCU_E_PTR` | The API is called outside the compilation phase. |60+| `ccu_result::CCU_E_PTR` | The API is called outside the compilation phase. |
61 61 
62## Usage Constraints62## Usage Constraints
63 63 
64- `notify_wait` can be called inside the body of a hardware loop.64- `notify_wait` can be called inside the body of a hardware loop.
65-- All channels within the same kernel must belong to the same die. Channels of different dies cannot be mixed into the same kernel. This constraint is uniformly verified by `<<<>>>`, and `CCU_E_PARA` is returned when it is violated.65+- All channels within the same kernel must belong to the same die. Channels of different dies cannot be mixed into the same kernel. This constraint is uniformly verified by `<<<>>>`, and `ccu_result::CCU_E_PARA` is returned when it is violated.
66- The `remote_notify_idx` of `notify_record` and the `local_notify_idx` of `notify_wait` have the same value.66- The `remote_notify_idx` of `notify_record` and the `local_notify_idx` of `notify_wait` have the same value.
67- `notify_record` and `notify_wait` use the same `mask`.67- `notify_record` and `notify_wait` use the same `mask`.
68- A single [`ChannelHandle`](https://gitcode.com/cann/hcomm/blob/master/docs/en/api_ref/comm_opdev/datatype_definition/ChannelHandle.md) provides up to 8 notify slots, so `local_notify_idx` ranges from 0 to 7.68- A single [`ChannelHandle`](https://gitcode.com/cann/hcomm/blob/master/docs/en/api_ref/comm_opdev/datatype_definition/ChannelHandle.md) provides up to 8 notify slots, so `local_notify_idx` ranges from 0 to 7.
@@ -72,7 +72,7 @@ CcuResult notify_wait(ChannelHandle channel, uint32_t local_notify_idx, uint16_t
72 72 
73```cpp73```cpp
74// For simplicity, the example omits return value handling and error handling.74// For simplicity, the example omits return value handling and error handling.
75-using namespace AscendC::ccu;75+using namespace asc::ccu;
76 76 
77// User-defined kernel input parameter struct, passed through the kernelArg of <<<>>> after link establishment on the host side.77// User-defined kernel input parameter struct, passed through the kernelArg of <<<>>> after link establishment on the host side.
78struct my_kernel_arg {78struct my_kernel_arg {
@@ -81,7 +81,7 @@ struct my_kernel_arg {
81 81 
82// Scenario: die B waits for die A to complete the write operation before reading data.82// Scenario: die B waits for die A to complete the write operation before reading data.
83// Inside the CCU kernel function body of die B.83// Inside the CCU kernel function body of die B.
84-CcuResult receiver_kernel(ccu_kernel_arg arg) {84+ccu_result receiver_kernel(ccu_kernel_arg arg) {
85 auto *params = static_cast<my_kernel_arg *>(arg); // ccu_kernel_arg is void*, so first cast it to the user input parameter struct.85 auto *params = static_cast<my_kernel_arg *>(arg); // ccu_kernel_arg is void*, so first cast it to the user input parameter struct.
86 // Wait for the signal from die A, bit0 of local notify slot 3.86 // Wait for the signal from die A, bit0 of local notify slot 3.
87 // Corresponds to notify_record(channel, /*remote_notify_idx=*/3, 0x1) on the die A side.87 // Corresponds to notify_record(channel, /*remote_notify_idx=*/3, 0x1) on the die A side.
@@ -94,6 +94,6 @@ CcuResult receiver_kernel(ccu_kernel_arg arg) {
94 event evt;94 event evt;
95 read(params->channel, dst, remote, len, evt);95 read(params->channel, dst, remote, len, evt);
96 event_wait(evt);96 event_wait(evt);
97- return CCU_SUCCESS;97+ return ccu_result::CCU_SUCCESS;
98}98}
99```99```
@@ -25,9 +25,9 @@
25 25 
26## Function Description26## Function Description
27 27 
28-Header file: `#include "ccu/hcomm/ccu_primitives.hpp"`.28+Header file: `#include <ccu/asc_ccu.h>`.
29 29 
30-Within a CCU kernel, this API combines "writing the variable value to the remote end" and "triggering the remote notify signal" into a single atomic operation. The hardware guarantees the completion order of "write the value first, then send the notification". The consumer waits for the signal through [notify_wait](notify_wait.md) and then reads the newly written value through `AscendC::ccu::get_res_by_channel<variable>(channel, remote_var_idx)`.30+Within a CCU kernel, this API combines "writing the variable value to the remote end" and "triggering the remote notify signal" into a single atomic operation. The hardware guarantees the completion order of "write the value first, then send the notification". The consumer waits for the signal through [notify_wait](notify_wait.md) and then reads the newly written value through `asc::ccu::get_res_by_channel<variable>(channel, remote_var_idx)`.
31 31 
32> [!CAUTION] Caution32> [!CAUTION] Caution
33> Do not split this API into two independent calls of "writing a variable" and "notify_record". The hardware layer does not guarantee the arrival order of two independent operations. When the consumer receives the notify signal and then reads the remote variable, there is a risk of reading a stale value. Only this API can guarantee the order at the hardware layer.33> Do not split this API into two independent calls of "writing a variable" and "notify_record". The hardware layer does not guarantee the arrival order of two independent operations. When the consumer receives the notify signal and then reads the remote variable, there is a risk of reading a stale value. Only this API can guarantee the order at the hardware layer.
@@ -35,13 +35,13 @@ Within a CCU kernel, this API combines "writing the variable value to the remote
35## Function Prototype35## Function Prototype
36 36 
37```cpp37```cpp
38-namespace AscendC {38+namespace asc {
39namespace ccu {39namespace ccu {
40-CcuResult write_variable_with_notify(ChannelHandle channel, variable var,40+ccu_result write_variable_with_notify(ChannelHandle channel, variable var,
41 uint32_t remote_var_idx, uint32_t remote_notify_idx,41 uint32_t remote_var_idx, uint32_t remote_notify_idx,
42 uint16_t mask = 1);42 uint16_t mask = 1);
43} // namespace ccu43} // namespace ccu
44-} // namespace AscendC44+} // namespace asc
45```45```
46 46 
47## Parameters47## Parameters
@@ -56,25 +56,25 @@ CcuResult write_variable_with_notify(ChannelHandle channel, variable var,
56 56 
57## Return Value57## Return Value
58 58 
59-[`CcuResult`](https://gitcode.com/cann/hcomm/blob/master/docs/en/api_ref/comm_opdev/datatype_definition/CcuResult.md): The API returns `CCU_SUCCESS` on success, and other values on failure.59+`ccu_result`: The API returns `ccu_result::CCU_SUCCESS` on success, and other values on failure.
60 60 
61| Return Value | Description |61| Return Value | Description |
62| --- | --- |62| --- | --- |
63-| `CCU_SUCCESS` | The operation is successful. |63+| `ccu_result::CCU_SUCCESS` | The operation is successful. |
64-| `CCU_E_NOT_FOUND` | The variable handle corresponding to `var` is not created in the current kernel. |64+| `ccu_result::CCU_E_NOT_FOUND` | The variable handle corresponding to `var` is not created in the current kernel. |
65-| `CCU_E_PTR` | The API is called outside the compilation phase. |65+| `ccu_result::CCU_E_PTR` | The API is called outside the compilation phase. |
66 66 
67## Usage Constraints67## Usage Constraints
68 68 
69- It cannot be called inside the loop body of a hardware loop.69- It cannot be called inside the loop body of a hardware loop.
70-- All channels in the same kernel must belong to the same die. Channels of different dies cannot be mixed into the same kernel. This constraint is uniformly checked by `<<<>>>`, and `CCU_E_PARA` is returned when it is violated.70+- All channels in the same kernel must belong to the same die. Channels of different dies cannot be mixed into the same kernel. This constraint is uniformly checked by `<<<>>>`, and `ccu_result::CCU_E_PARA` is returned when it is violated.
71- `remote_var_idx` and `remote_notify_idx` are both channel-level slot numbers, passed in by the kernels on both ends respectively. The framework neither assigns the numbers nor checks whether the two ends are consistent. You must ensure that both ends use the same numbers; otherwise, the consumer will be blocked permanently.71- `remote_var_idx` and `remote_notify_idx` are both channel-level slot numbers, passed in by the kernels on both ends respectively. The framework neither assigns the numbers nor checks whether the two ends are consistent. You must ensure that both ends use the same numbers; otherwise, the consumer will be blocked permanently.
72 72 
73## Call Example73## Call Example
74 74 
75```cpp75```cpp
76// For simplicity, return value reception and error handling are omitted.76// For simplicity, return value reception and error handling are omitted.
77-using namespace AscendC::ccu;77+using namespace asc::ccu;
78 78 
79// User-defined kernel argument struct, passed through the kernelArg of <<<>>> after link establishment on the host side.79// User-defined kernel argument struct, passed through the kernelArg of <<<>>> after link establishment on the host side.
80struct my_kernel_arg {80struct my_kernel_arg {
@@ -83,7 +83,7 @@ struct my_kernel_arg {
83 83 
84// Scenario: the producer sends the progress value to the consumer, and the consumer reads it after receiving the notification.84// Scenario: the producer sends the progress value to the consumer, and the consumer reads it after receiving the notification.
85// Inside the producer CCU kernel function body (die A).85// Inside the producer CCU kernel function body (die A).
86-CcuResult producer_kernel(ccu_kernel_arg arg) {86+ccu_result producer_kernel(ccu_kernel_arg arg) {
87 auto *params = static_cast<my_kernel_arg *>(arg); // ccu_kernel_arg is void*, so first cast it to the user argument struct.87 auto *params = static_cast<my_kernel_arg *>(arg); // ccu_kernel_arg is void*, so first cast it to the user argument struct.
88 variable progress;88 variable progress;
89 progress = 100; // Assign the immediate value 100.89 progress = 100; // Assign the immediate value 100.
@@ -91,17 +91,17 @@ CcuResult producer_kernel(ccu_kernel_arg arg) {
91 // Atomic operation: write to the peer variable slot 2 and notify bit0 of the peer notify slot 3.91 // Atomic operation: write to the peer variable slot 2 and notify bit0 of the peer notify slot 3.
92 write_variable_with_notify(params->channel, progress,92 write_variable_with_notify(params->channel, progress,
93 /*remote_var_idx=*/2, /*remote_notify_idx=*/3, 0x1);93 /*remote_var_idx=*/2, /*remote_notify_idx=*/3, 0x1);
94- return CCU_SUCCESS;94+ return ccu_result::CCU_SUCCESS;
95}95}
96 96 
97// Inside the consumer CCU kernel function body (die B).97// Inside the consumer CCU kernel function body (die B).
98-CcuResult consumer_kernel(ccu_kernel_arg arg) {98+ccu_result consumer_kernel(ccu_kernel_arg arg) {
99 auto *params = static_cast<my_kernel_arg *>(arg); // ccu_kernel_arg is void*, so first cast it to the user argument struct.99 auto *params = static_cast<my_kernel_arg *>(arg); // ccu_kernel_arg is void*, so first cast it to the user argument struct.
100 // Wait for the signal from die A.100 // Wait for the signal from die A.
101 notify_wait(params->channel, /*local_notify_idx=*/3, 0x1);101 notify_wait(params->channel, /*local_notify_idx=*/3, 0x1);
102 102 
103 // Safely read the value written by die A (ensuring the write is complete).103 // Safely read the value written by die A (ensuring the write is complete).
104 variable received = get_res_by_channel<variable>(params->channel, /*var_idx=*/2);104 variable received = get_res_by_channel<variable>(params->channel, /*var_idx=*/2);
105- return CCU_SUCCESS;105+ return ccu_result::CCU_SUCCESS;
106}106}
107```107```
@@ -97,7 +97,7 @@ The subsequent content of this chapter is organized according to this process, a
97 }97 }
98 ```98 ```
99 99 
100- The `asccomm_ccu_*` APIs return `CcuResult`. In the sample, the result is converted to `HcclResult` through `ConvertCcuToHccl` and then checked by `HCCLCHECK`.100+ The `asccomm_ccu_*` APIs return `ccu_result`. In the sample, the result is converted to `HcclResult` through `ConvertCcuToHccl` and then checked by `HCCLCHECK`.
101 101 
102 The VA address of the variable (`mappedAddrs.startVa`) is dispatched along with the AI Core kernel parameters for writing the communication address. The handles of the variable and event (`varHandle` and `eventHandle`) are written into `kernelArg` and dispatched along with the CCU kernel for reading the address and waiting for/setting events.102 The VA address of the variable (`mappedAddrs.startVa`) is dispatched along with the AI Core kernel parameters for writing the communication address. The handles of the variable and event (`varHandle` and `eventHandle`) are written into `kernelArg` and dispatched along with the CCU kernel for reading the address and waiting for/setting events.
103 103 
@@ -202,7 +202,7 @@ The subsequent content of this chapter is organized according to this process, a
202 HCCLCHECK(ConvertCcuToHccl(HcommCcuGetMemToken(baseInputAddr, inputSize, &token)));202 HCCLCHECK(ConvertCcuToHccl(HcommCcuGetMemToken(baseInputAddr, inputSize, &token)));
203 ```203 ```
204 204 
205- The `asccomm_ccu_*` APIs return `CcuResult`. In the sample, it is converted to `HcclResult` through `ConvertCcuToHccl` and then checked by `HCCLCHECK`.205+ The `asccomm_ccu_*` APIs return `ccu_result`. In the sample, it is converted to `HcclResult` through `ConvertCcuToHccl` and then checked by `HCCLCHECK`.
206 206 
207- Preparing **taskArgs**207- Preparing **taskArgs**
208 208 
@@ -351,16 +351,16 @@ The execution of AllGather consists of two parts: writing the local rank data to
351 351 
352 ```cpp352 ```cpp
353 ccu::local_addr src;353 ccu::local_addr src;
354- src.addr_ = ctx.input;354+ src.addr = ctx.input;
355- src.addr_ += ctx.currentRankSliceInputOffset;355+ src.addr += ctx.currentRankSliceInputOffset;
356 src.token = ctx.token[ctx.arg->rankId];356 src.token = ctx.token[ctx.arg->rankId];
357 357 
358 for (uint32_t rankIdx = 0; rankIdx < ctx.arg->rankSize; rankIdx++) {358 for (uint32_t rankIdx = 0; rankIdx < ctx.arg->rankSize; rankIdx++) {
359 if (rankIdx == ctx.arg->rankId) {359 if (rankIdx == ctx.arg->rankId) {
360- localDst.addr_ = ctx.output[rankIdx] + ctx.currentRankSliceOutputOffset;360+ localDst.addr = ctx.output[rankIdx] + ctx.currentRankSliceOutputOffset;
361 localDst.token = ctx.token[rankIdx];361 localDst.token = ctx.token[rankIdx];
362 } else {362 } else {
363- dst[rankIdx].addr_ = ctx.output[rankIdx] + ctx.currentRankSliceOutputOffset;363+ dst[rankIdx].addr = ctx.output[rankIdx] + ctx.currentRankSliceOutputOffset;
364 dst[rankIdx].token = ctx.token[rankIdx];364 dst[rankIdx].token = ctx.token[rankIdx];
365 }365 }
366 }366 }
@@ -23,7 +23,7 @@
23 23 
24## 功能说明24## 功能说明
25 25 
26-头文件为:`#include "ccu/hcomm/ccu_primitives.hpp"`26+头文件为:`#include <ccu/asc_ccu.h>`
27 27 
28在CCU kernel内从片上内存地址读取一个或多个`uint64_t`值写入variable。28在CCU kernel内从片上内存地址读取一个或多个`uint64_t`值写入variable。
29 29 
@@ -41,25 +41,25 @@
41- 立即数地址 -> 单个variable41- 立即数地址 -> 单个variable
42 42 
43 ```cpp43 ```cpp
44- CcuResult load(uint64_t addr, variable v);44+ ccu_result load(uint64_t addr, variable v);
45 ```45 ```
46 46 
47- 立即数地址 -> variable数组47- 立即数地址 -> variable数组
48 48 
49 ```cpp49 ```cpp
50- CcuResult load(uint64_t addr, array<variable>& v_arr, uint32_t num);50+ ccu_result load(uint64_t addr, array<variable>& v_arr, uint32_t num);
51 ```51 ```
52 52 
53- variable地址(间接寻址)-> 单个variable53- variable地址(间接寻址)-> 单个variable
54 54 
55 ```cpp55 ```cpp
56- CcuResult load(variable addr_var, variable v);56+ ccu_result load(variable addr_var, variable v);
57 ```57 ```
58 58 
59- variable地址(间接寻址)-> variable数组59- variable地址(间接寻址)-> variable数组
60 60 
61 ```cpp61 ```cpp
62- CcuResult load(variable addr_var, array<variable>& v_arr, uint32_t num);62+ ccu_result load(variable addr_var, array<variable>& v_arr, uint32_t num);
63 ```63 ```
64 64 
65## 参数说明65## 参数说明
@@ -74,20 +74,20 @@
74 74 
75## 返回值说明75## 返回值说明
76 76 
77-[`CcuResult`](https://gitcode.com/cann/hcomm/blob/master/docs/zh/api_ref/comm_opdev/datatype_definition/CcuResult.md):接口成功返回`CCU_SUCCESS`,其他值表示失败。77+`ccu_result`:接口成功返回`ccu_result::CCU_SUCCESS`,其他值表示失败。
78 78 
79| 返回值 | 说明 |79| 返回值 | 说明 |
80| --- | --- |80| --- | --- |
81-| `CCU_SUCCESS` | 操作成功。 |81+| `ccu_result::CCU_SUCCESS` | 操作成功。 |
82-| `CCU_E_PARA` | 参数错误:`num`为0或大于`v_arr.size()`;或`num>1`时`v_arr`元素物理不连续。 |82+| `ccu_result::CCU_E_PARA` | 参数错误:`num`为0或大于`v_arr.size()`;或`num>1`时`v_arr`元素物理不连续。 |
83-| `CCU_E_PTR` | 接口在Kernel函数体之外被调用。 |83+| `ccu_result::CCU_E_PTR` | 接口在Kernel函数体之外被调用。 |
84-| `CCU_E_NOT_FOUND` | 传入的`v`/`v_arr`句柄(或`v_arr[1..num-1]`的相邻句柄)未在当前kernel内创建。 |84+| `ccu_result::CCU_E_NOT_FOUND` | 传入的`v`/`v_arr`句柄(或`v_arr[1..num-1]`的相邻句柄)未在当前kernel内创建。 |
85 85 
86## 约束说明86## 约束说明
87 87 
88- `addr`须为CCU可访问的物理地址或经token化的VA,直接传入未经token化的进程虚拟地址将触发驱动错误。88- `addr`须为CCU可访问的物理地址或经token化的VA,直接传入未经token化的进程虚拟地址将触发驱动错误。
89-- `num`须满足`1 ≤ num ≤ v_arr.size()`。本接口在访问`v_arr[0]`之前完成该校验,传入0或超过`v_arr.size()`时返回`CCU_E_PARA`,不会触达底层接口;空`array`(`v_arr.size()`为0)传入任意`num`同样返回`CCU_E_PARA`。89+- `num`须满足`1 ≤ num ≤ v_arr.size()`。本接口在访问`v_arr[0]`之前完成该校验,传入0或超过`v_arr.size()`时返回`ccu_result::CCU_E_PARA`,不会触达底层接口;空`array`(`v_arr.size()`为0)传入任意`num`同样返回`ccu_result::CCU_E_PARA`。
90-- `num>1`时(variable数组通路),`v_arr`须指向物理连续的variable数组,必须通过`ccu::array<variable>`申请。单独声明多个`variable`对象不保证物理连续,违反时在`load(...)`调用处即返回`CCU_E_PARA`。90+- `num>1`时(variable数组通路),`v_arr`须指向物理连续的variable数组,必须通过`ccu::array<variable>`申请。单独声明多个`variable`对象不保证物理连续,违反时在`load(...)`调用处即返回`ccu_result::CCU_E_PARA`。
91- `addr_var`(variable地址通路)在调用本接口前须已被赋予有效地址值(通过`load_arg`、立即数赋值或算术运算)。91- `addr_var`(variable地址通路)在调用本接口前须已被赋予有效地址值(通过`load_arg`、立即数赋值或算术运算)。
92- 立即数地址通路在翻译期固化,执行期不可变;需执行期动态地址时使用variable地址通路。92- 立即数地址通路在翻译期固化,执行期不可变;需执行期动态地址时使用variable地址通路。
93 93 
@@ -95,27 +95,27 @@
95 95 
96```cpp96```cpp
97// 为简化示例,省略返回值接收与错误处理97// 为简化示例,省略返回值接收与错误处理
98-using namespace AscendC::ccu;98+using namespace asc::ccu;
99 99 
100// 场景1:从立即数地址加载1个variable(立即数地址 -> 单个variable)100// 场景1:从立即数地址加载1个variable(立即数地址 -> 单个variable)
101-CcuResult my_kernel(ccu_kernel_arg arg) {101+ccu_result my_kernel(ccu_kernel_arg arg) {
102 variable v;102 variable v;
103 load(0x10000000ULL, v);103 load(0x10000000ULL, v);
104- return CCU_SUCCESS;104+ return ccu_result::CCU_SUCCESS;
105}105}
106 106 
107// 场景2:从立即数地址批量加载4个variable(立即数地址 -> variable数组)107// 场景2:从立即数地址批量加载4个variable(立即数地址 -> variable数组)
108-CcuResult my_kernel2(ccu_kernel_arg arg) {108+ccu_result my_kernel2(ccu_kernel_arg arg) {
109 array<variable> v_arr(4); // 4个物理连续variable109 array<variable> v_arr(4); // 4个物理连续variable
110 load(0x80000000ULL, v_arr, 4);110 load(0x80000000ULL, v_arr, 4);
111- return CCU_SUCCESS;111+ return ccu_result::CCU_SUCCESS;
112}112}
113 113 
114// 场景3:从variable地址间接加载(variable地址 -> 单个variable,地址由上一步计算得出)114// 场景3:从variable地址间接加载(variable地址 -> 单个variable,地址由上一步计算得出)
115-CcuResult my_kernel3(ccu_kernel_arg arg) {115+ccu_result my_kernel3(ccu_kernel_arg arg) {
116 variable src_addr, v;116 variable src_addr, v;
117 load_arg(src_addr, 0); // host传入地址117 load_arg(src_addr, 0); // host传入地址
118 load(src_addr, v); // 执行期间接寻址118 load(src_addr, v); // 执行期间接寻址
119- return CCU_SUCCESS;119+ return ccu_result::CCU_SUCCESS;
120}120}
121```121```
@@ -23,7 +23,7 @@
23 23 
24## 功能说明24## 功能说明
25 25 
26-头文件为:`#include "ccu/hcomm/ccu_primitives.hpp"`26+头文件为:`#include <ccu/asc_ccu.h>`
27 27 
28`load_arg`在kernel函数体内调用,将host下发的参数加载到`variable`。host每次通过`<<<>>>`下发Kernel时,通过`taskArgs`数组传入参数;Kernel开始执行前,由硬件将`taskArgs[arg_id]`的值写入目标`variable`对应的寄存器,作为其初值。28`load_arg`在kernel函数体内调用,将host下发的参数加载到`variable`。host每次通过`<<<>>>`下发Kernel时,通过`taskArgs`数组传入参数;Kernel开始执行前,由硬件将`taskArgs[arg_id]`的值写入目标`variable`对应的寄存器,作为其初值。
29 29 
@@ -32,11 +32,11 @@
32## 函数原型32## 函数原型
33 33 
34```cpp34```cpp
35-namespace AscendC {35+namespace asc {
36namespace ccu {36namespace ccu {
37-CcuResult load_arg(variable v, uint32_t arg_id);37+ccu_result load_arg(variable v, uint32_t arg_id);
38} // namespace ccu38} // namespace ccu
39-} // namespace AscendC39+} // namespace asc
40```40```
41 41 
42## 参数说明42## 参数说明
@@ -48,20 +48,20 @@ CcuResult load_arg(variable v, uint32_t arg_id);
48 48 
49## 返回值说明49## 返回值说明
50 50 
51-[`CcuResult`](https://gitcode.com/cann/hcomm/blob/master/docs/zh/api_ref/comm_opdev/datatype_definition/CcuResult.md):接口成功返回`CCU_SUCCESS`,其他值表示失败。51+`ccu_result`:接口成功返回`ccu_result::CCU_SUCCESS`,其他值表示失败。
52 52 
53| 返回值 | 说明 |53| 返回值 | 说明 |
54| --- | --- |54| --- | --- |
55-| `CCU_SUCCESS` | 操作成功。 |55+| `ccu_result::CCU_SUCCESS` | 操作成功。 |
56-| `CCU_E_PTR` | 接口在Kernel函数体之外被调用。 |56+| `ccu_result::CCU_E_PTR` | 接口在Kernel函数体之外被调用。 |
57-| `CCU_E_NOT_FOUND` | 传入的`v`句柄未在当前kernel内创建。 |57+| `ccu_result::CCU_E_NOT_FOUND` | 传入的`v`句柄未在当前kernel内创建。 |
58 58 
59> [!NOTE]说明59> [!NOTE]说明
60-> 本接口不会返回`CCU_E_PARA`。`arg_id`相关的约束错误不在本接口处返回,而是由`<<<>>>`统一校验后返回`CCU_E_INTERNAL`,详见[约束说明](#约束说明)。60+> 本接口不会返回`ccu_result::CCU_E_PARA`。`arg_id`相关的约束错误不在本接口处返回,而是由`<<<>>>`统一校验后返回`ccu_result::CCU_E_INTERNAL`,详见[约束说明](#约束说明)。
61 61 
62## 约束说明62## 约束说明
63 63 
64-- 同一kernel内所有`load_arg`调用的`arg_id`须从0连续编号(0、1、2、…),不可重复,且个数须与`<<<>>>`的`argNum`严格相等。加载指令按`arg_id`升序对应到任务参数槽位,跳号、乱序或重复会使参数无法与槽位正确对应——以上均由`<<<>>>`统一校验,违反时返回`CCU_E_INTERNAL`。64+- 同一kernel内所有`load_arg`调用的`arg_id`须从0连续编号(0、1、2、…),不可重复,且个数须与`<<<>>>`的`argNum`严格相等。加载指令按`arg_id`升序对应到任务参数槽位,跳号、乱序或重复会使参数无法与槽位正确对应——以上均由`<<<>>>`统一校验,违反时返回`ccu_result::CCU_E_INTERNAL`。
65- `argNum`表示元素个数,而非字节数。例如`arg_id`为0、1、2的3个`load_arg`调用,`argNum`须传`3`,`taskArgs`须有至少3个`uint64_t`元素。65- `argNum`表示元素个数,而非字节数。例如`arg_id`为0、1、2的3个`load_arg`调用,`argNum`须传`3`,`taskArgs`须有至少3个`uint64_t`元素。
66- `arg_id`取值范围为0~12,因为CCU任务描述符最多携带13个参数。66- `arg_id`取值范围为0~12,因为CCU任务描述符最多携带13个参数。
67- `load_arg`只负责给`v`设初值:若kernel函数体内又对同一个`v`赋值,赋值会覆盖注入的初值。混用时须先把注入值读走、再重新赋值(作用在不同`variable`上的场景不受此影响,如`load_arg(addrVar, 0); load(addrVar, v);`中注入值作为地址被`load`消费)。67- `load_arg`只负责给`v`设初值:若kernel函数体内又对同一个`v`赋值,赋值会覆盖注入的初值。混用时须先把注入值读走、再重新赋值(作用在不同`variable`上的场景不受此影响,如`load_arg(addrVar, 0); load(addrVar, v);`中注入值作为地址被`load`消费)。
@@ -70,10 +70,10 @@ CcuResult load_arg(variable v, uint32_t arg_id);
70 70 
71```cpp71```cpp
72// 为简化示例,省略返回值接收与错误处理72// 为简化示例,省略返回值接收与错误处理
73-using namespace AscendC::ccu;73+using namespace asc::ccu;
74 74 
75// 场景:编译时声明循环次数n和起始偏移offset由host在Launch时传入75// 场景:编译时声明循环次数n和起始偏移offset由host在Launch时传入
76-CcuResult my_kernel(ccu_kernel_arg arg) {76+ccu_result my_kernel(ccu_kernel_arg arg) {
77 variable n, offset;77 variable n, offset;
78 78 
79 load_arg(n, 0); // 每次下发时taskArgs[0] → n79 load_arg(n, 0); // 每次下发时taskArgs[0] → n
@@ -81,7 +81,7 @@ CcuResult my_kernel(ccu_kernel_arg arg) {
81 81 
82 // 后续使用n和offset进行循环和地址计算82 // 后续使用n和offset进行循环和地址计算
83 // ...83 // ...
84- return CCU_SUCCESS;84+ return ccu_result::CCU_SUCCESS;
85}85}
86 86 
87// Host侧对应的<<<>>>(示意):87// Host侧对应的<<<>>>(示意):
@@ -23,7 +23,7 @@
23 23 
24## 功能说明24## 功能说明
25 25 
26-头文件为:`#include "ccu/hcomm/ccu_primitives.hpp"`26+头文件为:`#include <ccu/asc_ccu.h>`
27 27 
28在CCU kernel内将一个或多个variable的`uint64_t`值写入片上内存地址。28在CCU kernel内将一个或多个variable的`uint64_t`值写入片上内存地址。
29 29 
@@ -41,25 +41,25 @@
41- 单个variable -> 立即数地址41- 单个variable -> 立即数地址
42 42 
43 ```cpp43 ```cpp
44- CcuResult store(uint64_t addr, variable v);44+ ccu_result store(uint64_t addr, variable v);
45 ```45 ```
46 46 
47- variable数组 -> 立即数地址47- variable数组 -> 立即数地址
48 48 
49 ```cpp49 ```cpp
50- CcuResult store(uint64_t addr, array<variable>& v_arr, uint32_t num);50+ ccu_result store(uint64_t addr, array<variable>& v_arr, uint32_t num);
51 ```51 ```
52 52 
53- 单个variable -> variable地址(间接寻址)53- 单个variable -> variable地址(间接寻址)
54 54 
55 ```cpp55 ```cpp
56- CcuResult store(variable addr_var, variable v);56+ ccu_result store(variable addr_var, variable v);
57 ```57 ```
58 58 
59- variable数组 -> variable地址(间接寻址)59- variable数组 -> variable地址(间接寻址)
60 60 
61 ```cpp61 ```cpp
62- CcuResult store(variable addr_var, array<variable>& v_arr, uint32_t num);62+ ccu_result store(variable addr_var, array<variable>& v_arr, uint32_t num);
63 ```63 ```
64 64 
65## 参数说明65## 参数说明
@@ -74,20 +74,20 @@
74 74 
75## 返回值说明75## 返回值说明
76 76 
77-[`CcuResult`](https://gitcode.com/cann/hcomm/blob/master/docs/zh/api_ref/comm_opdev/datatype_definition/CcuResult.md):接口成功返回`CCU_SUCCESS`,其他值表示失败。77+`ccu_result`:接口成功返回`ccu_result::CCU_SUCCESS`,其他值表示失败。
78 78 
79| 返回值 | 说明 |79| 返回值 | 说明 |
80| --- | --- |80| --- | --- |
81-| `CCU_SUCCESS` | 操作成功。 |81+| `ccu_result::CCU_SUCCESS` | 操作成功。 |
82-| `CCU_E_PARA` | 参数错误:`num`为0或大于`v_arr.size()`;或`num>1`时`v_arr`元素物理不连续。 |82+| `ccu_result::CCU_E_PARA` | 参数错误:`num`为0或大于`v_arr.size()`;或`num>1`时`v_arr`元素物理不连续。 |
83-| `CCU_E_PTR` | 接口在Kernel函数体之外被调用。 |83+| `ccu_result::CCU_E_PTR` | 接口在Kernel函数体之外被调用。 |
84-| `CCU_E_NOT_FOUND` | 传入的`v`/`v_arr`句柄(或`v_arr[1..num-1]`的相邻句柄)未在当前kernel内创建。 |84+| `ccu_result::CCU_E_NOT_FOUND` | 传入的`v`/`v_arr`句柄(或`v_arr[1..num-1]`的相邻句柄)未在当前kernel内创建。 |
85 85 
86## 约束说明86## 约束说明
87 87 
88- `addr`须为CCU可访问的物理地址或经token化的VA,直接传入未经token化的进程虚拟地址将触发驱动错误。88- `addr`须为CCU可访问的物理地址或经token化的VA,直接传入未经token化的进程虚拟地址将触发驱动错误。
89-- `num`须满足`1 ≤ num ≤ v_arr.size()`。本接口在访问`v_arr[0]`之前完成该校验,传入0或超过`v_arr.size()`时返回`CCU_E_PARA`,不会触达底层接口;空`array`(`v_arr.size()`为0)传入任意`num`同样返回`CCU_E_PARA`。89+- `num`须满足`1 ≤ num ≤ v_arr.size()`。本接口在访问`v_arr[0]`之前完成该校验,传入0或超过`v_arr.size()`时返回`ccu_result::CCU_E_PARA`,不会触达底层接口;空`array`(`v_arr.size()`为0)传入任意`num`同样返回`ccu_result::CCU_E_PARA`。
90-- `num>1`时(variable数组通路),`v_arr`须指向物理连续的variable数组,必须通过`ccu::array<variable>`申请。单独声明多个`variable`对象不保证物理连续,违反时在`store(...)`调用处即返回`CCU_E_PARA`。90+- `num>1`时(variable数组通路),`v_arr`须指向物理连续的variable数组,必须通过`ccu::array<variable>`申请。单独声明多个`variable`对象不保证物理连续,违反时在`store(...)`调用处即返回`ccu_result::CCU_E_PARA`。
91- `addr_var`(variable地址通路)在调用本接口前须已被赋予有效地址值(通过`load_arg`、立即数赋值或算术运算)。91- `addr_var`(variable地址通路)在调用本接口前须已被赋予有效地址值(通过`load_arg`、立即数赋值或算术运算)。
92- 立即数地址通路在翻译期固化,执行期不可变;需执行期动态地址时使用variable地址通路。92- 立即数地址通路在翻译期固化,执行期不可变;需执行期动态地址时使用variable地址通路。
93 93 
@@ -95,30 +95,30 @@
95 95 
96```cpp96```cpp
97// 为简化示例,省略返回值接收与错误处理97// 为简化示例,省略返回值接收与错误处理
98-using namespace AscendC::ccu;98+using namespace asc::ccu;
99 99 
100// 场景1:将1个variable存储到立即数地址(单个variable -> 立即数地址)100// 场景1:将1个variable存储到立即数地址(单个variable -> 立即数地址)
101-CcuResult my_kernel(ccu_kernel_arg arg) {101+ccu_result my_kernel(ccu_kernel_arg arg) {
102 variable result;102 variable result;
103 // ... 对result进行计算 ...103 // ... 对result进行计算 ...
104 store(0x20000000ULL, result);104 store(0x20000000ULL, result);
105- return CCU_SUCCESS;105+ return ccu_result::CCU_SUCCESS;
106}106}
107 107 
108// 场景2:将4个variable批量存储到立即数地址(variable数组 -> 立即数地址)108// 场景2:将4个variable批量存储到立即数地址(variable数组 -> 立即数地址)
109-CcuResult my_kernel2(ccu_kernel_arg arg) {109+ccu_result my_kernel2(ccu_kernel_arg arg) {
110 array<variable> v_arr(4); // 4个物理连续variable110 array<variable> v_arr(4); // 4个物理连续variable
111 // ... 对v_arr进行计算 ...111 // ... 对v_arr进行计算 ...
112 store(0x80000000ULL, v_arr, 4);112 store(0x80000000ULL, v_arr, 4);
113- return CCU_SUCCESS;113+ return ccu_result::CCU_SUCCESS;
114}114}
115 115 
116// 场景3:将variable存储到由variable指定的地址(单个variable -> variable地址)116// 场景3:将variable存储到由variable指定的地址(单个variable -> variable地址)
117-CcuResult my_kernel3(ccu_kernel_arg arg) {117+ccu_result my_kernel3(ccu_kernel_arg arg) {
118 variable dst_addr, result;118 variable dst_addr, result;
119 load_arg(dst_addr, 0); // host传入目标地址119 load_arg(dst_addr, 0); // host传入目标地址
120 // ... 对result进行计算 ...120 // ... 对result进行计算 ...
121 store(dst_addr, result); // 执行期间接寻址写入121 store(dst_addr, result); // 执行期间接寻址写入
122- return CCU_SUCCESS;122+ return ccu_result::CCU_SUCCESS;
123}123}
124```124```
@@ -23,7 +23,7 @@
23 23 
24## 功能说明24## 功能说明
25 25 
26-头文件为:`#include "ccu/hcomm/ccu_primitives.hpp"`26+头文件为:`#include <ccu/asc_ccu.h>`
27 27 
28支持本端片上内存、本端CCU Buffer之间的异步数据拷贝,数据在传输过程中保持原始内容不变,硬件完成搬运时自动将`evt`中`mask`对应的标志位设置为1。28支持本端片上内存、本端CCU Buffer之间的异步数据拷贝,数据在传输过程中保持原始内容不变,硬件完成搬运时自动将`evt`中`mask`对应的标志位设置为1。
29 29 
@@ -41,21 +41,21 @@
41- 本端片上内存 -> 本端片上内存41- 本端片上内存 -> 本端片上内存
42 42 
43 ```cpp43 ```cpp
44- CcuResult local_copy(local_addr dst, local_addr src, variable len,44+ ccu_result local_copy(local_addr dst, local_addr src, variable len,
45 event evt, uint16_t mask = 1);45 event evt, uint16_t mask = 1);
46 ```46 ```
47 47 
48- 本端片上内存 -> 本端CCU Buffer48- 本端片上内存 -> 本端CCU Buffer
49 49 
50 ```cpp50 ```cpp
51- CcuResult local_copy(ccu_buffer dst, local_addr src, variable len,51+ ccu_result local_copy(ccu_buffer dst, local_addr src, variable len,
52 event evt, uint16_t mask = 1);52 event evt, uint16_t mask = 1);
53 ```53 ```
54 54 
55- 本端CCU Buffer -> 本端片上内存55- 本端CCU Buffer -> 本端片上内存
56 56 
57 ```cpp57 ```cpp
58- CcuResult local_copy(local_addr dst, ccu_buffer src, variable len,58+ ccu_result local_copy(local_addr dst, ccu_buffer src, variable len,
59 event evt, uint16_t mask = 1);59 event evt, uint16_t mask = 1);
60 ```60 ```
61 61 
@@ -71,13 +71,13 @@
71 71 
72## 返回值说明72## 返回值说明
73 73 
74-[`CcuResult`](https://gitcode.com/cann/hcomm/blob/master/docs/zh/api_ref/comm_opdev/datatype_definition/CcuResult.md):接口成功返回`CCU_SUCCESS`,其他值表示失败。74+`ccu_result`:接口成功返回`ccu_result::CCU_SUCCESS`,其他值表示失败。
75 75 
76| 返回值 | 说明 |76| 返回值 | 说明 |
77| --- | --- |77| --- | --- |
78-| `CCU_SUCCESS` | 操作成功。 |78+| `ccu_result::CCU_SUCCESS` | 操作成功。 |
79-| `CCU_E_PTR` | 接口在Kernel函数体之外被调用。 |79+| `ccu_result::CCU_E_PTR` | 接口在Kernel函数体之外被调用。 |
80-| `CCU_E_NOT_FOUND` | 传入的`dst`/`src`/`len`/`evt`句柄未在当前kernel内创建。 |80+| `ccu_result::CCU_E_NOT_FOUND` | 传入的`dst`/`src`/`len`/`evt`句柄未在当前kernel内创建。 |
81 81 
82## 约束说明82## 约束说明
83 83 
@@ -90,21 +90,21 @@
90 90 
91```cpp91```cpp
92// 为简化示例,省略返回值接收与错误处理92// 为简化示例,省略返回值接收与错误处理
93-using namespace AscendC::ccu;93+using namespace asc::ccu;
94 94 
95// 场景1:本端片上内存→本端片上内存拷贝95// 场景1:本端片上内存→本端片上内存拷贝
96-CcuResult my_kernel(ccu_kernel_arg arg) {96+ccu_result my_kernel(ccu_kernel_arg arg) {
97 local_addr src, dst;97 local_addr src, dst;
98 variable len;98 variable len;
99 event evt;99 event evt;
100 100 
101 local_copy(dst, src, len, evt); // mask默认0x1101 local_copy(dst, src, len, evt); // mask默认0x1
102 event_wait(evt);102 event_wait(evt);
103- return CCU_SUCCESS;103+ return ccu_result::CCU_SUCCESS;
104}104}
105 105 
106// 场景2:本端片上内存→本端CCU Buffer拷贝106// 场景2:本端片上内存→本端CCU Buffer拷贝
107-CcuResult my_kernel2(ccu_kernel_arg arg) {107+ccu_result my_kernel2(ccu_kernel_arg arg) {
108 ccu_buffer buf;108 ccu_buffer buf;
109 local_addr src;109 local_addr src;
110 variable len;110 variable len;
@@ -112,11 +112,11 @@ CcuResult my_kernel2(ccu_kernel_arg arg) {
112 112 
113 local_copy(buf, src, len, evt);113 local_copy(buf, src, len, evt);
114 event_wait(evt);114 event_wait(evt);
115- return CCU_SUCCESS;115+ return ccu_result::CCU_SUCCESS;
116}116}
117 117 
118// 场景3:本端CCU Buffer→本端片上内存拷贝118// 场景3:本端CCU Buffer→本端片上内存拷贝
119-CcuResult my_kernel3(ccu_kernel_arg arg) {119+ccu_result my_kernel3(ccu_kernel_arg arg) {
120 local_addr dst;120 local_addr dst;
121 ccu_buffer buf;121 ccu_buffer buf;
122 variable len;122 variable len;
@@ -124,6 +124,6 @@ CcuResult my_kernel3(ccu_kernel_arg arg) {
124 124 
125 local_copy(dst, buf, len, evt);125 local_copy(dst, buf, len, evt);
126 event_wait(evt);126 event_wait(evt);
127- return CCU_SUCCESS;127+ return ccu_result::CCU_SUCCESS;
128}128}
129```129```
@@ -23,7 +23,7 @@
23 23 
24## 功能说明24## 功能说明
25 25 
26-头文件为:`#include "ccu/hcomm/ccu_primitives.hpp"`26+头文件为:`#include <ccu/asc_ccu.h>`
27 27 
28将源数据与目标内存或多个ccu_buffer按指定算子合并(异步),硬件完成时自动将`evt`中`mask`对应的标志位设置为1。28将源数据与目标内存或多个ccu_buffer按指定算子合并(异步),硬件完成时自动将`evt`中`mask`对应的标志位设置为1。
29 29 
@@ -37,7 +37,7 @@
37- 本端片上内存 -> 本端片上内存37- 本端片上内存 -> 本端片上内存
38 38 
39 ```cpp39 ```cpp
40- CcuResult local_reduce(local_addr dst, local_addr src, variable len,40+ ccu_result local_reduce(local_addr dst, local_addr src, variable len,
41 HcclDataType data_type, HcclReduceOp op_type,41 HcclDataType data_type, HcclReduceOp op_type,
42 event evt, uint16_t mask = 1);42 event evt, uint16_t mask = 1);
43 ```43 ```
@@ -45,7 +45,7 @@
45- N个本端CCU Buffer -> `buffers[0]`(2 ≤ count ≤ 8)45- N个本端CCU Buffer -> `buffers[0]`(2 ≤ count ≤ 8)
46 46 
47 ```cpp47 ```cpp
48- CcuResult local_reduce(ccu_buffer* buffers, uint32_t count,48+ ccu_result local_reduce(ccu_buffer* buffers, uint32_t count,
49 HcclDataType data_type, HcclDataType output_data_type,49 HcclDataType data_type, HcclDataType output_data_type,
50 HcclReduceOp op_type,50 HcclReduceOp op_type,
51 variable len, event evt, uint16_t mask = 1);51 variable len, event evt, uint16_t mask = 1);
@@ -58,9 +58,9 @@
58| dst | 输入/输出 | 目标片上内存地址(`local_addr`,本端片上内存 -> 本端片上内存)。调用前须写入有效初值;硬件完成后更新为归约结果。 |58| dst | 输入/输出 | 目标片上内存地址(`local_addr`,本端片上内存 -> 本端片上内存)。调用前须写入有效初值;硬件完成后更新为归约结果。 |
59| src | 输入 | 源片上内存地址(`local_addr`,本端片上内存 -> 本端片上内存)。 |59| src | 输入 | 源片上内存地址(`local_addr`,本端片上内存 -> 本端片上内存)。 |
60| buffers | 输入/输出 | ccu_buffer数组首地址(`ccu_buffer*`,N个本端CCU Buffer -> `buffers[0]`),不可为`nullptr`。推荐通过`ccu::array<ccu_buffer>`申请以保证物理连续。`buffers[0]`为归约结果的输出位置,调用前须写入有效初值。精度膨胀场景(低精度输入 + SUM 升精度输出,如INT8→FP32时输出元素4×于输入)下,传入的ccu_buffer数组须同时覆盖输入与膨胀后的输出占用(例如2路INT8输入升FP32输出时须预留4个ccu_buffer,而非2个);预留不足会导致硬件读写越界、行为未定义。 |60| buffers | 输入/输出 | ccu_buffer数组首地址(`ccu_buffer*`,N个本端CCU Buffer -> `buffers[0]`),不可为`nullptr`。推荐通过`ccu::array<ccu_buffer>`申请以保证物理连续。`buffers[0]`为归约结果的输出位置,调用前须写入有效初值。精度膨胀场景(低精度输入 + SUM 升精度输出,如INT8→FP32时输出元素4×于输入)下,传入的ccu_buffer数组须同时覆盖输入与膨胀后的输出占用(例如2路INT8输入升FP32输出时须预留4个ccu_buffer,而非2个);预留不足会导致硬件读写越界、行为未定义。 |
61-| count | 输入 | ccu_buffer数量(N个本端CCU Buffer -> `buffers[0]`)。取值范围为`[2, 8]`(超过上限会抛出异常并携带错误码)。`count == 0`会被直接拒绝并返回`CCU_E_PARA`;`count == 1`不会被拒绝但硬件行为未定义,单个ccu_buffer场景请用“本端片上内存 -> 本端片上内存”通路。`count`须等于`buffers`数组实际长度。 |61+| count | 输入 | ccu_buffer数量(N个本端CCU Buffer -> `buffers[0]`)。取值范围为`[2, 8]`(超过上限会抛出异常并携带错误码)。`count == 0`会被直接拒绝并返回`ccu_result::CCU_E_PARA`;`count == 1`不会被拒绝但硬件行为未定义,单个ccu_buffer场景请用“本端片上内存 -> 本端片上内存”通路。`count`须等于`buffers`数组实际长度。 |
62| data_type | 输入 | 输入数据类型,取值见`HcclDataType`枚举。支持的类型集与通路及归约算子相关,详见[data_type 支持的数据类型](#data-type-table);不在支持集合内的取值会被拒绝并抛出异常(携带错误码)。 |62| data_type | 输入 | 输入数据类型,取值见`HcclDataType`枚举。支持的类型集与通路及归约算子相关,详见[data_type 支持的数据类型](#data-type-table);不在支持集合内的取值会被拒绝并抛出异常(携带错误码)。 |
63-| output_data_type | 输入 | 输出数据类型(仅“N个本端CCU Buffer -> `buffers[0]`”通路),取值见`HcclDataType`枚举。支持两种组合:①同精度——取值与`data_type`相同;②升精度——仅在`op_type == HCCL_REDUCE_SUM`时支持,将低精度输入归约后升至高精度输出(如`HCCL_DATA_TYPE_INT8`→`HCCL_DATA_TYPE_FP32`,见“调用示例 - 场景2”)。其他`data_type`/`output_data_type`组合返回`CCU_E_NOT_SUPPORT`(见返回值表)。升精度场景下`buffers`须按精度膨胀比例预留ccu_buffer,详见`buffers`参数说明。 |63+| output_data_type | 输入 | 输出数据类型(仅“N个本端CCU Buffer -> `buffers[0]`”通路),取值见`HcclDataType`枚举。支持两种组合:①同精度——取值与`data_type`相同;②升精度——仅在`op_type == HCCL_REDUCE_SUM`时支持,将低精度输入归约后升至高精度输出(如`HCCL_DATA_TYPE_INT8`→`HCCL_DATA_TYPE_FP32`,见“调用示例 - 场景2”)。其他`data_type`/`output_data_type`组合返回`ccu_result::CCU_E_NOT_SUPPORT`(见返回值表)。升精度场景下`buffers`须按精度膨胀比例预留ccu_buffer,详见`buffers`参数说明。 |
64| op_type | 输入 | 归约算子,取值见`HcclReduceOp`枚举。仅支持`HCCL_REDUCE_SUM`、`HCCL_REDUCE_MAX`、`HCCL_REDUCE_MIN`;`HCCL_REDUCE_PROD`不支持,传入会被拒绝并抛出异常(携带错误码)。当采用SUM操作时,低精度输入数据的求和结果会先升精度、再调整为与输入数据相同的精度(“N个本端CCU Buffer -> `buffers[0]`”通路下若指定了升精度的`output_data_type`,则按输出精度保留,不再调回输入精度)。 |64| op_type | 输入 | 归约算子,取值见`HcclReduceOp`枚举。仅支持`HCCL_REDUCE_SUM`、`HCCL_REDUCE_MAX`、`HCCL_REDUCE_MIN`;`HCCL_REDUCE_PROD`不支持,传入会被拒绝并抛出异常(携带错误码)。当采用SUM操作时,低精度输入数据的求和结果会先升精度、再调整为与输入数据相同的精度(“N个本端CCU Buffer -> `buffers[0]`”通路下若指定了升精度的`output_data_type`,则按输出精度保留,不再调回输入精度)。 |
65| len | 输入 | 操作字节数,类型为`variable`,实际值在执行期取自对应的通用寄存器。<br>&bull;本端片上内存 -> 本端片上内存:操作的总字节数。<br>&bull;N个本端CCU Buffer -> `buffers[0]`:每个ccu_buffer参与归约的字节数,不可超过单片大小(4096字节)。 |65| len | 输入 | 操作字节数,类型为`variable`,实际值在执行期取自对应的通用寄存器。<br>&bull;本端片上内存 -> 本端片上内存:操作的总字节数。<br>&bull;N个本端CCU Buffer -> `buffers[0]`:每个ccu_buffer参与归约的字节数,不可超过单片大小(4096字节)。 |
66| evt | 输入 | 完成事件对象,硬件归约完成时自动将`evt`中`mask`对应的标志位设置为1,下游调用`event_wait(evt, mask)`等待。 |66| evt | 输入 | 完成事件对象,硬件归约完成时自动将`evt`中`mask`对应的标志位设置为1,下游调用`event_wait(evt, mask)`等待。 |
@@ -90,19 +90,19 @@
90 90 
91## 返回值说明91## 返回值说明
92 92 
93-[`CcuResult`](https://gitcode.com/cann/hcomm/blob/master/docs/zh/api_ref/comm_opdev/datatype_definition/CcuResult.md):接口成功返回`CCU_SUCCESS`,其他值表示失败。93+`ccu_result`:接口成功返回`ccu_result::CCU_SUCCESS`,其他值表示失败。
94 94 
95| 返回值 | 说明 |95| 返回值 | 说明 |
96| --- | --- |96| --- | --- |
97-| `CCU_SUCCESS` | 操作成功。 |97+| `ccu_result::CCU_SUCCESS` | 操作成功。 |
98-| `CCU_E_PARA` | 参数错误,包括`buffers`为`nullptr`或`count`为0。 |98+| `ccu_result::CCU_E_PARA` | 参数错误,包括`buffers`为`nullptr`或`count`为0。 |
99-| `CCU_E_NOT_SUPPORT` | 仅“N个本端CCU Buffer -> `buffers[0]`”通路:`data_type`/`output_data_type`组合不满足升精度/同精度约束(详见`output_data_type`说明)。 |99+| `ccu_result::CCU_E_NOT_SUPPORT` | 仅“N个本端CCU Buffer -> `buffers[0]`”通路:`data_type`/`output_data_type`组合不满足升精度/同精度约束(详见`output_data_type`说明)。 |
100 100 
101## 约束说明101## 约束说明
102 102 
103- 归约为原地操作,调用前`dst`(“本端片上内存 -> 本端片上内存”通路)或`buffers[0]`(“N个本端CCU Buffer -> `buffers[0]`”通路)须已写入有效初值(如0或负无穷),否则归约结果未定义。103- 归约为原地操作,调用前`dst`(“本端片上内存 -> 本端片上内存”通路)或`buffers[0]`(“N个本端CCU Buffer -> `buffers[0]`”通路)须已写入有效初值(如0或负无穷),否则归约结果未定义。
104- “N个本端CCU Buffer -> `buffers[0]`”通路的`buffers`须指向物理连续的`ccu_buffer`数组,推荐使用`ccu::array<ccu_buffer>`申请。104- “N个本端CCU Buffer -> `buffers[0]`”通路的`buffers`须指向物理连续的`ccu_buffer`数组,推荐使用`ccu::array<ccu_buffer>`申请。
105-- “N个本端CCU Buffer -> `buffers[0]`”通路的`count`取值范围为`[2, 8]`;`count > 8`时抛出异常(携带错误码),`count == 0`直接返回`CCU_E_PARA`,`count == 1`不被拒但硬件行为未定义(请改用“本端片上内存 -> 本端片上内存”通路)。105+- “N个本端CCU Buffer -> `buffers[0]`”通路的`count`取值范围为`[2, 8]`;`count > 8`时抛出异常(携带错误码),`count == 0`直接返回`ccu_result::CCU_E_PARA`,`count == 1`不被拒但硬件行为未定义(请改用“本端片上内存 -> 本端片上内存”通路)。
106- “N个本端CCU Buffer -> `buffers[0]`”通路在精度膨胀场景(低精度输入 + SUM 升精度输出)下,`buffers`须按膨胀比例额外预留ccu_buffer以容纳膨胀后的输出,否则硬件读写越界、行为未定义。106- “N个本端CCU Buffer -> `buffers[0]`”通路在精度膨胀场景(低精度输入 + SUM 升精度输出)下,`buffers`须按膨胀比例额外预留ccu_buffer以容纳膨胀后的输出,否则硬件读写越界、行为未定义。
107- “N个本端CCU Buffer -> `buffers[0]`”通路,`len`不可超过`ccu_buffer`单片大小(4096字节);该上限须由调用方自行保证,超出会导致执行期硬件行为未定义。107- “N个本端CCU Buffer -> `buffers[0]`”通路,`len`不可超过`ccu_buffer`单片大小(4096字节);该上限须由调用方自行保证,超出会导致执行期硬件行为未定义。
108- 本接口为异步操作,须通过`event_wait(evt, mask)`等待归约完成后再读取结果。108- 本接口为异步操作,须通过`event_wait(evt, mask)`等待归约完成后再读取结果。
@@ -111,10 +111,10 @@
111 111 
112```cpp112```cpp
113// 为简化示例,省略返回值接收与错误处理113// 为简化示例,省略返回值接收与错误处理
114-using namespace AscendC::ccu;114+using namespace asc::ccu;
115 115 
116// 场景1:本端片上内存 -> 本端片上内存归约(FP16 SUM)116// 场景1:本端片上内存 -> 本端片上内存归约(FP16 SUM)
117-CcuResult my_kernel(ccu_kernel_arg arg) {117+ccu_result my_kernel(ccu_kernel_arg arg) {
118 local_addr dst, src;118 local_addr dst, src;
119 variable len;119 variable len;
120 event evt;120 event evt;
@@ -122,12 +122,12 @@ CcuResult my_kernel(ccu_kernel_arg arg) {
122 // dst须预先写入初值(如0.0)122 // dst须预先写入初值(如0.0)
123 local_reduce(dst, src, len, HCCL_DATA_TYPE_FP16, HCCL_REDUCE_SUM, evt);123 local_reduce(dst, src, len, HCCL_DATA_TYPE_FP16, HCCL_REDUCE_SUM, evt);
124 event_wait(evt);124 event_wait(evt);
125- return CCU_SUCCESS;125+ return ccu_result::CCU_SUCCESS;
126}126}
127 127 
128// 场景2:2个ccu_buffer归约到buffers[0],输入INT8升精度输出FP32(合法的“输入≠输出”组合;128// 场景2:2个ccu_buffer归约到buffers[0],输入INT8升精度输出FP32(合法的“输入≠输出”组合;
129// INT8→FP32 = 4× 膨胀,2路输入须预留4个ccu_buffer以容纳膨胀后的输出,见参数表`buffers`说明)129// INT8→FP32 = 4× 膨胀,2路输入须预留4个ccu_buffer以容纳膨胀后的输出,见参数表`buffers`说明)
130-CcuResult my_kernel2(ccu_kernel_arg arg) {130+ccu_result my_kernel2(ccu_kernel_arg arg) {
131 array<ccu_buffer> bufs(4); // 2路输入,按膨胀比例预留4个物理连续ccu_buffer131 array<ccu_buffer> bufs(4); // 2路输入,按膨胀比例预留4个物理连续ccu_buffer
132 variable len;132 variable len;
133 event evt;133 event evt;
@@ -138,11 +138,11 @@ CcuResult my_kernel2(ccu_kernel_arg arg) {
138 HCCL_DATA_TYPE_INT8, HCCL_DATA_TYPE_FP32,138 HCCL_DATA_TYPE_INT8, HCCL_DATA_TYPE_FP32,
139 HCCL_REDUCE_SUM, len, evt);139 HCCL_REDUCE_SUM, len, evt);
140 event_wait(evt);140 event_wait(evt);
141- return CCU_SUCCESS;141+ return ccu_result::CCU_SUCCESS;
142}142}
143 143 
144// 场景3:输入输出同类型的常规归约(FP16 SUM)144// 场景3:输入输出同类型的常规归约(FP16 SUM)
145-CcuResult my_kernel3(ccu_kernel_arg arg) {145+ccu_result my_kernel3(ccu_kernel_arg arg) {
146 array<ccu_buffer> bufs(4);146 array<ccu_buffer> bufs(4);
147 variable len;147 variable len;
148 event evt;148 event evt;
@@ -151,6 +151,6 @@ CcuResult my_kernel3(ccu_kernel_arg arg) {
151 HCCL_DATA_TYPE_FP16, HCCL_DATA_TYPE_FP16,151 HCCL_DATA_TYPE_FP16, HCCL_DATA_TYPE_FP16,
152 HCCL_REDUCE_SUM, len, evt);152 HCCL_REDUCE_SUM, len, evt);
153 event_wait(evt);153 event_wait(evt);
154- return CCU_SUCCESS;154+ return ccu_result::CCU_SUCCESS;
155}155}
156```156```
@@ -23,7 +23,7 @@
23 23 
24## 功能说明24## 功能说明
25 25 
26-头文件为:`#include "ccu/hcomm/ccu_primitives.hpp"`26+头文件为:`#include <ccu/asc_ccu.h>`
27 27 
28通过已建链的[`ChannelHandle`](https://gitcode.com/cann/hcomm/blob/master/docs/zh/api_ref/comm_opdev/datatype_definition/ChannelHandle.md)从对端片上内存异步读取数据到本端,硬件完成时自动将`evt`中`mask`对应的标志位设置为1。28通过已建链的[`ChannelHandle`](https://gitcode.com/cann/hcomm/blob/master/docs/zh/api_ref/comm_opdev/datatype_definition/ChannelHandle.md)从对端片上内存异步读取数据到本端,硬件完成时自动将`evt`中`mask`对应的标志位设置为1。
29 29 
@@ -37,14 +37,14 @@
37- 对端片上内存 -> 本端片上内存37- 对端片上内存 -> 本端片上内存
38 38 
39 ```cpp39 ```cpp
40- CcuResult read(ChannelHandle ch, local_addr local, remote_addr remote,40+ ccu_result read(ChannelHandle ch, local_addr local, remote_addr remote,
41 variable len, event evt, uint16_t mask = 1);41 variable len, event evt, uint16_t mask = 1);
42 ```42 ```
43 43 
44- 对端片上内存 -> 本端CCU Buffer44- 对端片上内存 -> 本端CCU Buffer
45 45 
46 ```cpp46 ```cpp
47- CcuResult read(ChannelHandle ch, ccu_buffer local, remote_addr remote,47+ ccu_result read(ChannelHandle ch, ccu_buffer local, remote_addr remote,
48 variable len, event evt, uint16_t mask = 1);48 variable len, event evt, uint16_t mask = 1);
49 ```49 ```
50 50 
@@ -61,18 +61,18 @@
61 61 
62## 返回值说明62## 返回值说明
63 63 
64-[`CcuResult`](https://gitcode.com/cann/hcomm/blob/master/docs/zh/api_ref/comm_opdev/datatype_definition/CcuResult.md):接口成功返回`CCU_SUCCESS`,其他值表示失败。64+`ccu_result`:接口成功返回`ccu_result::CCU_SUCCESS`,其他值表示失败。
65 65 
66| 返回值 | 说明 |66| 返回值 | 说明 |
67| --- | --- |67| --- | --- |
68-| `CCU_SUCCESS` | 操作成功。 |68+| `ccu_result::CCU_SUCCESS` | 操作成功。 |
69-| `CCU_E_PTR` | 接口在Kernel函数体之外被调用。 |69+| `ccu_result::CCU_E_PTR` | 接口在Kernel函数体之外被调用。 |
70-| `CCU_E_NOT_FOUND` | 传入的`local`/`remote`/`len`/`evt`句柄未在当前kernel内创建。 |70+| `ccu_result::CCU_E_NOT_FOUND` | 传入的`local`/`remote`/`len`/`evt`句柄未在当前kernel内创建。 |
71 71 
72## 约束说明72## 约束说明
73 73 
74- 参数顺序为目的端在前、源端在后:`read(ch, local, remote, ...)`,与`write`相反,顺序写反会因类型不同在编译期报错。74- 参数顺序为目的端在前、源端在后:`read(ch, local, remote, ...)`,与`write`相反,顺序写反会因类型不同在编译期报错。
75-- 同一kernel内所有[`ChannelHandle`](https://gitcode.com/cann/hcomm/blob/master/docs/zh/api_ref/comm_opdev/datatype_definition/ChannelHandle.md)须属于同一die,不同die的channel不可混入同一kernel。die一致性由`<<<>>>`统一校验,不一致时返回`CCU_E_PARA`,而非本接口的返回值。75+- 同一kernel内所有[`ChannelHandle`](https://gitcode.com/cann/hcomm/blob/master/docs/zh/api_ref/comm_opdev/datatype_definition/ChannelHandle.md)须属于同一die,不同die的channel不可混入同一kernel。die一致性由`<<<>>>`统一校验,不一致时返回`ccu_result::CCU_E_PARA`,而非本接口的返回值。
76- “对端片上内存 -> 本端CCU Buffer”时,`len`不可超过`ccu_buffer`单片大小(4096字节);该上限须由调用方自行保证,超出会导致执行期硬件行为未定义。76- “对端片上内存 -> 本端CCU Buffer”时,`len`不可超过`ccu_buffer`单片大小(4096字节);该上限须由调用方自行保证,超出会导致执行期硬件行为未定义。
77- 本接口为异步操作,须通过`event_wait(evt, mask)`等待读取完成后再访问目标内存。77- 本接口为异步操作,须通过`event_wait(evt, mask)`等待读取完成后再访问目标内存。
78 78 
@@ -80,7 +80,7 @@
80 80 
81```cpp81```cpp
82// 为简化示例,省略返回值接收与错误处理82// 为简化示例,省略返回值接收与错误处理
83-using namespace AscendC::ccu;83+using namespace asc::ccu;
84 84 
85// 用户自定义的kernel入参结构体,Host侧建链后通过<<<>>>的kernelArg传入85// 用户自定义的kernel入参结构体,Host侧建链后通过<<<>>>的kernelArg传入
86struct my_kernel_arg {86struct my_kernel_arg {
@@ -88,7 +88,7 @@ struct my_kernel_arg {
88};88};
89 89 
90// 场景1:从对端片上内存读取到本端片上内存90// 场景1:从对端片上内存读取到本端片上内存
91-CcuResult my_kernel(ccu_kernel_arg arg) {91+ccu_result my_kernel(ccu_kernel_arg arg) {
92 auto *params = static_cast<my_kernel_arg *>(arg); // ccu_kernel_arg为void*,先转型为用户入参结构体92 auto *params = static_cast<my_kernel_arg *>(arg); // ccu_kernel_arg为void*,先转型为用户入参结构体
93 ChannelHandle ch = params->channel_handle;93 ChannelHandle ch = params->channel_handle;
94 local_addr dst;94 local_addr dst;
@@ -98,11 +98,11 @@ CcuResult my_kernel(ccu_kernel_arg arg) {
98 98 
99 read(ch, dst, remote, len, evt); // local在前,remote在后99 read(ch, dst, remote, len, evt); // local在前,remote在后
100 event_wait(evt);100 event_wait(evt);
101- return CCU_SUCCESS;101+ return ccu_result::CCU_SUCCESS;
102}102}
103 103 
104// 场景2:从对端片上内存读取到本端CCU Buffer104// 场景2:从对端片上内存读取到本端CCU Buffer
105-CcuResult my_kernel2(ccu_kernel_arg arg) {105+ccu_result my_kernel2(ccu_kernel_arg arg) {
106 auto *params = static_cast<my_kernel_arg *>(arg); // ccu_kernel_arg为void*,先转型为用户入参结构体106 auto *params = static_cast<my_kernel_arg *>(arg); // ccu_kernel_arg为void*,先转型为用户入参结构体
107 ChannelHandle ch = params->channel_handle;107 ChannelHandle ch = params->channel_handle;
108 ccu_buffer buf;108 ccu_buffer buf;
@@ -112,6 +112,6 @@ CcuResult my_kernel2(ccu_kernel_arg arg) {
112 112 
113 read(ch, buf, remote, len, evt);113 read(ch, buf, remote, len, evt);
114 event_wait(evt);114 event_wait(evt);
115- return CCU_SUCCESS;115+ return ccu_result::CCU_SUCCESS;
116}116}
117```117```
@@ -23,7 +23,7 @@
23 23 
24## 功能说明24## 功能说明
25 25 
26-头文件为:`#include "ccu/hcomm/ccu_primitives.hpp"`26+头文件为:`#include <ccu/asc_ccu.h>`
27 27 
28通过已建链的[`ChannelHandle`](https://gitcode.com/cann/hcomm/blob/master/docs/zh/api_ref/comm_opdev/datatype_definition/ChannelHandle.md)从对端片上内存异步读取数据,并与本端片上内存现有数据按指定算子合并(`local = reduce(local, fetch_from_remote, op_type)`),硬件完成时自动将`evt`中`mask`对应的标志位设置为1。28通过已建链的[`ChannelHandle`](https://gitcode.com/cann/hcomm/blob/master/docs/zh/api_ref/comm_opdev/datatype_definition/ChannelHandle.md)从对端片上内存异步读取数据,并与本端片上内存现有数据按指定算子合并(`local = reduce(local, fetch_from_remote, op_type)`),硬件完成时自动将`evt`中`mask`对应的标志位设置为1。
29 29 
@@ -34,7 +34,7 @@
34## 函数原型34## 函数原型
35 35 
36```cpp36```cpp
37-CcuResult read_reduce(ChannelHandle ch, local_addr local, remote_addr remote,37+ccu_result read_reduce(ChannelHandle ch, local_addr local, remote_addr remote,
38 variable len, HcclDataType data_type, HcclReduceOp op_type,38 variable len, HcclDataType data_type, HcclReduceOp op_type,
39 event evt, uint16_t mask = 1);39 event evt, uint16_t mask = 1);
40```40```
@@ -54,18 +54,18 @@ CcuResult read_reduce(ChannelHandle ch, local_addr local, remote_addr remote,
54 54 
55## 返回值说明55## 返回值说明
56 56 
57-[`CcuResult`](https://gitcode.com/cann/hcomm/blob/master/docs/zh/api_ref/comm_opdev/datatype_definition/CcuResult.md):接口成功返回`CCU_SUCCESS`,其他值表示失败。57+`ccu_result`:接口成功返回`ccu_result::CCU_SUCCESS`,其他值表示失败。
58 58 
59| 返回值 | 说明 |59| 返回值 | 说明 |
60| --- | --- |60| --- | --- |
61-| `CCU_SUCCESS` | 操作成功。 |61+| `ccu_result::CCU_SUCCESS` | 操作成功。 |
62-| `CCU_E_PTR` | 接口在Kernel函数体之外被调用。 |62+| `ccu_result::CCU_E_PTR` | 接口在Kernel函数体之外被调用。 |
63-| `CCU_E_NOT_FOUND` | 传入的`local`/`remote`/`len`/`evt`句柄未在当前kernel内创建。 |63+| `ccu_result::CCU_E_NOT_FOUND` | 传入的`local`/`remote`/`len`/`evt`句柄未在当前kernel内创建。 |
64 64 
65## 约束说明65## 约束说明
66 66 
67- 参数顺序为目的端在前、源端在后:`read_reduce(ch, local, remote, ...)`,`local`同时也是归约的累加端。67- 参数顺序为目的端在前、源端在后:`read_reduce(ch, local, remote, ...)`,`local`同时也是归约的累加端。
68-- 同一kernel内所有[`ChannelHandle`](https://gitcode.com/cann/hcomm/blob/master/docs/zh/api_ref/comm_opdev/datatype_definition/ChannelHandle.md)须属于同一die,不同die的channel不可混入同一kernel。die一致性由`<<<>>>`统一校验,不一致时返回`CCU_E_PARA`,而非本接口的返回值。68+- 同一kernel内所有[`ChannelHandle`](https://gitcode.com/cann/hcomm/blob/master/docs/zh/api_ref/comm_opdev/datatype_definition/ChannelHandle.md)须属于同一die,不同die的channel不可混入同一kernel。die一致性由`<<<>>>`统一校验,不一致时返回`ccu_result::CCU_E_PARA`,而非本接口的返回值。
69- `local`在调用前须已写入有效初值(如0或负无穷),否则归约结果未定义。69- `local`在调用前须已写入有效初值(如0或负无穷),否则归约结果未定义。
70- 本接口为异步操作,须通过`event_wait(evt, mask)`等待归约完成后再读取结果。70- 本接口为异步操作,须通过`event_wait(evt, mask)`等待归约完成后再读取结果。
71 71 
@@ -73,7 +73,7 @@ CcuResult read_reduce(ChannelHandle ch, local_addr local, remote_addr remote,
73 73 
74```cpp74```cpp
75// 为简化示例,省略返回值接收与错误处理75// 为简化示例,省略返回值接收与错误处理
76-using namespace AscendC::ccu;76+using namespace asc::ccu;
77 77 
78// 用户自定义的kernel入参结构体,Host侧建链后通过<<<>>>的kernelArg传入78// 用户自定义的kernel入参结构体,Host侧建链后通过<<<>>>的kernelArg传入
79struct my_kernel_arg {79struct my_kernel_arg {
@@ -81,7 +81,7 @@ struct my_kernel_arg {
81};81};
82 82 
83// 场景:从对端片上内存读取并与本端数据做FP16 SUM归约83// 场景:从对端片上内存读取并与本端数据做FP16 SUM归约
84-CcuResult my_kernel(ccu_kernel_arg arg) {84+ccu_result my_kernel(ccu_kernel_arg arg) {
85 auto *params = static_cast<my_kernel_arg *>(arg); // ccu_kernel_arg为void*,先转型为用户入参结构体85 auto *params = static_cast<my_kernel_arg *>(arg); // ccu_kernel_arg为void*,先转型为用户入参结构体
86 ChannelHandle ch = params->channel_handle;86 ChannelHandle ch = params->channel_handle;
87 local_addr dst; // dst须预先写入初值(如0.0)87 local_addr dst; // dst须预先写入初值(如0.0)
@@ -91,6 +91,6 @@ CcuResult my_kernel(ccu_kernel_arg arg) {
91 91 
92 read_reduce(ch, dst, remote, len, HCCL_DATA_TYPE_FP16, HCCL_REDUCE_SUM, evt);92 read_reduce(ch, dst, remote, len, HCCL_DATA_TYPE_FP16, HCCL_REDUCE_SUM, evt);
93 event_wait(evt);93 event_wait(evt);
94- return CCU_SUCCESS;94+ return ccu_result::CCU_SUCCESS;
95}95}
96```96```
@@ -23,7 +23,7 @@
23 23 
24## 功能说明24## 功能说明
25 25 
26-头文件为:`#include "ccu/hcomm/ccu_primitives.hpp"`26+头文件为:`#include <ccu/asc_ccu.h>`
27 27 
28通过已建链的[`ChannelHandle`](https://gitcode.com/cann/hcomm/blob/master/docs/zh/api_ref/comm_opdev/datatype_definition/ChannelHandle.md)将本端数据异步写入对端片上内存,硬件完成时自动将`evt`中`mask`对应的标志位设置为1。28通过已建链的[`ChannelHandle`](https://gitcode.com/cann/hcomm/blob/master/docs/zh/api_ref/comm_opdev/datatype_definition/ChannelHandle.md)将本端数据异步写入对端片上内存,硬件完成时自动将`evt`中`mask`对应的标志位设置为1。
29 29 
@@ -37,14 +37,14 @@
37- 本端片上内存 -> 对端片上内存37- 本端片上内存 -> 对端片上内存
38 38 
39 ```cpp39 ```cpp
40- CcuResult write(ChannelHandle ch, remote_addr remote, local_addr local,40+ ccu_result write(ChannelHandle ch, remote_addr remote, local_addr local,
41 variable len, event evt, uint16_t mask = 1);41 variable len, event evt, uint16_t mask = 1);
42 ```42 ```
43 43 
44- 本端CCU Buffer -> 对端片上内存44- 本端CCU Buffer -> 对端片上内存
45 45 
46 ```cpp46 ```cpp
47- CcuResult write(ChannelHandle ch, remote_addr remote, ccu_buffer local,47+ ccu_result write(ChannelHandle ch, remote_addr remote, ccu_buffer local,
48 variable len, event evt, uint16_t mask = 1);48 variable len, event evt, uint16_t mask = 1);
49 ```49 ```
50 50 
@@ -61,13 +61,13 @@
61 61 
62## 返回值说明62## 返回值说明
63 63 
64-[`CcuResult`](https://gitcode.com/cann/hcomm/blob/master/docs/zh/api_ref/comm_opdev/datatype_definition/CcuResult.md):接口成功返回`CCU_SUCCESS`,其他值表示失败。64+`ccu_result`:接口成功返回`ccu_result::CCU_SUCCESS`,其他值表示失败。
65 65 
66| 返回值 | 说明 |66| 返回值 | 说明 |
67| --- | --- |67| --- | --- |
68-| `CCU_SUCCESS` | 操作成功。 |68+| `ccu_result::CCU_SUCCESS` | 操作成功。 |
69-| `CCU_E_PTR` | 接口在Kernel函数体之外被调用。 |69+| `ccu_result::CCU_E_PTR` | 接口在Kernel函数体之外被调用。 |
70-| `CCU_E_NOT_FOUND` | 传入的`remote`/`local`/`len`/`evt`句柄未在当前kernel内创建。 |70+| `ccu_result::CCU_E_NOT_FOUND` | 传入的`remote`/`local`/`len`/`evt`句柄未在当前kernel内创建。 |
71 71 
72## 约束说明72## 约束说明
73 73 
@@ -75,14 +75,14 @@
75- `len`必须大于0,否则硬件会发生未定义行为;该约束须由调用方自行保证。75- `len`必须大于0,否则硬件会发生未定义行为;该约束须由调用方自行保证。
76- “本端片上内存 -> 对端片上内存”时,`len`须小于256MB;该上限须由调用方自行保证,超出时硬件会发生未定义行为。76- “本端片上内存 -> 对端片上内存”时,`len`须小于256MB;该上限须由调用方自行保证,超出时硬件会发生未定义行为。
77- “本端CCU Buffer -> 对端片上内存”时,`len`不可超过`ccu_buffer`单片大小(4096字节);该上限须由调用方自行保证,超出时硬件会发生未定义行为。77- “本端CCU Buffer -> 对端片上内存”时,`len`不可超过`ccu_buffer`单片大小(4096字节);该上限须由调用方自行保证,超出时硬件会发生未定义行为。
78-- 同一kernel内所有[`ChannelHandle`](https://gitcode.com/cann/hcomm/blob/master/docs/zh/api_ref/comm_opdev/datatype_definition/ChannelHandle.md)须属于同一die,不同die的channel不可混入同一kernel。die一致性由`<<<>>>`统一校验,不一致时返回`CCU_E_PARA`,而非本接口的返回值。78+- 同一kernel内所有[`ChannelHandle`](https://gitcode.com/cann/hcomm/blob/master/docs/zh/api_ref/comm_opdev/datatype_definition/ChannelHandle.md)须属于同一die,不同die的channel不可混入同一kernel。die一致性由`<<<>>>`统一校验,不一致时返回`ccu_result::CCU_E_PARA`,而非本接口的返回值。
79- 本接口为异步操作,须通过`event_wait(evt, mask)`等待写入完成,方可保证对端数据可见。79- 本接口为异步操作,须通过`event_wait(evt, mask)`等待写入完成,方可保证对端数据可见。
80 80 
81## 调用示例81## 调用示例
82 82 
83```cpp83```cpp
84// 为简化示例,省略返回值接收与错误处理84// 为简化示例,省略返回值接收与错误处理
85-using namespace AscendC::ccu;85+using namespace asc::ccu;
86 86 
87// 用户自定义的kernel入参结构体,Host侧建链后通过<<<>>>的kernelArg传入87// 用户自定义的kernel入参结构体,Host侧建链后通过<<<>>>的kernelArg传入
88struct my_kernel_arg {88struct my_kernel_arg {
@@ -90,7 +90,7 @@ struct my_kernel_arg {
90};90};
91 91 
92// 场景1:本端片上内存→对端片上内存92// 场景1:本端片上内存→对端片上内存
93-CcuResult my_kernel(ccu_kernel_arg arg) {93+ccu_result my_kernel(ccu_kernel_arg arg) {
94 auto *params = static_cast<my_kernel_arg *>(arg); // ccu_kernel_arg为void*,先转型为用户入参结构体94 auto *params = static_cast<my_kernel_arg *>(arg); // ccu_kernel_arg为void*,先转型为用户入参结构体
95 ChannelHandle ch = params->channel_handle;95 ChannelHandle ch = params->channel_handle;
96 remote_addr remote;96 remote_addr remote;
@@ -100,11 +100,11 @@ CcuResult my_kernel(ccu_kernel_arg arg) {
100 100 
101 write(ch, remote, src, len, evt); // remote在前,local在后101 write(ch, remote, src, len, evt); // remote在前,local在后
102 event_wait(evt);102 event_wait(evt);
103- return CCU_SUCCESS;103+ return ccu_result::CCU_SUCCESS;
104}104}
105 105 
106// 场景2:本端CCU Buffer→对端片上内存106// 场景2:本端CCU Buffer→对端片上内存
107-CcuResult my_kernel2(ccu_kernel_arg arg) {107+ccu_result my_kernel2(ccu_kernel_arg arg) {
108 auto *params = static_cast<my_kernel_arg *>(arg); // ccu_kernel_arg为void*,先转型为用户入参结构体108 auto *params = static_cast<my_kernel_arg *>(arg); // ccu_kernel_arg为void*,先转型为用户入参结构体
109 ChannelHandle ch = params->channel_handle;109 ChannelHandle ch = params->channel_handle;
110 remote_addr remote;110 remote_addr remote;
@@ -114,6 +114,6 @@ CcuResult my_kernel2(ccu_kernel_arg arg) {
114 114 
115 write(ch, remote, buf, len, evt);115 write(ch, remote, buf, len, evt);
116 event_wait(evt);116 event_wait(evt);
117- return CCU_SUCCESS;117+ return ccu_result::CCU_SUCCESS;
118}118}
119```119```
@@ -23,7 +23,7 @@
23 23 
24## 功能说明24## 功能说明
25 25 
26-头文件为:`#include "ccu/hcomm/ccu_primitives.hpp"`26+头文件为:`#include <ccu/asc_ccu.h>`
27 27 
28将本端数据异步写入对端片上内存,同时按`op_type`指定的算子与对端现有数据进行归约`remote = reduce(remote, local, op_type)`,硬件完成时自动将`evt`中`mask`对应的标志位设置为1。28将本端数据异步写入对端片上内存,同时按`op_type`指定的算子与对端现有数据进行归约`remote = reduce(remote, local, op_type)`,硬件完成时自动将`evt`中`mask`对应的标志位设置为1。
29 29 
@@ -34,13 +34,13 @@
34## 函数原型34## 函数原型
35 35 
36```cpp36```cpp
37-namespace AscendC {37+namespace asc {
38namespace ccu {38namespace ccu {
39-CcuResult write_reduce(ChannelHandle ch, remote_addr remote, local_addr local,39+ccu_result write_reduce(ChannelHandle ch, remote_addr remote, local_addr local,
40 variable len, HcclDataType data_type, HcclReduceOp op_type,40 variable len, HcclDataType data_type, HcclReduceOp op_type,
41 event evt, uint16_t mask = 1);41 event evt, uint16_t mask = 1);
42} // namespace ccu42} // namespace ccu
43-} // namespace AscendC43+} // namespace asc
44```44```
45 45 
46## 参数说明46## 参数说明
@@ -58,13 +58,13 @@ CcuResult write_reduce(ChannelHandle ch, remote_addr remote, local_addr local,
58 58 
59## 返回值说明59## 返回值说明
60 60 
61-[`CcuResult`](https://gitcode.com/cann/hcomm/blob/master/docs/zh/api_ref/comm_opdev/datatype_definition/CcuResult.md):接口成功返回`CCU_SUCCESS`,其他值表示失败。61+`ccu_result`:接口成功返回`ccu_result::CCU_SUCCESS`,其他值表示失败。
62 62 
63| 返回值 | 说明 |63| 返回值 | 说明 |
64| --- | --- |64| --- | --- |
65-| `CCU_SUCCESS` | 操作成功。 |65+| `ccu_result::CCU_SUCCESS` | 操作成功。 |
66-| `CCU_E_PTR` | 接口在Kernel函数体之外被调用。 |66+| `ccu_result::CCU_E_PTR` | 接口在Kernel函数体之外被调用。 |
67-| `CCU_E_NOT_FOUND` | 传入的`remote`/`local`/`len`/`evt`句柄未在当前kernel内创建。 |67+| `ccu_result::CCU_E_NOT_FOUND` | 传入的`remote`/`local`/`len`/`evt`句柄未在当前kernel内创建。 |
68 68 
69## 约束说明69## 约束说明
70 70 
@@ -72,7 +72,7 @@ CcuResult write_reduce(ChannelHandle ch, remote_addr remote, local_addr local,
72- 参数顺序为目的端在前、源端在后:`write_reduce(ch, remote, local, ...)`,顺序写反会因类型不同在编译期报错。72- 参数顺序为目的端在前、源端在后:`write_reduce(ch, remote, local, ...)`,顺序写反会因类型不同在编译期报错。
73- `len`必须大于0,否则硬件会发生未定义行为;该约束须由调用方自行保证。73- `len`必须大于0,否则硬件会发生未定义行为;该约束须由调用方自行保证。
74- `len`须小于256MB;该上限须由调用方自行保证,超出时硬件会发生未定义行为,超长数据须拆分为多次搬运。74- `len`须小于256MB;该上限须由调用方自行保证,超出时硬件会发生未定义行为,超长数据须拆分为多次搬运。
75-- 同一kernel内所有channel须属于同一die,该约束由`<<<>>>`统一校验,违反时返回`CCU_E_PARA`。75+- 同一kernel内所有channel须属于同一die,该约束由`<<<>>>`统一校验,违反时返回`ccu_result::CCU_E_PARA`。
76- `data_type`仅支持`HCCL_DATA_TYPE_INT8`、`HCCL_DATA_TYPE_UINT8`、`HCCL_DATA_TYPE_INT16`、`HCCL_DATA_TYPE_UINT16`、`HCCL_DATA_TYPE_INT32`、`HCCL_DATA_TYPE_UINT32`、`HCCL_DATA_TYPE_FP16`、`HCCL_DATA_TYPE_BFP16`、`HCCL_DATA_TYPE_FP32`。76- `data_type`仅支持`HCCL_DATA_TYPE_INT8`、`HCCL_DATA_TYPE_UINT8`、`HCCL_DATA_TYPE_INT16`、`HCCL_DATA_TYPE_UINT16`、`HCCL_DATA_TYPE_INT32`、`HCCL_DATA_TYPE_UINT32`、`HCCL_DATA_TYPE_FP16`、`HCCL_DATA_TYPE_BFP16`、`HCCL_DATA_TYPE_FP32`。
77- `op_type`仅支持`HCCL_REDUCE_SUM`、`HCCL_REDUCE_MAX`、`HCCL_REDUCE_MIN`。77- `op_type`仅支持`HCCL_REDUCE_SUM`、`HCCL_REDUCE_MAX`、`HCCL_REDUCE_MIN`。
78- `data_type`/`op_type`不在支持范围内时抛出异常(携带错误码),会被`<<<>>>`统一接住。78- `data_type`/`op_type`不在支持范围内时抛出异常(携带错误码),会被`<<<>>>`统一接住。
@@ -82,7 +82,7 @@ CcuResult write_reduce(ChannelHandle ch, remote_addr remote, local_addr local,
82 82 
83```cpp83```cpp
84// 为简化示例,省略返回值接收与错误处理84// 为简化示例,省略返回值接收与错误处理
85-using namespace AscendC::ccu;85+using namespace asc::ccu;
86 86 
87// 用户自定义的kernel入参结构体,Host侧建链后通过<<<>>>的kernelArg传入87// 用户自定义的kernel入参结构体,Host侧建链后通过<<<>>>的kernelArg传入
88struct my_kernel_arg {88struct my_kernel_arg {
@@ -90,7 +90,7 @@ struct my_kernel_arg {
90};90};
91 91 
92// 场景:将本端FP16数据写入对端并做SUM归约92// 场景:将本端FP16数据写入对端并做SUM归约
93-CcuResult my_kernel(ccu_kernel_arg arg) {93+ccu_result my_kernel(ccu_kernel_arg arg) {
94 auto *params = static_cast<my_kernel_arg *>(arg); // ccu_kernel_arg为void*,先转型为用户入参结构体94 auto *params = static_cast<my_kernel_arg *>(arg); // ccu_kernel_arg为void*,先转型为用户入参结构体
95 ChannelHandle ch = params->channel_handle;95 ChannelHandle ch = params->channel_handle;
96 remote_addr remote; // 对端须预先写入初值96 remote_addr remote; // 对端须预先写入初值
@@ -100,6 +100,6 @@ CcuResult my_kernel(ccu_kernel_arg arg) {
100 100 
101 write_reduce(ch, remote, src, len, HCCL_DATA_TYPE_FP16, HCCL_REDUCE_SUM, evt);101 write_reduce(ch, remote, src, len, HCCL_DATA_TYPE_FP16, HCCL_REDUCE_SUM, evt);
102 event_wait(evt);102 event_wait(evt);
103- return CCU_SUCCESS;103+ return ccu_result::CCU_SUCCESS;
104}104}
105```105```
@@ -23,7 +23,7 @@
23 23 
24## 功能说明24## 功能说明
25 25 
26-头文件为:`#include "ccu/hcomm/ccu_primitives.hpp"`26+头文件为:`#include <ccu/asc_ccu.h>`
27 27 
28在CCU kernel内开始一个do-while循环块:body至少执行一次,然后由配套的`CCU_WHILE`判断是否继续。28在CCU kernel内开始一个do-while循环块:body至少执行一次,然后由配套的`CCU_WHILE`判断是否继续。
29 29 
@@ -50,7 +50,7 @@ CCU_DO {
50 50 
51## 返回值说明51## 返回值说明
52 52 
53-`CCU_DO`为预处理器宏,本身不返回[`CcuResult`](https://gitcode.com/cann/hcomm/blob/master/docs/zh/api_ref/comm_opdev/datatype_definition/CcuResult.md);在正常用法下不会失败。53+`CCU_DO`为预处理器宏,本身不返回`ccu_result`;在正常用法下不会失败。
54 54 
55## 约束说明55## 约束说明
56 56 
@@ -62,10 +62,10 @@ CCU_DO {
62## 调用示例62## 调用示例
63 63 
64```cpp64```cpp
65-using namespace AscendC::ccu;65+using namespace asc::ccu;
66 66 
67// 场景:do-while循环,body至少执行一次,然后根据条件决定是否继续67// 场景:do-while循环,body至少执行一次,然后根据条件决定是否继续
68-CcuResult my_kernel(ccu_kernel_arg arg) {68+ccu_result my_kernel(ccu_kernel_arg arg) {
69 variable inner, one;69 variable inner, one;
70 inner = 0;70 inner = 0;
71 one = 1;71 one = 1;
@@ -75,6 +75,6 @@ CcuResult my_kernel(ccu_kernel_arg arg) {
75 inner = inner + one;75 inner = inner + one;
76 } CCU_WHILE(inner != 5ULL);76 } CCU_WHILE(inner != 5ULL);
77 77 
78- return CCU_SUCCESS;78+ return ccu_result::CCU_SUCCESS;
79}79}
80```80```
@@ -23,7 +23,7 @@
23 23 
24## 功能说明24## 功能说明
25 25 
26-头文件为:`#include "ccu/hcomm/ccu_primitives.hpp"`26+头文件为:`#include <ccu/asc_ccu.h>`
27 27 
28在CCU kernel内开始`CCU_IF`的else分支:当`CCU_IF`条件不满足时执行该分支。28在CCU kernel内开始`CCU_IF`的else分支:当`CCU_IF`条件不满足时执行该分支。
29 29 
@@ -50,7 +50,7 @@ CCU_IF(cond_expr) {
50 50 
51## 返回值说明51## 返回值说明
52 52 
53-`CCU_ELSE`为预处理器宏,本身不返回[`CcuResult`](https://gitcode.com/cann/hcomm/blob/master/docs/zh/api_ref/comm_opdev/datatype_definition/CcuResult.md);在正常用法下不会失败。53+`CCU_ELSE`为预处理器宏,本身不返回`ccu_result`;在正常用法下不会失败。
54 54 
55## 约束说明55## 约束说明
56 56 
@@ -74,9 +74,9 @@ CCU_IF(v == 0) {
74## 调用示例74## 调用示例
75 75 
76```cpp76```cpp
77-using namespace AscendC::ccu;77+using namespace asc::ccu;
78 78 
79-CcuResult my_kernel(ccu_kernel_arg arg) {79+ccu_result my_kernel(ccu_kernel_arg arg) {
80 variable mode;80 variable mode;
81 load_arg(mode, 0);81 load_arg(mode, 0);
82 82 
@@ -90,6 +90,6 @@ CcuResult my_kernel(ccu_kernel_arg arg) {
90 result = 200;90 result = 200;
91 }91 }
92 92 
93- return CCU_SUCCESS;93+ return ccu_result::CCU_SUCCESS;
94}94}
95```95```
@@ -23,7 +23,7 @@
23 23 
24## 功能说明24## 功能说明
25 25 
26-头文件为:`#include "ccu/hcomm/ccu_primitives.hpp"`26+头文件为:`#include <ccu/asc_ccu.h>`
27 27 
28在CCU kernel内开始一个软件条件分支块。条件在执行期由CCU硬件计算,条件满足时执行then代码块,不满足时跳转至if块出口。28在CCU kernel内开始一个软件条件分支块。条件在执行期由CCU硬件计算,条件满足时执行then代码块,不满足时跳转至if块出口。
29 29 
@@ -39,11 +39,11 @@ CCU_IF(cond_expr) {
39 39 
40| 参数名 | 输入/输出 | 描述 |40| 参数名 | 输入/输出 | 描述 |
41| --- | --- | --- |41| --- | --- | --- |
42-| cond_expr | 输入 | 条件表达式,类型为`AscendC::ccu::cond_expr`。通过`ccu::variable`的`operator==(uint64_t)`或`operator!=(uint64_t)`产生,例如`v == 0`或`counter != 10`。 |42+| cond_expr | 输入 | 条件表达式,类型为`asc::ccu::cond_expr`。通过`ccu::variable`的`operator==(uint64_t)`或`operator!=(uint64_t)`产生,例如`v == 0`或`counter != 10`。 |
43 43 
44## 返回值说明44## 返回值说明
45 45 
46-`CCU_IF`为预处理器宏,本身不返回[`CcuResult`](https://gitcode.com/cann/hcomm/blob/master/docs/zh/api_ref/comm_opdev/datatype_definition/CcuResult.md)。宏展开后若发生内部错误(如label重复、句柄无效),可能产生`CCU_E_PARA`/`CCU_E_NOT_FOUND`。此时宏不抛异常、也不阻断kernel生成:失败时代码块被跳过,kernel生成仍然成功。错误不通过返回值反馈,调试时需留意。46+`CCU_IF`为预处理器宏,本身不返回`ccu_result`。宏展开后若发生内部错误(如label重复、句柄无效),可能产生`ccu_result::CCU_E_PARA`/`ccu_result::CCU_E_NOT_FOUND`。此时宏不抛异常、也不阻断kernel生成:失败时代码块被跳过,kernel生成仍然成功。错误不通过返回值反馈,调试时需留意。
47 47 
48## 约束说明48## 约束说明
49 49 
@@ -64,10 +64,10 @@ CCU_IF(cond_expr) {
64## 调用示例64## 调用示例
65 65 
66```cpp66```cpp
67-using namespace AscendC::ccu;67+using namespace asc::ccu;
68 68 
69// 场景:根据执行期变量值选择不同的执行路径69// 场景:根据执行期变量值选择不同的执行路径
70-CcuResult my_kernel(ccu_kernel_arg arg) {70+ccu_result my_kernel(ccu_kernel_arg arg) {
71 variable flag;71 variable flag;
72 load_arg(flag, 0); // 每次下发时从taskArgs[0]加载标志值72 load_arg(flag, 0); // 每次下发时从taskArgs[0]加载标志值
73 73 
@@ -78,6 +78,6 @@ CcuResult my_kernel(ccu_kernel_arg arg) {
78 b = 20;78 b = 20;
79 }79 }
80 80 
81- return CCU_SUCCESS;81+ return ccu_result::CCU_SUCCESS;
82}82}
83```83```
@@ -23,7 +23,7 @@
23 23 
24## 功能说明24## 功能说明
25 25 
26-头文件为:`#include "ccu/hcomm/ccu_primitives.hpp"`26+头文件为:`#include <ccu/asc_ccu.h>`
27 27 
28`CCU_WHILE`是一个预处理器宏,承担两种语义,由其前面是否有`CCU_DO`自动区分:28`CCU_WHILE`是一个预处理器宏,承担两种语义,由其前面是否有`CCU_DO`自动区分:
29 29 
@@ -50,13 +50,13 @@ CCU_DO {
50 50 
51| 参数名 | 描述 |51| 参数名 | 描述 |
52| --- | --- |52| --- | --- |
53-| cond_expr | 条件表达式,类型为`AscendC::ccu::cond_expr`。通过`ccu::variable`的`operator==(uint64_t)`或`operator!=(uint64_t)`产生,例如`counter == 10`。条件在执行期由CCU硬件计算。 |53+| cond_expr | 条件表达式,类型为`asc::ccu::cond_expr`。通过`ccu::variable`的`operator==(uint64_t)`或`operator!=(uint64_t)`产生,例如`counter == 10`。条件在执行期由CCU硬件计算。 |
54 54 
55`cond_expr`的定义与生成方式请参见[CCU_IF](CCU_IF.md#参数说明)。55`cond_expr`的定义与生成方式请参见[CCU_IF](CCU_IF.md#参数说明)。
56 56 
57## 返回值说明57## 返回值说明
58 58 
59-`CCU_WHILE`为预处理器宏,本身不返回[`CcuResult`](https://gitcode.com/cann/hcomm/blob/master/docs/zh/api_ref/comm_opdev/datatype_definition/CcuResult.md)。宏展开后若发生内部错误(如label重复、句柄无效),可能产生`CCU_E_PARA`/`CCU_E_NOT_FOUND`,此时宏不抛异常、也不阻断kernel生成:失败时body会被跳过,但kernel生成仍然成功,错误不通过返回值反馈,调试时需留意。59+`CCU_WHILE`为预处理器宏,本身不返回`ccu_result`。宏展开后若发生内部错误(如label重复、句柄无效),可能产生`ccu_result::CCU_E_PARA`/`ccu_result::CCU_E_NOT_FOUND`,此时宏不抛异常、也不阻断kernel生成:失败时body会被跳过,但kernel生成仍然成功,错误不通过返回值反馈,调试时需留意。
60 60 
61## 约束说明61## 约束说明
62 62 
@@ -70,10 +70,10 @@ CCU_DO {
70## 调用示例70## 调用示例
71 71 
72```cpp72```cpp
73-using namespace AscendC::ccu;73+using namespace asc::ccu;
74 74 
75// 场景:独立while循环,对计数器循环10次75// 场景:独立while循环,对计数器循环10次
76-CcuResult my_kernel(ccu_kernel_arg arg) {76+ccu_result my_kernel(ccu_kernel_arg arg) {
77 variable counter, one;77 variable counter, one;
78 counter = 0;78 counter = 0;
79 one = 1;79 one = 1;
@@ -83,6 +83,6 @@ CcuResult my_kernel(ccu_kernel_arg arg) {
83 counter = counter + one;83 counter = counter + one;
84 }84 }
85 85 
86- return CCU_SUCCESS;86+ return ccu_result::CCU_SUCCESS;
87}87}
88```88```
@@ -23,22 +23,22 @@
23 23 
24## 功能说明24## 功能说明
25 25 
26-头文件为:`#include "ccu/hcomm/ccu_primitives.hpp"`26+头文件为:`#include <ccu/asc_ccu.h>`
27 27 
28函数块的调用接口,与[func](func.md)配合使用。`call_func<obj>(args...)`首次调用时执行`obj`的lambda,将逻辑合成为一份函数块并追加一条跳转指令;对同一`obj`的后续调用只追加跳转指令,复用已合成的函数块。函数块的定义方式参见[func](func.md)。28函数块的调用接口,与[func](func.md)配合使用。`call_func<obj>(args...)`首次调用时执行`obj`的lambda,将逻辑合成为一份函数块并追加一条跳转指令;对同一`obj`的后续调用只追加跳转指令,复用已合成的函数块。函数块的定义方式参见[func](func.md)。
29 29 
30## 函数原型30## 函数原型
31 31 
32```cpp32```cpp
33-namespace AscendC {33+namespace asc {
34namespace ccu {34namespace ccu {
35 35 
36// obj须为namespace作用域或static存储的ccu::func对象,args中每个参数为ccu::variable36// obj须为namespace作用域或static存储的ccu::func对象,args中每个参数为ccu::variable
37template <func &obj, typename... args>37template <func &obj, typename... args>
38-CcuResult call_func(args... args_);38+ccu_result call_func(args... args_);
39 39 
40} // namespace ccu40} // namespace ccu
41-} // namespace AscendC41+} // namespace asc
42```42```
43 43 
44## 参数说明44## 参数说明
@@ -50,12 +50,12 @@ CcuResult call_func(args... args_);
50 50 
51## 返回值说明51## 返回值说明
52 52 
53-[`CcuResult`](https://gitcode.com/cann/hcomm/blob/master/docs/zh/api_ref/comm_opdev/datatype_definition/CcuResult.md):接口成功返回`CCU_SUCCESS`,其他值表示失败。53+`ccu_result`:接口成功返回`ccu_result::CCU_SUCCESS`,其他值表示失败。
54 54 
55| 返回值 | 说明 |55| 返回值 | 说明 |
56| --- | --- |56| --- | --- |
57-| `CCU_SUCCESS` | 操作成功。 |57+| `ccu_result::CCU_SUCCESS` | 操作成功。 |
58-| `CCU_E_PARA` | 实参个数与`obj`的lambda形参个数不一致。 |58+| `ccu_result::CCU_E_PARA` | 实参个数与`obj`的lambda形参个数不一致。 |
59| 其他 | 跳转指令下发、函数块合成过程中底层操作(如形参variable资源申请)失败时返回的对应错误码。 |59| 其他 | 跳转指令下发、函数块合成过程中底层操作(如形参variable资源申请)失败时返回的对应错误码。 |
60 60 
61> [!NOTE]说明61> [!NOTE]说明
@@ -64,15 +64,15 @@ CcuResult call_func(args... args_);
64## 约束说明64## 约束说明
65 65 
66- `obj`必须为namespace作用域或static存储的`ccu::func`对象,不能是函数局部变量:`call_func`以`func`对象引用作模板参数,这是C++语言要求,违反时编译期直接报错。66- `obj`必须为namespace作用域或static存储的`ccu::func`对象,不能是函数局部变量:`call_func`以`func`对象引用作模板参数,这是C++语言要求,违反时编译期直接报错。
67-- 不可在硬件Loop的循环体内调用,否则抛出异常(错误码`CCU_E_INTERNAL`)。67+- 不可在硬件Loop的循环体内调用,否则抛出异常(错误码`ccu_result::CCU_E_INTERNAL`)。
68-- 不可嵌套调用:lambda内不可再调用`call_func`,违反时抛出异常(错误码`CCU_E_INTERNAL`)。68+- 不可嵌套调用:lambda内不可再调用`call_func`,违反时抛出异常(错误码`ccu_result::CCU_E_INTERNAL`)。
69- 首次调用时合成函数块,对同一`obj`的后续调用复用已有函数块;不同的`ccu::func`对象即使lambda内容相同,也各自合成独立的函数块。69- 首次调用时合成函数块,对同一`obj`的后续调用复用已有函数块;不同的`ccu::func`对象即使lambda内容相同,也各自合成独立的函数块。
70-- 抛出的异常会被`<<<>>>`统一接住,对外返回`CCU_E_INTERNAL`,调用方无须自行捕获。70+- 抛出的异常会被`<<<>>>`统一接住,对外返回`ccu_result::CCU_E_INTERNAL`,调用方无须自行捕获。
71 71 
72## 调用示例72## 调用示例
73 73 
74```cpp74```cpp
75-using namespace AscendC::ccu;75+using namespace asc::ccu;
76 76 
77// 声明为namespace作用域的static对象,满足模板参数的链接性要求77// 声明为namespace作用域的static对象,满足模板参数的链接性要求
78static func add_dbl([](variable x) {78static func add_dbl([](variable x) {
@@ -80,14 +80,14 @@ static func add_dbl([](variable x) {
80 tmp = x + x; // 对x翻倍80 tmp = x + x; // 对x翻倍
81});81});
82 82 
83-CcuResult my_kernel(ccu_kernel_arg arg) {83+ccu_result my_kernel(ccu_kernel_arg arg) {
84 variable a, b;84 variable a, b;
85 a = 2;85 a = 2;
86 b = 5;86 b = 5;
87 87 
88 // 首次调用:合成函数块,并追加一条跳转指令88 // 首次调用:合成函数块,并追加一条跳转指令
89- CcuResult ret = call_func<add_dbl>(a);89+ ccu_result ret = call_func<add_dbl>(a);
90- if (ret != CCU_SUCCESS) { return ret; }90+ if (ret != ccu_result::CCU_SUCCESS) { return ret; }
91 91 
92 // 第二次调用:仅追加跳转指令,复用已合成的函数块92 // 第二次调用:仅追加跳转指令,复用已合成的函数块
93 return call_func<add_dbl>(b);93 return call_func<add_dbl>(b);
@@ -23,7 +23,7 @@
23 23 
24## 功能说明24## 功能说明
25 25 
26-头文件为:`#include "ccu/hcomm/ccu_primitives.hpp"`26+头文件为:`#include <ccu/asc_ccu.h>`
27 27 
28`ccu::func`将一个lambda封装为可复用的函数块(FuncBlock):构造时仅记录lambda,不生成指令;首次通过[call_func](call_func.md)调用时执行lambda,把逻辑合成为一份指令块;后续每次调用只追加一条跳转指令,复用同一份指令块,从而节省指令空间。lambda形参为零个或多个`ccu::variable`,在调用时绑定实参,返回`void`。28`ccu::func`将一个lambda封装为可复用的函数块(FuncBlock):构造时仅记录lambda,不生成指令;首次通过[call_func](call_func.md)调用时执行lambda,把逻辑合成为一份指令块;后续每次调用只追加一条跳转指令,复用同一份指令块,从而节省指令空间。lambda形参为零个或多个`ccu::variable`,在调用时绑定实参,返回`void`。
29 29 
@@ -33,7 +33,7 @@
33## 类声明33## 类声明
34 34 
35```cpp35```cpp
36-namespace AscendC {36+namespace asc {
37namespace ccu {37namespace ccu {
38 38 
39class func {39class func {
@@ -47,7 +47,7 @@ public:
47};47};
48 48 
49} // namespace ccu49} // namespace ccu
50-} // namespace AscendC50+} // namespace asc
51```51```
52 52 
53## 参数说明53## 参数说明
@@ -71,7 +71,7 @@ public:
71## 调用示例71## 调用示例
72 72 
73```cpp73```cpp
74-using namespace AscendC::ccu;74+using namespace asc::ccu;
75 75 
76static func add_dbl([](variable x) {76static func add_dbl([](variable x) {
77 variable tmp;77 variable tmp;
@@ -23,7 +23,7 @@
23 23 
24## 功能说明24## 功能说明
25 25 
26-头文件为:`#include "ccu/hcomm/ccu_primitives.hpp"`26+头文件为:`#include <ccu/asc_ccu.h>`
27 27 
28`ccu::loop`是CCU kernel内的硬件循环类,用于描述一段需要重复执行的搬运逻辑。28`ccu::loop`是CCU kernel内的硬件循环类,用于描述一段需要重复执行的搬运逻辑。
29 29 
@@ -35,7 +35,7 @@
35## 类声明35## 类声明
36 36 
37```cpp37```cpp
38-namespace AscendC {38+namespace asc {
39namespace ccu {39namespace ccu {
40 40 
41class loop {41class loop {
@@ -48,7 +48,7 @@ public:
48};48};
49 49 
50} // namespace ccu50} // namespace ccu
51-} // namespace AscendC51+} // namespace asc
52```52```
53 53 
54## 参数说明54## 参数说明
@@ -83,11 +83,11 @@ var-based构造的`loop_cfg`有64个比特位,按位段定义:
83 83 
84## 约束说明84## 约束说明
85 85 
86-- 循环体的lambda必须无入参,有入参时`<<<>>>`抛出异常`CCU_E_PARA`。86+- 循环体的lambda必须无入参,有入参时`<<<>>>`抛出异常`ccu_result::CCU_E_PARA`。
87- 构造完成后不可再向该Loop追加内容。87- 构造完成后不可再向该Loop追加内容。
88- 循环体内的接口限制:88- 循环体内的接口限制:
89- - [event_record](../synchronization/event_record.md)、[local_notify_record](../synchronization/local_notify_record.md)、[notify_record](../synchronization/notify_record.md)和[write_variable_with_notify](../synchronization/write_variable_with_notify.md)不可调用,调用时返回`CCU_E_NOT_SUPPORT`。89+ - [event_record](../synchronization/event_record.md)、[local_notify_record](../synchronization/local_notify_record.md)、[notify_record](../synchronization/notify_record.md)和[write_variable_with_notify](../synchronization/write_variable_with_notify.md)不可调用,调用时返回`ccu_result::CCU_E_NOT_SUPPORT`。
90- - [call_func](call_func.md)不可调用,调用时抛出异常(错误码`CCU_E_INTERNAL`)。90+ - [call_func](call_func.md)不可调用,调用时抛出异常(错误码`ccu_result::CCU_E_INTERNAL`)。
91 - [CCU_IF](CCU_IF.md)等软件分支宏不可使用,代码不会报错,但硬件会发生未定义行为。91 - [CCU_IF](CCU_IF.md)等软件分支宏不可使用,代码不会报错,但硬件会发生未定义行为。
92- `ccu::loop`必须加入`ccu::loop_group`才能下发硬件循环指令,不要单独使用,详见[功能说明](#功能说明)。92- `ccu::loop`必须加入`ccu::loop_group`才能下发硬件循环指令,不要单独使用,详见[功能说明](#功能说明)。
93- `ccu::loop`对象不可在`ccu::loop_group`中被重复添加。93- `ccu::loop`对象不可在`ccu::loop_group`中被重复添加。
@@ -96,11 +96,11 @@ var-based构造的`loop_cfg`有64个比特位,按位段定义:
96## 调用示例96## 调用示例
97 97 
98```cpp98```cpp
99-using namespace AscendC::ccu;99+using namespace asc::ccu;
100 100 
101// 场景:将4个连续4KB数据块依次从片上内存搬到CCU Buffer101// 场景:将4个连续4KB数据块依次从片上内存搬到CCU Buffer
102// 硬件Loop每轮按addr_offset更新地址,无需手写地址自增102// 硬件Loop每轮按addr_offset更新地址,无需手写地址自增
103-CcuResult my_kernel(ccu_kernel_arg arg) {103+ccu_result my_kernel(ccu_kernel_arg arg) {
104 variable r1, numA, numB;104 variable r1, numA, numB;
105 numA = 10;105 numA = 10;
106 numB = 20;106 numB = 20;
@@ -120,6 +120,6 @@ CcuResult my_kernel(ccu_kernel_arg arg) {
120 ccu_loop_group_config grp_cfg{}; // 单Loop场景全字段置0即可120 ccu_loop_group_config grp_cfg{}; // 单Loop场景全字段置0即可
121 loop_group g(grp_cfg, /*max_loop_num=*/1, {l});121 loop_group g(grp_cfg, /*max_loop_num=*/1, {l});
122 122 
123- return CCU_SUCCESS;123+ return ccu_result::CCU_SUCCESS;
124}124}
125```125```
@@ -23,7 +23,7 @@
23 23 
24## 功能说明24## 功能说明
25 25 
26-头文件为:`#include "ccu/hcomm/ccu_primitives.hpp"`26+头文件为:`#include <ccu/asc_ccu.h>`
27 27 
28CCU kernel内的硬件LoopGroup类,将多个`ccu::loop`对象组织为一组,共享同一份LoopEngine资源池,避免多个独立`loop`各自独占LoopEngine导致资源耗尽。28CCU kernel内的硬件LoopGroup类,将多个`ccu::loop`对象组织为一组,共享同一份LoopEngine资源池,避免多个独立`loop`各自独占LoopEngine导致资源耗尽。
29 29 
@@ -32,7 +32,7 @@ CCU kernel内的硬件LoopGroup类,将多个`ccu::loop`对象组织为一组
32## 类声明32## 类声明
33 33 
34```cpp34```cpp
35-namespace AscendC {35+namespace asc {
36namespace ccu {36namespace ccu {
37 37 
38class loop_group {38class loop_group {
@@ -47,7 +47,7 @@ public:
47};47};
48 48 
49} // namespace ccu49} // namespace ccu
50-} // namespace AscendC50+} // namespace asc
51```51```
52 52 
53## 参数说明53## 参数说明
@@ -94,13 +94,13 @@ config-based构造的`loop_group_cfg`类型,字段如下:
94 94 
95## 返回值说明95## 返回值说明
96 96 
97-无返回值。构造失败时抛出异常(携带[`CcuResult`](https://gitcode.com/cann/hcomm/blob/master/docs/zh/api_ref/comm_opdev/datatype_definition/CcuResult.md)错误码),被`<<<>>>`统一捕获后以错误码返回。常见原因:97+无返回值。构造失败时抛出异常(携带`ccu_result`错误码),被`<<<>>>`统一捕获后以错误码返回。常见原因:
98 98 
99| 原因 | 错误码 |99| 原因 | 错误码 |
100| --- | --- |100| --- | --- |
101-| `max_loop_num`为0,或var-based构造传入的`variable`无效 | `CCU_E_PARA` |101+| `max_loop_num`为0,或var-based构造传入的`variable`无效 | `ccu_result::CCU_E_PARA` |
102-| 实际加入的loop数超过`max_loop_num`(LoopEngine池容量不足) | `CCU_E_PARA` |102+| 实际加入的loop数超过`max_loop_num`(LoopEngine池容量不足) | `ccu_result::CCU_E_PARA` |
103-| 物理资源不足 | `CCU_E_UNAVAIL`等 |103+| 物理资源不足 | `ccu_result::CCU_E_UNAVAIL`等 |
104 104 
105## 约束说明105## 约束说明
106 106 
@@ -108,8 +108,8 @@ config-based构造的`loop_group_cfg`类型,字段如下:
108- `loops`列表中的`ccu::loop`对象必须在`ccu::loop_group`构造前完成构造,即循环体已记录。108- `loops`列表中的`ccu::loop`对象必须在`ccu::loop_group`构造前完成构造,即循环体已记录。
109- 同一个`ccu::loop`对象不应被加入多个`ccu::loop_group`。109- 同一个`ccu::loop`对象不应被加入多个`ccu::loop_group`。
110- Group内各Loop的循环体约束与独立`ccu::loop`相同(参见[loop](loop.md)的约束说明)。110- Group内各Loop的循环体约束与独立`ccu::loop`相同(参见[loop](loop.md)的约束说明)。
111-- `max_loop_num`必须大于0,为0时构造直接失败(`CCU_E_PARA`)。111+- `max_loop_num`必须大于0,为0时构造直接失败(`ccu_result::CCU_E_PARA`)。
112-- `max_loop_num`应 ≥ `loops`列表实际大小(即真正会加入Group的Loop数,含展开复用);偏小会导致后续加入Loop时因LoopEngine池容量不足而失败(`CCU_E_PARA`)。112+- `max_loop_num`应 ≥ `loops`列表实际大小(即真正会加入Group的Loop数,含展开复用);偏小会导致后续加入Loop时因LoopEngine池容量不足而失败(`ccu_result::CCU_E_PARA`)。
113- var-based构造时,须保证`parallel_cfg`与`offset_cfg`的`variable`在执行期的取值符合预期,其中:`parallel_cfg`的[47:41]须等于实际加入Group的Loop个数;[54:48]指定的开始复制Loop编号须小于Group内Loop个数;按[61:55]展开后的总Loop个数(Loop个数 + 复制份数)须不超过`max_loop_num`。取值不符合预期会导致硬件Loop展开错乱,行为未定义。113- var-based构造时,须保证`parallel_cfg`与`offset_cfg`的`variable`在执行期的取值符合预期,其中:`parallel_cfg`的[47:41]须等于实际加入Group的Loop个数;[54:48]指定的开始复制Loop编号须小于Group内Loop个数;按[61:55]展开后的总Loop个数(Loop个数 + 复制份数)须不超过`max_loop_num`。取值不符合预期会导致硬件Loop展开错乱,行为未定义。
114 114 
115## 调用示例115## 调用示例
@@ -117,10 +117,10 @@ config-based构造的`loop_group_cfg`类型,字段如下:
117- config-based:117- config-based:
118 118 
119 ```cpp119 ```cpp
120- using namespace AscendC::ccu;120+ using namespace asc::ccu;
121 121 
122 // 场景:两个loop共享LoopEngine资源池122 // 场景:两个loop共享LoopEngine资源池
123- CcuResult my_kernel(ccu_kernel_arg arg) {123+ ccu_result my_kernel(ccu_kernel_arg arg) {
124 variable r1, r2, numA, numB;124 variable r1, r2, numA, numB;
125 numA = 10; numB = 20;125 numA = 10; numB = 20;
126 126 
@@ -146,7 +146,7 @@ config-based构造的`loop_group_cfg`类型,字段如下:
146 grp_cfg.event_offset = 0;146 grp_cfg.event_offset = 0;
147 loop_group g(grp_cfg, /*max_loop_num=*/2, {l1, l2});147 loop_group g(grp_cfg, /*max_loop_num=*/2, {l1, l2});
148 148 
149- return CCU_SUCCESS;149+ return ccu_result::CCU_SUCCESS;
150 }150 }
151 ```151 ```
152 152 
@@ -159,7 +159,7 @@ config-based构造的`loop_group_cfg`类型,字段如下:
159 uint64_t numB;159 uint64_t numB;
160 };160 };
161 161 
162- CcuResult my_kernel(ccu_kernel_arg arg)162+ ccu_result my_kernel(ccu_kernel_arg arg)
163 {163 {
164 using namespace ccu;164 using namespace ccu;
165 auto* args = static_cast<my_kernel_arg*>(arg); // ccu_kernel_arg为void*,先转型为用户入参结构体165 auto* args = static_cast<my_kernel_arg*>(arg); // ccu_kernel_arg为void*,先转型为用户入参结构体
@@ -193,6 +193,6 @@ config-based构造的`loop_group_cfg`类型,字段如下:
193 193 
194 loop_group group(var_parallel, var_offset, /*max_loop_num=*/4, {loop1, loop2});194 loop_group group(var_parallel, var_offset, /*max_loop_num=*/4, {loop1, loop2});
195 195 
196- return CCU_SUCCESS;196+ return ccu_result::CCU_SUCCESS;
197 }197 }
198 ```198 ```
@@ -23,7 +23,7 @@
23 23 
24## 功能说明24## 功能说明
25 25 
26-头文件为:`#include "ccu/hcomm/ccu_primitives.hpp"`26+头文件为:`#include <ccu/asc_ccu.h>`
27 27 
28`ccu::address`是CCU kernel内地址寄存器的C++包装类,用于保存地址值,支持赋值和加法运算。28`ccu::address`是CCU kernel内地址寄存器的C++包装类,用于保存地址值,支持赋值和加法运算。
29 29 
@@ -39,7 +39,7 @@
39## 类声明39## 类声明
40 40 
41```cpp41```cpp
42-namespace AscendC {42+namespace asc {
43namespace ccu {43namespace ccu {
44class address final {44class address final {
45public:45public:
@@ -62,7 +62,7 @@ public:
62// variable + address(交换律,全局函数)62// variable + address(交换律,全局函数)
63/*内部表达式对象*/ operator+(const variable& var, const address& addr);63/*内部表达式对象*/ operator+(const variable& var, const address& addr);
64} // namespace ccu64} // namespace ccu
65-} // namespace AscendC65+} // namespace asc
66```66```
67 67 
68## 构造函数说明68## 构造函数说明
@@ -92,8 +92,8 @@ public:
92 92 
93## 约束说明93## 约束说明
94 94 
95-- 只能在Kernel函数体内构造;在Kernel函数体之外构造时,抛出携带`CCU_E_PTR`的异常。95+- 只能在Kernel函数体内构造;在Kernel函数体之外构造时,抛出携带`ccu_result::CCU_E_PTR`的异常。
96-- 默认构造只申请虚拟句柄,在Kernel函数体内恒成功不抛异常;`address`物理资源不足时,由<<<>>>统一校验并返回`CCU_E_UNAVAIL`,不是在构造时抛出。96+- 默认构造只申请虚拟句柄,在Kernel函数体内恒成功不抛异常;`address`物理资源不足时,由<<<>>>统一校验并返回`ccu_result::CCU_E_UNAVAIL`,不是在构造时抛出。
97- copy/move构造函数只拷贝`handle`字段、不申请新的`address`,`address a2 = a1;`后两个对象指向同一个地址寄存器;`operator=(const address&)`则会发出device端寄存器赋值指令。如需独立的`address`,必须显式默认构造。97- copy/move构造函数只拷贝`handle`字段、不申请新的`address`,`address a2 = a1;`后两个对象指向同一个地址寄存器;`operator=(const address&)`则会发出device端寄存器赋值指令。如需独立的`address`,必须显式默认构造。
98- 不应在kernel之外保存或比较`handle`值,翻译完成后句柄即失效。98- 不应在kernel之外保存或比较`handle`值,翻译完成后句柄即失效。
99- `address`不可被赋值到`variable`,即不提供`variable = address`操作。99- `address`不可被赋值到`variable`,即不提供`variable = address`操作。
@@ -103,9 +103,9 @@ public:
103## 调用示例103## 调用示例
104 104 
105```cpp105```cpp
106-using namespace AscendC::ccu;106+using namespace asc::ccu;
107 107 
108-CcuResult my_kernel(ccu_kernel_arg arg) {108+ccu_result my_kernel(ccu_kernel_arg arg) {
109 address base, dst;109 address base, dst;
110 variable offset, stride;110 variable offset, stride;
111 111 
@@ -129,6 +129,6 @@ CcuResult my_kernel(ccu_kernel_arg arg) {
129 address result;129 address result;
130 result = base + dst;130 result = base + dst;
131 131 
132- return CCU_SUCCESS;132+ return ccu_result::CCU_SUCCESS;
133}133}
134```134```
@@ -23,7 +23,7 @@
23 23 
24## 功能说明24## 功能说明
25 25 
26-头文件为:`#include "ccu/hcomm/ccu_primitives.hpp"`26+头文件为:`#include <ccu/asc_ccu.h>`
27 27 
28`ccu::array<T>`是CCU kernel内批量持有物理连续资源的C++模板类。28`ccu::array<T>`是CCU kernel内批量持有物理连续资源的C++模板类。
29 29 
@@ -37,7 +37,7 @@
37## 类声明37## 类声明
38 38 
39```cpp39```cpp
40-namespace AscendC {40+namespace asc {
41namespace ccu {41namespace ccu {
42template <typename T> // T仅支持variable、event、ccu_buffer42template <typename T> // T仅支持variable、event、ccu_buffer
43class array final {43class array final {
@@ -57,7 +57,7 @@ public:
57 array& operator=(array&& other) noexcept;57 array& operator=(array&& other) noexcept;
58};58};
59} // namespace ccu59} // namespace ccu
60-} // namespace AscendC60+} // namespace asc
61```61```
62 62 
63## 参数说明63## 参数说明
@@ -104,22 +104,22 @@ public:
104## 约束说明104## 约束说明
105 105 
106- `array(count)`和`array(acq_handle, count)`只能在Kernel函数体内构造。106- `array(count)`和`array(acq_handle, count)`只能在Kernel函数体内构造。
107-- `array(count)`恒成功;资源池无法凑出`count`个连续物理资源时,由<<<>>>统一校验并返回`CCU_E_UNAVAIL`,不是在构造时抛出。107+- `array(count)`恒成功;资源池无法凑出`count`个连续物理资源时,由<<<>>>统一校验并返回`ccu_result::CCU_E_UNAVAIL`,不是在构造时抛出。
108- `array<T>`仅特化`variable`、`event`、`ccu_buffer`三种类型;预约构造只对`variable`、`event`可用,其他类型实例化或使用预约构造会在编译期失败。108- `array<T>`仅特化`variable`、`event`、`ccu_buffer`三种类型;预约构造只对`variable`、`event`可用,其他类型实例化或使用预约构造会在编译期失败。
109-- `array(acq_handle, count)`在`count > 0`时会校验预约句柄与`count`,参数不合法(如句柄无效、`count`超出预约句柄名下的资源个数)时抛出携带`CCU_E_PARA`的异常,被`<<<>>>`统一接住后按该错误码返回,本轮编译被中止。109+- `array(acq_handle, count)`在`count > 0`时会校验预约句柄与`count`,参数不合法(如句柄无效、`count`超出预约句柄名下的资源个数)时抛出携带`ccu_result::CCU_E_PARA`的异常,被`<<<>>>`统一接住后按该错误码返回,本轮编译被中止。
110- `count`须不大于预约句柄名下的资源个数;`count`为0时直接构造成空`array`(`size() == 0`),不绑定资源,也不校验`acq_handle`。110- `count`须不大于预约句柄名下的资源个数;`count`为0时直接构造成空`array`(`size() == 0`),不绑定资源,也不校验`acq_handle`。
111- 多个单独声明的`variable`/`event`/`ccu_buffer`对象不保证物理连续,不可用于需要物理连续资源的接口(如`load`/`store`的variable数组批量形态、多ccu_buffer`local_reduce`)。111- 多个单独声明的`variable`/`event`/`ccu_buffer`对象不保证物理连续,不可用于需要物理连续资源的接口(如`load`/`store`的variable数组批量形态、多ccu_buffer`local_reduce`)。
112- 不应在kernel之外保存元素的`handle`值,翻译完成后句柄即失效。112- 不应在kernel之外保存元素的`handle`值,翻译完成后句柄即失效。
113 113 
114> [!NOTE]说明114> [!NOTE]说明
115-> `load`/`store`会对variable数组做连续性校验(不连续返回`CCU_E_PARA`);而`local_reduce`的多ccu_buffer通路不校验ccu_buffer是否物理连续,须由调用方自行保证。使用非`ccu::array`申请的多个ccu_buffer时不会立即报错,但执行期行为未定义。115+> `load`/`store`会对variable数组做连续性校验(不连续返回`ccu_result::CCU_E_PARA`);而`local_reduce`的多ccu_buffer通路不校验ccu_buffer是否物理连续,须由调用方自行保证。使用非`ccu::array`申请的多个ccu_buffer时不会立即报错,但执行期行为未定义。
116 116 
117## 调用示例117## 调用示例
118 118 
119```cpp119```cpp
120-using namespace AscendC::ccu;120+using namespace asc::ccu;
121 121 
122-CcuResult my_kernel(ccu_kernel_arg arg) {122+ccu_result my_kernel(ccu_kernel_arg arg) {
123 // 批量申请4个物理连续variable123 // 批量申请4个物理连续variable
124 array<variable> v_arr(4);124 array<variable> v_arr(4);
125 125 
@@ -129,14 +129,14 @@ CcuResult my_kernel(ccu_kernel_arg arg) {
129 // 下标访问单个元素129 // 下标访问单个元素
130 v_arr[0] = 1024; // 对第0个variable赋立即数130 v_arr[0] = 1024; // 对第0个variable赋立即数
131 131 
132- return CCU_SUCCESS;132+ return ccu_result::CCU_SUCCESS;
133}133}
134```134```
135 135 
136绑定Host侧预约资源的用法:136绑定Host侧预约资源的用法:
137 137 
138```cpp138```cpp
139-using namespace AscendC::ccu;139+using namespace asc::ccu;
140 140 
141// Host侧通过asccomm_ccu_variable_alloc/asccomm_ccu_event_alloc预约资源后,141// Host侧通过asccomm_ccu_variable_alloc/asccomm_ccu_event_alloc预约资源后,
142// 把预约句柄和个数放进kernelArg传入kernel142// 把预约句柄和个数放进kernelArg传入kernel
@@ -147,7 +147,7 @@ struct my_kernel_arg {
147 uint32_t event_num;147 uint32_t event_num;
148};148};
149 149 
150-CcuResult my_kernel(ccu_kernel_arg arg) {150+ccu_result my_kernel(ccu_kernel_arg arg) {
151 auto* args = static_cast<my_kernel_arg*>(arg);151 auto* args = static_cast<my_kernel_arg*>(arg);
152 152 
153 // 绑定Host侧预约的var_num个标量寄存器,不申请新的标量寄存器;绑定后的variable用法与153 // 绑定Host侧预约的var_num个标量寄存器,不申请新的标量寄存器;绑定后的variable用法与
@@ -163,6 +163,6 @@ CcuResult my_kernel(ccu_kernel_arg arg) {
163 event_record(events[i]);163 event_record(events[i]);
164 }164 }
165 165 
166- return CCU_SUCCESS;166+ return ccu_result::CCU_SUCCESS;
167}167}
168```168```
@@ -23,7 +23,7 @@
23 23 
24## 功能说明24## 功能说明
25 25 
26-头文件为:`#include "ccu/hcomm/ccu_primitives.hpp"`26+头文件为:`#include <ccu/asc_ccu.h>`
27 27 
28`ccu::ccu_buffer`是CCU kernel内片上CCU Buffer的C++包装类,每个切片固定4096个字节,用于在片上内存与对端之间中转数据,或作为[local_reduce](../data_movement/local_reduce.md)多ccu_buffer归约的操作数(一次最多8路,经`ccu::array<ccu_buffer>`申请以保证物理连续)。28`ccu::ccu_buffer`是CCU kernel内片上CCU Buffer的C++包装类,每个切片固定4096个字节,用于在片上内存与对端之间中转数据,或作为[local_reduce](../data_movement/local_reduce.md)多ccu_buffer归约的操作数(一次最多8路,经`ccu::array<ccu_buffer>`申请以保证物理连续)。
29 29 
@@ -36,7 +36,7 @@
36## 类声明36## 类声明
37 37 
38```cpp38```cpp
39-namespace AscendC {39+namespace asc {
40namespace ccu {40namespace ccu {
41class ccu_buffer final {41class ccu_buffer final {
42public:42public:
@@ -44,7 +44,7 @@ public:
44 ccu_buffer_handle handle{0}; // 虚拟句柄44 ccu_buffer_handle handle{0}; // 虚拟句柄
45};45};
46} // namespace ccu46} // namespace ccu
47-} // namespace AscendC47+} // namespace asc
48```48```
49 49 
50## 构造函数说明50## 构造函数说明
@@ -55,8 +55,8 @@ public:
55 55 
56## 约束说明56## 约束说明
57 57 
58-- 只能在Kernel函数体内构造;在Kernel函数体之外构造时,抛出携带`CCU_E_PTR`的异常。58+- 只能在Kernel函数体内构造;在Kernel函数体之外构造时,抛出携带`ccu_result::CCU_E_PTR`的异常。
59-- 默认构造只申请虚拟句柄,在Kernel函数体内恒成功不抛异常;CCU Buffer物理资源不足时,由<<<>>>统一校验并返回`CCU_E_UNAVAIL`,不是在构造时抛出。59+- 默认构造只申请虚拟句柄,在Kernel函数体内恒成功不抛异常;CCU Buffer物理资源不足时,由<<<>>>统一校验并返回`ccu_result::CCU_E_UNAVAIL`,不是在构造时抛出。
60- copy/move构造函数只拷贝`handle`字段、不申请新的CCU Buffer切片,`ccu_buffer b2 = b1;`后两个对象指向同一块切片;如需独立的`ccu_buffer`,必须显式默认构造或用[`array<ccu_buffer>`](array.md)。60- copy/move构造函数只拷贝`handle`字段、不申请新的CCU Buffer切片,`ccu_buffer b2 = b1;`后两个对象指向同一块切片;如需独立的`ccu_buffer`,必须显式默认构造或用[`array<ccu_buffer>`](array.md)。
61- 不应在kernel之外保存或比较`handle`值,翻译完成后句柄即失效。61- 不应在kernel之外保存或比较`handle`值,翻译完成后句柄即失效。
62- 每个`ccu_buffer`固定代表4096字节的片上切片,大小不可配置。62- 每个`ccu_buffer`固定代表4096字节的片上切片,大小不可配置。
@@ -65,9 +65,9 @@ public:
65## 调用示例65## 调用示例
66 66 
67```cpp67```cpp
68-using namespace AscendC::ccu;68+using namespace asc::ccu;
69 69 
70-CcuResult my_kernel(ccu_kernel_arg arg) {70+ccu_result my_kernel(ccu_kernel_arg arg) {
71 ccu_buffer buf; // 申请1块4KB CCU Buffer切片71 ccu_buffer buf; // 申请1块4KB CCU Buffer切片
72 local_addr src;72 local_addr src;
73 variable len;73 variable len;
@@ -77,6 +77,6 @@ CcuResult my_kernel(ccu_kernel_arg arg) {
77 local_copy(buf, src, len, evt);77 local_copy(buf, src, len, evt);
78 event_wait(evt);78 event_wait(evt);
79 79 
80- return CCU_SUCCESS;80+ return ccu_result::CCU_SUCCESS;
81}81}
82```82```
@@ -23,7 +23,7 @@
23 23 
24## 功能说明24## 功能说明
25 25 
26-头文件为:`#include "ccu/hcomm/ccu_primitives.hpp"`26+头文件为:`#include <ccu/asc_ccu.h>`
27 27 
28`ccu::event`是CCU kernel内同步寄存器槽位的C++包装类,用于标记异步操作(如数据搬运)的完成状态。28`ccu::event`是CCU kernel内同步寄存器槽位的C++包装类,用于标记异步操作(如数据搬运)的完成状态。
29 29 
@@ -36,7 +36,7 @@
36## 类声明36## 类声明
37 37 
38```cpp38```cpp
39-namespace AscendC {39+namespace asc {
40namespace ccu {40namespace ccu {
41class event final {41class event final {
42public:42public:
@@ -49,7 +49,7 @@ public:
49 ccu_event_handle handle{0}; // 虚拟句柄49 ccu_event_handle handle{0}; // 虚拟句柄
50};50};
51} // namespace ccu51} // namespace ccu
52-} // namespace AscendC52+} // namespace asc
53```53```
54 54 
55## 构造函数说明55## 构造函数说明
@@ -65,7 +65,7 @@ public:
65 | 参数名 | 输入/输出 | 描述 |65 | 参数名 | 输入/输出 | 描述 |
66 | --- | --- | --- |66 | --- | --- | --- |
67 | acq_handle | 输入 | 预约句柄,即Host侧调用`asccomm_ccu_event_alloc`预先从实例资源池划出一段物理event槽位后返回的句柄,通过`kernelArg`传入kernel。不可传入其他类型资源(如`variable`)的预约句柄。 |67 | acq_handle | 输入 | 预约句柄,即Host侧调用`asccomm_ccu_event_alloc`预先从实例资源池划出一段物理event槽位后返回的句柄,通过`kernelArg`传入kernel。不可传入其他类型资源(如`variable`)的预约句柄。 |
68- | index | 输入 | 要绑定的event槽位在预约段内的序号,默认值为`0`,取值范围为`[0, num-1]`(`num`为Host侧`asccomm_ccu_event_alloc`预约的event槽位数量),超出该范围抛出`CCU_E_PARA`异常。 |68+ | index | 输入 | 要绑定的event槽位在预约段内的序号,默认值为`0`,取值范围为`[0, num-1]`(`num`为Host侧`asccomm_ccu_event_alloc`预约的event槽位数量),超出该范围抛出`ccu_result::CCU_E_PARA`异常。 |
69 69 
70 多次用同一预约句柄和同一`index`构造,得到的多个`event`对象共享同一个物理event槽位。70 多次用同一预约句柄和同一`index`构造,得到的多个`event`对象共享同一个物理event槽位。
71 71 
@@ -74,9 +74,9 @@ public:
74 74 
75## 约束说明75## 约束说明
76 76 
77-- 只能在Kernel函数体内构造;在Kernel函数体之外构造时,抛出携带`CCU_E_PTR`的异常。77+- 只能在Kernel函数体内构造;在Kernel函数体之外构造时,抛出携带`ccu_result::CCU_E_PTR`的异常。
78-- 默认构造只申请虚拟句柄,在Kernel函数体内恒成功不抛异常;event槽位物理资源不足时,由<<<>>>统一校验并返回`CCU_E_UNAVAIL`,不是在构造时抛出。78+- 默认构造只申请虚拟句柄,在Kernel函数体内恒成功不抛异常;event槽位物理资源不足时,由<<<>>>统一校验并返回`ccu_result::CCU_E_UNAVAIL`,不是在构造时抛出。
79-- 预约构造会校验预约句柄与`index`,`index`超出预约段范围(`[0, num-1]`,`num`为Host侧预约的event槽位数量)时抛出`CCU_E_PARA`异常。79+- 预约构造会校验预约句柄与`index`,`index`超出预约段范围(`[0, num-1]`,`num`为Host侧预约的event槽位数量)时抛出`ccu_result::CCU_E_PARA`异常。
80- copy/move构造函数只拷贝`handle`字段、不申请新的event槽位,`event e2 = e1;`后两个对象是同一个kernel内句柄,对任一对象`event_record`/`event_wait`操作的是同一份硬件状态位;如需独立的`event`,使用默认构造或[`array<event>`](array.md)。80- copy/move构造函数只拷贝`handle`字段、不申请新的event槽位,`event e2 = e1;`后两个对象是同一个kernel内句柄,对任一对象`event_record`/`event_wait`操作的是同一份硬件状态位;如需独立的`event`,使用默认构造或[`array<event>`](array.md)。
81- 不应在kernel之外保存或比较`handle`值,翻译完成后句柄即失效。81- 不应在kernel之外保存或比较`handle`值,翻译完成后句柄即失效。
82- `event`没有`mask`字段,`mask`在`event_record`/`event_wait`及数据搬运接口中以参数形式传入,C++默认值为`1`。同一个`event`的不同bit相互独立,可承载多组配对。82- `event`没有`mask`字段,`mask`在`event_record`/`event_wait`及数据搬运接口中以参数形式传入,C++默认值为`1`。同一个`event`的不同bit相互独立,可承载多组配对。
@@ -84,9 +84,9 @@ public:
84## 调用示例84## 调用示例
85 85 
86```cpp86```cpp
87-using namespace AscendC::ccu;87+using namespace asc::ccu;
88 88 
89-CcuResult my_kernel(ccu_kernel_arg arg) {89+ccu_result my_kernel(ccu_kernel_arg arg) {
90 event evt; // 申请1个event槽位90 event evt; // 申请1个event槽位
91 91 
92 // 配合数据搬运接口使用:硬件搬运完成时自动将evt中mask对应的标志位设置为192 // 配合数据搬运接口使用:硬件搬运完成时自动将evt中mask对应的标志位设置为1
@@ -95,6 +95,6 @@ CcuResult my_kernel(ccu_kernel_arg arg) {
95 local_copy(dst, src, len, evt); // mask默认0x195 local_copy(dst, src, len, evt); // mask默认0x1
96 event_wait(evt); // 等待bit0被设置为196 event_wait(evt); // 等待bit0被设置为1
97 97 
98- return CCU_SUCCESS;98+ return ccu_result::CCU_SUCCESS;
99}99}
100```100```
@@ -23,7 +23,7 @@
23 23 
24## 功能说明24## 功能说明
25 25 
26-头文件为:`#include "ccu/hcomm/ccu_primitives.hpp"`26+头文件为:`#include <ccu/asc_ccu.h>`
27 27 
28在CCU kernel内获取指向channel共享`variable`槽位的句柄。28在CCU kernel内获取指向channel共享`variable`槽位的句柄。
29 29 
@@ -34,7 +34,7 @@
34## 函数原型34## 函数原型
35 35 
36```cpp36```cpp
37-namespace AscendC {37+namespace asc {
38namespace ccu {38namespace ccu {
39template <typename T>39template <typename T>
40T get_res_by_channel(ChannelHandle channel, uint32_t index);40T get_res_by_channel(ChannelHandle channel, uint32_t index);
@@ -43,7 +43,7 @@ T get_res_by_channel(ChannelHandle channel, uint32_t index);
43template <>43template <>
44variable get_res_by_channel<variable>(ChannelHandle channel, uint32_t var_index);44variable get_res_by_channel<variable>(ChannelHandle channel, uint32_t var_index);
45} // namespace ccu45} // namespace ccu
46-} // namespace AscendC46+} // namespace asc
47```47```
48 48 
49## 参数说明49## 参数说明
@@ -53,7 +53,7 @@ variable get_res_by_channel<variable>(ChannelHandle channel, uint32_t var_index)
53| 参数名 | 输入/输出 | 描述 |53| 参数名 | 输入/输出 | 描述 |
54| --- | --- | --- |54| --- | --- | --- |
55| channel | 输入 | 跨rank通道句柄,类型为[`ChannelHandle`](https://gitcode.com/cann/hcomm/blob/master/docs/zh/api_ref/comm_opdev/datatype_definition/ChannelHandle.md),须已完成建链。 |55| channel | 输入 | 跨rank通道句柄,类型为[`ChannelHandle`](https://gitcode.com/cann/hcomm/blob/master/docs/zh/api_ref/comm_opdev/datatype_definition/ChannelHandle.md),须已完成建链。 |
56-| var_index | 输入 | 通道内变量索引(0起),对应channel建链时预分配的一组variable槽位中的一个。当前每条channel固定预留4个variable槽位(`var_index`取值范围为`[0, 3]`),超出该范围返回`CCU_E_PARA`。 |56+| var_index | 输入 | 通道内变量索引(0起),对应channel建链时预分配的一组variable槽位中的一个。当前每条channel固定预留4个variable槽位(`var_index`取值范围为`[0, 3]`),超出该范围返回`ccu_result::CCU_E_PARA`。 |
57 57 
58## 返回值说明58## 返回值说明
59 59 
@@ -63,8 +63,8 @@ variable get_res_by_channel<variable>(ChannelHandle channel, uint32_t var_index)
63 63 
64| 情形 | 错误码 |64| 情形 | 错误码 |
65| --- | --- |65| --- | --- |
66-| `channel == nullptr`、channel类型非法、接口在Kernel函数体之外被调用 | `CCU_E_PTR` |66+| `channel == nullptr`、channel类型非法、接口在Kernel函数体之外被调用 | `ccu_result::CCU_E_PTR` |
67-| `var_index`越界(超过channel预分配variable池大小) | `CCU_E_PARA` |67+| `var_index`越界(超过channel预分配variable池大小) | `ccu_result::CCU_E_PARA` |
68 68 
69## 约束说明69## 约束说明
70 70 
@@ -76,7 +76,7 @@ variable get_res_by_channel<variable>(ChannelHandle channel, uint32_t var_index)
76## 调用示例76## 调用示例
77 77 
78```cpp78```cpp
79-using namespace AscendC::ccu;79+using namespace asc::ccu;
80 80 
81// 用户自定义的kernel入参结构体,Host侧填充后通过kernelArg传入81// 用户自定义的kernel入参结构体,Host侧填充后通过kernelArg传入
82struct my_kernel_arg {82struct my_kernel_arg {
@@ -86,7 +86,7 @@ struct my_kernel_arg {
86// 端到端场景:对端通过write_variable_with_notify向本端channel的共享variable槽位0写值,86// 端到端场景:对端通过write_variable_with_notify向本端channel的共享variable槽位0写值,
87// 本端kernel通过get_res_by_channel读取该值87// 本端kernel通过get_res_by_channel读取该值
88 88 
89-CcuResult my_kernel(ccu_kernel_arg arg) { // arg为void*,指向Host传入的my_kernel_arg89+ccu_result my_kernel(ccu_kernel_arg arg) { // arg为void*,指向Host传入的my_kernel_arg
90 auto* params = static_cast<my_kernel_arg*>(arg);90 auto* params = static_cast<my_kernel_arg*>(arg);
91 ChannelHandle ch = params->channel_handle;91 ChannelHandle ch = params->channel_handle;
92 92 
@@ -100,6 +100,6 @@ CcuResult my_kernel(ccu_kernel_arg arg) { // arg为void*,指向Host传入的m
100 variable result;100 variable result;
101 result = sync_var;101 result = sync_var;
102 102 
103- return CCU_SUCCESS;103+ return ccu_result::CCU_SUCCESS;
104}104}
105```105```
@@ -23,7 +23,7 @@
23 23 
24## 功能说明24## 功能说明
25 25 
26-头文件为:`#include "ccu/hcomm/ccu_primitives.hpp"`26+头文件为:`#include <ccu/asc_ccu.h>`
27 27 
28`ccu::local_addr`是CCU kernel内本端片上内存地址的C++包装类,是“地址(`address`)+ token(`variable`)”的复合对象。28`ccu::local_addr`是CCU kernel内本端片上内存地址的C++包装类,是“地址(`address`)+ token(`variable`)”的复合对象。
29 29 
@@ -38,7 +38,7 @@ CCU硬件不接受进程虚拟地址,访问片上内存必须使用由[`HcommC
38## 类声明38## 类声明
39 39 
40```cpp40```cpp
41-namespace AscendC {41+namespace asc {
42namespace ccu {42namespace ccu {
43class local_addr final {43class local_addr final {
44public:44public:
@@ -49,7 +49,7 @@ public:
49 ccu_local_addr_handle handle{0}; // 复合句柄49 ccu_local_addr_handle handle{0}; // 复合句柄
50};50};
51} // namespace ccu51} // namespace ccu
52-} // namespace AscendC52+} // namespace asc
53```53```
54 54 
55## 构造函数说明55## 构造函数说明
@@ -72,8 +72,8 @@ public:
72> [!CAUTION]注意72> [!CAUTION]注意
73> `token`属于安全信息,host/device日志均不允许打印,禁止以明文形式跨rank透传。73> `token`属于安全信息,host/device日志均不允许打印,禁止以明文形式跨rank透传。
74 74 
75-- 只能在Kernel函数体内构造;在Kernel函数体之外构造时,抛出携带`CCU_E_PTR`的异常。75+- 只能在Kernel函数体内构造;在Kernel函数体之外构造时,抛出携带`ccu_result::CCU_E_PTR`的异常。
76-- 默认构造只申请虚拟句柄,在Kernel函数体内恒成功不抛异常;`address/variable`物理资源不足时,由<<<>>>统一校验并返回`CCU_E_UNAVAIL`,不是在构造时抛出。76+- 默认构造只申请虚拟句柄,在Kernel函数体内恒成功不抛异常;`address/variable`物理资源不足时,由<<<>>>统一校验并返回`ccu_result::CCU_E_UNAVAIL`,不是在构造时抛出。
77- copy/move构造函数只拷贝`handle`、`addr.handle`、`token.handle`三个字段,不申请新的`address/variable`,`local_addr l2 = l1;`后两个对象指向同一组寄存器;`operator=(const local_addr&)`则会发出两条device端寄存器赋值指令(把`other.addr`、`other.token`的值搬移过来),两者语义不对称。77- copy/move构造函数只拷贝`handle`、`addr.handle`、`token.handle`三个字段,不申请新的`address/variable`,`local_addr l2 = l1;`后两个对象指向同一组寄存器;`operator=(const local_addr&)`则会发出两条device端寄存器赋值指令(把`other.addr`、`other.token`的值搬移过来),两者语义不对称。
78- 不应在kernel之外保存或比较`handle`值,翻译完成后句柄即失效。78- 不应在kernel之外保存或比较`handle`值,翻译完成后句柄即失效。
79- 不可对内嵌的`addr`/`token`字段再单独调用`address()`/`variable()`构造新对象——`local_addr()`已一次性完成所有子字段的分配。79- 不可对内嵌的`addr`/`token`字段再单独调用`address()`/`variable()`构造新对象——`local_addr()`已一次性完成所有子字段的分配。
@@ -83,7 +83,7 @@ public:
83## 调用示例83## 调用示例
84 84 
85```cpp85```cpp
86-using namespace AscendC::ccu;86+using namespace asc::ccu;
87 87 
88// 用户自定义的kernel入参结构体,Host侧填充后通过kernelArg传入88// 用户自定义的kernel入参结构体,Host侧填充后通过kernelArg传入
89// (src_addr为本端片上内存地址,src_token由Host调用HcommCcuGetMemToken换算获得)89// (src_addr为本端片上内存地址,src_token由Host调用HcommCcuGetMemToken换算获得)
@@ -92,7 +92,7 @@ struct my_kernel_arg {
92 uint64_t src_token; // 配套的安全token92 uint64_t src_token; // 配套的安全token
93};93};
94 94 
95-CcuResult my_kernel(ccu_kernel_arg arg) { // arg为void*,指向Host传入的my_kernel_arg95+ccu_result my_kernel(ccu_kernel_arg arg) { // arg为void*,指向Host传入的my_kernel_arg
96 auto* params = static_cast<my_kernel_arg*>(arg);96 auto* params = static_cast<my_kernel_arg*>(arg);
97 97 
98 local_addr src;98 local_addr src;
@@ -108,6 +108,6 @@ CcuResult my_kernel(ccu_kernel_arg arg) { // arg为void*,指向Host传入的m
108 src2.addr = addrVar; // 执行期动态地址108 src2.addr = addrVar; // 执行期动态地址
109 src2.token = tokenVar;109 src2.token = tokenVar;
110 110 
111- return CCU_SUCCESS;111+ return ccu_result::CCU_SUCCESS;
112}112}
113```113```
@@ -23,7 +23,7 @@
23 23 
24## 功能说明24## 功能说明
25 25 
26-头文件为:`#include "ccu/hcomm/ccu_primitives.hpp"`26+头文件为:`#include <ccu/asc_ccu.h>`
27 27 
28`ccu::remote_addr`是CCU kernel内对端片上内存地址的C++包装类,是“地址(`address`)+ token(`variable`)”的复合对象,结构与[local_addr](local_addr.md)相同。28`ccu::remote_addr`是CCU kernel内对端片上内存地址的C++包装类,是“地址(`address`)+ token(`variable`)”的复合对象,结构与[local_addr](local_addr.md)相同。
29 29 
@@ -38,7 +38,7 @@
38## 类声明38## 类声明
39 39 
40```cpp40```cpp
41-namespace AscendC {41+namespace asc {
42namespace ccu {42namespace ccu {
43class remote_addr final {43class remote_addr final {
44public:44public:
@@ -49,7 +49,7 @@ public:
49 ccu_remote_addr_handle handle{0}; // 复合句柄49 ccu_remote_addr_handle handle{0}; // 复合句柄
50};50};
51} // namespace ccu51} // namespace ccu
52-} // namespace AscendC52+} // namespace asc
53```53```
54 54 
55## 构造函数说明55## 构造函数说明
@@ -70,8 +70,8 @@ public:
70> [!CAUTION]注意70> [!CAUTION]注意
71> `token`属于安全信息,host/device日志均不允许打印,禁止以明文形式跨rank透传。`addr`和`token`字段必须是对端rank目标内存的值,与本端`local_addr`字段来源完全不同。71> `token`属于安全信息,host/device日志均不允许打印,禁止以明文形式跨rank透传。`addr`和`token`字段必须是对端rank目标内存的值,与本端`local_addr`字段来源完全不同。
72 72 
73-- 只能在Kernel函数体内构造;在Kernel函数体之外构造时,抛出携带`CCU_E_PTR`的异常。73+- 只能在Kernel函数体内构造;在Kernel函数体之外构造时,抛出携带`ccu_result::CCU_E_PTR`的异常。
74-- 默认构造只申请虚拟句柄,在Kernel函数体内恒成功不抛异常;`address/variable`物理资源不足时,由<<<>>>统一校验并返回`CCU_E_UNAVAIL`,不是在构造时抛出。74+- 默认构造只申请虚拟句柄,在Kernel函数体内恒成功不抛异常;`address/variable`物理资源不足时,由<<<>>>统一校验并返回`ccu_result::CCU_E_UNAVAIL`,不是在构造时抛出。
75- copy/move构造函数只拷贝`handle`、`addr.handle`、`token.handle`三个字段,不申请新的`address/variable`,`remote_addr r2 = r1;`后两个对象指向同一组寄存器;`operator=(const remote_addr&)`则会执行device端寄存器赋值指令(语义与`local_addr`相同),两者不对称。75- copy/move构造函数只拷贝`handle`、`addr.handle`、`token.handle`三个字段,不申请新的`address/variable`,`remote_addr r2 = r1;`后两个对象指向同一组寄存器;`operator=(const remote_addr&)`则会执行device端寄存器赋值指令(语义与`local_addr`相同),两者不对称。
76- 不应在kernel之外保存或比较`handle`值,翻译完成后句柄即失效。76- 不应在kernel之外保存或比较`handle`值,翻译完成后句柄即失效。
77- 不可对内嵌的`addr`/`token`字段再单独调用`address()`/`variable()`构造新对象——`remote_addr()`已一次性完成所有子字段的分配。77- 不可对内嵌的`addr`/`token`字段再单独调用`address()`/`variable()`构造新对象——`remote_addr()`已一次性完成所有子字段的分配。
@@ -80,7 +80,7 @@ public:
80## 调用示例80## 调用示例
81 81 
82```cpp82```cpp
83-using namespace AscendC::ccu;83+using namespace asc::ccu;
84 84 
85// 对端rank的地址与token须通过进程间通信(如消息传递框架)从对端获取,85// 对端rank的地址与token须通过进程间通信(如消息传递框架)从对端获取,
86// 再通过kernelArg或taskArgs+load_arg传入kernel。86// 再通过kernelArg或taskArgs+load_arg传入kernel。
@@ -92,7 +92,7 @@ struct my_kernel_arg {
92 uint64_t local_token;92 uint64_t local_token;
93};93};
94 94 
95-CcuResult my_kernel(ccu_kernel_arg arg) {95+ccu_result my_kernel(ccu_kernel_arg arg) {
96 auto* params = static_cast<my_kernel_arg*>(arg); // ccu_kernel_arg为void*,先转型为用户入参结构体96 auto* params = static_cast<my_kernel_arg*>(arg); // ccu_kernel_arg为void*,先转型为用户入参结构体
97 97 
98 remote_addr remote;98 remote_addr remote;
@@ -112,6 +112,6 @@ CcuResult my_kernel(ccu_kernel_arg arg) {
112 write(ch, remote, local, len, evt); // 将本端片上内存数据写入对端片上内存112 write(ch, remote, local, len, evt); // 将本端片上内存数据写入对端片上内存
113 event_wait(evt);113 event_wait(evt);
114 114 
115- return CCU_SUCCESS;115+ return ccu_result::CCU_SUCCESS;
116}116}
117```117```
@@ -23,7 +23,7 @@
23 23 
24## 功能说明24## 功能说明
25 25 
26-头文件为:`#include "ccu/hcomm/ccu_primitives.hpp"`26+头文件为:`#include <ccu/asc_ccu.h>`
27 27 
28`ccu::variable`是CCU kernel内通用寄存器的C++包装类,用于保存标量值,支持赋值、加法运算,以及供`CCU_IF`/`CCU_WHILE`/`CCU_DO`等控制流宏使用的比较运算。28`ccu::variable`是CCU kernel内通用寄存器的C++包装类,用于保存标量值,支持赋值、加法运算,以及供`CCU_IF`/`CCU_WHILE`/`CCU_DO`等控制流宏使用的比较运算。
29 29 
@@ -37,7 +37,7 @@
37## 类声明37## 类声明
38 38 
39```cpp39```cpp
40-namespace AscendC {40+namespace asc {
41namespace ccu {41namespace ccu {
42class variable final {42class variable final {
43public:43public:
@@ -61,7 +61,7 @@ public:
61 ccu_variable_handle handle{0}; // 虚拟句柄61 ccu_variable_handle handle{0}; // 虚拟句柄
62};62};
63} // namespace ccu63} // namespace ccu
64-} // namespace AscendC64+} // namespace asc
65```65```
66 66 
67## 构造函数说明67## 构造函数说明
@@ -77,7 +77,7 @@ public:
77 | 参数名 | 输入/输出 | 描述 |77 | 参数名 | 输入/输出 | 描述 |
78 | --- | --- | --- |78 | --- | --- | --- |
79 | var_handle | 输入 | 预约句柄,即Host侧调用`asccomm_ccu_variable_alloc`预先从实例资源池划出一段物理标量寄存器后返回的句柄,通过`kernelArg`传入kernel。 |79 | var_handle | 输入 | 预约句柄,即Host侧调用`asccomm_ccu_variable_alloc`预先从实例资源池划出一段物理标量寄存器后返回的句柄,通过`kernelArg`传入kernel。 |
80- | index | 输入 | 要绑定的标量寄存器在预约段内的序号,默认值为`0`,取值范围为`[0, num-1]`(`num`为Host侧`asccomm_ccu_variable_alloc`预约的标量寄存器数量),超出该范围抛出`CCU_E_PARA`异常。 |80+ | index | 输入 | 要绑定的标量寄存器在预约段内的序号,默认值为`0`,取值范围为`[0, num-1]`(`num`为Host侧`asccomm_ccu_variable_alloc`预约的标量寄存器数量),超出该范围抛出`ccu_result::CCU_E_PARA`异常。 |
81 81 
82 多次用同一预约句柄和同一`index`构造,得到的多个`variable`对象共享同一个物理标量寄存器。82 多次用同一预约句柄和同一`index`构造,得到的多个`variable`对象共享同一个物理标量寄存器。
83 83 
@@ -112,9 +112,9 @@ public:
112 112 
113## 约束说明113## 约束说明
114 114 
115-- 只能在Kernel函数体内构造;在Kernel函数体之外构造时,抛出携带`CCU_E_PTR`的异常。115+- 只能在Kernel函数体内构造;在Kernel函数体之外构造时,抛出携带`ccu_result::CCU_E_PTR`的异常。
116-- 默认构造只申请虚拟句柄,在Kernel函数体内恒成功不抛异常;标量寄存器物理资源不足时,由<<<>>>统一校验并返回`CCU_E_UNAVAIL`,不是在构造时抛出。116+- 默认构造只申请虚拟句柄,在Kernel函数体内恒成功不抛异常;标量寄存器物理资源不足时,由<<<>>>统一校验并返回`ccu_result::CCU_E_UNAVAIL`,不是在构造时抛出。
117-- 预约构造会校验预约句柄与`index`,`index`超出预约段范围(`[0, num-1]`,`num`为Host侧预约的标量寄存器数量)时抛出`CCU_E_PARA`异常。117+- 预约构造会校验预约句柄与`index`,`index`超出预约段范围(`[0, num-1]`,`num`为Host侧预约的标量寄存器数量)时抛出`ccu_result::CCU_E_PARA`异常。
118- copy/move构造函数只拷贝`handle`字段、不申请新的标量寄存器,`variable v2 = v1;`后两个对象是同一个kernel内句柄;如需独立的`variable`,使用默认构造或[`array<variable>`](array.md)。118- copy/move构造函数只拷贝`handle`字段、不申请新的标量寄存器,`variable v2 = v1;`后两个对象是同一个kernel内句柄;如需独立的`variable`,使用默认构造或[`array<variable>`](array.md)。
119- 不应在kernel之外保存或比较`handle`值,翻译完成后句柄即失效。119- 不应在kernel之外保存或比较`handle`值,翻译完成后句柄即失效。
120- 当前仅支持加法运算,不支持减法、乘法、除法、按位逻辑与移位运算。120- 当前仅支持加法运算,不支持减法、乘法、除法、按位逻辑与移位运算。
@@ -123,9 +123,9 @@ public:
123## 调用示例123## 调用示例
124 124 
125```cpp125```cpp
126-using namespace AscendC::ccu;126+using namespace asc::ccu;
127 127 
128-CcuResult my_kernel(ccu_kernel_arg arg) {128+ccu_result my_kernel(ccu_kernel_arg arg) {
129 variable n, i, one, step;129 variable n, i, one, step;
130 130 
131 // 赋立即数(翻译期固化)131 // 赋立即数(翻译期固化)
@@ -150,6 +150,6 @@ CcuResult my_kernel(ccu_kernel_arg arg) {
150 // ...150 // ...
151 }151 }
152 152 
153- return CCU_SUCCESS;153+ return ccu_result::CCU_SUCCESS;
154}154}
155```155```
@@ -23,7 +23,7 @@
23 23 
24## 功能说明24## 功能说明
25 25 
26-头文件为:`#include "ccu/hcomm/ccu_primitives.hpp"`26+头文件为:`#include <ccu/asc_ccu.h>`
27 27 
28将本端同步寄存器中`mask`对应的event标志位显式设置为1,表示当前操作或阶段已完成,供同kernel内的[event_wait](event_wait.md)读取完成信号。28将本端同步寄存器中`mask`对应的event标志位显式设置为1,表示当前操作或阶段已完成,供同kernel内的[event_wait](event_wait.md)读取完成信号。
29 29 
@@ -33,11 +33,11 @@
33## 函数原型33## 函数原型
34 34 
35```cpp35```cpp
36-namespace AscendC {36+namespace asc {
37namespace ccu {37namespace ccu {
38-CcuResult event_record(event e, uint16_t mask = 1);38+ccu_result event_record(event e, uint16_t mask = 1);
39} // namespace ccu39} // namespace ccu
40-} // namespace AscendC40+} // namespace asc
41```41```
42 42 
43## 参数说明43## 参数说明
@@ -49,21 +49,21 @@ CcuResult event_record(event e, uint16_t mask = 1);
49 49 
50## 返回值说明50## 返回值说明
51 51 
52-[`CcuResult`](https://gitcode.com/cann/hcomm/blob/master/docs/zh/api_ref/comm_opdev/datatype_definition/CcuResult.md):接口成功返回`CCU_SUCCESS`,其他值表示失败。52+`ccu_result`:接口成功返回`ccu_result::CCU_SUCCESS`,其他值表示失败。
53 53 
54| 返回值 | 说明 |54| 返回值 | 说明 |
55| --- | --- |55| --- | --- |
56-| `CCU_SUCCESS` | 操作成功。 |56+| `ccu_result::CCU_SUCCESS` | 操作成功。 |
57-| `CCU_E_PTR` | 接口在Kernel函数体之外被调用。 |57+| `ccu_result::CCU_E_PTR` | 接口在Kernel函数体之外被调用。 |
58-| `CCU_E_NOT_FOUND` | 传入的`e`句柄未在当前kernel内创建。 |58+| `ccu_result::CCU_E_NOT_FOUND` | 传入的`e`句柄未在当前kernel内创建。 |
59-| `CCU_E_NOT_SUPPORT` | 不支持在硬件loop的循环体内调用。 |59+| `ccu_result::CCU_E_NOT_SUPPORT` | 不支持在硬件loop的循环体内调用。 |
60 60 
61> [!NOTE]说明61> [!NOTE]说明
62-> 本接口在调用处不做参数取值校验,不会返回`CCU_E_PARA`。62+> 本接口在调用处不做参数取值校验,不会返回`ccu_result::CCU_E_PARA`。
63 63 
64## 约束说明64## 约束说明
65 65 
66-- 不可在硬件loop的循环体内调用,否则返回`CCU_E_NOT_SUPPORT`。循环体会被复制为多份并行执行,每份都会执行一次`event_record`,置位语义不再明确。66+- 不可在硬件loop的循环体内调用,否则返回`ccu_result::CCU_E_NOT_SUPPORT`。循环体会被复制为多份并行执行,每份都会执行一次`event_record`,置位语义不再明确。
67- 置位后须有[event_wait](event_wait.md)消费该信号,否则该次置位不被使用。67- 置位后须有[event_wait](event_wait.md)消费该信号,否则该次置位不被使用。
68- `event_record`和`event_wait`的`mask`必须一致,否则`event_wait`永远等不到信号。68- `event_record`和`event_wait`的`mask`必须一致,否则`event_wait`永远等不到信号。
69 69 
@@ -71,10 +71,10 @@ CcuResult event_record(event e, uint16_t mask = 1);
71 71 
72```cpp72```cpp
73// 为简化示例,省略返回值接收与错误处理73// 为简化示例,省略返回值接收与错误处理
74-using namespace AscendC::ccu;74+using namespace asc::ccu;
75 75 
76// CCU kernel函数体内76// CCU kernel函数体内
77-CcuResult my_kernel(ccu_kernel_arg arg) {77+ccu_result my_kernel(ccu_kernel_arg arg) {
78 event evt;78 event evt;
79 79 
80 // 执行某些操作后,手动标记bit0完成80 // 执行某些操作后,手动标记bit0完成
@@ -82,6 +82,6 @@ CcuResult my_kernel(ccu_kernel_arg arg) {
82 82 
83 // 下游等待bit0被置位83 // 下游等待bit0被置位
84 event_wait(evt, 0x1);84 event_wait(evt, 0x1);
85- return CCU_SUCCESS;85+ return ccu_result::CCU_SUCCESS;
86}86}
87```87```
@@ -23,7 +23,7 @@
23 23 
24## 功能说明24## 功能说明
25 25 
26-头文件为:`#include "ccu/hcomm/ccu_primitives.hpp"`26+头文件为:`#include <ccu/asc_ccu.h>`
27 27 
28阻塞等待本端同步寄存器中`mask`对应的event标志位,直到其全部为1后继续执行,随后自动将这些标志位清零。该标志位由同kernel内的[event_record](event_record.md)或[数据搬运接口](../data_movement/README.md)置位。28阻塞等待本端同步寄存器中`mask`对应的event标志位,直到其全部为1后继续执行,随后自动将这些标志位清零。该标志位由同kernel内的[event_record](event_record.md)或[数据搬运接口](../data_movement/README.md)置位。
29 29 
@@ -33,11 +33,11 @@
33## 函数原型33## 函数原型
34 34 
35```cpp35```cpp
36-namespace AscendC {36+namespace asc {
37namespace ccu {37namespace ccu {
38-CcuResult event_wait(event e, uint16_t mask = 1);38+ccu_result event_wait(event e, uint16_t mask = 1);
39} // namespace ccu39} // namespace ccu
40-} // namespace AscendC40+} // namespace asc
41```41```
42 42 
43## 参数说明43## 参数说明
@@ -49,16 +49,16 @@ CcuResult event_wait(event e, uint16_t mask = 1);
49 49 
50## 返回值说明50## 返回值说明
51 51 
52-[`CcuResult`](https://gitcode.com/cann/hcomm/blob/master/docs/zh/api_ref/comm_opdev/datatype_definition/CcuResult.md):接口成功返回`CCU_SUCCESS`,其他值表示失败。52+`ccu_result`:接口成功返回`ccu_result::CCU_SUCCESS`,其他值表示失败。
53 53 
54| 返回值 | 说明 |54| 返回值 | 说明 |
55| --- | --- |55| --- | --- |
56-| `CCU_SUCCESS` | 操作成功。 |56+| `ccu_result::CCU_SUCCESS` | 操作成功。 |
57-| `CCU_E_PTR` | 接口在Kernel函数体之外被调用。 |57+| `ccu_result::CCU_E_PTR` | 接口在Kernel函数体之外被调用。 |
58-| `CCU_E_NOT_FOUND` | 传入的`e`句柄未在当前kernel内创建。 |58+| `ccu_result::CCU_E_NOT_FOUND` | 传入的`e`句柄未在当前kernel内创建。 |
59 59 
60> [!NOTE]说明60> [!NOTE]说明
61-> 本接口在调用处不做参数取值校验,不会返回`CCU_E_PARA`。61+> 本接口在调用处不做参数取值校验,不会返回`ccu_result::CCU_E_PARA`。
62 62 
63## 约束说明63## 约束说明
64 64 
@@ -70,11 +70,11 @@ CcuResult event_wait(event e, uint16_t mask = 1);
70 70 
71```cpp71```cpp
72// 为简化示例,省略返回值接收与错误处理72// 为简化示例,省略返回值接收与错误处理
73-using namespace AscendC::ccu;73+using namespace asc::ccu;
74 74 
75// 场景:等待本端片上内存→片上内存拷贝完成后再继续75// 场景:等待本端片上内存→片上内存拷贝完成后再继续
76// CCU kernel函数体内76// CCU kernel函数体内
77-CcuResult my_kernel(ccu_kernel_arg arg) {77+ccu_result my_kernel(ccu_kernel_arg arg) {
78 local_addr src, dst;78 local_addr src, dst;
79 variable len;79 variable len;
80 event evt;80 event evt;
@@ -86,6 +86,6 @@ CcuResult my_kernel(ccu_kernel_arg arg) {
86 event_wait(evt, 0x1);86 event_wait(evt, 0x1);
87 87 
88 // 此后可安全使用dst指向的数据88 // 此后可安全使用dst指向的数据
89- return CCU_SUCCESS;89+ return ccu_result::CCU_SUCCESS;
90}90}
91```91```
@@ -23,18 +23,18 @@
23 23 
24## 功能说明24## 功能说明
25 25 
26-头文件为:`#include "ccu/hcomm/ccu_primitives.hpp"`26+头文件为:`#include <ccu/asc_ccu.h>`
27 27 
28在CCU kernel内发出同die内跨kernel同步信号的生产者侧接口,以字符串tag标识配对:相同tag的生产/消费两侧自动绑定到同一同步资源。28在CCU kernel内发出同die内跨kernel同步信号的生产者侧接口,以字符串tag标识配对:相同tag的生产/消费两侧自动绑定到同一同步资源。
29 29 
30> [!NOTE]说明30> [!NOTE]说明
31-> 本接口在C++层实现为`AscendC::ccu::event_record(const char* notify_tag, uint16_t mask)`重载,与`event_record(event, mask)`共用同一函数名,通过入参类型区分。适用于同一die内不同kernel之间的顺序同步(同device跨kernel),不适用于跨die或跨rank场景,跨die场景请使用[notify_record](notify_record.md)。31+> 本接口在C++层实现为`asc::ccu::event_record(const char* notify_tag, uint16_t mask)`重载,与`event_record(event, mask)`共用同一函数名,通过入参类型区分。适用于同一die内不同kernel之间的顺序同步(同device跨kernel),不适用于跨die或跨rank场景,跨die场景请使用[notify_record](notify_record.md)。
32 32 
33## 函数原型33## 函数原型
34 34 
35```cpp35```cpp
36// local_notify_record 对应 event_record 的 const char* 重载36// local_notify_record 对应 event_record 的 const char* 重载
37-CcuResult event_record(const char* notify_tag, uint16_t mask = 1);37+ccu_result event_record(const char* notify_tag, uint16_t mask = 1);
38```38```
39 39 
40## 参数说明40## 参数说明
@@ -46,17 +46,17 @@ CcuResult event_record(const char* notify_tag, uint16_t mask = 1);
46 46 
47## 返回值说明47## 返回值说明
48 48 
49-[`CcuResult`](https://gitcode.com/cann/hcomm/blob/master/docs/zh/api_ref/comm_opdev/datatype_definition/CcuResult.md):接口成功返回`CCU_SUCCESS`,其他值表示失败。49+`ccu_result`:接口成功返回`ccu_result::CCU_SUCCESS`,其他值表示失败。
50 50 
51| 返回值 | 说明 |51| 返回值 | 说明 |
52| --- | --- |52| --- | --- |
53-| `CCU_SUCCESS` | 操作成功。 |53+| `ccu_result::CCU_SUCCESS` | 操作成功。 |
54-| `CCU_E_PTR` | `notify_tag`为空指针,或接口在Kernel函数体之外被调用。 |54+| `ccu_result::CCU_E_PTR` | `notify_tag`为空指针,或接口在Kernel函数体之外被调用。 |
55-| `CCU_E_NOT_SUPPORT` | 在硬件loop body内调用,不支持。 |55+| `ccu_result::CCU_E_NOT_SUPPORT` | 在硬件loop body内调用,不支持。 |
56 56 
57## 约束说明57## 约束说明
58 58 
59-- 不可在硬件loop body内调用,否则将返回`CCU_E_NOT_SUPPORT`。loop body会被硬件并行展开为N份,notify记录语义在并行环境中不唯一。59+- 不可在硬件loop body内调用,否则将返回`ccu_result::CCU_E_NOT_SUPPORT`。loop body会被硬件并行展开为N份,notify记录语义在并行环境中不唯一。
60- `notify_tag`必须在翻译期保持有效,应使用字符串字面量(如`"phase1_done"`)或kernel内的`static char[]`,禁止使用栈上临时`char[]`。60- `notify_tag`必须在翻译期保持有效,应使用字符串字面量(如`"phase1_done"`)或kernel内的`static char[]`,禁止使用栈上临时`char[]`。
61- 生产侧`local_notify_record`与消费侧`local_notify_wait`必须使用完全相同的`notify_tag`字符串内容进行配对。61- 生产侧`local_notify_record`与消费侧`local_notify_wait`必须使用完全相同的`notify_tag`字符串内容进行配对。
62- 同一tag可承载多组配对,由`mask`的不同bit区分;等待侧`mask`必须与此处一致。62- 同一tag可承载多组配对,由`mask`的不同bit区分;等待侧`mask`必须与此处一致。
@@ -68,24 +68,24 @@ CcuResult event_record(const char* notify_tag, uint16_t mask = 1);
68 68 
69```cpp69```cpp
70// 为简化示例,省略返回值接收与错误处理70// 为简化示例,省略返回值接收与错误处理
71-using namespace AscendC::ccu;71+using namespace asc::ccu;
72 72 
73// 场景:同die内,phase_producer_kernel完成阶段1操作后通知phase_consumer_kernel继续73// 场景:同die内,phase_producer_kernel完成阶段1操作后通知phase_consumer_kernel继续
74// core 0 上的CCU kernel函数体内74// core 0 上的CCU kernel函数体内
75-CcuResult phase_producer_kernel(ccu_kernel_arg arg) {75+ccu_result phase_producer_kernel(ccu_kernel_arg arg) {
76 // ... 阶段1操作 ...76 // ... 阶段1操作 ...
77 77 
78 // 通知同die内的phase_consumer_kernel,阶段1已完成(即local_notify_record语义)78 // 通知同die内的phase_consumer_kernel,阶段1已完成(即local_notify_record语义)
79 event_record("phase1_done", 0x1);79 event_record("phase1_done", 0x1);
80- return CCU_SUCCESS;80+ return ccu_result::CCU_SUCCESS;
81}81}
82 82 
83// core 1 上的CCU kernel函数体内83// core 1 上的CCU kernel函数体内
84-CcuResult phase_consumer_kernel(ccu_kernel_arg arg) {84+ccu_result phase_consumer_kernel(ccu_kernel_arg arg) {
85 // 等待phase_producer_kernel发出的阶段1完成信号85 // 等待phase_producer_kernel发出的阶段1完成信号
86 event_wait("phase1_done", 0x1);86 event_wait("phase1_done", 0x1);
87 87 
88 // 此后可安全使用phase_producer_kernel阶段1的结果88 // 此后可安全使用phase_producer_kernel阶段1的结果
89- return CCU_SUCCESS;89+ return ccu_result::CCU_SUCCESS;
90}90}
91```91```
@@ -23,18 +23,18 @@
23 23 
24## 功能说明24## 功能说明
25 25 
26-头文件为:`#include "ccu/hcomm/ccu_primitives.hpp"`26+头文件为:`#include <ccu/asc_ccu.h>`
27 27 
28在CCU kernel内阻塞等待同die内跨kernel同步信号的消费者侧接口,以字符串tag标识配对。硬件执行到此处会阻塞,直到对应bit被置位后继续。28在CCU kernel内阻塞等待同die内跨kernel同步信号的消费者侧接口,以字符串tag标识配对。硬件执行到此处会阻塞,直到对应bit被置位后继续。
29 29 
30> [!NOTE]说明30> [!NOTE]说明
31-> 本接口在C++层实现为`AscendC::ccu::event_wait(const char* notify_tag, uint16_t mask)`重载,与`event_wait(event, mask)`共用同一函数名,通过入参类型区分。适用于同一die内不同kernel之间的顺序同步,不适用于跨die或跨rank场景,跨die场景请使用[notify_wait](notify_wait.md)。31+> 本接口在C++层实现为`asc::ccu::event_wait(const char* notify_tag, uint16_t mask)`重载,与`event_wait(event, mask)`共用同一函数名,通过入参类型区分。适用于同一die内不同kernel之间的顺序同步,不适用于跨die或跨rank场景,跨die场景请使用[notify_wait](notify_wait.md)。
32 32 
33## 函数原型33## 函数原型
34 34 
35```cpp35```cpp
36// local_notify_wait 对应 event_wait 的 const char* 重载36// local_notify_wait 对应 event_wait 的 const char* 重载
37-CcuResult event_wait(const char* notify_tag, uint16_t mask = 1);37+ccu_result event_wait(const char* notify_tag, uint16_t mask = 1);
38```38```
39 39 
40## 参数说明40## 参数说明
@@ -46,12 +46,12 @@ CcuResult event_wait(const char* notify_tag, uint16_t mask = 1);
46 46 
47## 返回值说明47## 返回值说明
48 48 
49-[`CcuResult`](https://gitcode.com/cann/hcomm/blob/master/docs/zh/api_ref/comm_opdev/datatype_definition/CcuResult.md):接口成功返回`CCU_SUCCESS`,其他值表示失败。49+`ccu_result`:接口成功返回`ccu_result::CCU_SUCCESS`,其他值表示失败。
50 50 
51| 返回值 | 说明 |51| 返回值 | 说明 |
52| --- | --- |52| --- | --- |
53-| `CCU_SUCCESS` | 操作成功。 |53+| `ccu_result::CCU_SUCCESS` | 操作成功。 |
54-| `CCU_E_PTR` | `notify_tag`为空指针,或接口在Kernel函数体之外被调用。 |54+| `ccu_result::CCU_E_PTR` | `notify_tag`为空指针,或接口在Kernel函数体之外被调用。 |
55 55 
56## 约束说明56## 约束说明
57 57 
@@ -66,16 +66,16 @@ CcuResult event_wait(const char* notify_tag, uint16_t mask = 1);
66 66 
67```cpp67```cpp
68// 为简化示例,省略返回值接收与错误处理68// 为简化示例,省略返回值接收与错误处理
69-using namespace AscendC::ccu;69+using namespace asc::ccu;
70 70 
71// 场景:同die内,phase_consumer_kernel等待phase_producer_kernel完成阶段1后才开始阶段271// 场景:同die内,phase_consumer_kernel等待phase_producer_kernel完成阶段1后才开始阶段2
72// core 1 上的CCU kernel函数体内72// core 1 上的CCU kernel函数体内
73-CcuResult phase_consumer_kernel(ccu_kernel_arg arg) {73+ccu_result phase_consumer_kernel(ccu_kernel_arg arg) {
74 // 等待phase_producer_kernel发出"phase1_done"信号的bit0(即local_notify_wait语义)74 // 等待phase_producer_kernel发出"phase1_done"信号的bit0(即local_notify_wait语义)
75 event_wait("phase1_done", 0x1);75 event_wait("phase1_done", 0x1);
76 76 
77 // 此后可安全使用phase_producer_kernel阶段1的结果77 // 此后可安全使用phase_producer_kernel阶段1的结果
78 // ... 阶段2操作 ...78 // ... 阶段2操作 ...
79- return CCU_SUCCESS;79+ return ccu_result::CCU_SUCCESS;
80}80}
81```81```
@@ -23,7 +23,7 @@
23 23 
24## 功能说明24## 功能说明
25 25 
26-头文件为:`#include "ccu/hcomm/ccu_primitives.hpp"`26+头文件为:`#include <ccu/asc_ccu.h>`
27 27 
28在CCU kernel内通过channel向对端die发送完成信号,将对端同步寄存器中`mask`对应的notify标志位置1,供对端的[notify_wait](notify_wait.md)读取完成信号。执行期信号以die-to-die信号包经channel传输:同device跨die走片间互联(HCCS),跨device/跨节点走RDMA网络。28在CCU kernel内通过channel向对端die发送完成信号,将对端同步寄存器中`mask`对应的notify标志位置1,供对端的[notify_wait](notify_wait.md)读取完成信号。执行期信号以die-to-die信号包经channel传输:同device跨die走片间互联(HCCS),跨device/跨节点走RDMA网络。
29 29 
@@ -33,11 +33,11 @@
33## 函数原型33## 函数原型
34 34 
35```cpp35```cpp
36-namespace AscendC {36+namespace asc {
37namespace ccu {37namespace ccu {
38-CcuResult notify_record(ChannelHandle channel, uint32_t remote_notify_idx, uint16_t mask = 1);38+ccu_result notify_record(ChannelHandle channel, uint32_t remote_notify_idx, uint16_t mask = 1);
39} // namespace ccu39} // namespace ccu
40-} // namespace AscendC40+} // namespace asc
41```41```
42 42 
43## 参数说明43## 参数说明
@@ -50,18 +50,18 @@ CcuResult notify_record(ChannelHandle channel, uint32_t remote_notify_idx, uint1
50 50 
51## 返回值说明51## 返回值说明
52 52 
53-[`CcuResult`](https://gitcode.com/cann/hcomm/blob/master/docs/zh/api_ref/comm_opdev/datatype_definition/CcuResult.md):接口成功返回`CCU_SUCCESS`,其他值表示失败。53+`ccu_result`:接口成功返回`ccu_result::CCU_SUCCESS`,其他值表示失败。
54 54 
55| 返回值 | 说明 |55| 返回值 | 说明 |
56| --- | --- |56| --- | --- |
57-| `CCU_SUCCESS` | 操作成功。 |57+| `ccu_result::CCU_SUCCESS` | 操作成功。 |
58-| `CCU_E_PTR` | 接口在Kernel函数体之外被调用。 |58+| `ccu_result::CCU_E_PTR` | 接口在Kernel函数体之外被调用。 |
59-| `CCU_E_NOT_SUPPORT` | 不支持在硬件loop的循环体内调用。 |59+| `ccu_result::CCU_E_NOT_SUPPORT` | 不支持在硬件loop的循环体内调用。 |
60 60 
61## 约束说明61## 约束说明
62 62 
63-- 不可在硬件loop的循环体内调用,调用时返回`CCU_E_NOT_SUPPORT`。循环体会被复制为多份并行执行,每份都会执行一次`notify_record`,置位语义不再明确。63+- 不可在硬件loop的循环体内调用,调用时返回`ccu_result::CCU_E_NOT_SUPPORT`。循环体会被复制为多份并行执行,每份都会执行一次`notify_record`,置位语义不再明确。
64-- 同一kernel内所有channel须属于同一die,不同die的channel不可混入同一kernel。该约束由`<<<>>>`统一校验,违反时返回`CCU_E_PARA`。64+- 同一kernel内所有channel须属于同一die,不同die的channel不可混入同一kernel。该约束由`<<<>>>`统一校验,违反时返回`ccu_result::CCU_E_PARA`。
65- `notify_record`的`remote_notify_idx`和`notify_wait`的`local_notify_idx`数值相同:槽位编号由通信双方在协议层约定一致,框架不校验两侧是否一致,也不自动配对。65- `notify_record`的`remote_notify_idx`和`notify_wait`的`local_notify_idx`数值相同:槽位编号由通信双方在协议层约定一致,框架不校验两侧是否一致,也不自动配对。
66- `notify_record`和`notify_wait`的`mask`相同。66- `notify_record`和`notify_wait`的`mask`相同。
67- 单个[`ChannelHandle`](https://gitcode.com/cann/hcomm/blob/master/docs/zh/api_ref/comm_opdev/datatype_definition/ChannelHandle.md)可用的notify槽位最多8个,因此`remote_notify_idx`的取值范围为0~7。67- 单个[`ChannelHandle`](https://gitcode.com/cann/hcomm/blob/master/docs/zh/api_ref/comm_opdev/datatype_definition/ChannelHandle.md)可用的notify槽位最多8个,因此`remote_notify_idx`的取值范围为0~7。
@@ -70,7 +70,7 @@ CcuResult notify_record(ChannelHandle channel, uint32_t remote_notify_idx, uint1
70 70 
71```cpp71```cpp
72// 为简化示例,省略返回值接收与错误处理72// 为简化示例,省略返回值接收与错误处理
73-using namespace AscendC::ccu;73+using namespace asc::ccu;
74 74 
75// 用户自定义的kernel入参结构体,Host侧建链后通过<<<>>>的kernelArg传入75// 用户自定义的kernel入参结构体,Host侧建链后通过<<<>>>的kernelArg传入
76struct my_kernel_arg {76struct my_kernel_arg {
@@ -79,22 +79,22 @@ struct my_kernel_arg {
79 79 
80// 场景:die A完成写操作后通知die B可以读取数据80// 场景:die A完成写操作后通知die B可以读取数据
81// die A的CCU kernel函数体内81// die A的CCU kernel函数体内
82-CcuResult sender_kernel(ccu_kernel_arg arg) {82+ccu_result sender_kernel(ccu_kernel_arg arg) {
83 auto *params = static_cast<my_kernel_arg *>(arg); // ccu_kernel_arg为void*,先转型为用户入参结构体83 auto *params = static_cast<my_kernel_arg *>(arg); // ccu_kernel_arg为void*,先转型为用户入参结构体
84 // ... 执行写操作,将数据写入对端内存 ...84 // ... 执行写操作,将数据写入对端内存 ...
85 85 
86 // 通知die B的notify槽位3,bit0已完成86 // 通知die B的notify槽位3,bit0已完成
87 notify_record(params->channel, /*remote_notify_idx=*/3, 0x1);87 notify_record(params->channel, /*remote_notify_idx=*/3, 0x1);
88- return CCU_SUCCESS;88+ return ccu_result::CCU_SUCCESS;
89}89}
90 90 
91// die B的CCU kernel函数体内,与die A的kernel对应91// die B的CCU kernel函数体内,与die A的kernel对应
92-CcuResult receiver_kernel(ccu_kernel_arg arg) {92+ccu_result receiver_kernel(ccu_kernel_arg arg) {
93 auto *params = static_cast<my_kernel_arg *>(arg); // ccu_kernel_arg为void*,先转型为用户入参结构体93 auto *params = static_cast<my_kernel_arg *>(arg); // ccu_kernel_arg为void*,先转型为用户入参结构体
94 // 等待来自die A的信号,本端notify槽位3的bit094 // 等待来自die A的信号,本端notify槽位3的bit0
95 notify_wait(params->channel, /*local_notify_idx=*/3, 0x1);95 notify_wait(params->channel, /*local_notify_idx=*/3, 0x1);
96 96 
97 // 此后可安全读取die A写入的数据97 // 此后可安全读取die A写入的数据
98- return CCU_SUCCESS;98+ return ccu_result::CCU_SUCCESS;
99}99}
100```100```
@@ -23,7 +23,7 @@
23 23 
24## 功能说明24## 功能说明
25 25 
26-头文件为:`#include "ccu/hcomm/ccu_primitives.hpp"`26+头文件为:`#include <ccu/asc_ccu.h>`
27 27 
28阻塞等待本端同步寄存器中`mask`对应的notify标志位,直到其全部为1后继续执行。该标志位由对端die的[notify_record](notify_record.md)通过channel置位。28阻塞等待本端同步寄存器中`mask`对应的notify标志位,直到其全部为1后继续执行。该标志位由对端die的[notify_record](notify_record.md)通过channel置位。
29 29 
@@ -33,11 +33,11 @@
33## 函数原型33## 函数原型
34 34 
35```cpp35```cpp
36-namespace AscendC {36+namespace asc {
37namespace ccu {37namespace ccu {
38-CcuResult notify_wait(ChannelHandle channel, uint32_t local_notify_idx, uint16_t mask = 1);38+ccu_result notify_wait(ChannelHandle channel, uint32_t local_notify_idx, uint16_t mask = 1);
39} // namespace ccu39} // namespace ccu
40-} // namespace AscendC40+} // namespace asc
41```41```
42 42 
43## 参数说明43## 参数说明
@@ -50,17 +50,17 @@ CcuResult notify_wait(ChannelHandle channel, uint32_t local_notify_idx, uint16_t
50 50 
51## 返回值说明51## 返回值说明
52 52 
53-[`CcuResult`](https://gitcode.com/cann/hcomm/blob/master/docs/zh/api_ref/comm_opdev/datatype_definition/CcuResult.md):接口成功返回`CCU_SUCCESS`,其他值表示失败。53+`ccu_result`:接口成功返回`ccu_result::CCU_SUCCESS`,其他值表示失败。
54 54 
55| 返回值 | 说明 |55| 返回值 | 说明 |
56| --- | --- |56| --- | --- |
57-| `CCU_SUCCESS` | 操作成功。 |57+| `ccu_result::CCU_SUCCESS` | 操作成功。 |
58-| `CCU_E_PTR` | 接口在Kernel函数体之外被调用。 |58+| `ccu_result::CCU_E_PTR` | 接口在Kernel函数体之外被调用。 |
59 59 
60## 约束说明60## 约束说明
61 61 
62- `notify_wait`可在硬件loop的循环体内调用。62- `notify_wait`可在硬件loop的循环体内调用。
63-- 同一kernel内所有channel须属于同一die,不同die的channel不可混入同一kernel。该约束由`<<<>>>`统一校验,违反时返回`CCU_E_PARA`。63+- 同一kernel内所有channel须属于同一die,不同die的channel不可混入同一kernel。该约束由`<<<>>>`统一校验,违反时返回`ccu_result::CCU_E_PARA`。
64- `notify_record`的`remote_notify_idx`和`notify_wait`的`local_notify_idx`数值相同:槽位编号由通信双方在协议层约定一致,框架不校验两侧是否一致,也不自动配对。64- `notify_record`的`remote_notify_idx`和`notify_wait`的`local_notify_idx`数值相同:槽位编号由通信双方在协议层约定一致,框架不校验两侧是否一致,也不自动配对。
65- `notify_record`和`notify_wait`的`mask`相同。65- `notify_record`和`notify_wait`的`mask`相同。
66- 单个[`ChannelHandle`](https://gitcode.com/cann/hcomm/blob/master/docs/zh/api_ref/comm_opdev/datatype_definition/ChannelHandle.md)可用的notify槽位最多8个,因此`local_notify_idx`的取值范围为0~7。66- 单个[`ChannelHandle`](https://gitcode.com/cann/hcomm/blob/master/docs/zh/api_ref/comm_opdev/datatype_definition/ChannelHandle.md)可用的notify槽位最多8个,因此`local_notify_idx`的取值范围为0~7。
@@ -70,7 +70,7 @@ CcuResult notify_wait(ChannelHandle channel, uint32_t local_notify_idx, uint16_t
70 70 
71```cpp71```cpp
72// 为简化示例,省略返回值接收与错误处理72// 为简化示例,省略返回值接收与错误处理
73-using namespace AscendC::ccu;73+using namespace asc::ccu;
74 74 
75// 用户自定义的kernel入参结构体,Host侧建链后通过<<<>>>的kernelArg传入75// 用户自定义的kernel入参结构体,Host侧建链后通过<<<>>>的kernelArg传入
76struct my_kernel_arg {76struct my_kernel_arg {
@@ -79,7 +79,7 @@ struct my_kernel_arg {
79 79 
80// 场景:die B等待die A完成写操作后再读取数据80// 场景:die B等待die A完成写操作后再读取数据
81// die B的CCU kernel函数体内81// die B的CCU kernel函数体内
82-CcuResult receiver_kernel(ccu_kernel_arg arg) {82+ccu_result receiver_kernel(ccu_kernel_arg arg) {
83 auto *params = static_cast<my_kernel_arg *>(arg); // ccu_kernel_arg为void*,先转型为用户入参结构体83 auto *params = static_cast<my_kernel_arg *>(arg); // ccu_kernel_arg为void*,先转型为用户入参结构体
84 // 等待来自die A的信号,本端notify槽位3的bit084 // 等待来自die A的信号,本端notify槽位3的bit0
85 // 对应die A侧notify_record(channel, /*remote_notify_idx=*/3, 0x1)85 // 对应die A侧notify_record(channel, /*remote_notify_idx=*/3, 0x1)
@@ -92,6 +92,6 @@ CcuResult receiver_kernel(ccu_kernel_arg arg) {
92 event evt;92 event evt;
93 read(params->channel, dst, remote, len, evt);93 read(params->channel, dst, remote, len, evt);
94 event_wait(evt);94 event_wait(evt);
95- return CCU_SUCCESS;95+ return ccu_result::CCU_SUCCESS;
96}96}
97```97```
@@ -23,9 +23,9 @@
23 23 
24## 功能说明24## 功能说明
25 25 
26-头文件为:`#include "ccu/hcomm/ccu_primitives.hpp"`26+头文件为:`#include <ccu/asc_ccu.h>`
27 27 
28-在CCU kernel内将“写对端variable值”与“触发对端notify信号”合并为单条原子操作,硬件保证“先写值后发通知”的完成顺序。消费侧通过[notify_wait](notify_wait.md)等待信号,再通过`AscendC::ccu::get_res_by_channel<variable>(channel, remote_var_idx)`读取写入的新值。28+在CCU kernel内将“写对端variable值”与“触发对端notify信号”合并为单条原子操作,硬件保证“先写值后发通知”的完成顺序。消费侧通过[notify_wait](notify_wait.md)等待信号,再通过`asc::ccu::get_res_by_channel<variable>(channel, remote_var_idx)`读取写入的新值。
29 29 
30> [!CAUTION]注意30> [!CAUTION]注意
31> 不可将本接口拆分为独立的“写variable”与“notify_record”两步调用。硬件层不保证两条独立操作的到达顺序,消费侧收到notify信号后读取对端variable时,存在读到旧值的风险。仅本接口能从硬件层保证顺序。31> 不可将本接口拆分为独立的“写variable”与“notify_record”两步调用。硬件层不保证两条独立操作的到达顺序,消费侧收到notify信号后读取对端variable时,存在读到旧值的风险。仅本接口能从硬件层保证顺序。
@@ -33,13 +33,13 @@
33## 函数原型33## 函数原型
34 34 
35```cpp35```cpp
36-namespace AscendC {36+namespace asc {
37namespace ccu {37namespace ccu {
38-CcuResult write_variable_with_notify(ChannelHandle channel, variable var,38+ccu_result write_variable_with_notify(ChannelHandle channel, variable var,
39 uint32_t remote_var_idx, uint32_t remote_notify_idx,39 uint32_t remote_var_idx, uint32_t remote_notify_idx,
40 uint16_t mask = 1);40 uint16_t mask = 1);
41} // namespace ccu41} // namespace ccu
42-} // namespace AscendC42+} // namespace asc
43```43```
44 44 
45## 参数说明45## 参数说明
@@ -54,26 +54,26 @@ CcuResult write_variable_with_notify(ChannelHandle channel, variable var,
54 54 
55## 返回值说明55## 返回值说明
56 56 
57-[`CcuResult`](https://gitcode.com/cann/hcomm/blob/master/docs/zh/api_ref/comm_opdev/datatype_definition/CcuResult.md):接口成功返回`CCU_SUCCESS`,其他值表示失败。57+`ccu_result`:接口成功返回`ccu_result::CCU_SUCCESS`,其他值表示失败。
58 58 
59| 返回值 | 说明 |59| 返回值 | 说明 |
60| --- | --- |60| --- | --- |
61-| `CCU_SUCCESS` | 操作成功。 |61+| `ccu_result::CCU_SUCCESS` | 操作成功。 |
62-| `CCU_E_NOT_FOUND` | `var`对应的variable句柄未在当前kernel内创建。 |62+| `ccu_result::CCU_E_NOT_FOUND` | `var`对应的variable句柄未在当前kernel内创建。 |
63-| `CCU_E_PTR` | 接口在Kernel函数体之外被调用。 |63+| `ccu_result::CCU_E_PTR` | 接口在Kernel函数体之外被调用。 |
64-| `CCU_E_NOT_SUPPORT` | 不支持在硬件loop的循环体内调用。 |64+| `ccu_result::CCU_E_NOT_SUPPORT` | 不支持在硬件loop的循环体内调用。 |
65 65 
66## 约束说明66## 约束说明
67 67 
68-- 不可在硬件loop的循环体内调用,调用时返回`CCU_E_NOT_SUPPORT`。68+- 不可在硬件loop的循环体内调用,调用时返回`ccu_result::CCU_E_NOT_SUPPORT`。
69-- 同一kernel内所有channel须属于同一die,不同die的channel不可混入同一kernel。该约束由`<<<>>>`统一校验,违反时返回`CCU_E_PARA`。69+- 同一kernel内所有channel须属于同一die,不同die的channel不可混入同一kernel。该约束由`<<<>>>`统一校验,违反时返回`ccu_result::CCU_E_PARA`。
70- `remote_var_idx`与`remote_notify_idx`均为channel级别的槽位编号,由两端kernel各自传入:框架不分配编号,也不校验两侧是否一致,须由开发者保证两端使用相同编号,若不一致则消费侧将永久阻塞。70- `remote_var_idx`与`remote_notify_idx`均为channel级别的槽位编号,由两端kernel各自传入:框架不分配编号,也不校验两侧是否一致,须由开发者保证两端使用相同编号,若不一致则消费侧将永久阻塞。
71 71 
72## 调用示例72## 调用示例
73 73 
74```cpp74```cpp
75// 为简化示例,省略返回值接收与错误处理75// 为简化示例,省略返回值接收与错误处理
76-using namespace AscendC::ccu;76+using namespace asc::ccu;
77 77 
78// 用户自定义的kernel入参结构体,Host侧建链后通过<<<>>>的kernelArg传入78// 用户自定义的kernel入参结构体,Host侧建链后通过<<<>>>的kernelArg传入
79struct my_kernel_arg {79struct my_kernel_arg {
@@ -82,7 +82,7 @@ struct my_kernel_arg {
82 82 
83// 场景:生产者将进度值发给消费者,消费者收到通知后读取83// 场景:生产者将进度值发给消费者,消费者收到通知后读取
84// 生产者CCU kernel函数体内(die A)84// 生产者CCU kernel函数体内(die A)
85-CcuResult producer_kernel(ccu_kernel_arg arg) {85+ccu_result producer_kernel(ccu_kernel_arg arg) {
86 auto *params = static_cast<my_kernel_arg *>(arg); // ccu_kernel_arg为void*,先转型为用户入参结构体86 auto *params = static_cast<my_kernel_arg *>(arg); // ccu_kernel_arg为void*,先转型为用户入参结构体
87 variable progress;87 variable progress;
88 progress = 100; // 赋立即数10088 progress = 100; // 赋立即数100
@@ -90,17 +90,17 @@ CcuResult producer_kernel(ccu_kernel_arg arg) {
90 // 原子操作:写对端变量槽位2 + 通知对端notify槽位3的bit090 // 原子操作:写对端变量槽位2 + 通知对端notify槽位3的bit0
91 write_variable_with_notify(params->channel, progress,91 write_variable_with_notify(params->channel, progress,
92 /*remote_var_idx=*/2, /*remote_notify_idx=*/3, 0x1);92 /*remote_var_idx=*/2, /*remote_notify_idx=*/3, 0x1);
93- return CCU_SUCCESS;93+ return ccu_result::CCU_SUCCESS;
94}94}
95 95 
96// 消费者CCU kernel函数体内(die B)96// 消费者CCU kernel函数体内(die B)
97-CcuResult consumer_kernel(ccu_kernel_arg arg) {97+ccu_result consumer_kernel(ccu_kernel_arg arg) {
98 auto *params = static_cast<my_kernel_arg *>(arg); // ccu_kernel_arg为void*,先转型为用户入参结构体98 auto *params = static_cast<my_kernel_arg *>(arg); // ccu_kernel_arg为void*,先转型为用户入参结构体
99 // 等待来自die A的信号99 // 等待来自die A的信号
100 notify_wait(params->channel, /*local_notify_idx=*/3, 0x1);100 notify_wait(params->channel, /*local_notify_idx=*/3, 0x1);
101 101 
102 // 安全读取die A写入的值(保证已写入完成)102 // 安全读取die A写入的值(保证已写入完成)
103 variable received = get_res_by_channel<variable>(params->channel, /*var_idx=*/2);103 variable received = get_res_by_channel<variable>(params->channel, /*var_idx=*/2);
104- return CCU_SUCCESS;104+ return ccu_result::CCU_SUCCESS;
105}105}
106```106```
@@ -23,7 +23,7 @@
23 23 
24## 功能说明24## 功能说明
25 25 
26-使用该接口需要包含头文件`ccu/hcomm/ccu_print.hpp`。26+使用该接口需要包含头文件`ccu/asc_ccu.h`。
27 27 
28打印CCU kernel执行到调用位置时的`ccu::variable`值,用于调试。日志包含`[CCU_PRINT]`前缀、文件名、行号和格式化后的变量值。28打印CCU kernel执行到调用位置时的`ccu::variable`值,用于调试。日志包含`[CCU_PRINT]`前缀、文件名、行号和格式化后的变量值。
29 29 
@@ -42,7 +42,7 @@ CCU_PRINTF(fmt, args...)
42| 参数名 | 输入/输出 | 描述 |42| 参数名 | 输入/输出 | 描述 |
43| --- | --- | --- |43| --- | --- | --- |
44| fmt | 输入 | 有效的、以`\0`结尾的Host格式字符串,构建时保存。不支持`nullptr`。 |44| fmt | 输入 | 有效的、以`\0`结尾的Host格式字符串,构建时保存。不支持`nullptr`。 |
45-| args | 输入 | 零个或多个`AscendC::ccu::variable`,按设备运行时值输出。不支持Host整数、字符串、指针或浮点数。 |45+| args | 输入 | 零个或多个`asc::ccu::variable`,按设备运行时值输出。不支持Host整数、字符串、指针或浮点数。 |
46 46 
47| 格式符 | 含义 |47| 格式符 | 含义 |
48| --- | --- |48| --- | --- |
@@ -57,16 +57,16 @@ CCU_PRINTF(fmt, args...)
57 57 
58## 返回值说明58## 返回值说明
59 59 
60-返回`CcuResult`,表示Host侧打印指令的构建状态。60+返回`ccu_result`,表示Host侧打印指令的构建状态。
61 61 
62| 返回值/行为 | 说明 |62| 返回值/行为 | 说明 |
63| --- | --- |63| --- | --- |
64-| `CCU_SUCCESS` | 打印指令构建成功。 |64+| `ccu_result::CCU_SUCCESS` | 打印指令构建成功。 |
65-| `CCU_E_PARA` | 格式字符串非法、格式符数量与参数数量不匹配,或注册失败导致打印句柄为空。 |65+| `ccu_result::CCU_E_PARA` | 格式字符串非法、格式符数量与参数数量不匹配,或注册失败导致打印句柄为空。 |
66-| 其他`CcuResult` | 构建内部`load`、`store`或条件控制指令失败,向调用方透传错误。 |66+| 其他`ccu_result` | 构建内部`load`、`store`或条件控制指令失败,向调用方透传错误。 |
67| 编译期错误 | 可变参数中包含非`ccu::variable`类型,触发静态类型检查。 |67| 编译期错误 | 可变参数中包含非`ccu::variable`类型,触发静态类型检查。 |
68 68 
69-格式不合法时,不分配打印缓冲区、不生成打印指令,返回`CCU_E_PARA`,并输出ERROR级别运行日志(`DLOG_ERROR`):69+格式不合法时,不分配打印缓冲区、不生成打印指令,返回`ccu_result::CCU_E_PARA`,并输出ERROR级别运行日志(`DLOG_ERROR`):
70 70 
71```text71```text
72[CCU_PRINT] invalid format or argument count72[CCU_PRINT] invalid format or argument count
@@ -82,7 +82,7 @@ Host处理记录时若检测到非法格式,输出WARNING日志,并停止本
82| 宽度、精度、标志或位置参数 | `%08x`、`%.2u`、`%+u`、`% u`、`%#x`、`%*u`、`%1$u` |82| 宽度、精度、标志或位置参数 | `%08x`、`%.2u`、`%+u`、`% u`、`%#x`、`%*u`、`%1$u` |
83| 格式符与参数数量不匹配 | `CCU_PRINTF("%u")`,或向`""`、`"%%"`传入变量 |83| 格式符与参数数量不匹配 | `CCU_PRINTF("%u")`,或向`""`、`"%%"`传入变量 |
84 84 
85-资源分配等其他注册失败不生成打印指令,返回`CCU_E_PARA`。85+资源分配等其他注册失败不生成打印指令,返回`ccu_result::CCU_E_PARA`。
86 86 
87## 约束说明87## 约束说明
88 88 
@@ -94,7 +94,7 @@ Host处理记录时若检测到非法格式,输出WARNING日志,并停止本
94> [!CAUTION]注意94> [!CAUTION]注意
95> CCU_PRINTF接口打印功能会对CCU kernel实际运行的性能带来一定影响,通常在调测阶段使用。开发者可以按需在编译包含CCU_PRINTF调用的源文件时设置`-DASCENDC_DUMP=0`,关闭打印功能。95> CCU_PRINTF接口打印功能会对CCU kernel实际运行的性能带来一定影响,通常在调测阶段使用。开发者可以按需在编译包含CCU_PRINTF调用的源文件时设置`-DASCENDC_DUMP=0`,关闭打印功能。
96 96 
97-关闭打印时,CCU_PRINTF不求值参数、不分配打印缓冲区、不生成打印指令,返回`CCU_SUCCESS`。未定义ASCENDC_DUMP或其值非0时,打印功能开启。97+关闭打印时,CCU_PRINTF不求值参数、不分配打印缓冲区、不生成打印指令,返回`ccu_result::CCU_SUCCESS`。未定义ASCENDC_DUMP或其值非0时,打印功能开启。
98 98 
99## 使用说明99## 使用说明
100 100 
@@ -107,19 +107,19 @@ CCU_PRINTF正文沿用HCCL_RUN_INFO的INFO级运行日志通道,可在Host侧
107以下代码为kernel构建函数中的打印片段,`load_arg`参数0、1由Host launch传入:107以下代码为kernel构建函数中的打印片段,`load_arg`参数0、1由Host launch传入:
108 108 
109```cpp109```cpp
110-#include "ccu/hcomm/ccu_print.hpp"110+#include "ccu/asc_ccu.h"
111 111 
112-namespace ccu = AscendC::ccu;112+namespace ccu = asc::ccu;
113 113 
114-CcuResult BuildPrintBody()114+ccu_result BuildPrintBody()
115{115{
116 ccu::variable a, b, sum;116 ccu::variable a, b, sum;
117- CcuResult ret = ccu::load_arg(a, 0);117+ ccu_result ret = ccu::load_arg(a, 0);
118- if (ret != CCU_SUCCESS) {118+ if (ret != ccu_result::CCU_SUCCESS) {
119 return ret;119 return ret;
120 }120 }
121 ret = ccu::load_arg(b, 1);121 ret = ccu::load_arg(b, 1);
122- if (ret != CCU_SUCCESS) {122+ if (ret != ccu_result::CCU_SUCCESS) {
123 return ret;123 return ret;
124 }124 }
125 sum = a + b;125 sum = a + b;
@@ -95,7 +95,7 @@ Host侧与Kernel侧的关联体现在:Host侧完成资源准备后,通过第
95 }95 }
96 ```96 ```
97 97 
98- `asccomm_ccu_*`接口返回`CcuResult`,样例中通过`ConvertCcuToHccl`转换为`HcclResult`后交由`HCCLCHECK`检查。98+ `asccomm_ccu_*`接口返回`ccu_result`,样例中通过`ConvertCcuToHccl`转换为`HcclResult`后交由`HCCLCHECK`检查。
99 99 
100 变量的VA地址(`mappedAddrs.startVa`)随AI Core Kernel参数下发,供其写通信地址;变量、事件的句柄(`varHandle`、`eventHandle`)写入`kernelArg`随CCU Kernel下发,供其读地址、等待/置位事件。100 变量的VA地址(`mappedAddrs.startVa`)随AI Core Kernel参数下发,供其写通信地址;变量、事件的句柄(`varHandle`、`eventHandle`)写入`kernelArg`随CCU Kernel下发,供其读地址、等待/置位事件。
101 101 
@@ -200,7 +200,7 @@ Host侧与Kernel侧的关联体现在:Host侧完成资源准备后,通过第
200 HCCLCHECK(ConvertCcuToHccl(HcommCcuGetMemToken(baseInputAddr, inputSize, &token)));200 HCCLCHECK(ConvertCcuToHccl(HcommCcuGetMemToken(baseInputAddr, inputSize, &token)));
201 ```201 ```
202 202 
203- `asccomm_ccu_*`接口返回`CcuResult`,样例中通过`ConvertCcuToHccl`转换为`HcclResult`后交由`HCCLCHECK`检查。203+ `asccomm_ccu_*`接口返回`ccu_result`,样例中通过`ConvertCcuToHccl`转换为`HcclResult`后交由`HCCLCHECK`检查。
204 204 
205- 准备taskArgs205- 准备taskArgs
206 206 
@@ -349,16 +349,16 @@ AllGather的执行分为两部分:向其他rank写入本rank数据,以及本
349 349 
350 ```cpp350 ```cpp
351 ccu::local_addr src;351 ccu::local_addr src;
352- src.addr_ = ctx.input;352+ src.addr = ctx.input;
353- src.addr_ += ctx.currentRankSliceInputOffset;353+ src.addr += ctx.currentRankSliceInputOffset;
354 src.token = ctx.token[ctx.arg->rankId];354 src.token = ctx.token[ctx.arg->rankId];
355 355 
356 for (uint32_t rankIdx = 0; rankIdx < ctx.arg->rankSize; rankIdx++) {356 for (uint32_t rankIdx = 0; rankIdx < ctx.arg->rankSize; rankIdx++) {
357 if (rankIdx == ctx.arg->rankId) {357 if (rankIdx == ctx.arg->rankId) {
358- localDst.addr_ = ctx.output[rankIdx] + ctx.currentRankSliceOutputOffset;358+ localDst.addr = ctx.output[rankIdx] + ctx.currentRankSliceOutputOffset;
359 localDst.token = ctx.token[rankIdx];359 localDst.token = ctx.token[rankIdx];
360 } else {360 } else {
361- dst[rankIdx].addr_ = ctx.output[rankIdx] + ctx.currentRankSliceOutputOffset;361+ dst[rankIdx].addr = ctx.output[rankIdx] + ctx.currentRankSliceOutputOffset;
362 dst[rankIdx].token = ctx.token[rankIdx];362 dst[rankIdx].token = ctx.token[rankIdx];
363 }363 }
364 }364 }
@@ -58,7 +58,7 @@
58 } \58 } \
59 } while (0)59 } while (0)
60 60 
61-// namespace ccu = ::AscendC::ccu;61+// namespace ccu = ::asc::ccu;
62 62 
63constexpr uint64_t CCU_MAX_RANK_SIZE = 16;63constexpr uint64_t CCU_MAX_RANK_SIZE = 16;
64constexpr int32_t kErrResNotSufficient = 1043;64constexpr int32_t kErrResNotSufficient = 1043;
@@ -64,7 +64,6 @@ target_link_options(ccu_allgather PRIVATE
64 -Wl,-rpath,${ASCEND_CANN_PACKAGE_PATH}/lib6464 -Wl,-rpath,${ASCEND_CANN_PACKAGE_PATH}/lib64
65)65)
66target_link_directories(ccu_allgather PRIVATE66target_link_directories(ccu_allgather PRIVATE
67- ${ASCEND_CANN_PACKAGE_PATH}/asc/lib64
68 ${ASCEND_CANN_PACKAGE_PATH}/lib6467 ${ASCEND_CANN_PACKAGE_PATH}/lib64
69)68)
70target_link_libraries(ccu_allgather PRIVATE69target_link_libraries(ccu_allgather PRIVATE
@@ -17,9 +17,10 @@
17#include <vector>17#include <vector>
18 18 
19#include <hccl/hccl_res.h>19#include <hccl/hccl_res.h>
20-#include <ccu/hcomm/ccu_primitives.hpp>20+#include <ccu/ccu_api/ccu_types.h>
21+#include <ccu/ccu_api/ccu_primitives.h>
21 22 
22-namespace ccu = ::AscendC::ccu;23+namespace ccu = ::asc::ccu;
23 24 
24namespace ops_comm_ag {25namespace ops_comm_ag {
25 26 
@@ -94,7 +95,7 @@ struct AllGatherMesh1DMem2MemContext {
94 bool IsLoopEntityRegistered(std::string loopStr) { return loopMap.count(loopStr) != 0; }95 bool IsLoopEntityRegistered(std::string loopStr) { return loopMap.count(loopStr) != 0; }
95};96};
96 97 
97-// 把 CCU 接口返回的 CcuResult 归一化为 HCCL 错误码,便于统一用 HCCLCHECK 检查98+// 把 CCU 接口返回的 ccu_result 归一化为 HCCL 错误码,便于统一用 HCCLCHECK 检查
98constexpr int OUTPUT_VAR_ID = 1;99constexpr int OUTPUT_VAR_ID = 1;
99constexpr int TOKEN_VAR_ID = 2;100constexpr int TOKEN_VAR_ID = 2;
100constexpr int EVENT_IDX_0 = 0;101constexpr int EVENT_IDX_0 = 0;
@@ -179,7 +180,7 @@ static void InitGroupCopyResources(
179}180}
180 181 
181// 按切分参数执行本地拷贝。182// 按切分参数执行本地拷贝。
182-static CcuResult GroupCopy(183+static ccu_result GroupCopy(
183 AllGatherMesh1DMem2MemContext& ctx, ccu::local_addr dst, ccu::local_addr src, GroupOpSizeVars goSize)184 AllGatherMesh1DMem2MemContext& ctx, ccu::local_addr dst, ccu::local_addr src, GroupOpSizeVars goSize)
184{185{
185 ccu::local_addr loopSrc[2];186 ccu::local_addr loopSrc[2];
@@ -255,10 +256,10 @@ static CcuResult GroupCopy(
255 ccu::loop_group group(goSize.parallelParam, offsetCfg, ctx.moConfig.loopCount, grpLoops);256 ccu::loop_group group(goSize.parallelParam, offsetCfg, ctx.moConfig.loopCount, grpLoops);
256 }257 }
257 258 
258- return CCU_SUCCESS;259+ return ccu_result::CCU_SUCCESS;
259}260}
260 261 
261-static CcuResult ExecuteAllGatherTransfer(AllGatherMesh1DMem2MemContext& ctx)262+static ccu_result ExecuteAllGatherTransfer(AllGatherMesh1DMem2MemContext& ctx)
262{263{
263 ccu::local_addr src;264 ccu::local_addr src;
264 ccu::local_addr localDst;265 ccu::local_addr localDst;
@@ -304,7 +305,7 @@ static CcuResult ExecuteAllGatherTransfer(AllGatherMesh1DMem2MemContext& ctx)
304 const uint16_t totalMask = (1 << ctx.arg->rankSize) - 1;305 const uint16_t totalMask = (1 << ctx.arg->rankSize) - 1;
305 ccu::event_wait(ctx.event, totalMask);306 ccu::event_wait(ctx.event, totalMask);
306 307 
307- return CcuResult::CCU_SUCCESS;308+ return ccu_result::CCU_SUCCESS;
308}309}
309 310 
310// Host 侧 CCU Kernel:通过 SQE 下发 CCU 编排指令。311// Host 侧 CCU Kernel:通过 SQE 下发 CCU 编排指令。
@@ -18,14 +18,18 @@
18#include <acl/acl_rt.h>18#include <acl/acl_rt.h>
19#include <hccl/hccl_comm.h>19#include <hccl/hccl_comm.h>
20#include <hccl/hccl_rank_graph.h>20#include <hccl/hccl_rank_graph.h>
21+#include <hccl/hccl_res.h>
22+#include <hcomm/hcomm_primitives.h>
21#include <ccu_res.h>23#include <ccu_res.h>
24+#include <ccu/asc_ccu.h>
22 25 
23-#include <ccu/ccu_host_launch.h>
24#include "../../../common/ccu_instance.h"26#include "../../../common/ccu_instance.h"
25#include "ccu_allgather_kernel.h"27#include "ccu_allgather_kernel.h"
26 28 
27using namespace ops_comm_ag;29using namespace ops_comm_ag;
28 30 
31+namespace ccu = ::asc::ccu;
32+ 
29#ifdef ACLCHECK33#ifdef ACLCHECK
30#undef ACLCHECK34#undef ACLCHECK
31#endif35#endif
@@ -61,7 +61,6 @@ target_link_options(ccu_allgather_mesh1d_mem2mem PRIVATE
61 -Wl,-z,noexecstack61 -Wl,-z,noexecstack
62)62)
63target_link_directories(ccu_allgather_mesh1d_mem2mem PRIVATE63target_link_directories(ccu_allgather_mesh1d_mem2mem PRIVATE
64- ${ASCEND_CANN_PACKAGE_PATH}/asc/lib64
65 ${ASCEND_CANN_PACKAGE_PATH}/lib6464 ${ASCEND_CANN_PACKAGE_PATH}/lib64
66)65)
67target_link_libraries(ccu_allgather_mesh1d_mem2mem PRIVATE66target_link_libraries(ccu_allgather_mesh1d_mem2mem PRIVATE
@@ -18,9 +18,10 @@
18#include <vector>18#include <vector>
19 19 
20#include <hccl/hccl_res.h>20#include <hccl/hccl_res.h>
21-#include <ccu/hcomm/ccu_primitives.hpp>21+#include <ccu/ccu_api/ccu_types.h>
22+#include <ccu/ccu_api/ccu_primitives.h>
22 23 
23-namespace ccu = ::AscendC::ccu;24+namespace ccu = ::asc::ccu;
24 25 
25namespace ops_comm_ag {26namespace ops_comm_ag {
26constexpr uint32_t CCU_MAX_RANK_SIZE = 16;27constexpr uint32_t CCU_MAX_RANK_SIZE = 16;
@@ -196,7 +197,7 @@ static void InitGroupCopyResources(
196// 按 CalGoSize 的切分结果组织本地拷贝:addr_offset 非 0 时先整体循环搬运已切分的部分,197// 按 CalGoSize 的切分结果组织本地拷贝:addr_offset 非 0 时先整体循环搬运已切分的部分,
197// parallel_param 非 0 时再单独搬运尾块(尾分片 + 尾残余),两部分经 CcuBuffer 中转。198// parallel_param 非 0 时再单独搬运尾块(尾分片 + 尾残余),两部分经 CcuBuffer 中转。
198 199 
199-static CcuResult GroupCopy(200+static ccu_result GroupCopy(
200 AllGatherMesh1DMem2MemContext& ctx, ccu::local_addr dst_, ccu::local_addr src_, GroupOpSizeVars goSize)201 AllGatherMesh1DMem2MemContext& ctx, ccu::local_addr dst_, ccu::local_addr src_, GroupOpSizeVars goSize)
201{202{
202 ccu::local_addr loopSrc[2];203 ccu::local_addr loopSrc[2];
@@ -271,17 +272,17 @@ static CcuResult GroupCopy(
271 ccu::loop_group group(goSize.parallel_param, offsetCfg, ctx.moConfig.loop_count, grpLoops);272 ccu::loop_group group(goSize.parallel_param, offsetCfg, ctx.moConfig.loop_count, grpLoops);
272 }273 }
273 274 
274- return CCU_SUCCESS;275+ return ccu_result::CCU_SUCCESS;
275}276}
276 277 
277// Kernel 内资源准备:把各对端 output 地址与 token 绑定到对应 Channel 的 Variable 单元,278// Kernel 内资源准备:把各对端 output 地址与 token 绑定到对应 Channel 的 Variable 单元,
278// 并按 rank 数分配事件数组279// 并按 rank 数分配事件数组
279 280 
280-static CcuResult InitResource(AllGatherMesh1DMem2MemContext& ctx)281+static ccu_result InitResource(AllGatherMesh1DMem2MemContext& ctx)
281{282{
282 if (ctx.arg->rankSize < 2 || ctx.arg->rankId >= ctx.arg->rankSize ||283 if (ctx.arg->rankSize < 2 || ctx.arg->rankId >= ctx.arg->rankSize ||
283 ctx.arg->channelCount != ctx.arg->rankSize - 1) {284 ctx.arg->channelCount != ctx.arg->rankSize - 1) {
284- return CCU_E_PARA;285+ return ccu_result::CCU_E_PARA;
285 }286 }
286 287 
287 ctx.output.resize(ctx.arg->rankSize);288 ctx.output.resize(ctx.arg->rankSize);
@@ -298,7 +299,7 @@ static CcuResult InitResource(AllGatherMesh1DMem2MemContext& ctx)
298 299 
299 const uint32_t eventNum = (ctx.arg->rankSize + BITS_PER_EVENT - 1) / BITS_PER_EVENT;300 const uint32_t eventNum = (ctx.arg->rankSize + BITS_PER_EVENT - 1) / BITS_PER_EVENT;
300 ctx.events.resize(eventNum);301 ctx.events.resize(eventNum);
301- return CCU_SUCCESS;302+ return ccu_result::CCU_SUCCESS;
302}303}
303 304 
304// 前同步:本端 output 地址与 token 写入对端并置位对端 notify,305// 前同步:本端 output 地址与 token 写入对端并置位对端 notify,
@@ -335,7 +336,7 @@ static void PostSync(AllGatherMesh1DMem2MemContext& ctx)
335// 提交跨 rank 写任务:把本 rank 分片异步写入其余 rank,mask 位标记搬运完成后置位的 event 标志;336// 提交跨 rank 写任务:把本 rank 分片异步写入其余 rank,mask 位标记搬运完成后置位的 event 标志;
336// 本 rank 位用 event_record 补齐(本地拷贝分支不会自动置位)337// 本 rank 位用 event_record 补齐(本地拷贝分支不会自动置位)
337 338 
338-static CcuResult DoAllGatherWrite(339+static ccu_result DoAllGatherWrite(
339 AllGatherMesh1DMem2MemContext& ctx, const ccu::local_addr& src_, const std::vector<ccu::remote_addr>& dst_)340 AllGatherMesh1DMem2MemContext& ctx, const ccu::local_addr& src_, const std::vector<ccu::remote_addr>& dst_)
340{341{
341 uint32_t channelIdx = 0;342 uint32_t channelIdx = 0;
@@ -349,12 +350,12 @@ static CcuResult DoAllGatherWrite(
349 ccu::write(ctx.arg->channels[channelIdx], dst_[rankIdx], src_, ctx.chunkSize, ctx.events[eventIdx], rankMask);350 ccu::write(ctx.arg->channels[channelIdx], dst_[rankIdx], src_, ctx.chunkSize, ctx.events[eventIdx], rankMask);
350 channelIdx++;351 channelIdx++;
351 }352 }
352- return CCU_SUCCESS;353+ return ccu_result::CCU_SUCCESS;
353}354}
354 355 
355// 等待所有搬运分支完成:逐个 event 等待其覆盖的 rank 位全部置位356// 等待所有搬运分支完成:逐个 event 等待其覆盖的 rank 位全部置位
356 357 
357-static CcuResult DoAllGatherWait(AllGatherMesh1DMem2MemContext& ctx)358+static ccu_result DoAllGatherWait(AllGatherMesh1DMem2MemContext& ctx)
358{359{
359 const uint32_t eventNum = static_cast<uint32_t>(ctx.events.size());360 const uint32_t eventNum = static_cast<uint32_t>(ctx.events.size());
360 for (uint32_t eventIdx = 0; eventIdx < eventNum; eventIdx++) {361 for (uint32_t eventIdx = 0; eventIdx < eventNum; eventIdx++) {
@@ -364,12 +365,12 @@ static CcuResult DoAllGatherWait(AllGatherMesh1DMem2MemContext& ctx)
364 static_cast<uint16_t>((1U << bitCount) - 1);365 static_cast<uint16_t>((1U << bitCount) - 1);
365 ccu::event_wait(ctx.events[eventIdx], eventMask);366 ccu::event_wait(ctx.events[eventIdx], eventMask);
366 }367 }
367- return CCU_SUCCESS;368+ return ccu_result::CCU_SUCCESS;
368}369}
369 370 
370// AllGather 执行:组装源/目的地址后,先向其余 rank 写本 rank 分片,再做本 rank 分片的本地拷贝,最后统一等待371// AllGather 执行:组装源/目的地址后,先向其余 rank 写本 rank 分片,再做本 rank 分片的本地拷贝,最后统一等待
371 372 
372-static CcuResult DoAllGather(AllGatherMesh1DMem2MemContext& ctx)373+static ccu_result DoAllGather(AllGatherMesh1DMem2MemContext& ctx)
373{374{
374 // 源地址:本 rank 输入缓冲中偏移 rankId 个 stride 的位置(本 rank 要发送的分片)375 // 源地址:本 rank 输入缓冲中偏移 rankId 个 stride 的位置(本 rank 要发送的分片)
375 ccu::local_addr src_;376 ccu::local_addr src_;
@@ -403,7 +404,7 @@ static CcuResult DoAllGather(AllGatherMesh1DMem2MemContext& ctx)
403 DoAllGatherWrite(ctx, src_, dst_);404 DoAllGatherWrite(ctx, src_, dst_);
404 GroupCopy(ctx, localDst, src_, ctx.goSize);405 GroupCopy(ctx, localDst, src_, ctx.goSize);
405 DoAllGatherWait(ctx);406 DoAllGatherWait(ctx);
406- return CCU_SUCCESS;407+ return ccu_result::CCU_SUCCESS;
407}408}
408 409 
409// Host 侧 CCU Kernel:通过 SQE 下发 CCU 编排指令。410// Host 侧 CCU Kernel:通过 SQE 下发 CCU 编排指令。
@@ -29,14 +29,18 @@
29#include <vector>29#include <vector>
30 30 
31#include <hccl/hccl_rank_graph.h>31#include <hccl/hccl_rank_graph.h>
32+#include <hccl/hccl_res.h>
33+#include <hcomm/hcomm_primitives.h>
32#include <ccu_res.h>34#include <ccu_res.h>
33-#include <ccu/ccu_host_launch.h>35+#include <ccu/asc_ccu.h>
34 36 
35#include "../../../common/ccu_instance.h"37#include "../../../common/ccu_instance.h"
36#include "ccu_allgather_mesh1d_kernel.h"38#include "ccu_allgather_mesh1d_kernel.h"
37 39 
38using namespace ops_comm_ag;40using namespace ops_comm_ag;
39 41 
42+namespace ccu = ::asc::ccu;
43+ 
40// 各 rank 先把本 rank 的 slice 写入所有对端,再做一次本地拷贝,最后统一同步收尾。44// 各 rank 先把本 rank 的 slice 写入所有对端,再做一次本地拷贝,最后统一同步收尾。
41namespace CcuAgMem2mem {45namespace CcuAgMem2mem {
42 46 
@@ -61,7 +61,6 @@ target_link_options(ccu_allgather_nhr1d_mem2mem PRIVATE
61 -Wl,-z,noexecstack61 -Wl,-z,noexecstack
62)62)
63target_link_directories(ccu_allgather_nhr1d_mem2mem PRIVATE63target_link_directories(ccu_allgather_nhr1d_mem2mem PRIVATE
64- ${ASCEND_CANN_PACKAGE_PATH}/asc/lib64
65 ${ASCEND_CANN_PACKAGE_PATH}/lib6464 ${ASCEND_CANN_PACKAGE_PATH}/lib64
66)65)
67target_link_libraries(ccu_allgather_nhr1d_mem2mem PRIVATE66target_link_libraries(ccu_allgather_nhr1d_mem2mem PRIVATE
@@ -18,9 +18,10 @@
18#include <vector>18#include <vector>
19 19 
20#include <hccl/hccl_res.h>20#include <hccl/hccl_res.h>
21-#include <ccu/hcomm/ccu_primitives.hpp>21+#include <ccu/ccu_api/ccu_types.h>
22+#include <ccu/ccu_api/ccu_primitives.h>
22 23 
23-namespace ccu = ::AscendC::ccu;24+namespace ccu = ::asc::ccu;
24 25 
25namespace ops_comm_ag {26namespace ops_comm_ag {
26constexpr uint32_t CCU_MAX_RANK_SIZE = 16;27constexpr uint32_t CCU_MAX_RANK_SIZE = 16;
@@ -210,7 +211,7 @@ static void InitGroupCopyResources(
210// 按 CalGoSize 的切分结果组织本地拷贝:addr_offset 非 0 时先整体循环搬运已切分的部分,211// 按 CalGoSize 的切分结果组织本地拷贝:addr_offset 非 0 时先整体循环搬运已切分的部分,
211// parallel_param 非 0 时再单独搬运尾块(尾分片 + 尾残余),两部分经 CcuBuffer 中转。212// parallel_param 非 0 时再单独搬运尾块(尾分片 + 尾残余),两部分经 CcuBuffer 中转。
212 213 
213-static CcuResult GroupCopy(214+static ccu_result GroupCopy(
214 AllGatherNhr1DMem2MemContext& ctx, ccu::local_addr dst_, ccu::local_addr src_, GroupOpSizeVars goSize)215 AllGatherNhr1DMem2MemContext& ctx, ccu::local_addr dst_, ccu::local_addr src_, GroupOpSizeVars goSize)
215{216{
216 ccu::local_addr loopSrc[2];217 ccu::local_addr loopSrc[2];
@@ -281,16 +282,16 @@ static CcuResult GroupCopy(
281 // 构造 loop_group 即完成提交:LoopGroup 按偏移复制出多份 Loop 并发执行,无独立的提交调用282 // 构造 loop_group 即完成提交:LoopGroup 按偏移复制出多份 Loop 并发执行,无独立的提交调用
282 ccu::loop_group group(goSize.parallel_param, offsetCfg, ctx.moConfig.loop_count, grpLoops);283 ccu::loop_group group(goSize.parallel_param, offsetCfg, ctx.moConfig.loop_count, grpLoops);
283 }284 }
284- return CcuResult::CCU_SUCCESS;285+ return ccu_result::CCU_SUCCESS;
285}286}
286 287 
287// Kernel 内资源准备:按 rank→Channel 映射把各对端的 output 地址与 token 绑定到对应 Variable 单元288// Kernel 内资源准备:按 rank→Channel 映射把各对端的 output 地址与 token 绑定到对应 Variable 单元
288 289 
289-static CcuResult InitResource(AllGatherNhr1DMem2MemContext& ctx)290+static ccu_result InitResource(AllGatherNhr1DMem2MemContext& ctx)
290{291{
291 if (ctx.arg->rankSize < 2 || ctx.arg->rankId >= ctx.arg->rankSize ||292 if (ctx.arg->rankSize < 2 || ctx.arg->rankId >= ctx.arg->rankSize ||
292 ctx.arg->channelCount != ctx.arg->rank2ChannelIdx.size()) {293 ctx.arg->channelCount != ctx.arg->rank2ChannelIdx.size()) {
293- return CcuResult::CCU_E_PARA;294+ return ccu_result::CCU_E_PARA;
294 }295 }
295 296 
296 ctx.output.resize(ctx.arg->rankSize);297 ctx.output.resize(ctx.arg->rankSize);
@@ -299,12 +300,12 @@ static CcuResult InitResource(AllGatherNhr1DMem2MemContext& ctx)
299 const uint32_t peerRank = rankAndChannel.first;300 const uint32_t peerRank = rankAndChannel.first;
300 const uint32_t channelIdx = rankAndChannel.second;301 const uint32_t channelIdx = rankAndChannel.second;
301 if (peerRank >= ctx.arg->rankSize || channelIdx >= ctx.arg->channelCount) {302 if (peerRank >= ctx.arg->rankSize || channelIdx >= ctx.arg->channelCount) {
302- return CcuResult::CCU_E_PARA;303+ return ccu_result::CCU_E_PARA;
303 }304 }
304 ctx.output[peerRank] = ccu::get_res_by_channel<ccu::variable>(ctx.arg->channels[channelIdx], OUTPUT_XN_ID);305 ctx.output[peerRank] = ccu::get_res_by_channel<ccu::variable>(ctx.arg->channels[channelIdx], OUTPUT_XN_ID);
305 ctx.token[peerRank] = ccu::get_res_by_channel<ccu::variable>(ctx.arg->channels[channelIdx], TOKEN_XN_ID);306 ctx.token[peerRank] = ccu::get_res_by_channel<ccu::variable>(ctx.arg->channels[channelIdx], TOKEN_XN_ID);
306 }307 }
307- return CcuResult::CCU_SUCCESS;308+ return ccu_result::CCU_SUCCESS;
308}309}
309 310 
310// 前同步:本端 output 地址与 token 写入对端并置位对端 notify,311// 前同步:本端 output 地址与 token 写入对端并置位对端 notify,
@@ -340,7 +341,7 @@ static void PostSync(AllGatherNhr1DMem2MemContext& ctx)
340 341 
341// 把本 rank 的 slice 就地拷贝到输出缓冲中本 rank 的区段342// 把本 rank 的 slice 就地拷贝到输出缓冲中本 rank 的区段
342 343 
343-static CcuResult CopyLocalSlice(AllGatherNhr1DMem2MemContext& ctx)344+static ccu_result CopyLocalSlice(AllGatherNhr1DMem2MemContext& ctx)
344{345{
345 // 源地址:本 rank 输入缓冲中偏移 rankId 个 stride 的位置346 // 源地址:本 rank 输入缓冲中偏移 rankId 个 stride 的位置
346 ccu::local_addr src_;347 ccu::local_addr src_;
@@ -363,12 +364,12 @@ static CcuResult CopyLocalSlice(AllGatherNhr1DMem2MemContext& ctx)
363// 执行单个 NHR step:把本步负责的 slice 逐片写入 toRank,写后即等待完成;364// 执行单个 NHR step:把本步负责的 slice 逐片写入 toRank,写后即等待完成;
364// 非末尾 step 还要与 fromRank 做一次对端同步,确保下一步转发的数据已写入本地输出。365// 非末尾 step 还要与 fromRank 做一次对端同步,确保下一步转发的数据已写入本地输出。
365 366 
366-static CcuResult RunNhrStep(AllGatherNhr1DMem2MemContext& ctx, const NhrStepInfo& stepInfo, bool isLastStep)367+static ccu_result RunNhrStep(AllGatherNhr1DMem2MemContext& ctx, const NhrStepInfo& stepInfo, bool isLastStep)
367{368{
368 const auto sendIt = ctx.arg->rank2ChannelIdx.find(stepInfo.toRank);369 const auto sendIt = ctx.arg->rank2ChannelIdx.find(stepInfo.toRank);
369 const auto recvIt = ctx.arg->rank2ChannelIdx.find(stepInfo.fromRank);370 const auto recvIt = ctx.arg->rank2ChannelIdx.find(stepInfo.fromRank);
370 if (sendIt == ctx.arg->rank2ChannelIdx.end() || recvIt == ctx.arg->rank2ChannelIdx.end()) {371 if (sendIt == ctx.arg->rank2ChannelIdx.end() || recvIt == ctx.arg->rank2ChannelIdx.end()) {
371- return CcuResult::CCU_E_NOT_FOUND;372+ return ccu_result::CCU_E_NOT_FOUND;
372 }373 }
373 374 
374 const uint32_t sendChannelIdx = sendIt->second;375 const uint32_t sendChannelIdx = sendIt->second;
@@ -409,19 +410,19 @@ static CcuResult RunNhrStep(AllGatherNhr1DMem2MemContext& ctx, const NhrStepInfo
409 ccu::notify_record(sendChannel, CKE_IDX_0, 1U << STEP_POST_SYNC_ID);410 ccu::notify_record(sendChannel, CKE_IDX_0, 1U << STEP_POST_SYNC_ID);
410 ccu::notify_wait(recvChannel, CKE_IDX_0, 1U << STEP_POST_SYNC_ID);411 ccu::notify_wait(recvChannel, CKE_IDX_0, 1U << STEP_POST_SYNC_ID);
411 }412 }
412- return CcuResult::CCU_SUCCESS;413+ return ccu_result::CCU_SUCCESS;
413}414}
414 415 
415// AllGather 执行:先做本 rank slice 的本地落位,再按 NHR 调度逐步向对端转发 slice416// AllGather 执行:先做本 rank slice 的本地落位,再按 NHR 调度逐步向对端转发 slice
416 417 
417-static CcuResult DoAllGather(AllGatherNhr1DMem2MemContext& ctx)418+static ccu_result DoAllGather(AllGatherNhr1DMem2MemContext& ctx)
418{419{
419 CopyLocalSlice(ctx);420 CopyLocalSlice(ctx);
420 for (uint32_t stepIdx = 0; stepIdx < ctx.arg->stepInfoVector.size(); stepIdx++) {421 for (uint32_t stepIdx = 0; stepIdx < ctx.arg->stepInfoVector.size(); stepIdx++) {
421 const bool isLastStep = (stepIdx + 1 == ctx.arg->stepInfoVector.size());422 const bool isLastStep = (stepIdx + 1 == ctx.arg->stepInfoVector.size());
422 RunNhrStep(ctx, ctx.arg->stepInfoVector[stepIdx], isLastStep);423 RunNhrStep(ctx, ctx.arg->stepInfoVector[stepIdx], isLastStep);
423 }424 }
424- return CcuResult::CCU_SUCCESS;425+ return ccu_result::CCU_SUCCESS;
425}426}
426 427 
427// Host 侧 CCU Kernel:通过 SQE 下发 AllGather NHR 编排指令。428// Host 侧 CCU Kernel:通过 SQE 下发 AllGather NHR 编排指令。
@@ -30,13 +30,17 @@
30#include <vector>30#include <vector>
31 31 
32#include <hccl/hccl_rank_graph.h>32#include <hccl/hccl_rank_graph.h>
33+#include <hccl/hccl_res.h>
34+#include <hcomm/hcomm_primitives.h>
33#include <ccu_res.h>35#include <ccu_res.h>
34-#include <ccu/ccu_host_launch.h>36+#include <ccu/asc_ccu.h>
35 37 
36#include "../../../common/ccu_instance.h"38#include "../../../common/ccu_instance.h"
37#include "ccu_allgather_nhr1d_kernel.h"39#include "ccu_allgather_nhr1d_kernel.h"
38 40 
39using namespace ops_comm_ag;41using namespace ops_comm_ag;
42+ 
43+namespace ccu = ::asc::ccu;
40// 按 NHR 的 log2(rankSize) 步逐步向对端转发 slice,每步之间做对端同步。44// 按 NHR 的 log2(rankSize) 步逐步向对端转发 slice,每步之间做对端同步。
41namespace CcuAgNhr1dMem2mem {45namespace CcuAgNhr1dMem2mem {
42 46 
@@ -67,7 +67,6 @@ target_link_options(ccu_allreduce PRIVATE
67 -Wl,-z,noexecstack67 -Wl,-z,noexecstack
68)68)
69target_link_directories(ccu_allreduce PRIVATE69target_link_directories(ccu_allreduce PRIVATE
70- ${ASCEND_CANN_PACKAGE_PATH}/asc/lib64
71 ${ASCEND_CANN_PACKAGE_PATH}/lib6470 ${ASCEND_CANN_PACKAGE_PATH}/lib64
72)71)
73target_link_libraries(ccu_allreduce PRIVATE72target_link_libraries(ccu_allreduce PRIVATE
@@ -18,9 +18,10 @@
18#include <vector>18#include <vector>
19 19 
20#include <hccl/hccl_res.h>20#include <hccl/hccl_res.h>
21-#include <ccu/hcomm/ccu_primitives.hpp>21+#include <ccu/ccu_api/ccu_types.h>
22+#include <ccu/ccu_api/ccu_primitives.h>
22 23 
23-namespace ccu = ::AscendC::ccu;24+namespace ccu = ::asc::ccu;
24 25 
25namespace ops_comm_ag {26namespace ops_comm_ag {
26// CCU 本地拷贝与调度的规模常量:最大 rank 数、Channel notify 槽位数、Die 数等27// CCU 本地拷贝与调度的规模常量:最大 rank 数、Channel notify 槽位数、Die 数等
@@ -73,7 +74,7 @@ constexpr int REMOTE_INPUT_XN_MASK_BIT = 5;
73constexpr int REMOTE_INPUT_TOKEN_MASK_BIT = 6;74constexpr int REMOTE_INPUT_TOKEN_MASK_BIT = 6;
74 75 
75// 把本 rank 输入先拷入本端输出,再 write_reduce 到各对端输出并等待完成76// 把本 rank 输入先拷入本端输出,再 write_reduce 到各对端输出并等待完成
76-static CcuResult ExecuteAllReduceTransfer(AllReduceMesh1DMem2MemContext& ctx)77+static ccu_result ExecuteAllReduceTransfer(AllReduceMesh1DMem2MemContext& ctx)
77{78{
78 ccu::local_addr src_;79 ccu::local_addr src_;
79 ccu::local_addr localDst;80 ccu::local_addr localDst;
@@ -122,13 +123,13 @@ static CcuResult ExecuteAllReduceTransfer(AllReduceMesh1DMem2MemContext& ctx)
122 ccu::event_wait(ctx.event, remoteMask);123 ccu::event_wait(ctx.event, remoteMask);
123 }124 }
124 125 
125- return CcuResult::CCU_SUCCESS;126+ return ccu_result::CCU_SUCCESS;
126}127}
127 128 
128// SC2 前同步:仅交换本端输入地址与 token(gather 需要读取对端输入;129// SC2 前同步:仅交换本端输入地址与 token(gather 需要读取对端输入;
129// SC2 无远端写,不交换 output 地址),并等待所有对端完成登记130// SC2 无远端写,不交换 output 地址),并等待所有对端完成登记
130 131 
131-static CcuResult ExchangeRemoteInput(AllReduceMesh1DMem2MemContext& ctx)132+static ccu_result ExchangeRemoteInput(AllReduceMesh1DMem2MemContext& ctx)
132{133{
133 for (uint32_t i = 0; i < ctx.arg->channelCount; i++) {134 for (uint32_t i = 0; i < ctx.arg->channelCount; i++) {
134 ccu::write_variable_with_notify(135 ccu::write_variable_with_notify(
@@ -142,7 +143,7 @@ static CcuResult ExchangeRemoteInput(AllReduceMesh1DMem2MemContext& ctx)
142 for (uint32_t i = 0; i < ctx.arg->channelCount; i++) {143 for (uint32_t i = 0; i < ctx.arg->channelCount; i++) {
143 ccu::notify_wait(ctx.arg->channels[i], CKE_IDX_0, allBits);144 ccu::notify_wait(ctx.arg->channels[i], CKE_IDX_0, allBits);
144 }145 }
145- return CcuResult::CCU_SUCCESS;146+ return ccu_result::CCU_SUCCESS;
146}147}
147 148 
148// SC2:gather + local_reduce,独立的"聚合-归约"AllReduce 实现路径(与场景1 的149// SC2:gather + local_reduce,独立的"聚合-归约"AllReduce 实现路径(与场景1 的
@@ -153,11 +154,11 @@ static CcuResult ExchangeRemoteInput(AllReduceMesh1DMem2MemContext& ctx)
153// 4. bufs[0] 拷回本端 output。154// 4. bufs[0] 拷回本端 output。
154// 约束:ccu_buffer 归约重载支持 2~8 路,单片缓存 4096 字节155// 约束:ccu_buffer 归约重载支持 2~8 路,单片缓存 4096 字节
155 156 
156-static CcuResult ExecuteGatherLocalReduce(AllReduceMesh1DMem2MemContext& ctx)157+static ccu_result ExecuteGatherLocalReduce(AllReduceMesh1DMem2MemContext& ctx)
157{158{
158 const uint64_t rankSize = ctx.arg->rankSize;159 const uint64_t rankSize = ctx.arg->rankSize;
159 if (rankSize < 2U || rankSize > 8U) {160 if (rankSize < 2U || rankSize > 8U) {
160- return CcuResult::CCU_E_NOT_SUPPORT;161+ return ccu_result::CCU_E_NOT_SUPPORT;
161 }162 }
162 163 
163 ccu::array<ccu::ccu_buffer> bufs(static_cast<uint32_t>(rankSize));164 ccu::array<ccu::ccu_buffer> bufs(static_cast<uint32_t>(rankSize));
@@ -197,7 +198,7 @@ static CcuResult ExecuteGatherLocalReduce(AllReduceMesh1DMem2MemContext& ctx)
197 ccu::local_copy(dst, bufs[0], ctx.sliceSize, ctx.event, 1U);198 ccu::local_copy(dst, bufs[0], ctx.sliceSize, ctx.event, 1U);
198 ccu::event_wait(ctx.event, 1U);199 ccu::event_wait(ctx.event, 1U);
199 200 
200- return CcuResult::CCU_SUCCESS;201+ return ccu_result::CCU_SUCCESS;
201}202}
202 203 
203__ccu_host__ void CcuAllReduceMesh1DMem2MemKernel(204__ccu_host__ void CcuAllReduceMesh1DMem2MemKernel(
@@ -20,13 +20,15 @@
20#include <hccl/hccl_types.h>20#include <hccl/hccl_types.h>
21#include <hccl/hccl_rank_graph.h>21#include <hccl/hccl_rank_graph.h>
22 22 
23+#include <hcomm/hcomm_primitives.h>
23#include <ccu_res.h>24#include <ccu_res.h>
24-#include <ccu/ccu_host_launch.h>25+#include <ccu/asc_ccu.h>
25 26 
26#include "../../../common/ccu_instance.h"27#include "../../../common/ccu_instance.h"
27#include "ccu_allreduce_kernel.h"28#include "ccu_allreduce_kernel.h"
28 29 
29using namespace ops_comm_ag;30using namespace ops_comm_ag;
31+namespace ccu = ::asc::ccu;
30 32 
31#ifdef ACLCHECK33#ifdef ACLCHECK
32#undef ACLCHECK34#undef ACLCHECK
@@ -61,7 +61,6 @@ target_link_options(ccu_all_to_all PRIVATE
61 -Wl,-z,noexecstack61 -Wl,-z,noexecstack
62)62)
63target_link_directories(ccu_all_to_all PRIVATE63target_link_directories(ccu_all_to_all PRIVATE
64- ${ASCEND_CANN_PACKAGE_PATH}/asc/lib64
65 ${ASCEND_CANN_PACKAGE_PATH}/lib6464 ${ASCEND_CANN_PACKAGE_PATH}/lib64
66)65)
67target_link_libraries(ccu_all_to_all PRIVATE66target_link_libraries(ccu_all_to_all PRIVATE
@@ -18,9 +18,10 @@
18#include <vector>18#include <vector>
19 19 
20#include <hccl/hccl_res.h>20#include <hccl/hccl_res.h>
21-#include <ccu/hcomm/ccu_primitives.hpp>21+#include <ccu/ccu_api/ccu_types.h>
22+#include <ccu/ccu_api/ccu_primitives.h>
22 23 
23-namespace ccu = ::AscendC::ccu;24+namespace ccu = ::asc::ccu;
24 25 
25namespace ops_comm_ag {26namespace ops_comm_ag {
26// CCU 本地拷贝与调度的规模常量:最大 rank 数、Channel notify 槽位数、Die 数等27// CCU 本地拷贝与调度的规模常量:最大 rank 数、Channel notify 槽位数、Die 数等
@@ -177,7 +178,7 @@ static void InitGroupCopyResources(
177 178 
178// 按切分参数执行本地拷贝。179// 按切分参数执行本地拷贝。
179 180 
180-static CcuResult GroupCopy(181+static ccu_result GroupCopy(
181 AllToAllMesh1DMem2MemContext& ctx, ccu::local_addr dst_, ccu::local_addr src_, GroupOpSizeVars goSize)182 AllToAllMesh1DMem2MemContext& ctx, ccu::local_addr dst_, ccu::local_addr src_, GroupOpSizeVars goSize)
182{183{
183 ccu::local_addr loopSrc[2];184 ccu::local_addr loopSrc[2];
@@ -241,13 +242,13 @@ static CcuResult GroupCopy(
241 std::vector<ccu::loop> grpLoops{*loops.loops[0], *loops.loops[1]};242 std::vector<ccu::loop> grpLoops{*loops.loops[0], *loops.loops[1]};
242 ccu::loop_group group(goSize.parallel_param, offsetCfg, 2, grpLoops);243 ccu::loop_group group(goSize.parallel_param, offsetCfg, 2, grpLoops);
243 }244 }
244- return CCU_SUCCESS;245+ return ccu_result::CCU_SUCCESS;
245}246}
246 247 
247// 按 rank 拆分地址:本 rank 段写入本端输出,其余 rank 段写入各自远端输出;248// 按 rank 拆分地址:本 rank 段写入本端输出,其余 rank 段写入各自远端输出;
248// 再将本 rank 数据写入其余 rank,并用本地拷贝补全本端段,最后等所有 rank 完成。249// 再将本 rank 数据写入其余 rank,并用本地拷贝补全本端段,最后等所有 rank 完成。
249 250 
250-static CcuResult ExecuteAllToAllTransfer(AllToAllMesh1DMem2MemContext& ctx)251+static ccu_result ExecuteAllToAllTransfer(AllToAllMesh1DMem2MemContext& ctx)
251{252{
252 ccu::local_addr localSrc;253 ccu::local_addr localSrc;
253 ccu::local_addr localDst;254 ccu::local_addr localDst;
@@ -305,7 +306,7 @@ static CcuResult ExecuteAllToAllTransfer(AllToAllMesh1DMem2MemContext& ctx)
305 // 等所有 rank 位均置位,AllToAll 才算完成306 // 等所有 rank 位均置位,AllToAll 才算完成
306 ccu::event_wait(ctx.event, totalMask);307 ccu::event_wait(ctx.event, totalMask);
307 }308 }
308- return CcuResult::CCU_SUCCESS;309+ return ccu_result::CCU_SUCCESS;
309}310}
310 311 
311// Host 侧 CCU Kernel:通过 SQE 下发 CCU 编排指令。312// Host 侧 CCU Kernel:通过 SQE 下发 CCU 编排指令。
@@ -21,13 +21,15 @@
21#include <hccl/hccl_types.h>21#include <hccl/hccl_types.h>
22#include <hccl/hccl_rank_graph.h>22#include <hccl/hccl_rank_graph.h>
23 23 
24+#include <hcomm/hcomm_primitives.h>
24#include <ccu_res.h>25#include <ccu_res.h>
25-#include <ccu/ccu_host_launch.h>26+#include <ccu/asc_ccu.h>
26 27 
27#include "../../../common/ccu_instance.h"28#include "../../../common/ccu_instance.h"
28#include "ccu_all_to_all_kernel.h"29#include "ccu_all_to_all_kernel.h"
29 30 
30using namespace ops_comm_ag;31using namespace ops_comm_ag;
32+namespace ccu = ::asc::ccu;
31 33 
32#ifdef ACLCHECK34#ifdef ACLCHECK
33#undef ACLCHECK35#undef ACLCHECK
@@ -61,7 +61,6 @@ target_link_options(ccu_all_to_allv PRIVATE
61 -Wl,-z,noexecstack61 -Wl,-z,noexecstack
62)62)
63target_link_directories(ccu_all_to_allv PRIVATE63target_link_directories(ccu_all_to_allv PRIVATE
64- ${ASCEND_CANN_PACKAGE_PATH}/asc/lib64
65 ${ASCEND_CANN_PACKAGE_PATH}/lib6464 ${ASCEND_CANN_PACKAGE_PATH}/lib64
66)65)
67target_link_libraries(ccu_all_to_allv PRIVATE66target_link_libraries(ccu_all_to_allv PRIVATE
@@ -18,9 +18,10 @@
18#include <vector>18#include <vector>
19 19 
20#include <hccl/hccl_res.h>20#include <hccl/hccl_res.h>
21-#include <ccu/hcomm/ccu_primitives.hpp>21+#include <ccu/ccu_api/ccu_types.h>
22+#include <ccu/ccu_api/ccu_primitives.h>
22 23 
23-namespace ccu = ::AscendC::ccu;24+namespace ccu = ::asc::ccu;
24 25 
25namespace ops_comm_ag {26namespace ops_comm_ag {
26// 规模上限与每链路 notify 数;最大单次传输 256MB,超出即拒绝27// 规模上限与每链路 notify 数;最大单次传输 256MB,超出即拒绝
@@ -76,7 +77,7 @@ static constexpr int CKE_IDX_0 = 0;
76static constexpr int POST_SYNC_ID = 3;77static constexpr int POST_SYNC_ID = 3;
77 78 
78// 把上下文中的常量(收发地址、token、各 rank 收发偏移)登记为 Kernel 可读的 CCU Variable79// 把上下文中的常量(收发地址、token、各 rank 收发偏移)登记为 Kernel 可读的 CCU Variable
79-static CcuResult InitVariables(AllToAllVMesh1DContext& ctx)80+static ccu_result InitVariables(AllToAllVMesh1DContext& ctx)
80{81{
81 ctx.input = ctx.arg->inputAddr;82 ctx.input = ctx.arg->inputAddr;
82 ctx.localOutput = ctx.arg->outputAddr;83 ctx.localOutput = ctx.arg->outputAddr;
@@ -88,13 +89,13 @@ static CcuResult InitVariables(AllToAllVMesh1DContext& ctx)
88 ctx.sendOffsets[rankIdx] = ctx.arg->sendOffsets[rankIdx];89 ctx.sendOffsets[rankIdx] = ctx.arg->sendOffsets[rankIdx];
89 ctx.recvOffsets[rankIdx] = ctx.arg->recvOffsets[rankIdx];90 ctx.recvOffsets[rankIdx] = ctx.arg->recvOffsets[rankIdx];
90 }91 }
91- return CCU_SUCCESS;92+ return ccu_result::CCU_SUCCESS;
92}93}
93 94 
94// 与所有对端互换接收区地址与 token:把本端对应接收偏移处的地址告知对端,95// 与所有对端互换接收区地址与 token:把本端对应接收偏移处的地址告知对端,
95// 再等所有对端把它们的地址写回,为后续直接 write 到对端接收区做准备96// 再等所有对端把它们的地址写回,为后续直接 write 到对端接收区做准备
96 97 
97-static CcuResult ExchangeOutput(AllToAllVMesh1DContext& ctx)98+static ccu_result ExchangeOutput(AllToAllVMesh1DContext& ctx)
98{99{
99 uint32_t channelId = 0;100 uint32_t channelId = 0;
100 for (uint32_t peerId = 0; peerId < ctx.arg->rankSize; peerId++) {101 for (uint32_t peerId = 0; peerId < ctx.arg->rankSize; peerId++) {
@@ -116,13 +117,13 @@ static CcuResult ExchangeOutput(AllToAllVMesh1DContext& ctx)
116 for (uint32_t i = 0; i < ctx.arg->channelCount; i++) {117 for (uint32_t i = 0; i < ctx.arg->channelCount; i++) {
117 ccu::notify_wait(ctx.arg->channels[i], CKE_IDX_0, allBits);118 ccu::notify_wait(ctx.arg->channels[i], CKE_IDX_0, allBits);
118 }119 }
119- return CCU_SUCCESS;120+ return ccu_result::CCU_SUCCESS;
120}121}
121 122 
122// 逐目的 rank 搬运发送数据:本 rank 的数据走本地拷贝,其余走跨 rank write;123// 逐目的 rank 搬运发送数据:本 rank 的数据走本地拷贝,其余走跨 rank write;
123// 每段各记一个事件位,最后按全量掩码等待所有搬运完成124// 每段各记一个事件位,最后按全量掩码等待所有搬运完成
124 125 
125-static CcuResult ExecuteTransfer(AllToAllVMesh1DContext& ctx)126+static ccu_result ExecuteTransfer(AllToAllVMesh1DContext& ctx)
126{127{
127 uint32_t channelId = 0;128 uint32_t channelId = 0;
128 for (uint32_t rankIdx = 0; rankIdx < ctx.arg->rankSize; rankIdx++) {129 for (uint32_t rankIdx = 0; rankIdx < ctx.arg->rankSize; rankIdx++) {
@@ -156,7 +157,7 @@ static CcuResult ExecuteTransfer(AllToAllVMesh1DContext& ctx)
156 157 
157 const uint16_t allRanksMask = (1U << ctx.arg->rankSize) - 1;158 const uint16_t allRanksMask = (1U << ctx.arg->rankSize) - 1;
158 ccu::event_wait(ctx.event, allRanksMask);159 ccu::event_wait(ctx.event, allRanksMask);
159- return CCU_SUCCESS;160+ return ccu_result::CCU_SUCCESS;
160}161}
161 162 
162// Host 侧 CCU Kernel:通过 SQE 下发 CCU 编排指令。163// Host 侧 CCU Kernel:通过 SQE 下发 CCU 编排指令。
@@ -20,13 +20,15 @@
20#include <hccl/hccl_comm.h>20#include <hccl/hccl_comm.h>
21#include <hccl/hccl_rank_graph.h>21#include <hccl/hccl_rank_graph.h>
22 22 
23+#include <hcomm/hcomm_primitives.h>
23#include <ccu_res.h>24#include <ccu_res.h>
24-#include <ccu/ccu_host_launch.h>25+#include <ccu/asc_ccu.h>
25 26 
26#include "../../../common/ccu_instance.h"27#include "../../../common/ccu_instance.h"
27#include "ccu_all_to_allv_kernel.h"28#include "ccu_all_to_allv_kernel.h"
28 29 
29using namespace ops_comm_ag;30using namespace ops_comm_ag;
31+namespace ccu = ::asc::ccu;
30 32 
31#ifdef ACLCHECK33#ifdef ACLCHECK
32#undef ACLCHECK34#undef ACLCHECK
@@ -61,7 +61,6 @@ target_link_options(ccu_all_to_all_vc PRIVATE
61 -Wl,-z,noexecstack61 -Wl,-z,noexecstack
62)62)
63target_link_directories(ccu_all_to_all_vc PRIVATE63target_link_directories(ccu_all_to_all_vc PRIVATE
64- ${ASCEND_CANN_PACKAGE_PATH}/asc/lib64
65 ${ASCEND_CANN_PACKAGE_PATH}/lib6464 ${ASCEND_CANN_PACKAGE_PATH}/lib64
66)65)
67target_link_libraries(ccu_all_to_all_vc PRIVATE66target_link_libraries(ccu_all_to_all_vc PRIVATE
@@ -18,9 +18,10 @@
18#include <vector>18#include <vector>
19 19 
20#include <hccl/hccl_res.h>20#include <hccl/hccl_res.h>
21-#include <ccu/hcomm/ccu_primitives.hpp>21+#include <ccu/ccu_api/ccu_types.h>
22+#include <ccu/ccu_api/ccu_primitives.h>
22 23 
23-namespace ccu = ::AscendC::ccu;24+namespace ccu = ::asc::ccu;
24 25 
25namespace ops_comm_ag {26namespace ops_comm_ag {
26// 规模上限与每链路 notify 数;最大单次传输 256MB,超出即拒绝27// 规模上限与每链路 notify 数;最大单次传输 256MB,超出即拒绝
@@ -76,7 +77,7 @@ static constexpr int CKE_IDX_0 = 0;
76static constexpr int POST_SYNC_ID = 3;77static constexpr int POST_SYNC_ID = 3;
77 78 
78// 把上下文中的常量(收发地址、token、各 rank 收发偏移)登记为 Kernel 可读的 CCU Variable79// 把上下文中的常量(收发地址、token、各 rank 收发偏移)登记为 Kernel 可读的 CCU Variable
79-static CcuResult InitVariables(AllToAllVCMesh1DContext& ctx)80+static ccu_result InitVariables(AllToAllVCMesh1DContext& ctx)
80{81{
81 ctx.input = ctx.arg->inputAddr;82 ctx.input = ctx.arg->inputAddr;
82 ctx.localOutput = ctx.arg->outputAddr;83 ctx.localOutput = ctx.arg->outputAddr;
@@ -88,13 +89,13 @@ static CcuResult InitVariables(AllToAllVCMesh1DContext& ctx)
88 ctx.sendOffsets[rankIdx] = ctx.arg->sendOffsets[rankIdx];89 ctx.sendOffsets[rankIdx] = ctx.arg->sendOffsets[rankIdx];
89 ctx.recvOffsets[rankIdx] = ctx.arg->recvOffsets[rankIdx];90 ctx.recvOffsets[rankIdx] = ctx.arg->recvOffsets[rankIdx];
90 }91 }
91- return CCU_SUCCESS;92+ return ccu_result::CCU_SUCCESS;
92}93}
93 94 
94// 与所有对端互换接收区地址与 token:把本端对应接收偏移处的地址告知对端,95// 与所有对端互换接收区地址与 token:把本端对应接收偏移处的地址告知对端,
95// 再等所有对端把它们的地址写回,为后续直接 write 到对端接收区做准备96// 再等所有对端把它们的地址写回,为后续直接 write 到对端接收区做准备
96 97 
97-static CcuResult ExchangeOutput(AllToAllVCMesh1DContext& ctx)98+static ccu_result ExchangeOutput(AllToAllVCMesh1DContext& ctx)
98{99{
99 uint32_t channelId = 0;100 uint32_t channelId = 0;
100 for (uint32_t peerId = 0; peerId < ctx.arg->rankSize; peerId++) {101 for (uint32_t peerId = 0; peerId < ctx.arg->rankSize; peerId++) {
@@ -116,13 +117,13 @@ static CcuResult ExchangeOutput(AllToAllVCMesh1DContext& ctx)
116 for (uint32_t i = 0; i < ctx.arg->channelCount; i++) {117 for (uint32_t i = 0; i < ctx.arg->channelCount; i++) {
117 ccu::notify_wait(ctx.arg->channels[i], CKE_IDX_0, allBits);118 ccu::notify_wait(ctx.arg->channels[i], CKE_IDX_0, allBits);
118 }119 }
119- return CCU_SUCCESS;120+ return ccu_result::CCU_SUCCESS;
120}121}
121 122 
122// 逐目的 rank 搬运发送数据:本 rank 的数据走本地拷贝,其余走跨 rank write;123// 逐目的 rank 搬运发送数据:本 rank 的数据走本地拷贝,其余走跨 rank write;
123// 每段各记一个事件位,最后按全量掩码等待所有搬运完成124// 每段各记一个事件位,最后按全量掩码等待所有搬运完成
124 125 
125-static CcuResult ExecuteTransfer(AllToAllVCMesh1DContext& ctx)126+static ccu_result ExecuteTransfer(AllToAllVCMesh1DContext& ctx)
126{127{
127 uint32_t channelId = 0;128 uint32_t channelId = 0;
128 for (uint32_t rankIdx = 0; rankIdx < ctx.arg->rankSize; rankIdx++) {129 for (uint32_t rankIdx = 0; rankIdx < ctx.arg->rankSize; rankIdx++) {
@@ -156,7 +157,7 @@ static CcuResult ExecuteTransfer(AllToAllVCMesh1DContext& ctx)
156 157 
157 const uint16_t allRanksMask = (1U << ctx.arg->rankSize) - 1;158 const uint16_t allRanksMask = (1U << ctx.arg->rankSize) - 1;
158 ccu::event_wait(ctx.event, allRanksMask);159 ccu::event_wait(ctx.event, allRanksMask);
159- return CCU_SUCCESS;160+ return ccu_result::CCU_SUCCESS;
160}161}
161 162 
162// Host 侧 CCU Kernel:通过 SQE 下发 CCU 编排指令。163// Host 侧 CCU Kernel:通过 SQE 下发 CCU 编排指令。
@@ -20,13 +20,15 @@
20#include <hccl/hccl_comm.h>20#include <hccl/hccl_comm.h>
21#include <hccl/hccl_rank_graph.h>21#include <hccl/hccl_rank_graph.h>
22 22 
23+#include <hcomm/hcomm_primitives.h>
23#include <ccu_res.h>24#include <ccu_res.h>
24-#include <ccu/ccu_host_launch.h>25+#include <ccu/asc_ccu.h>
25 26 
26#include "../../../common/ccu_instance.h"27#include "../../../common/ccu_instance.h"
27#include "ccu_all_to_all_vc_kernel.h"28#include "ccu_all_to_all_vc_kernel.h"
28 29 
29using namespace ops_comm_ag;30using namespace ops_comm_ag;
31+namespace ccu = ::asc::ccu;
30 32 
31#ifdef ACLCHECK33#ifdef ACLCHECK
32#undef ACLCHECK34#undef ACLCHECK
@@ -61,7 +61,6 @@ target_link_options(ccu_broadcast PRIVATE
61 -Wl,-z,noexecstack61 -Wl,-z,noexecstack
62)62)
63target_link_directories(ccu_broadcast PRIVATE63target_link_directories(ccu_broadcast PRIVATE
64- ${ASCEND_CANN_PACKAGE_PATH}/asc/lib64
65 ${ASCEND_CANN_PACKAGE_PATH}/lib6464 ${ASCEND_CANN_PACKAGE_PATH}/lib64
66)65)
67target_link_libraries(ccu_broadcast PRIVATE66target_link_libraries(ccu_broadcast PRIVATE
@@ -18,9 +18,10 @@
18#include <vector>18#include <vector>
19 19 
20#include <hccl/hccl_res.h>20#include <hccl/hccl_res.h>
21-#include <ccu/hcomm/ccu_primitives.hpp>21+#include <ccu/ccu_api/ccu_types.h>
22+#include <ccu/ccu_api/ccu_primitives.h>
22 23 
23-namespace ccu = ::AscendC::ccu;24+namespace ccu = ::asc::ccu;
24 25 
25namespace ops_comm_ag {26namespace ops_comm_ag {
26// 规模上限与每链路 notify 数27// 规模上限与每链路 notify 数
@@ -63,7 +64,7 @@ constexpr int POST_SYNC_ID = 3;
63constexpr uint64_t MAX_TRANSFER_BYTES = 256ULL * 1024 * 1024;64constexpr uint64_t MAX_TRANSFER_BYTES = 256ULL * 1024 * 1024;
64 65 
65// 与所有对端互换缓冲地址与 token:先把本端地址写给对端,再等对端写回66// 与所有对端互换缓冲地址与 token:先把本端地址写给对端,再等对端写回
66-static CcuResult ExchangeBuffers(BroadcastMesh1DContext& ctx)67+static ccu_result ExchangeBuffers(BroadcastMesh1DContext& ctx)
67{68{
68 for (uint32_t i = 0; i < ctx.arg->channelCount; i++) {69 for (uint32_t i = 0; i < ctx.arg->channelCount; i++) {
69 ccu::write_variable_with_notify(70 ccu::write_variable_with_notify(
@@ -76,15 +77,15 @@ static CcuResult ExchangeBuffers(BroadcastMesh1DContext& ctx)
76 for (uint32_t i = 0; i < ctx.arg->channelCount; i++) {77 for (uint32_t i = 0; i < ctx.arg->channelCount; i++) {
77 ccu::notify_wait(ctx.arg->channels[i], CKE_IDX_0, allBits);78 ccu::notify_wait(ctx.arg->channels[i], CKE_IDX_0, allBits);
78 }79 }
79- return CCU_SUCCESS;80+ return ccu_result::CCU_SUCCESS;
80}81}
81 82 
82// 由根 rank 把本端数据写到其余所有 rank 的缓冲;非根 rank 直接返回83// 由根 rank 把本端数据写到其余所有 rank 的缓冲;非根 rank 直接返回
83 84 
84-static CcuResult BroadcastFromRoot(BroadcastMesh1DContext& ctx)85+static ccu_result BroadcastFromRoot(BroadcastMesh1DContext& ctx)
85{86{
86 if (ctx.arg->rankId != ctx.arg->rootId) {87 if (ctx.arg->rankId != ctx.arg->rootId) {
87- return CCU_SUCCESS;88+ return ccu_result::CCU_SUCCESS;
88 }89 }
89 90 
90 ccu::local_addr src_;91 ccu::local_addr src_;
@@ -107,7 +108,7 @@ static CcuResult BroadcastFromRoot(BroadcastMesh1DContext& ctx)
107 channelId++;108 channelId++;
108 }109 }
109 ccu::event_wait(ctx.event, remoteMask);110 ccu::event_wait(ctx.event, remoteMask);
110- return CCU_SUCCESS;111+ return ccu_result::CCU_SUCCESS;
111}112}
112 113 
113// Host 侧 CCU Kernel:通过 SQE 下发 CCU 编排指令。114// Host 侧 CCU Kernel:通过 SQE 下发 CCU 编排指令。
@@ -19,13 +19,15 @@
19#include <hccl/hccl_comm.h>19#include <hccl/hccl_comm.h>
20#include <hccl/hccl_rank_graph.h>20#include <hccl/hccl_rank_graph.h>
21 21 
22+#include <hcomm/hcomm_primitives.h>
22#include <ccu_res.h>23#include <ccu_res.h>
23-#include <ccu/ccu_host_launch.h>24+#include <ccu/asc_ccu.h>
24 25 
25#include "../../../common/ccu_instance.h"26#include "../../../common/ccu_instance.h"
26#include "ccu_broadcast_kernel.h"27#include "ccu_broadcast_kernel.h"
27 28 
28using namespace ops_comm_ag;29using namespace ops_comm_ag;
30+namespace ccu = ::asc::ccu;
29 31 
30#ifdef ACLCHECK32#ifdef ACLCHECK
31#undef ACLCHECK33#undef ACLCHECK
@@ -61,7 +61,6 @@ target_link_options(ccu_reduce_scatter PRIVATE
61 -Wl,-z,noexecstack61 -Wl,-z,noexecstack
62)62)
63target_link_directories(ccu_reduce_scatter PRIVATE63target_link_directories(ccu_reduce_scatter PRIVATE
64- ${ASCEND_CANN_PACKAGE_PATH}/asc/lib64
65 ${ASCEND_CANN_PACKAGE_PATH}/lib6464 ${ASCEND_CANN_PACKAGE_PATH}/lib64
66)65)
67target_link_libraries(ccu_reduce_scatter PRIVATE66target_link_libraries(ccu_reduce_scatter PRIVATE
@@ -18,9 +18,10 @@
18#include <vector>18#include <vector>
19 19 
20#include <hccl/hccl_res.h>20#include <hccl/hccl_res.h>
21-#include <ccu/hcomm/ccu_primitives.hpp>21+#include <ccu/ccu_api/ccu_types.h>
22+#include <ccu/ccu_api/ccu_primitives.h>
22 23 
23-namespace ccu = ::AscendC::ccu;24+namespace ccu = ::asc::ccu;
24 25 
25namespace ops_comm_ag {26namespace ops_comm_ag {
26// CCU 本地拷贝与调度的规模常量:最大 rank 数、Channel notify 槽位数、Die 数等27// CCU 本地拷贝与调度的规模常量:最大 rank 数、Channel notify 槽位数、Die 数等
@@ -178,7 +179,7 @@ static void InitGroupCopyResources(
178 179 
179// 按切分参数执行本地拷贝。180// 按切分参数执行本地拷贝。
180 181 
181-static CcuResult GroupCopy(182+static ccu_result GroupCopy(
182 ReduceScatterMesh1DMem2MemContext& ctx, ccu::local_addr dst_, ccu::local_addr src_, GroupOpSizeVars goSize)183 ReduceScatterMesh1DMem2MemContext& ctx, ccu::local_addr dst_, ccu::local_addr src_, GroupOpSizeVars goSize)
183{184{
184 ccu::local_addr loopSrc[2];185 ccu::local_addr loopSrc[2];
@@ -240,12 +241,12 @@ static CcuResult GroupCopy(
240 // 构造 loop_group 即完成提交:LoopGroup 按偏移复制出多份 Loop 并发执行,无独立的提交调用241 // 构造 loop_group 即完成提交:LoopGroup 按偏移复制出多份 Loop 并发执行,无独立的提交调用
241 ccu::loop_group group(goSize.parallel_param, offsetCfg, 2, grpLoops);242 ccu::loop_group group(goSize.parallel_param, offsetCfg, 2, grpLoops);
242 }243 }
243- return CCU_SUCCESS;244+ return ccu_result::CCU_SUCCESS;
244}245}
245 246 
246// 按 rank 拆分地址并执行通信:跨 rank 写入与本地拷贝配合,最后等所有 rank 完成。247// 按 rank 拆分地址并执行通信:跨 rank 写入与本地拷贝配合,最后等所有 rank 完成。
247 248 
248-static CcuResult ExecuteReduceScatterTransfer(ReduceScatterMesh1DMem2MemContext& ctx)249+static ccu_result ExecuteReduceScatterTransfer(ReduceScatterMesh1DMem2MemContext& ctx)
249{250{
250 ccu::local_addr localSrc;251 ccu::local_addr localSrc;
251 ccu::local_addr localDst;252 ccu::local_addr localDst;
@@ -301,7 +302,7 @@ static CcuResult ExecuteReduceScatterTransfer(ReduceScatterMesh1DMem2MemContext&
301 }302 }
302 ccu::event_wait(ctx.event, remoteMask);303 ccu::event_wait(ctx.event, remoteMask);
303 }304 }
304- return CcuResult::CCU_SUCCESS;305+ return ccu_result::CCU_SUCCESS;
305}306}
306 307 
307// Host 侧 CCU Kernel:通过 SQE 下发 CCU 编排指令。308// Host 侧 CCU Kernel:通过 SQE 下发 CCU 编排指令。
@@ -21,13 +21,15 @@
21#include <hccl/hccl_types.h>21#include <hccl/hccl_types.h>
22#include <hccl/hccl_rank_graph.h>22#include <hccl/hccl_rank_graph.h>
23 23 
24+#include <hcomm/hcomm_primitives.h>
24#include <ccu_res.h>25#include <ccu_res.h>
25-#include <ccu/ccu_host_launch.h>26+#include <ccu/asc_ccu.h>
26 27 
27#include "../../../common/ccu_instance.h"28#include "../../../common/ccu_instance.h"
28#include "ccu_reduce_scatter_kernel.h"29#include "ccu_reduce_scatter_kernel.h"
29 30 
30using namespace ops_comm_ag;31using namespace ops_comm_ag;
32+namespace ccu = ::asc::ccu;
31 33 
32#ifdef ACLCHECK34#ifdef ACLCHECK
33#undef ACLCHECK35#undef ACLCHECK
@@ -67,7 +67,6 @@ target_link_options(ccu_transfer PRIVATE
67 -Wl,-z,noexecstack67 -Wl,-z,noexecstack
68)68)
69target_link_directories(ccu_transfer PRIVATE69target_link_directories(ccu_transfer PRIVATE
70- ${ASCEND_CANN_PACKAGE_PATH}/asc/lib64
71 ${ASCEND_CANN_PACKAGE_PATH}/lib6470 ${ASCEND_CANN_PACKAGE_PATH}/lib64
72)71)
73target_link_libraries(ccu_transfer PRIVATE72target_link_libraries(ccu_transfer PRIVATE
@@ -18,9 +18,10 @@
18#include <vector>18#include <vector>
19 19 
20#include <hccl/hccl_res.h>20#include <hccl/hccl_res.h>
21-#include <ccu/hcomm/ccu_primitives.hpp>21+#include <ccu/ccu_api/ccu_types.h>
22+#include <ccu/ccu_api/ccu_primitives.h>
22 23 
23-namespace ccu = ::AscendC::ccu;24+namespace ccu = ::asc::ccu;
24 25 
25namespace ops_comm_ag {26namespace ops_comm_ag {
26constexpr uint32_t CHANNEL_NOTIFY_NUM = 3;27constexpr uint32_t CHANNEL_NOTIFY_NUM = 3;
@@ -99,7 +100,7 @@ ccu::remote_addr MakeRemoteAddr(const ccu::variable& address, const ccu::variabl
99 100 
100// 与对端互换输出地址与 token,为跨卡写准备目的地址101// 与对端互换输出地址与 token,为跨卡写准备目的地址
101 102 
102-CcuResult ExchangeRemoteOutput(TransferContext& ctx)103+ccu_result ExchangeRemoteOutput(TransferContext& ctx)
103{104{
104 ccu::write_variable_with_notify(ctx.arg->channels[0], ctx.output, OUTPUT_XN_ID, CKE_IDX_0, 1U << OUTPUT_XN_ID);105 ccu::write_variable_with_notify(ctx.arg->channels[0], ctx.output, OUTPUT_XN_ID, CKE_IDX_0, 1U << OUTPUT_XN_ID);
105 ccu::write_variable_with_notify(ctx.arg->channels[0], ctx.outputToken, TOKEN_XN_ID, CKE_IDX_0, 1U << TOKEN_XN_ID);106 ccu::write_variable_with_notify(ctx.arg->channels[0], ctx.outputToken, TOKEN_XN_ID, CKE_IDX_0, 1U << TOKEN_XN_ID);
@@ -116,7 +117,7 @@ CcuResult ExchangeRemoteOutput(TransferContext& ctx)
116 const uint32_t allBits = (1U << OUTPUT_XN_ID) | (1U << TOKEN_XN_ID);117 const uint32_t allBits = (1U << OUTPUT_XN_ID) | (1U << TOKEN_XN_ID);
117#endif118#endif
118 ccu::notify_wait(ctx.arg->channels[0], CKE_IDX_0, allBits);119 ccu::notify_wait(ctx.arg->channels[0], CKE_IDX_0, allBits);
119- return CCU_SUCCESS;120+ return ccu_result::CCU_SUCCESS;
120}121}
121 122 
122ccu::func StagedCopyFunc([](ccu::variable srcAddr, ccu::variable srcToken, ccu::variable dstAddr,123ccu::func StagedCopyFunc([](ccu::variable srcAddr, ccu::variable srcToken, ccu::variable dstAddr,
@@ -149,7 +150,7 @@ ccu::func StagedCopyFunc([](ccu::variable srcAddr, ccu::variable srcToken, ccu::
149// 场景 1:本地拷贝。输入直接写本地输出一次,再经片上 staging buffer 中转写一次,150// 场景 1:本地拷贝。输入直接写本地输出一次,再经片上 staging buffer 中转写一次,
150// 两条路径结果应一致,验证本地搬移的直连与中转两种写法;151// 两条路径结果应一致,验证本地搬移的直连与中转两种写法;
151// 中转一路改由 call_func 函数块完成,演示带参函数块对真实搬运步骤的封装152// 中转一路改由 call_func 函数块完成,演示带参函数块对真实搬运步骤的封装
152-CcuResult ExecuteLocalCopy(TransferContext& ctx)153+ccu_result ExecuteLocalCopy(TransferContext& ctx)
153{154{
154 const ccu::local_addr input = MakeLocalAddr(ctx.input, ctx.inputToken);155 const ccu::local_addr input = MakeLocalAddr(ctx.input, ctx.inputToken);
155 const ccu::local_addr output = MakeLocalAddr(ctx.output, ctx.outputToken);156 const ccu::local_addr output = MakeLocalAddr(ctx.output, ctx.outputToken);
@@ -158,7 +159,7 @@ CcuResult ExecuteLocalCopy(TransferContext& ctx)
158 ccu::event_wait(ctx.event, EVENT_MASK);159 ccu::event_wait(ctx.event, EVENT_MASK);
159 // 中转一路:源/目的地址与 token、长度经 variable 实参传入函数块,块内完成两段搬运160 // 中转一路:源/目的地址与 token、长度经 variable 实参传入函数块,块内完成两段搬运
160 ccu::call_func<StagedCopyFunc>(ctx.input, ctx.inputToken, ctx.output, ctx.outputToken, ctx.dataSize);161 ccu::call_func<StagedCopyFunc>(ctx.input, ctx.inputToken, ctx.output, ctx.outputToken, ctx.dataSize);
161- return CCU_SUCCESS;162+ return ccu_result::CCU_SUCCESS;
162}163}
163 164 
164// 场景 7:CCU_DO/CCU_WHILE/CCU_ELSE 软件控制流宏 + local_notify 跨 kernel 同步。165// 场景 7:CCU_DO/CCU_WHILE/CCU_ELSE 软件控制流宏 + local_notify 跨 kernel 同步。
@@ -167,7 +168,7 @@ CcuResult ExecuteLocalCopy(TransferContext& ctx)
167// - CCU_IF(cond) { ... } CCU_ELSE { ... } 分支选择搬运通路;168// - CCU_IF(cond) { ... } CCU_ELSE { ... } 分支选择搬运通路;
168// - event_record("tag", mask)/event_wait("tag", mask) 为 local_notify 重载(同 die 跨 kernel)。169// - event_record("tag", mask)/event_wait("tag", mask) 为 local_notify 重载(同 die 跨 kernel)。
169 170 
170-CcuResult ExecuteControlFlowAndLocalNotify(TransferContext& ctx)171+ccu_result ExecuteControlFlowAndLocalNotify(TransferContext& ctx)
171{172{
172 ccu::ccu_buffer stagingBuffer;173 ccu::ccu_buffer stagingBuffer;
173 174 
@@ -216,13 +217,13 @@ CcuResult ExecuteControlFlowAndLocalNotify(TransferContext& ctx)
216 // 注意 tag 必须与 record 侧完全一致:record 的 tag 若无配对的 wait,217 // 注意 tag 必须与 record 侧完全一致:record 的 tag 若无配对的 wait,
217 // kernel 注册(翻译)阶段会因找不到 exported 资源而失败218 // kernel 注册(翻译)阶段会因找不到 exported 资源而失败
218 ccu::event_wait("transfer_ready", 0x1);219 ccu::event_wait("transfer_ready", 0x1);
219- return CCU_SUCCESS;220+ return ccu_result::CCU_SUCCESS;
220}221}
221 222 
222// 场景 2:跨卡写。输入直接写到对端输出一次,再先落到片上 staging buffer、223// 场景 2:跨卡写。输入直接写到对端输出一次,再先落到片上 staging buffer、
223// 由 staging buffer 写到对端输出一次,两次都写同一目标,验证跨卡写的直连与中转两种写法224// 由 staging buffer 写到对端输出一次,两次都写同一目标,验证跨卡写的直连与中转两种写法
224 225 
225-CcuResult ExecuteWrite(TransferContext& ctx)226+ccu_result ExecuteWrite(TransferContext& ctx)
226{227{
227 ccu::ccu_buffer stagingBuffer;228 ccu::ccu_buffer stagingBuffer;
228 229 
@@ -235,13 +236,13 @@ CcuResult ExecuteWrite(TransferContext& ctx)
235 ccu::event_wait(ctx.event, EVENT_MASK);236 ccu::event_wait(ctx.event, EVENT_MASK);
236 ccu::write(ctx.arg->channels[0], output, stagingBuffer, ctx.dataSize, ctx.event, EVENT_MASK);237 ccu::write(ctx.arg->channels[0], output, stagingBuffer, ctx.dataSize, ctx.event, EVENT_MASK);
237 ccu::event_wait(ctx.event, EVENT_MASK);238 ccu::event_wait(ctx.event, EVENT_MASK);
238- return CCU_SUCCESS;239+ return ccu_result::CCU_SUCCESS;
239}240}
240 241 
241// 场景 3:跨卡写并 SUM 规约。先把输入落到本地输出,再与对端做一次同步,242// 场景 3:跨卡写并 SUM 规约。先把输入落到本地输出,再与对端做一次同步,
242// 最后以求和方式写到对端输出(两 rank 输入相加的结果落在对端)243// 最后以求和方式写到对端输出(两 rank 输入相加的结果落在对端)
243 244 
244-CcuResult ExecuteWriteReduce(TransferContext& ctx)245+ccu_result ExecuteWriteReduce(TransferContext& ctx)
245{246{
246 const ccu::local_addr input = MakeLocalAddr(ctx.input, ctx.inputToken);247 const ccu::local_addr input = MakeLocalAddr(ctx.input, ctx.inputToken);
247 const ccu::local_addr output = MakeLocalAddr(ctx.output, ctx.outputToken);248 const ccu::local_addr output = MakeLocalAddr(ctx.output, ctx.outputToken);
@@ -255,7 +256,7 @@ CcuResult ExecuteWriteReduce(TransferContext& ctx)
255 ctx.arg->channels[0], remoteOutput, input, ctx.dataSize, HCCL_DATA_TYPE_FP32, HCCL_REDUCE_SUM, ctx.event,256 ctx.arg->channels[0], remoteOutput, input, ctx.dataSize, HCCL_DATA_TYPE_FP32, HCCL_REDUCE_SUM, ctx.event,
256 EVENT_MASK);257 EVENT_MASK);
257 ccu::event_wait(ctx.event, EVENT_MASK);258 ccu::event_wait(ctx.event, EVENT_MASK);
258- return CCU_SUCCESS;259+ return ccu_result::CCU_SUCCESS;
259}260}
260 261 
261// 场景 4:load/store + address 演示。262// 场景 4:load/store + address 演示。
@@ -263,7 +264,7 @@ CcuResult ExecuteWriteReduce(TransferContext& ctx)
263// address 是独立的地址资源类型,支持 imm/var/addr+var 赋值,264// address 是独立的地址资源类型,支持 imm/var/addr+var 赋值,
264// 此处用 address 承载输入地址并装入 local_addr,演示其与 variable 的互换性。265// 此处用 address 承载输入地址并装入 local_addr,演示其与 variable 的互换性。
265 266 
266-CcuResult ExecuteLoadStore(TransferContext& ctx)267+ccu_result ExecuteLoadStore(TransferContext& ctx)
267{268{
268 // 1) address 资源:variable 间接赋值后作为 local_addr 的地址成员269 // 1) address 资源:variable 间接赋值后作为 local_addr 的地址成员
269 // (local_addr.addr 为 address 类型,local_addr.token 为 variable 类型)270 // (local_addr.addr 为 address 类型,local_addr.token 为 variable 类型)
@@ -293,12 +294,12 @@ CcuResult ExecuteLoadStore(TransferContext& ctx)
293 294 
294 ccu::local_copy(output, input, ctx.dataSize, ctx.event, EVENT_MASK);295 ccu::local_copy(output, input, ctx.dataSize, ctx.event, EVENT_MASK);
295 ccu::event_wait(ctx.event, EVENT_MASK);296 ccu::event_wait(ctx.event, EVENT_MASK);
296- return CCU_SUCCESS;297+ return ccu_result::CCU_SUCCESS;
297}298}
298 299 
299// 场景 5:read 演示(对端写 -> 本端读回,注意 read 参数序为"目的在前,源在后")。300// 场景 5:read 演示(对端写 -> 本端读回,注意 read 参数序为"目的在前,源在后")。
300 301 
301-CcuResult ExecuteRead(TransferContext& ctx)302+ccu_result ExecuteRead(TransferContext& ctx)
302{303{
303 ccu::ccu_buffer stagingBuffer;304 ccu::ccu_buffer stagingBuffer;
304 305 
@@ -314,12 +315,12 @@ CcuResult ExecuteRead(TransferContext& ctx)
314 // stagingBuffer 落回 output,验证 buffer 通路读到的数据同样正确315 // stagingBuffer 落回 output,验证 buffer 通路读到的数据同样正确
315 ccu::local_copy(output, stagingBuffer, ctx.dataSize, ctx.event, EVENT_MASK);316 ccu::local_copy(output, stagingBuffer, ctx.dataSize, ctx.event, EVENT_MASK);
316 ccu::event_wait(ctx.event, EVENT_MASK);317 ccu::event_wait(ctx.event, EVENT_MASK);
317- return CCU_SUCCESS;318+ return ccu_result::CCU_SUCCESS;
318}319}
319 320 
320// 场景 6:read_reduce 演示(对端写 -> 本端读取并原地归约)。321// 场景 6:read_reduce 演示(对端写 -> 本端读取并原地归约)。
321 322 
322-CcuResult ExecuteReadReduce(TransferContext& ctx)323+ccu_result ExecuteReadReduce(TransferContext& ctx)
323{324{
324 const ccu::local_addr output = MakeLocalAddr(ctx.output, ctx.outputToken);325 const ccu::local_addr output = MakeLocalAddr(ctx.output, ctx.outputToken);
325 const ccu::remote_addr remoteInput = MakeRemoteAddr(ctx.remoteInput, ctx.remoteInputToken);326 const ccu::remote_addr remoteInput = MakeRemoteAddr(ctx.remoteInput, ctx.remoteInputToken);
@@ -333,7 +334,7 @@ CcuResult ExecuteReadReduce(TransferContext& ctx)
333 ctx.arg->channels[0], output, remoteInput, ctx.dataSize, HCCL_DATA_TYPE_FP32, HCCL_REDUCE_SUM, ctx.event,334 ctx.arg->channels[0], output, remoteInput, ctx.dataSize, HCCL_DATA_TYPE_FP32, HCCL_REDUCE_SUM, ctx.event,
334 EVENT_MASK);335 EVENT_MASK);
335 ccu::event_wait(ctx.event, EVENT_MASK);336 ccu::event_wait(ctx.event, EVENT_MASK);
336- return CCU_SUCCESS;337+ return ccu_result::CCU_SUCCESS;
337}338}
338 339 
339// Host 侧 CCU Kernel:通过 SQE 下发 CCU 编排指令。340// Host 侧 CCU Kernel:通过 SQE 下发 CCU 编排指令。
@@ -22,13 +22,15 @@
22#include <hccl/hccl_types.h>22#include <hccl/hccl_types.h>
23#include <hccl/hccl_rank_graph.h>23#include <hccl/hccl_rank_graph.h>
24 24 
25+#include <hcomm/hcomm_primitives.h>
25#include <ccu_res.h>26#include <ccu_res.h>
26-#include <ccu/ccu_host_launch.h>27+#include <ccu/asc_ccu.h>
27 28 
28#include "../../../common/ccu_instance.h"29#include "../../../common/ccu_instance.h"
29#include "ccu_transfer_kernel.h"30#include "ccu_transfer_kernel.h"
30 31 
31using namespace ops_comm_ag;32using namespace ops_comm_ag;
33+namespace ccu = ::asc::ccu;
32 34 
33// 样例固定 4 个 float;每链路 notify 数;IO Die 数量35// 样例固定 4 个 float;每链路 notify 数;IO Die 数量
34constexpr uint64_t ELEMENT_COUNT = 4;36constexpr uint64_t ELEMENT_COUNT = 4;
Rinclude/ccu/hcomm/ccu_address.hpp→include/ccu/ccu_api/ccu_address.h+22-68
Rinclude/ccu/hcomm/ccu_array.hpp→include/ccu/ccu_api/ccu_array.h+19-26
Rinclude/ccu/hcomm/ccu_buffer.hpp→include/ccu/ccu_api/ccu_buffer.h+8-9
Rinclude/ccu/hcomm/ccu_control_flow_macro.h→include/ccu/ccu_api/ccu_control_flow_macro.h+66-30
Rinclude/ccu/hcomm/ccu_event.hpp→include/ccu/ccu_api/ccu_event.h+9-14
Rinclude/ccu/hcomm/ccu_func.hpp→include/ccu/ccu_api/ccu_func.h+33-17
Rinclude/ccu/hcomm/ccu_local_addr.hpp→include/ccu/ccu_api/ccu_local_addr.h+9-14
Rinclude/ccu/hcomm/ccu_print.hpp→include/ccu/ccu_api/ccu_print.h+42-38
Rinclude/ccu/hcomm/ccu_remote_addr.hpp→include/ccu/ccu_api/ccu_remote_addr.h+9-14
Rinclude/ccu/hcomm/ccu_api_types.h→include/ccu/ccu_api/ccu_types.h+38-2
Rinclude/ccu/hcomm/ccu_utils.hpp→include/ccu/ccu_api/ccu_utils.h+25-25
Rinclude/ccu/hcomm/ccu_variable.hpp→include/ccu/ccu_api/ccu_variable.h+32-195
Rinclude/ccu/hcomm/ccu_resource_api.h→include/ccu/experimental/ccu_resource_api.h+9-9
Rpkg_inc/hcomm/ccu/hcomm_res_ccu_entity_defs.h→pkg_inc/ccu_api/ccu/asccomm_res_ccu_entity_defs.h+0-0
Rinclude/ccu/hcomm/hccl_types.h→pkg_inc/ccu_api/ccu/hccl_types.h+2-3
Rsrc/ccu/hcomm/CMakeLists.txt→src/ccu/ccu_api/CMakeLists.txt+3-0
Rsrc/ccu/hcomm/primitives/ccu_launch.h→src/ccu/ccu_api/ccu_launch.h+9-11
Rsrc/ccu/hcomm/primitives/ccu_primitives_impl.h→src/ccu/ccu_api/ccu_primitives_impl.h+85-84
Rsrc/ccu/hcomm/common/ccu_common.h→src/ccu/ccu_api/common/ccu_common.h+0-0
Rsrc/ccu/hcomm/common/ccu_dev_mem.cc→src/ccu/ccu_api/common/ccu_dev_mem.cc+2-2
Rsrc/ccu/hcomm/common/ccu_dev_mem.h→src/ccu/ccu_api/common/ccu_dev_mem.h+0-0
Rsrc/ccu/hcomm/common/ccu_device_context.cc→src/ccu/ccu_api/common/ccu_device_context.cc+1-1
Rsrc/ccu/hcomm/common/ccu_device_context.h→src/ccu/ccu_api/common/ccu_device_context.h+1-1
Rsrc/ccu/hcomm/common/ccu_exception.h→src/ccu/ccu_api/common/ccu_exception.h+13-13
Rsrc/ccu/hcomm/common/ccu_log.h→src/ccu/ccu_api/common/ccu_log.h+81-21
Rsrc/ccu/hcomm/common/ccu_print.cc→src/ccu/ccu_api/common/ccu_print.cc+4-4
Rsrc/ccu/hcomm/common/ccu_print_internal.h→src/ccu/ccu_api/common/ccu_print_internal.h+2-2
Rsrc/ccu/hcomm/dfx/ccu_profiling.cc→src/ccu/ccu_api/dfx/ccu_profiling.cc+1-1
Rsrc/ccu/hcomm/dfx/ccu_profiling.h→src/ccu/ccu_api/dfx/ccu_profiling.h+2-2
Rsrc/ccu/hcomm/primitives/ccu_launch.cc→src/ccu/ccu_api/primitives/ccu_launch.cc+100-98
Rinclude/ccu/hcomm/ccu_primitives.hpp→src/ccu/ccu_api/primitives/ccu_primitives_api.cc+64-77
Rsrc/ccu/hcomm/primitives/ccu_primitives_impl.cc→src/ccu/ccu_api/primitives/ccu_primitives_impl.cc+354-344
Rsrc/ccu/hcomm/resource/channel/ccu_channel.cc→src/ccu/ccu_api/resource/channel/ccu_channel.cc+3-3
Rsrc/ccu/hcomm/resource/channel/ccu_channel.h→src/ccu/ccu_api/resource/channel/ccu_channel.h+2-2
Rsrc/ccu/hcomm/resource/common/asc_ccu_res_snapshot.cc→src/ccu/ccu_api/resource/common/asc_ccu_res_snapshot.cc+32-32
Rsrc/ccu/hcomm/resource/common/asc_ccu_res_snapshot.h→src/ccu/ccu_api/resource/common/asc_ccu_res_snapshot.h+10-10
Rsrc/ccu/hcomm/resource/common/asc_ccu_resource_local.h→src/ccu/ccu_api/resource/common/asc_ccu_resource_local.h+4-4
Rsrc/ccu/hcomm/resource/common/ccu_kernel_func.h→src/ccu/ccu_api/resource/common/ccu_kernel_func.h+3-3
Rsrc/ccu/hcomm/resource/common/ccu_kernel_resource.h→src/ccu/ccu_api/resource/common/ccu_kernel_resource.h+1-1
Rsrc/ccu/hcomm/resource/common/ccu_var_event_res_mgr.cc→src/ccu/ccu_api/resource/common/ccu_var_event_res_mgr.cc+79-79
Rsrc/ccu/hcomm/resource/common/ccu_var_event_res_mgr.h→src/ccu/ccu_api/resource/common/ccu_var_event_res_mgr.h+14-14
Rsrc/ccu/hcomm/resource/kernel/ccu_kernel.cc→src/ccu/ccu_api/resource/kernel/ccu_kernel.cc+282-282
Rsrc/ccu/hcomm/resource/kernel/ccu_kernel.h→src/ccu/ccu_api/resource/kernel/ccu_kernel.h+120-117
Rsrc/ccu/hcomm/resource/kernel/ccu_kernel_mgr.cc→src/ccu/ccu_api/resource/kernel/ccu_kernel_mgr.cc+59-59
Rsrc/ccu/hcomm/resource/kernel/ccu_kernel_mgr.h→src/ccu/ccu_api/resource/kernel/ccu_kernel_mgr.h+11-11
Rsrc/ccu/hcomm/resource/kernel/ccu_kernel_registry.cc→src/ccu/ccu_api/resource/kernel/ccu_kernel_registry.cc+26-26
Rsrc/ccu/hcomm/resource/kernel/ccu_kernel_registry.h→src/ccu/ccu_api/resource/kernel/ccu_kernel_registry.h+9-9
Rsrc/ccu/hcomm/resource/kernel/ccu_kernel_registry_mgr.cc→src/ccu/ccu_api/resource/kernel/ccu_kernel_registry_mgr.cc+15-15
Rsrc/ccu/hcomm/resource/kernel/ccu_kernel_registry_mgr.h→src/ccu/ccu_api/resource/kernel/ccu_kernel_registry_mgr.h+6-5
Rsrc/ccu/hcomm/resource/kernel/ccu_kernel_res_allocator.cc→src/ccu/ccu_api/resource/kernel/ccu_kernel_res_allocator.cc+4-4
Rsrc/ccu/hcomm/resource/kernel/ccu_kernel_res_allocator.h→src/ccu/ccu_api/resource/kernel/ccu_kernel_res_allocator.h+3-3
Rsrc/ccu/hcomm/resource/kernel/ccu_task_arg_v1.h→src/ccu/ccu_api/resource/kernel/ccu_task_arg_v1.h+0-0
Rsrc/ccu/hcomm/resource/kernel/ccu_task_param_v1.h→src/ccu/ccu_api/resource/kernel/ccu_task_param_v1.h+0-0
Rsrc/ccu/hcomm/resource/microcode/ccu_assist.cc→src/ccu/ccu_api/resource/microcode/ccu_assist.cc+3-3
Rsrc/ccu/hcomm/resource/microcode/ccu_assist_pub.h→src/ccu/ccu_api/resource/microcode/ccu_assist_pub.h+0-0
Rsrc/ccu/hcomm/resource/microcode/ccu_assist_v1.h→src/ccu/ccu_api/resource/microcode/ccu_assist_v1.h+2-2
Rsrc/ccu/hcomm/resource/microcode/ccu_instr_info_v1.h→src/ccu/ccu_api/resource/microcode/ccu_instr_info_v1.h+1-1
Rsrc/ccu/hcomm/resource/microcode/ccu_microcode.cc→src/ccu/ccu_api/resource/microcode/ccu_microcode.cc+2-2
Rsrc/ccu/hcomm/resource/microcode/ccu_microcode_v1.h→src/ccu/ccu_api/resource/microcode/ccu_microcode_v1.h+0-0
Rsrc/ccu/hcomm/resource/microcode_opt/CMakeLists.txt→src/ccu/ccu_api/resource/microcode_opt/CMakeLists.txt+0-0
Rsrc/ccu/hcomm/resource/microcode_opt/config/barrier_config.h→src/ccu/ccu_api/resource/microcode_opt/config/barrier_config.h+0-0
Rsrc/ccu/hcomm/resource/microcode_opt/extract_operands.cc→src/ccu/ccu_api/resource/microcode_opt/extract_operands.cc+1-1
Rsrc/ccu/hcomm/resource/microcode_opt/extract_operands.h→src/ccu/ccu_api/resource/microcode_opt/extract_operands.h+1-1
Rsrc/ccu/hcomm/resource/microcode_opt/instruction_scheduler.cc→src/ccu/ccu_api/resource/microcode_opt/instruction_scheduler.cc+1-1
Rsrc/ccu/hcomm/resource/microcode_opt/instruction_scheduler.h→src/ccu/ccu_api/resource/microcode_opt/instruction_scheduler.h+2-2
Rsrc/ccu/hcomm/resource/microcode_opt/microcode_optimizer.cc→src/ccu/ccu_api/resource/microcode_opt/microcode_optimizer.cc+2-2
Rsrc/ccu/hcomm/resource/microcode_opt/microcode_optimizer.h→src/ccu/ccu_api/resource/microcode_opt/microcode_optimizer.h+2-2
Rsrc/ccu/hcomm/resource/representation/context/ccu_rep_context.cc→src/ccu/ccu_api/resource/representation/context/ccu_rep_context.cc+4-4
Rsrc/ccu/hcomm/resource/representation/context/ccu_rep_context_v1.h→src/ccu/ccu_api/resource/representation/context/ccu_rep_context_v1.h+4-4
Rsrc/ccu/hcomm/resource/representation/interface/ccu_condition.cc→src/ccu/ccu_api/resource/representation/interface/ccu_condition.cc+3-3
Rsrc/ccu/hcomm/resource/representation/interface/ccu_condition_v1.h→src/ccu/ccu_api/resource/representation/interface/ccu_condition_v1.h+3-3
Rsrc/ccu/hcomm/resource/representation/interface/ccu_datatype.cc→src/ccu/ccu_api/resource/representation/interface/ccu_datatype.cc+5-5
Rsrc/ccu/hcomm/resource/representation/interface/ccu_datatype_v1.h→src/ccu/ccu_api/resource/representation/interface/ccu_datatype_v1.h+3-3
Rsrc/ccu/hcomm/resource/representation/interface/ccu_funcblock.cc→src/ccu/ccu_api/resource/representation/interface/ccu_funcblock.cc+4-4
Rsrc/ccu/hcomm/resource/representation/interface/ccu_funcblock_v1.h→src/ccu/ccu_api/resource/representation/interface/ccu_funcblock_v1.h+3-3
Rsrc/ccu/hcomm/resource/representation/interface/ccu_funccall.cc→src/ccu/ccu_api/resource/representation/interface/ccu_funccall.cc+5-5
Rsrc/ccu/hcomm/resource/representation/interface/ccu_funccall_v1.h→src/ccu/ccu_api/resource/representation/interface/ccu_funccall_v1.h+2-2
Rsrc/ccu/hcomm/resource/representation/interface/ccu_interface_assist.cc→src/ccu/ccu_api/resource/representation/interface/ccu_interface_assist.cc+3-3
Rsrc/ccu/hcomm/resource/representation/interface/ccu_interface_assist_v1.h→src/ccu/ccu_api/resource/representation/interface/ccu_interface_assist_v1.h+3-3
Rsrc/ccu/hcomm/resource/representation/interface/ccu_loopblock.cc→src/ccu/ccu_api/resource/representation/interface/ccu_loopblock.cc+3-3
Rsrc/ccu/hcomm/resource/representation/interface/ccu_loopblock_v1.h→src/ccu/ccu_api/resource/representation/interface/ccu_loopblock_v1.h+3-3
Rsrc/ccu/hcomm/resource/representation/interface/ccu_loopcall.cc→src/ccu/ccu_api/resource/representation/interface/ccu_loopcall.cc+2-2
Rsrc/ccu/hcomm/resource/representation/interface/ccu_loopcall_v1.h→src/ccu/ccu_api/resource/representation/interface/ccu_loopcall_v1.h+2-2
Rsrc/ccu/hcomm/resource/representation/interface/ccu_repeat.cc→src/ccu/ccu_api/resource/representation/interface/ccu_repeat.cc+3-3
Rsrc/ccu/hcomm/resource/representation/interface/ccu_repeat_v1.h→src/ccu/ccu_api/resource/representation/interface/ccu_repeat_v1.h+3-3
Rsrc/ccu/hcomm/resource/representation/reps/arithmetic/ccu_operator.cc→src/ccu/ccu_api/resource/representation/reps/arithmetic/ccu_operator.cc+2-2
Rsrc/ccu/hcomm/resource/representation/reps/arithmetic/ccu_operator_v1.h→src/ccu/ccu_api/resource/representation/reps/arithmetic/ccu_operator_v1.h+1-1
Rsrc/ccu/hcomm/resource/representation/reps/arithmetic/ccu_rep_add.cc→src/ccu/ccu_api/resource/representation/reps/arithmetic/ccu_rep_add.cc+8-8
Rsrc/ccu/hcomm/resource/representation/reps/arithmetic/ccu_rep_add_v1.h→src/ccu/ccu_api/resource/representation/reps/arithmetic/ccu_rep_add_v1.h+2-2
Rsrc/ccu/hcomm/resource/representation/reps/arithmetic/ccu_rep_assign.cc→src/ccu/ccu_api/resource/representation/reps/arithmetic/ccu_rep_assign.cc+7-7
Rsrc/ccu/hcomm/resource/representation/reps/arithmetic/ccu_rep_assign_v1.h→src/ccu/ccu_api/resource/representation/reps/arithmetic/ccu_rep_assign_v1.h+2-2
Rsrc/ccu/hcomm/resource/representation/reps/arithmetic/ccu_rep_mul.cc→src/ccu/ccu_api/resource/representation/reps/arithmetic/ccu_rep_mul.cc+8-8
Rsrc/ccu/hcomm/resource/representation/reps/arithmetic/ccu_rep_mul_v1.h→src/ccu/ccu_api/resource/representation/reps/arithmetic/ccu_rep_mul_v1.h+2-2
Rsrc/ccu/hcomm/resource/representation/reps/arithmetic/ccu_rep_sub.cc→src/ccu/ccu_api/resource/representation/reps/arithmetic/ccu_rep_sub.cc+8-8
Rsrc/ccu/hcomm/resource/representation/reps/arithmetic/ccu_rep_sub_v1.h→src/ccu/ccu_api/resource/representation/reps/arithmetic/ccu_rep_sub_v1.h+2-2
Rsrc/ccu/hcomm/resource/representation/reps/common/ccu_rep_arg_v1.h→src/ccu/ccu_api/resource/representation/reps/common/ccu_rep_arg_v1.h+1-1
Rsrc/ccu/hcomm/resource/representation/reps/common/ccu_rep_base.cc→src/ccu/ccu_api/resource/representation/reps/common/ccu_rep_base.cc+1-1
Rsrc/ccu/hcomm/resource/representation/reps/common/ccu_rep_base_v1.h→src/ccu/ccu_api/resource/representation/reps/common/ccu_rep_base_v1.h+3-3
Rsrc/ccu/hcomm/resource/representation/reps/common/ccu_rep_block.cc→src/ccu/ccu_api/resource/representation/reps/common/ccu_rep_block.cc+4-4
Rsrc/ccu/hcomm/resource/representation/reps/common/ccu_rep_block_v1.h→src/ccu/ccu_api/resource/representation/reps/common/ccu_rep_block_v1.h+1-1
Rsrc/ccu/hcomm/resource/representation/reps/common/ccu_rep_load.cc→src/ccu/ccu_api/resource/representation/reps/common/ccu_rep_load.cc+7-7
Rsrc/ccu/hcomm/resource/representation/reps/common/ccu_rep_load_v1.h→src/ccu/ccu_api/resource/representation/reps/common/ccu_rep_load_v1.h+2-2
Rsrc/ccu/hcomm/resource/representation/reps/common/ccu_rep_load_var.cc→src/ccu/ccu_api/resource/representation/reps/common/ccu_rep_load_var.cc+7-8
Rsrc/ccu/hcomm/resource/representation/reps/common/ccu_rep_load_var_v1.h→src/ccu/ccu_api/resource/representation/reps/common/ccu_rep_load_var_v1.h+2-2
Rsrc/ccu/hcomm/resource/representation/reps/common/ccu_rep_loadarg.cc→src/ccu/ccu_api/resource/representation/reps/common/ccu_rep_loadarg.cc+6-7
Rsrc/ccu/hcomm/resource/representation/reps/common/ccu_rep_loadarg_v1.h→src/ccu/ccu_api/resource/representation/reps/common/ccu_rep_loadarg_v1.h+2-2
Rsrc/ccu/hcomm/resource/representation/reps/common/ccu_rep_nop.cc→src/ccu/ccu_api/resource/representation/reps/common/ccu_rep_nop.cc+6-6
Rsrc/ccu/hcomm/resource/representation/reps/common/ccu_rep_nop_v1.h→src/ccu/ccu_api/resource/representation/reps/common/ccu_rep_nop_v1.h+1-1
Rsrc/ccu/hcomm/resource/representation/reps/common/ccu_rep_store.cc→src/ccu/ccu_api/resource/representation/reps/common/ccu_rep_store.cc+7-7
Rsrc/ccu/hcomm/resource/representation/reps/common/ccu_rep_store_v1.h→src/ccu/ccu_api/resource/representation/reps/common/ccu_rep_store_v1.h+2-2
Rsrc/ccu/hcomm/resource/representation/reps/common/ccu_rep_store_var.cc→src/ccu/ccu_api/resource/representation/reps/common/ccu_rep_store_var.cc+7-8
Rsrc/ccu/hcomm/resource/representation/reps/common/ccu_rep_store_var_v1.h→src/ccu/ccu_api/resource/representation/reps/common/ccu_rep_store_var_v1.h+2-2
Rsrc/ccu/hcomm/resource/representation/reps/common/ccu_rep_type_v1.h→src/ccu/ccu_api/resource/representation/reps/common/ccu_rep_type_v1.h+0-0
Rsrc/ccu/hcomm/resource/representation/reps/control/ccu_rep_funcblock.cc→src/ccu/ccu_api/resource/representation/reps/control/ccu_rep_funcblock.cc+10-12
Rsrc/ccu/hcomm/resource/representation/reps/control/ccu_rep_funcblock_v1.h→src/ccu/ccu_api/resource/representation/reps/control/ccu_rep_funcblock_v1.h+3-3
Rsrc/ccu/hcomm/resource/representation/reps/control/ccu_rep_funccall.cc→src/ccu/ccu_api/resource/representation/reps/control/ccu_rep_funccall.cc+7-8
Rsrc/ccu/hcomm/resource/representation/reps/control/ccu_rep_funccall_v1.h→src/ccu/ccu_api/resource/representation/reps/control/ccu_rep_funccall_v1.h+3-3
Rsrc/ccu/hcomm/resource/representation/reps/control/ccu_rep_jump.cc→src/ccu/ccu_api/resource/representation/reps/control/ccu_rep_jump.cc+27-34
Rsrc/ccu/hcomm/resource/representation/reps/control/ccu_rep_jump_v1.h→src/ccu/ccu_api/resource/representation/reps/control/ccu_rep_jump_v1.h+5-5
Rsrc/ccu/hcomm/resource/representation/reps/control/ccu_rep_jumplabel.cc→src/ccu/ccu_api/resource/representation/reps/control/ccu_rep_jumplabel.cc+3-3
Rsrc/ccu/hcomm/resource/representation/reps/control/ccu_rep_jumplabel_v1.h→src/ccu/ccu_api/resource/representation/reps/control/ccu_rep_jumplabel_v1.h+1-1
Rsrc/ccu/hcomm/resource/representation/reps/data/ccu_rep_buflocread.cc→src/ccu/ccu_api/resource/representation/reps/data/ccu_rep_buflocread.cc+7-7
Rsrc/ccu/hcomm/resource/representation/reps/data/ccu_rep_buflocread_v1.h→src/ccu/ccu_api/resource/representation/reps/data/ccu_rep_buflocread_v1.h+2-2
Rsrc/ccu/hcomm/resource/representation/reps/data/ccu_rep_buflocwrite.cc→src/ccu/ccu_api/resource/representation/reps/data/ccu_rep_buflocwrite.cc+7-7
Rsrc/ccu/hcomm/resource/representation/reps/data/ccu_rep_buflocwrite_v1.h→src/ccu/ccu_api/resource/representation/reps/data/ccu_rep_buflocwrite_v1.h+2-2
Rsrc/ccu/hcomm/resource/representation/reps/data/ccu_rep_bufread.cc→src/ccu/ccu_api/resource/representation/reps/data/ccu_rep_bufread.cc+5-5
Rsrc/ccu/hcomm/resource/representation/reps/data/ccu_rep_bufread_v1.h→src/ccu/ccu_api/resource/representation/reps/data/ccu_rep_bufread_v1.h+2-2
Rsrc/ccu/hcomm/resource/representation/reps/data/ccu_rep_bufreduce.cc→src/ccu/ccu_api/resource/representation/reps/data/ccu_rep_bufreduce.cc+7-7
Rsrc/ccu/hcomm/resource/representation/reps/data/ccu_rep_bufreduce_v1.h→src/ccu/ccu_api/resource/representation/reps/data/ccu_rep_bufreduce_v1.h+2-2
Rsrc/ccu/hcomm/resource/representation/reps/data/ccu_rep_bufwrite.cc→src/ccu/ccu_api/resource/representation/reps/data/ccu_rep_bufwrite.cc+8-8
Rsrc/ccu/hcomm/resource/representation/reps/data/ccu_rep_bufwrite_v1.h→src/ccu/ccu_api/resource/representation/reps/data/ccu_rep_bufwrite_v1.h+2-2
Rsrc/ccu/hcomm/resource/representation/reps/data/ccu_rep_loccpy.cc→src/ccu/ccu_api/resource/representation/reps/data/ccu_rep_loccpy.cc+7-7
Rsrc/ccu/hcomm/resource/representation/reps/data/ccu_rep_loccpy_v1.h→src/ccu/ccu_api/resource/representation/reps/data/ccu_rep_loccpy_v1.h+2-2
Rsrc/ccu/hcomm/resource/representation/reps/data/ccu_rep_read.cc→src/ccu/ccu_api/resource/representation/reps/data/ccu_rep_read.cc+7-7
Rsrc/ccu/hcomm/resource/representation/reps/data/ccu_rep_read_v1.h→src/ccu/ccu_api/resource/representation/reps/data/ccu_rep_read_v1.h+2-2
Rsrc/ccu/hcomm/resource/representation/reps/data/ccu_rep_remMem.cc→src/ccu/ccu_api/resource/representation/reps/data/ccu_rep_remMem.cc+7-7
Rsrc/ccu/hcomm/resource/representation/reps/data/ccu_rep_remMem_v1.h→src/ccu/ccu_api/resource/representation/reps/data/ccu_rep_remMem_v1.h+2-2
Rsrc/ccu/hcomm/resource/representation/reps/data/ccu_rep_write.cc→src/ccu/ccu_api/resource/representation/reps/data/ccu_rep_write.cc+9-9
Rsrc/ccu/hcomm/resource/representation/reps/data/ccu_rep_write_v1.h→src/ccu/ccu_api/resource/representation/reps/data/ccu_rep_write_v1.h+2-2
Rsrc/ccu/hcomm/resource/representation/reps/logical/ccu_rep_and.cc→src/ccu/ccu_api/resource/representation/reps/logical/ccu_rep_and.cc+7-7
Rsrc/ccu/hcomm/resource/representation/reps/logical/ccu_rep_and.h→src/ccu/ccu_api/resource/representation/reps/logical/ccu_rep_and.h+2-2
Rsrc/ccu/hcomm/resource/representation/reps/logical/ccu_rep_not.cc→src/ccu/ccu_api/resource/representation/reps/logical/ccu_rep_not.cc+7-7
Rsrc/ccu/hcomm/resource/representation/reps/logical/ccu_rep_not.h→src/ccu/ccu_api/resource/representation/reps/logical/ccu_rep_not.h+2-2
Rsrc/ccu/hcomm/resource/representation/reps/logical/ccu_rep_or.cc→src/ccu/ccu_api/resource/representation/reps/logical/ccu_rep_or.cc+7-7
Rsrc/ccu/hcomm/resource/representation/reps/logical/ccu_rep_or.h→src/ccu/ccu_api/resource/representation/reps/logical/ccu_rep_or.h+2-2
Rsrc/ccu/hcomm/resource/representation/reps/logical/ccu_rep_xor.cc→src/ccu/ccu_api/resource/representation/reps/logical/ccu_rep_xor.cc+7-7
Rsrc/ccu/hcomm/resource/representation/reps/logical/ccu_rep_xor.h→src/ccu/ccu_api/resource/representation/reps/logical/ccu_rep_xor.h+2-2
Rsrc/ccu/hcomm/resource/representation/reps/loop/ccu_rep_loop.cc→src/ccu/ccu_api/resource/representation/reps/loop/ccu_rep_loop.cc+4-4
Rsrc/ccu/hcomm/resource/representation/reps/loop/ccu_rep_loop_v1.h→src/ccu/ccu_api/resource/representation/reps/loop/ccu_rep_loop_v1.h+3-3
Rsrc/ccu/hcomm/resource/representation/reps/loop/ccu_rep_loopblock.cc→src/ccu/ccu_api/resource/representation/reps/loop/ccu_rep_loopblock.cc+2-2
Rsrc/ccu/hcomm/resource/representation/reps/loop/ccu_rep_loopblock_v1.h→src/ccu/ccu_api/resource/representation/reps/loop/ccu_rep_loopblock_v1.h+2-2
Rsrc/ccu/hcomm/resource/representation/reps/loop/ccu_rep_loopcall.cc→src/ccu/ccu_api/resource/representation/reps/loop/ccu_rep_loopcall.cc+4-4
Rsrc/ccu/hcomm/resource/representation/reps/loop/ccu_rep_loopcall_v1.h→src/ccu/ccu_api/resource/representation/reps/loop/ccu_rep_loopcall_v1.h+2-2
Rsrc/ccu/hcomm/resource/representation/reps/loop/ccu_rep_loopgroup_bundle.cc→src/ccu/ccu_api/resource/representation/reps/loop/ccu_rep_loopgroup_bundle.cc+5-6
Rsrc/ccu/hcomm/resource/representation/reps/loop/ccu_rep_loopgroup_bundle_v1.h→src/ccu/ccu_api/resource/representation/reps/loop/ccu_rep_loopgroup_bundle_v1.h+4-4
Rsrc/ccu/hcomm/resource/representation/reps/loop/ccu_rep_setloop.cc→src/ccu/ccu_api/resource/representation/reps/loop/ccu_rep_setloop.cc+6-6
Rsrc/ccu/hcomm/resource/representation/reps/loop/ccu_rep_setloop_v1.h→src/ccu/ccu_api/resource/representation/reps/loop/ccu_rep_setloop_v1.h+2-2
Rsrc/ccu/hcomm/resource/representation/reps/shift/ccu_rep_shl.cc→src/ccu/ccu_api/resource/representation/reps/shift/ccu_rep_shl.cc+7-7
Rsrc/ccu/hcomm/resource/representation/reps/shift/ccu_rep_shl.h→src/ccu/ccu_api/resource/representation/reps/shift/ccu_rep_shl.h+2-2
Rsrc/ccu/hcomm/resource/representation/reps/shift/ccu_rep_shr.cc→src/ccu/ccu_api/resource/representation/reps/shift/ccu_rep_shr.cc+7-7
Rsrc/ccu/hcomm/resource/representation/reps/shift/ccu_rep_shr.h→src/ccu/ccu_api/resource/representation/reps/shift/ccu_rep_shr.h+2-2
Rsrc/ccu/hcomm/resource/representation/reps/sync/ccu_rep_loc_record_event.cc→src/ccu/ccu_api/resource/representation/reps/sync/ccu_rep_loc_record_event.cc+6-6
Rsrc/ccu/hcomm/resource/representation/reps/sync/ccu_rep_loc_record_event.h→src/ccu/ccu_api/resource/representation/reps/sync/ccu_rep_loc_record_event.h+2-2
Rsrc/ccu/hcomm/resource/representation/reps/sync/ccu_rep_loc_wait_event.cc→src/ccu/ccu_api/resource/representation/reps/sync/ccu_rep_loc_wait_event.cc+8-8
Rsrc/ccu/hcomm/resource/representation/reps/sync/ccu_rep_loc_wait_event.h→src/ccu/ccu_api/resource/representation/reps/sync/ccu_rep_loc_wait_event.h+2-2
Rsrc/ccu/hcomm/resource/representation/reps/sync/ccu_rep_loc_wait_notify.cc→src/ccu/ccu_api/resource/representation/reps/sync/ccu_rep_loc_wait_notify.cc+8-8
Rsrc/ccu/hcomm/resource/representation/reps/sync/ccu_rep_loc_wait_notify.h→src/ccu/ccu_api/resource/representation/reps/sync/ccu_rep_loc_wait_notify.h+2-2
Rsrc/ccu/hcomm/resource/representation/reps/sync/ccu_rep_record_shared_notify.cc→src/ccu/ccu_api/resource/representation/reps/sync/ccu_rep_record_shared_notify.cc+7-7
Rsrc/ccu/hcomm/resource/representation/reps/sync/ccu_rep_record_shared_notify.h→src/ccu/ccu_api/resource/representation/reps/sync/ccu_rep_record_shared_notify.h+2-2
Rsrc/ccu/hcomm/resource/representation/reps/sync/ccu_rep_rempostsem.cc→src/ccu/ccu_api/resource/representation/reps/sync/ccu_rep_rempostsem.cc+6-6
Rsrc/ccu/hcomm/resource/representation/reps/sync/ccu_rep_rempostsem_v1.h→src/ccu/ccu_api/resource/representation/reps/sync/ccu_rep_rempostsem_v1.h+1-1
Rsrc/ccu/hcomm/resource/representation/reps/sync/ccu_rep_rempostvar.cc→src/ccu/ccu_api/resource/representation/reps/sync/ccu_rep_rempostvar.cc+7-7
Rsrc/ccu/hcomm/resource/representation/reps/sync/ccu_rep_rempostvar_v1.h→src/ccu/ccu_api/resource/representation/reps/sync/ccu_rep_rempostvar_v1.h+2-2
Rsrc/ccu/hcomm/resource/representation/reps/sync/ccu_rep_remwaitsem.cc→src/ccu/ccu_api/resource/representation/reps/sync/ccu_rep_remwaitsem.cc+7-7
Rsrc/ccu/hcomm/resource/representation/reps/sync/ccu_rep_remwaitsem_v1.h→src/ccu/ccu_api/resource/representation/reps/sync/ccu_rep_remwaitsem_v1.h+1-1
Rsrc/ccu/hcomm/resource/representation/reps/translator/ccu_ins_generater_base.h→src/ccu/ccu_api/resource/representation/reps/translator/ccu_ins_generater_base.h+6-6
Rsrc/ccu/hcomm/resource/representation/reps/translator/ccu_ins_generater_v1.cc→src/ccu/ccu_api/resource/representation/reps/translator/ccu_ins_generater_v1.cc+7-7
Rsrc/ccu/hcomm/resource/representation/reps/translator/ccu_ins_generater_v1.h→src/ccu/ccu_api/resource/representation/reps/translator/ccu_ins_generater_v1.h+1-1
Rsrc/ccu/hcomm/resource/representation/reps/translator/ccu_rep_reference_manager.cc→src/ccu/ccu_api/resource/representation/reps/translator/ccu_rep_reference_manager.cc+2-2
Rsrc/ccu/hcomm/resource/representation/reps/translator/ccu_rep_reference_manager_v1.h→src/ccu/ccu_api/resource/representation/reps/translator/ccu_rep_reference_manager_v1.h+3-3
Rsrc/ccu/hcomm/resource/representation/reps/translator/ccu_rep_translator.cc→src/ccu/ccu_api/resource/representation/reps/translator/ccu_rep_translator.cc+11-11
Rsrc/ccu/hcomm/resource/representation/reps/translator/ccu_rep_translator_v1.h→src/ccu/ccu_api/resource/representation/reps/translator/ccu_rep_translator_v1.h+7-7
Rsrc/ccu/experimental/ccu_runtime_hcomm_backend.cpp→src/ccu/experimental/ccu_runtime_asccomm_backend.cpp+1-1
Rsrc/ccu/experimental/ccu_runtime_hcomm_backend.h→src/ccu/experimental/ccu_runtime_asccomm_backend.h+0-0
Rtests/ut/ccu/hcomm/CMakeLists.txt→tests/ut/ccu/ccu_api/CMakeLists.txt+39-15
Rtests/ut/ccu/hcomm/ccu_kernel_impl/ccu_func_call_demo.h→tests/ut/ccu/ccu_api/ccu_kernel_impl/ccu_func_call_demo.h+9-9
Rtests/ut/ccu/hcomm/ccu_kernel_impl/ccu_groupcopy_alg.cc→tests/ut/ccu/ccu_api/ccu_kernel_impl/ccu_groupcopy_alg.cc+5-5
Rtests/ut/ccu/hcomm/ccu_kernel_impl/ccu_groupcopy_demo.h→tests/ut/ccu/ccu_api/ccu_kernel_impl/ccu_groupcopy_demo.h+9-9
Rtests/ut/ccu/hcomm/ccu_kernel_impl/ccu_groupcopy_kernel.cc→tests/ut/ccu/ccu_api/ccu_kernel_impl/ccu_groupcopy_kernel.cc+15-15
Rtests/ut/ccu/hcomm/ccu_kernel_impl/ccu_jump_demo.h→tests/ut/ccu/ccu_api/ccu_kernel_impl/ccu_jump_demo.h+21-21
Rtests/ut/ccu/hcomm/ccu_kernel_impl/ccu_loop_add_demo.h→tests/ut/ccu/ccu_api/ccu_kernel_impl/ccu_loop_add_demo.h+21-21
Rtests/ut/ccu/hcomm/ccu_kernel_impl/ccu_reduce_scatter_mesh1d_demo.h→tests/ut/ccu/ccu_api/ccu_kernel_impl/ccu_reduce_scatter_mesh1d_demo.h+22-22
Rtests/ut/ccu/hcomm/ccu_kernel_impl/ccu_var_add_simple_demo.h→tests/ut/ccu/ccu_api/ccu_kernel_impl/ccu_var_add_simple_demo.h+26-26
Rtests/ut/ccu/hcomm/ccu_variable/CMakeLists.txt→tests/ut/ccu/ccu_api/ccu_variable/CMakeLists.txt+59-57
Rtests/ut/ccu/hcomm/ccu_variable/ccu_variable_ut_stub.cc→tests/ut/ccu/ccu_api/ccu_variable/ccu_variable_ut_stub.cc+163-163
Rtests/ut/ccu/hcomm/ccu_variable/ccu_variable_ut_stub.h→tests/ut/ccu/ccu_api/ccu_variable/ccu_variable_ut_stub.h+2-2
Rtests/ut/ccu/hcomm/ccu_variable/main.cc→tests/ut/ccu/ccu_api/ccu_variable/main.cc+0-0
Rtests/ut/ccu/hcomm/ccu_variable/ut_ccu_variable_test.cc→tests/ut/ccu/ccu_api/ccu_variable/ut_ccu_variable_test.cc+38-36
Rtests/ut/ccu/hcomm/common/ut_ccu_print.cc→tests/ut/ccu/ccu_api/common/ut_ccu_print.cc+67-52
Rtests/ut/ccu/hcomm/common/ut_ccu_print_a5_translate.cc→tests/ut/ccu/ccu_api/common/ut_ccu_print_a5_translate.cc+9-9
Rtests/ut/ccu/hcomm/common/ut_ccu_print_disabled.cc→tests/ut/ccu/ccu_api/common/ut_ccu_print_disabled.cc+4-4
Rtests/ut/ccu/hcomm/main.cc→tests/ut/ccu/ccu_api/main.cc+0-0
Rtests/ut/ccu/hcomm/resource/channel/CMakeLists.txt→tests/ut/ccu/ccu_api/resource/channel/CMakeLists.txt+3-3
Rtests/ut/ccu/hcomm/resource/channel/ut_ccu_channel_test.cc→tests/ut/ccu/ccu_api/resource/channel/ut_ccu_channel_test.cc+1-1
Rtests/ut/ccu/hcomm/resource/common/asc_ccu_res_snapshot_main.cc→tests/ut/ccu/ccu_api/resource/common/asc_ccu_res_snapshot_main.cc+0-0
Rtests/ut/ccu/hcomm/resource/common/ut_asc_ccu_res_snapshot.cc→tests/ut/ccu/ccu_api/resource/common/ut_asc_ccu_res_snapshot.cc+35-35
Rtests/ut/ccu/hcomm/resource/kernel/ut_ccu_kernel_res_allocator.cc→tests/ut/ccu/ccu_api/resource/kernel/ut_ccu_kernel_res_allocator.cc+5-5
Rtests/ut/ccu/hcomm/resource/microcode/CMakeLists.txt→tests/ut/ccu/ccu_api/resource/microcode/CMakeLists.txt+4-4
Rtests/ut/ccu/hcomm/resource/microcode/main.cc→tests/ut/ccu/ccu_api/resource/microcode/main.cc+0-0
Rtests/ut/ccu/hcomm/resource/microcode/ut_ccu_assist_test.cc→tests/ut/ccu/ccu_api/resource/microcode/ut_ccu_assist_test.cc+4-4
Rtests/ut/ccu/hcomm/resource/microcode/ut_ccu_microcode.cc→tests/ut/ccu/ccu_api/resource/microcode/ut_ccu_microcode.cc+1-1
Rtests/ut/ccu/hcomm/resource/microcode/ut_ccu_microcode_v1_test.cc→tests/ut/ccu/ccu_api/resource/microcode/ut_ccu_microcode_v1_test.cc+1-1
Rtests/ut/ccu/hcomm/resource/microcode_opt/CMakeLists.txt→tests/ut/ccu/ccu_api/resource/microcode_opt/CMakeLists.txt+7-7
Rtests/ut/ccu/hcomm/resource/microcode_opt/main.cc→tests/ut/ccu/ccu_api/resource/microcode_opt/main.cc+0-0
Rtests/ut/ccu/hcomm/resource/microcode_opt/ut_extract_operands_test.cc→tests/ut/ccu/ccu_api/resource/microcode_opt/ut_extract_operands_test.cc+3-3
Rtests/ut/ccu/hcomm/resource/microcode_opt/ut_instruction_scheduler_test.cc→tests/ut/ccu/ccu_api/resource/microcode_opt/ut_instruction_scheduler_test.cc+3-3
Rtests/ut/ccu/hcomm/resource/microcode_opt/ut_microcode_optimizer_test.cc→tests/ut/ccu/ccu_api/resource/microcode_opt/ut_microcode_optimizer_test.cc+3-3
Rtests/ut/ccu/hcomm/resource/representation/context/CMakeLists.txt→tests/ut/ccu/ccu_api/resource/representation/context/CMakeLists.txt+41-41
Rtests/ut/ccu/hcomm/resource/representation/context/main.cc→tests/ut/ccu/ccu_api/resource/representation/context/main.cc+0-0
Rtests/ut/ccu/hcomm/resource/representation/context/ut_ccu_rep_context_test.cc→tests/ut/ccu/ccu_api/resource/representation/context/ut_ccu_rep_context_test.cc+7-7
Rtests/ut/ccu/hcomm/resource/representation/interface/CMakeLists.txt→tests/ut/ccu/ccu_api/resource/representation/interface/CMakeLists.txt+40-40
Rtests/ut/ccu/hcomm/resource/representation/interface/main.cc→tests/ut/ccu/ccu_api/resource/representation/interface/main.cc+0-0
Rtests/ut/ccu/hcomm/resource/representation/interface/ut_ccu_interface_assist.cc→tests/ut/ccu/ccu_api/resource/representation/interface/ut_ccu_interface_assist.cc+4-4
Rtests/ut/ccu/hcomm/resource/representation/interface/ut_ccu_rep_interface_test.cc→tests/ut/ccu/ccu_api/resource/representation/interface/ut_ccu_rep_interface_test.cc+12-12
Rtests/ut/ccu/hcomm/resource/representation/reps/arithmetic/CMakeLists.txt→tests/ut/ccu/ccu_api/resource/representation/reps/arithmetic/CMakeLists.txt+41-41
Rtests/ut/ccu/hcomm/resource/representation/reps/arithmetic/main.cc→tests/ut/ccu/ccu_api/resource/representation/reps/arithmetic/main.cc+0-0
Rtests/ut/ccu/hcomm/resource/representation/reps/arithmetic/ut_ccu_rep_arithmetic_test.cc→tests/ut/ccu/ccu_api/resource/representation/reps/arithmetic/ut_ccu_rep_arithmetic_test.cc+10-10
Rtests/ut/ccu/hcomm/resource/representation/reps/common/CMakeLists.txt→tests/ut/ccu/ccu_api/resource/representation/reps/common/CMakeLists.txt+46-46
Rtests/ut/ccu/hcomm/resource/representation/reps/common/main.cc→tests/ut/ccu/ccu_api/resource/representation/reps/common/main.cc+0-0
Rtests/ut/ccu/hcomm/resource/representation/reps/common/ut_ccu_rep_common_test.cc→tests/ut/ccu/ccu_api/resource/representation/reps/common/ut_ccu_rep_common_test.cc+2-2
Rtests/ut/ccu/hcomm/resource/representation/reps/control/CMakeLists.txt→tests/ut/ccu/ccu_api/resource/representation/reps/control/CMakeLists.txt+36-36
Rtests/ut/ccu/hcomm/resource/representation/reps/control/main.cc→tests/ut/ccu/ccu_api/resource/representation/reps/control/main.cc+0-0
Rtests/ut/ccu/hcomm/resource/representation/reps/control/ut_ccu_rep_control_test.cc→tests/ut/ccu/ccu_api/resource/representation/reps/control/ut_ccu_rep_control_test.cc+4-4
Rtests/ut/ccu/hcomm/resource/representation/reps/data/main.cc→tests/ut/ccu/ccu_api/resource/representation/reps/data/main.cc+0-0
Rtests/ut/ccu/hcomm/resource/representation/reps/data/ut_ccu_rep_data_test.cc→tests/ut/ccu/ccu_api/resource/representation/reps/data/ut_ccu_rep_data_test.cc+15-15
Rtests/ut/ccu/hcomm/resource/representation/reps/logical/main.cc→tests/ut/ccu/ccu_api/resource/representation/reps/logical/main.cc+0-0
Rtests/ut/ccu/hcomm/resource/representation/reps/logical/ut_ccu_rep_logical_test.cc→tests/ut/ccu/ccu_api/resource/representation/reps/logical/ut_ccu_rep_logical_test.cc+7-7
Rtests/ut/ccu/hcomm/resource/representation/reps/loop/CMakeLists.txt→tests/ut/ccu/ccu_api/resource/representation/reps/loop/CMakeLists.txt+32-32
Rtests/ut/ccu/hcomm/resource/representation/reps/loop/main.cc→tests/ut/ccu/ccu_api/resource/representation/reps/loop/main.cc+0-0
Rtests/ut/ccu/hcomm/resource/representation/reps/loop/ut_ccu_rep_loop_test.cc→tests/ut/ccu/ccu_api/resource/representation/reps/loop/ut_ccu_rep_loop_test.cc+16-16
Rtests/ut/ccu/hcomm/resource/representation/reps/shift/main.cc→tests/ut/ccu/ccu_api/resource/representation/reps/shift/main.cc+0-0
Rtests/ut/ccu/hcomm/resource/representation/reps/shift/ut_ccu_rep_shift_test.cc→tests/ut/ccu/ccu_api/resource/representation/reps/shift/ut_ccu_rep_shift_test.cc+5-5
Rtests/ut/ccu/hcomm/resource/representation/reps/sync/CMakeLists.txt→tests/ut/ccu/ccu_api/resource/representation/reps/sync/CMakeLists.txt+27-27
Rtests/ut/ccu/hcomm/resource/representation/reps/sync/main.cc→tests/ut/ccu/ccu_api/resource/representation/reps/sync/main.cc+0-0
Rtests/ut/ccu/hcomm/resource/representation/reps/sync/ut_ccu_rep_sync_test.cc→tests/ut/ccu/ccu_api/resource/representation/reps/sync/ut_ccu_rep_sync_test.cc+11-11
Rtests/ut/ccu/hcomm/resource/representation/translator/main.cc→tests/ut/ccu/ccu_api/resource/representation/translator/main.cc+0-0
Rtests/ut/ccu/hcomm/resource/representation/translator/ut_ccu_rep_reference_manager_test.cc→tests/ut/ccu/ccu_api/resource/representation/translator/ut_ccu_rep_reference_manager_test.cc+6-6
Rtests/ut/ccu/hcomm/resource/representation/translator/ut_ccu_rep_translator_test.cc→tests/ut/ccu/ccu_api/resource/representation/translator/ut_ccu_rep_translator_test.cc+15-15
Rtests/ut/ccu/hcomm/ut_ccu_primitives_transfer.cc→tests/ut/ccu/ccu_api/ut_ccu_primitives_transfer.cc+27-27
Rtests/ut/ccu/hcomm_compat/include/hcomm_adapter_rts.h→tests/ut/ccu/ccu_api_compat/include/asccomm_adapter_rts.h+1-1
Rtests/ut/ccu/hcomm_compat/include/hcomm_c_adpt.h→tests/ut/ccu/ccu_api_compat/include/asccomm_c_adpt.h+3-3
Rtests/ut/ccu/hcomm_compat/include/hcomm_primitives.h→tests/ut/ccu/ccu_api_compat/include/asccomm_primitives.h+1-1
Rtests/ut/ccu/hcomm_compat/include/hcomm/resource/kernel/ccu_kernel.h.shadow.bak→tests/ut/ccu/ccu_api_compat/include/ccu_api/resource/kernel/ccu_kernel.h.shadow.bak+3-3
Rtests/ut/ccu/hcomm_compat/include/ccu_api_exception.h→tests/ut/ccu/ccu_api_compat/include/ccu_api_exception.h+0-0
Rtests/ut/ccu/hcomm_compat/include/ccu_dev_mgr_imp.h→tests/ut/ccu/ccu_api_compat/include/ccu_dev_mgr_imp.h+1-1
Rtests/ut/ccu/hcomm_compat/include/ccu_urma_channel.h→tests/ut/ccu/ccu_api_compat/include/ccu_urma_channel.h+0-0
Rtests/ut/ccu/hcomm_compat/include/ccu_urma_channel_compat.h→tests/ut/ccu/ccu_api_compat/include/ccu_urma_channel_compat.h+2-2
Rtests/ut/ccu/hcomm_compat/include/ccu_ut_legacy_compat.h→tests/ut/ccu/ccu_api_compat/include/ccu_ut_legacy_compat.h+0-0
Rtests/ut/ccu/hcomm_compat/include/const_val.h→tests/ut/ccu/ccu_api_compat/include/const_val.h+0-0
Rtests/ut/ccu/hcomm_compat/include/data_type.h→tests/ut/ccu/ccu_api_compat/include/data_type.h+0-0
Rtests/ut/ccu/hcomm_compat/include/exception_defination.h→tests/ut/ccu/ccu_api_compat/include/exception_defination.h+1-1
Rtests/ut/ccu/hcomm_compat/include/exception_util.h→tests/ut/ccu/ccu_api_compat/include/exception_util.h+0-0
Rtests/ut/ccu/hcomm_compat/include/hccl_exception.h→tests/ut/ccu/ccu_api_compat/include/hccl_exception.h+0-0
Rtests/ut/ccu/hcomm_compat/include/hccl_res.h→tests/ut/ccu/ccu_api_compat/include/hccl_res.h+0-0
Rtests/ut/ccu/hcomm_compat/include/internal_exception.h→tests/ut/ccu/ccu_api_compat/include/internal_exception.h+0-0
Rtests/ut/ccu/hcomm_compat/include/log.h→tests/ut/ccu/ccu_api_compat/include/log.h+0-0
Rtests/ut/ccu/hcomm_compat/include/null_ptr_exception.h→tests/ut/ccu/ccu_api_compat/include/null_ptr_exception.h+0-0
Rtests/ut/ccu/hcomm_compat/include/reduce_op.h→tests/ut/ccu/ccu_api_compat/include/reduce_op.h+0-0
Rtests/ut/ccu/hcomm_compat/include/string_util.h→tests/ut/ccu/ccu_api_compat/include/string_util.h+0-0
Rtests/ut/ccu/hcomm_compat/include/task_param.h→tests/ut/ccu/ccu_api_compat/include/task_param.h+0-0
Rtests/ut/ccu/hcomm_compat/source/base_comm/resources/ccu/ccu_representation/context/.gitkeep→tests/ut/ccu/ccu_api_compat/source/base_comm/resources/ccu/ccu_representation/context/.gitkeep+0-0
Rtests/ut/ccu/hcomm_compat/source/base_comm/resources/ccu/ccu_representation/reps/data/.gitkeep→tests/ut/ccu/ccu_api_compat/source/base_comm/resources/ccu/ccu_representation/reps/data/.gitkeep+0-0
Rtests/ut/ccu/hcomm_compat/source/base_comm/resources/ccu/ccu_representation/reps/sync/.gitkeep→tests/ut/ccu/ccu_api_compat/source/base_comm/resources/ccu/ccu_representation/reps/sync/.gitkeep+0-0
Rtests/ut/ccu/hcomm_compat/source/base_comm/resources/endpoint_pairs/channels/ccu/ccu_urma_channel.h→tests/ut/ccu/ccu_api_compat/source/base_comm/resources/endpoint_pairs/channels/ccu/ccu_urma_channel.h+0-0