VacantInQue

Product Support

Product

Supported

Atlas A3 training products / Atlas A3 inference products

Atlas A2 training products / Atlas A2 inference products

Atlas 200I/500 A2 inference products

Atlas inference product 's AI Core

Atlas inference product 's Vector Core

x

Atlas training products

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::TQue<AscendC::TPosition::VECOUT, 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.