flashinfer.testing.attention_tflops_per_sec

flashinfer.testing.attention_tflops_per_sec(batch_size, qo_seqlen, kv_seqlen, head_dim_qk, head_dim_vo, num_qo_heads, causal, time)

Calculate TFLOPS per second for a given attention layer. Assumes all sequence lengths are the same within the batch.

Parameters:
  • batch_size (int) – Batch size.

  • qo_seqlen (int) – Sequence length of the query.

  • kv_seqlen (int) – Sequence length of the key and value.

  • head_dim_qk (int) – Head dimension of the query and key.

  • head_dim_vo (int) – Head dimension of the value.

  • num_qo_heads (int) – Number of query heads.

  • causal (bool) – Whether to use causal masking.

  • time (float) – Execution time in milliseconds.

Returns:

TFLOPS per second for the layer.

Return type:

tflops_per_sec (float)