GetRuntimeUBSize
Applicability
Product |
Supported |
|---|---|
Atlas 350 Accelerator Card |
√ |
x |
|
x |
|
x |
|
x |
|
x |
|
x |
Function Usage
Obtains the runtime UB size, in bytes. Developers can calculate the number of cycles based on the UB size.
Prototype
1 | __aicore__ inline uint32_t GetRuntimeUBSize() |
Parameters
None
Returns
Runtime UB size, in bytes.
Under the Atlas 350 Accelerator Card architecture, in mixed SIMD and SIMT scenarios, the maximum UB size is 216 KB; in non-mixed SIMD and SIMT scenarios, the return value is fixed at 248 KB.
Restrictions
None
Example
This example shows how to calculate the value of tileNum based on the UB size obtained by calling GetRuntimeUBSize.
1 2 3 4 5 6 7 | // Define the total length of data to be processed (number of elements). uint32_t totalLength = 126976; // GetRuntimeUBSize() / sizeof(half) -> Calculate the number of half elements that the UB can accommodate. // Divide by 2 -> Reserve 50% of the UB space. uint32_t tileLength = AscendC::GetRuntimeUBSize() / sizeof(half) / 2; // Number of tiles to be iterated: 126976/63488 = 2 uint32_t tileNum = totalLength / tileLength; |
Parent topic: Tool Functions