[v2,05/16] test/bbdev: enable early termination for validation

Message ID 20230215170949.60569-6-hernan.vargas@intel.com (mailing list archive)
State Superseded, archived
Delegated to: Maxime Coquelin
Headers
Series test/bbdev: changes for 23.03 |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Hernan Vargas Feb. 15, 2023, 5:09 p.m. UTC
  Enhancement to enable early termination for validation tests if the
device supports it.

Signed-off-by: Hernan Vargas <hernan.vargas@intel.com>
---
 app/test-bbdev/test_bbdev_perf.c | 30 +++++++++++++++++++-----------
 1 file changed, 19 insertions(+), 11 deletions(-)
  

Comments

Maxime Coquelin Feb. 20, 2023, 8:12 p.m. UTC | #1
On 2/15/23 18:09, Hernan Vargas wrote:
> Enhancement to enable early termination for validation tests if the
> device supports it.
> 
> Signed-off-by: Hernan Vargas <hernan.vargas@intel.com>
> ---
>   app/test-bbdev/test_bbdev_perf.c | 30 +++++++++++++++++++-----------
>   1 file changed, 19 insertions(+), 11 deletions(-)
> 
> diff --git a/app/test-bbdev/test_bbdev_perf.c b/app/test-bbdev/test_bbdev_perf.c
> index dede0f900e..8c4b82efca 100644
> --- a/app/test-bbdev/test_bbdev_perf.c
> +++ b/app/test-bbdev/test_bbdev_perf.c
> @@ -3775,11 +3775,11 @@ throughput_pmd_lcore_ldpc_dec(void *arg)
>   	TEST_ASSERT_SUCCESS(ret, "Allocation failed for %d ops", num_ops);
>   
>   	/* For throughput tests we need to disable early termination */
> -	if (check_bit(ref_op->ldpc_dec.op_flags,
> -			RTE_BBDEV_LDPC_ITERATION_STOP_ENABLE))
> -		ref_op->ldpc_dec.op_flags -=
> -				RTE_BBDEV_LDPC_ITERATION_STOP_ENABLE;
> +	if (check_bit(ref_op->ldpc_dec.op_flags, RTE_BBDEV_LDPC_ITERATION_STOP_ENABLE))
> +		ref_op->ldpc_dec.op_flags -= RTE_BBDEV_LDPC_ITERATION_STOP_ENABLE;
> +
>   	ref_op->ldpc_dec.iter_max = get_iter_max();
> +	/* Since ET is disabled, the expected iter_count is iter_max */
>   	ref_op->ldpc_dec.iter_count = ref_op->ldpc_dec.iter_max;
>   
>   	if (test_vector.op_type != RTE_BBDEV_OP_NONE)
> @@ -4465,7 +4465,7 @@ latency_test_dec(struct rte_mempool *mempool,
>   		struct test_buffers *bufs, struct rte_bbdev_dec_op *ref_op,
>   		int vector_mask, uint16_t dev_id, uint16_t queue_id,
>   		const uint16_t num_to_process, uint16_t burst_sz,
> -		uint64_t *total_time, uint64_t *min_time, uint64_t *max_time)
> +		uint64_t *total_time, uint64_t *min_time, uint64_t *max_time, bool disable_et)
>   {
>   	int ret = TEST_SUCCESS;
>   	uint16_t i, j, dequeued;
> @@ -4481,8 +4481,14 @@ latency_test_dec(struct rte_mempool *mempool,
>   			burst_sz = num_to_process - dequeued;
>   
>   		ret = rte_bbdev_dec_op_alloc_bulk(mempool, ops_enq, burst_sz);
> -		TEST_ASSERT_SUCCESS(ret,
> -				"rte_bbdev_dec_op_alloc_bulk() failed");
> +		TEST_ASSERT_SUCCESS(ret, "rte_bbdev_dec_op_alloc_bulk() failed");
> +
> +		ref_op->turbo_dec.iter_max = get_iter_max();
> +		/* For validation tests we want to enable early termination */
> +		if (!disable_et && !check_bit(ref_op->turbo_dec.op_flags,
> +				RTE_BBDEV_TURBO_EARLY_TERMINATION))
> +			ref_op->turbo_dec.op_flags |= RTE_BBDEV_TURBO_EARLY_TERMINATION;
> +
>   		if (test_vector.op_type != RTE_BBDEV_OP_NONE)
>   			copy_reference_dec_op(ops_enq, burst_sz, dequeued,
>   					bufs->inputs,
> @@ -4561,10 +4567,12 @@ latency_test_ldpc_dec(struct rte_mempool *mempool,
>   		/* For latency tests we need to disable early termination */
>   		if (disable_et && check_bit(ref_op->ldpc_dec.op_flags,
>   				RTE_BBDEV_LDPC_ITERATION_STOP_ENABLE))
> -			ref_op->ldpc_dec.op_flags -=
> -					RTE_BBDEV_LDPC_ITERATION_STOP_ENABLE;
> +			ref_op->ldpc_dec.op_flags -= RTE_BBDEV_LDPC_ITERATION_STOP_ENABLE;
> +
>   		ref_op->ldpc_dec.iter_max = get_iter_max();
> -		ref_op->ldpc_dec.iter_count = ref_op->ldpc_dec.iter_max;
> +		/* When ET is disabled, the expected iter_count is iter_max */
> +		if (disable_et)
> +			ref_op->ldpc_dec.iter_count = ref_op->ldpc_dec.iter_max;
>   
>   		if (test_vector.op_type != RTE_BBDEV_OP_NONE)
>   			copy_reference_ldpc_dec_op(ops_enq, burst_sz, dequeued,
> @@ -4873,7 +4881,7 @@ validation_latency_test(struct active_device *ad,
>   		iter = latency_test_dec(op_params->mp, bufs,
>   				op_params->ref_dec_op, op_params->vector_mask,
>   				ad->dev_id, queue_id, num_to_process,
> -				burst_sz, &total_time, &min_time, &max_time);
> +				burst_sz, &total_time, &min_time, &max_time, latency_flag);
>   	else if (op_type == RTE_BBDEV_OP_LDPC_ENC)
>   		iter = latency_test_ldpc_enc(op_params->mp, bufs,
>   				op_params->ref_enc_op, ad->dev_id, queue_id,

Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>

Thanks,
Maxime
  

Patch

diff --git a/app/test-bbdev/test_bbdev_perf.c b/app/test-bbdev/test_bbdev_perf.c
index dede0f900e..8c4b82efca 100644
--- a/app/test-bbdev/test_bbdev_perf.c
+++ b/app/test-bbdev/test_bbdev_perf.c
@@ -3775,11 +3775,11 @@  throughput_pmd_lcore_ldpc_dec(void *arg)
 	TEST_ASSERT_SUCCESS(ret, "Allocation failed for %d ops", num_ops);
 
 	/* For throughput tests we need to disable early termination */
-	if (check_bit(ref_op->ldpc_dec.op_flags,
-			RTE_BBDEV_LDPC_ITERATION_STOP_ENABLE))
-		ref_op->ldpc_dec.op_flags -=
-				RTE_BBDEV_LDPC_ITERATION_STOP_ENABLE;
+	if (check_bit(ref_op->ldpc_dec.op_flags, RTE_BBDEV_LDPC_ITERATION_STOP_ENABLE))
+		ref_op->ldpc_dec.op_flags -= RTE_BBDEV_LDPC_ITERATION_STOP_ENABLE;
+
 	ref_op->ldpc_dec.iter_max = get_iter_max();
+	/* Since ET is disabled, the expected iter_count is iter_max */
 	ref_op->ldpc_dec.iter_count = ref_op->ldpc_dec.iter_max;
 
 	if (test_vector.op_type != RTE_BBDEV_OP_NONE)
@@ -4465,7 +4465,7 @@  latency_test_dec(struct rte_mempool *mempool,
 		struct test_buffers *bufs, struct rte_bbdev_dec_op *ref_op,
 		int vector_mask, uint16_t dev_id, uint16_t queue_id,
 		const uint16_t num_to_process, uint16_t burst_sz,
-		uint64_t *total_time, uint64_t *min_time, uint64_t *max_time)
+		uint64_t *total_time, uint64_t *min_time, uint64_t *max_time, bool disable_et)
 {
 	int ret = TEST_SUCCESS;
 	uint16_t i, j, dequeued;
@@ -4481,8 +4481,14 @@  latency_test_dec(struct rte_mempool *mempool,
 			burst_sz = num_to_process - dequeued;
 
 		ret = rte_bbdev_dec_op_alloc_bulk(mempool, ops_enq, burst_sz);
-		TEST_ASSERT_SUCCESS(ret,
-				"rte_bbdev_dec_op_alloc_bulk() failed");
+		TEST_ASSERT_SUCCESS(ret, "rte_bbdev_dec_op_alloc_bulk() failed");
+
+		ref_op->turbo_dec.iter_max = get_iter_max();
+		/* For validation tests we want to enable early termination */
+		if (!disable_et && !check_bit(ref_op->turbo_dec.op_flags,
+				RTE_BBDEV_TURBO_EARLY_TERMINATION))
+			ref_op->turbo_dec.op_flags |= RTE_BBDEV_TURBO_EARLY_TERMINATION;
+
 		if (test_vector.op_type != RTE_BBDEV_OP_NONE)
 			copy_reference_dec_op(ops_enq, burst_sz, dequeued,
 					bufs->inputs,
@@ -4561,10 +4567,12 @@  latency_test_ldpc_dec(struct rte_mempool *mempool,
 		/* For latency tests we need to disable early termination */
 		if (disable_et && check_bit(ref_op->ldpc_dec.op_flags,
 				RTE_BBDEV_LDPC_ITERATION_STOP_ENABLE))
-			ref_op->ldpc_dec.op_flags -=
-					RTE_BBDEV_LDPC_ITERATION_STOP_ENABLE;
+			ref_op->ldpc_dec.op_flags -= RTE_BBDEV_LDPC_ITERATION_STOP_ENABLE;
+
 		ref_op->ldpc_dec.iter_max = get_iter_max();
-		ref_op->ldpc_dec.iter_count = ref_op->ldpc_dec.iter_max;
+		/* When ET is disabled, the expected iter_count is iter_max */
+		if (disable_et)
+			ref_op->ldpc_dec.iter_count = ref_op->ldpc_dec.iter_max;
 
 		if (test_vector.op_type != RTE_BBDEV_OP_NONE)
 			copy_reference_ldpc_dec_op(ops_enq, burst_sz, dequeued,
@@ -4873,7 +4881,7 @@  validation_latency_test(struct active_device *ad,
 		iter = latency_test_dec(op_params->mp, bufs,
 				op_params->ref_dec_op, op_params->vector_mask,
 				ad->dev_id, queue_id, num_to_process,
-				burst_sz, &total_time, &min_time, &max_time);
+				burst_sz, &total_time, &min_time, &max_time, latency_flag);
 	else if (op_type == RTE_BBDEV_OP_LDPC_ENC)
 		iter = latency_test_ldpc_enc(op_params->mp, bufs,
 				op_params->ref_enc_op, ad->dev_id, queue_id,