[PATCH i-g-t, v2 5/6] lib/intel_compute: Give option to skip results check

Francois Dugast francois.dugast at intel.com
Mon Feb 24 14:46:13 UTC 2025


This is useful when using a custom compute kernel which produces
different results than the default one (square) and when those
results should be ignored because they are not the purpose of the
test.

Signed-off-by: Francois Dugast <francois.dugast at intel.com>
---
 lib/intel_compute.c | 15 ++++++++++-----
 lib/intel_compute.h |  2 ++
 2 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/lib/intel_compute.c b/lib/intel_compute.c
index 04fb83321..4818c0ff7 100644
--- a/lib/intel_compute.c
+++ b/lib/intel_compute.c
@@ -753,7 +753,8 @@ static void compute_exec(int fd, const unsigned char *kernel,
 		if (output != expected_output)
 			igt_debug("[%4d] input:%f output:%f expected_output:%f\n",
 				  i, input, output, expected_output);
-		igt_assert_eq(output, expected_output);
+		if (!user || (user && !user->skip_results_check))
+			igt_assert_eq(output, expected_output);
 	}
 
 	bo_execenv_unbind(&execenv, bo_dict, BO_DICT_ENTRIES);
@@ -1033,7 +1034,8 @@ static void xehp_compute_exec(int fd, const unsigned char *kernel,
 		if (output != expected_output)
 			igt_debug("[%4d] input:%f output:%f expected_output:%f\n",
 				  i, input, output, expected_output);
-		igt_assert_eq(output, expected_output);
+		if (!user || (user && !user->skip_results_check))
+			igt_assert_eq(output, expected_output);
 	}
 
 	bo_execenv_unbind(&execenv, bo_dict, XEHP_BO_DICT_ENTRIES);
@@ -1243,7 +1245,8 @@ static void xehpc_compute_exec(int fd, const unsigned char *kernel,
 		if (output != expected_output)
 			igt_debug("[%4d] input:%f output:%f expected_output:%f\n",
 				  i, input, output, expected_output);
-		igt_assert_eq(output, expected_output);
+		if (!user || (user && !user->skip_results_check))
+			igt_assert_eq(output, expected_output);
 	}
 
 	bo_execenv_unbind(&execenv, bo_dict, XEHPC_BO_DICT_ENTRIES);
@@ -1609,7 +1612,8 @@ static void xelpg_compute_exec(int fd, const unsigned char *kernel,
 		if (output != expected_output)
 			igt_debug("[%4d] input:%f output:%f expected_output:%f\n",
 				  i, input, output, expected_output);
-		igt_assert_eq(output, expected_output);
+		if (!user || (user && !user->skip_results_check))
+			igt_assert_eq(output, expected_output);
 	}
 
 	bo_execenv_unbind(&execenv, bo_dict, XELPG_BO_DICT_ENTRIES);
@@ -1701,7 +1705,8 @@ static void xe2lpg_compute_exec(int fd, const unsigned char *kernel,
 		if (output != expected_output)
 			igt_debug("[%4d] input:%f output:%f expected_output:%f\n",
 				  i, input, output, expected_output);
-		igt_assert_eq(output, expected_output);
+		if (!user || (user && !user->skip_results_check))
+			igt_assert_eq(output, expected_output);
 	}
 
 	bo_execenv_unbind(&execenv, bo_dict, XE2_BO_DICT_ENTRIES);
diff --git a/lib/intel_compute.h b/lib/intel_compute.h
index 3f6d0bb1d..dc0fe2ec2 100644
--- a/lib/intel_compute.h
+++ b/lib/intel_compute.h
@@ -53,6 +53,8 @@ struct user_execenv {
 	const unsigned char *kernel;
 	/** @kernel_size: size of the custom kernel, if provided */
 	unsigned int kernel_size;
+	/** @skip_results_check: do not verify correctness of the results if true */
+	bool skip_results_check;
 };
 
 extern const struct intel_compute_kernels intel_compute_square_kernels[];
-- 
2.43.0



More information about the igt-dev mailing list