已合并
修复样例中的同步错误 #6254
UFOunder创建于 9月20日
修复样例中的同步错误 #6254
已合并
共 2 个文件变更+8-7
| @@ -100,14 +100,14 @@ public: | |||
| 100 | CopyInBias(bias1Local); | 100 | CopyInBias(bias1Local); |
| 101 | } | 101 | } |
| 102 | 102 | ||
| 103 | - AscendC::SetFlag<AscendC::HardEvent::MTE2_MTE1>(EVENT_ID0); | 103 | + AscendC::PipeBarrier<PIPE_MTE2>(); |
| 104 | - AscendC::WaitFlag<AscendC::HardEvent::MTE2_MTE1>(EVENT_ID0); | ||
| 105 | 104 | ||
| 106 | // ---- Fill: 无效数据置0,防止脏数据参与Mmad ---- | 105 | // ---- Fill: 无效数据置0,防止脏数据参与Mmad ---- |
| 107 | FillZeroInA1(a1Local); | 106 | FillZeroInA1(a1Local); |
| 108 | FillZeroInB1(b1Local); | 107 | FillZeroInB1(b1Local); |
| 109 | 108 | ||
| 110 | - AscendC::PipeBarrier<PIPE_MTE1>(); | 109 | + AscendC::SetFlag<AscendC::HardEvent::MTE2_MTE1>(EVENT_ID0); |
| 110 | + AscendC::WaitFlag<AscendC::HardEvent::MTE2_MTE1>(EVENT_ID0); | ||
| 111 | 111 | ||
| 112 | // L1 -> L0A | 112 | // L1 -> L0A |
| 113 | AscendC::LocalTensor<TA> a2Local(AscendC::TPosition::A2, 0, aSizeAlignL0); | 113 | AscendC::LocalTensor<TA> a2Local(AscendC::TPosition::A2, 0, aSizeAlignL0); |
| @@ -127,7 +127,8 @@ public: | |||
| 127 | // Ascend 950PR/Ascend 950DT不支持直接初始化L0A和L0B,所以通过Fill初始化L1,再通过LoadData搬运到L0A和L0B | 127 | // Ascend 950PR/Ascend 950DT不支持直接初始化L0A和L0B,所以通过Fill初始化L1,再通过LoadData搬运到L0A和L0B |
| 128 | InitConstA1(a1Local); | 128 | InitConstA1(a1Local); |
| 129 | InitConstB1(b1Local); | 129 | InitConstB1(b1Local); |
| 130 | - AscendC::PipeBarrier<PIPE_MTE1>(); | 130 | + AscendC::SetFlag<AscendC::HardEvent::MTE2_MTE1>(EVENT_ID0); |
| 131 | + AscendC::WaitFlag<AscendC::HardEvent::MTE2_MTE1>(EVENT_ID0); | ||
| 131 | Load2DA1ToA2(a1Local, a2Local); | 132 | Load2DA1ToA2(a1Local, a2Local); |
| 132 | Load2DB1ToB2(b1Local, b2Local); | 133 | Load2DB1ToB2(b1Local, b2Local); |
| 133 | #endif | 134 | #endif |
| @@ -142,10 +143,10 @@ public: | |||
| 142 | 143 | ||
| 143 | private: | 144 | private: |
| 144 | uint64_t a1Addr = 0; | 145 | uint64_t a1Addr = 0; |
| 145 | - uint64_t b1Addr = 0; | 146 | + uint64_t b1Addr = a1Addr + static_cast<uint64_t>(M) * K * sizeof(T); |
| 146 | uint64_t a2Addr = 0; | 147 | uint64_t a2Addr = 0; |
| 147 | - uint64_t b2Addr = a2Addr + static_cast<uint64_t>(M) * K * sizeof(T); | 148 | + uint64_t b2Addr = 0; |
| 148 | - uint64_t co1Addr = b2Addr + static_cast<uint64_t>(N) * K * sizeof(U); | 149 | + uint64_t co1Addr = 0; |
| 149 | AscendC::GlobalTensor<T> aGlobal; | 150 | AscendC::GlobalTensor<T> aGlobal; |
| 150 | AscendC::GlobalTensor<U> bGlobal; | 151 | AscendC::GlobalTensor<U> bGlobal; |
| 151 | AscendC::GlobalTensor<S> cGlobal; | 152 | AscendC::GlobalTensor<S> cGlobal; |