VacantInQue
Product Support
|
Product |
Supported |
|---|---|
|
|
√ |
|
|
√ |
|
|
√ |
|
|
√ |
|
|
x |
|
|
√ |
Function
Checks whether a queue is full.
Prototype
1
|
__aicore__ inline bool VacantInQue() |
Parameters
None
Restrictions
This API does not support inplace tensor operations, that is, the scenario where the depth of TQue is set to 0.
Returns
- true: The queue is not full and the EnQue operation can be performed.
- false: The queue is full and no more tensors can be added.
Example
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
// Check whether the current queue is full based on VacantInQue and set the current queue depth to 4. AscendC::TPipe pipe; AscendC::TQueBind<AscendC::TPosition::VECOUT, AscendC::TPosition::GM, 4> que; int num = 10; int len = 1024; pipe.InitBuffer(que, num, len); bool ret = que.VacantInQue(); // The return is true. AscendC::LocalTensor<half> tensor1 = que.AllocTensor<half>(); AscendC::LocalTensor<half> tensor2 = que.AllocTensor<half>(); AscendC::LocalTensor<half> tensor3 = que.AllocTensor<half>(); AscendC::LocalTensor<half> tensor4 = que.AllocTensor<half>(); AscendC::LocalTensor<half> tensor5 = que.AllocTensor<half>(); que.EnQue(tensor1);// Add tensor1 to the queue of VECOUT. que.EnQue(tensor2);// Add tensor2 to the queue of VECOUT. que.EnQue(tensor3);// Add tensor3 to the queue of VECOUT. que.EnQue(tensor4);// Add tensor4 to the queue of VECOUT. ret = que.VacantInQue(); // The return is false. An error is reported if the EnQue operation continues. |
Parent topic: TQueBind