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

Francois Dugast francois.dugast at intel.com
Wed Feb 5 10:17:05 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 |  1 +
 2 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/lib/intel_compute.c b/lib/intel_compute.c
index a826d58c0..db6e81c38 100644
--- a/lib/intel_compute.c
+++ b/lib/intel_compute.c
@@ -752,7 +752,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);
@@ -1031,7 +1032,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);
@@ -1240,7 +1242,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);
@@ -1606,7 +1609,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);
@@ -1698,7 +1702,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 6096bb83a..f32da2734 100644
--- a/lib/intel_compute.h
+++ b/lib/intel_compute.h
@@ -37,6 +37,7 @@ struct user_execenv {
 	uint32_t vm;
 	const unsigned char *kernel;
 	unsigned int kernel_size;
+	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