PR #23385 opened by Niklas Haas (haasn) URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/23385 Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/23385.patch
The current approach of re-testing the C reference for every backend separately leads to both confusing output (e.g. having an extra redundant `memcpy_c` line for every op, even those not implemented by the memcpy backend), as well as a lot of unnecessary wasted time re-testing and re-benching the same C variant for every backend. This new API function lets us test the C function only a single time, while simultaneously having all of the other backends implicitly compare themselves against the C reference. Signed-off-by: Niklas Haas <[email protected]> # Summary of changes Briefly describe what this PR does and why. <!-- If this PR requires new FATE test samples, attach them to the PR and list their target paths below (relative to the fate-suite root). Attached filenames must match the sample's filename: ```fate-samples # e.g. vorbis/new-sample.ogg ``` --> >From 3fc63c93f99eb40ae436adcf1bb2b18fbcca5189 Mon Sep 17 00:00:00 2001 From: Niklas Haas <[email protected]> Date: Sun, 19 Apr 2026 15:27:11 +0200 Subject: [PATCH] tests/checkasm/sw_ops: use new checkasm_set_func_variant() The current approach of re-testing the C reference for every backend separately leads to both confusing output (e.g. having an extra redundant `memcpy_c` line for every op, even those not implemented by the memcpy backend), as well as a lot of unnecessary wasted time re-testing and re-benching the same C variant for every backend. This new API function lets us test the C function only a single time, while simultaneously having all of the other backends implicitly compare themselves against the C reference. Signed-off-by: Niklas Haas <[email protected]> --- tests/checkasm/sw_ops.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/tests/checkasm/sw_ops.c b/tests/checkasm/sw_ops.c index ca6882dae7..0540bdeb28 100644 --- a/tests/checkasm/sw_ops.c +++ b/tests/checkasm/sw_ops.c @@ -111,7 +111,7 @@ static void set_range(AVRational *rangeq, unsigned range, unsigned range_def) *rangeq = (AVRational) { range, 1 }; } -static void check_compiled(const char *name, const SwsOpBackend *backend, +static void check_compiled(const char *name, const SwsOp *read_op, const SwsOp *write_op, const int ranges[NB_PLANES], const SwsCompiledOp *comp_ref, @@ -124,7 +124,7 @@ static void check_compiled(const char *name, const SwsOpBackend *backend, */ uintptr_t id = (uintptr_t) comp_new->func; id ^= (id << 6) + (id >> 2) + 0x9e3779b97f4a7c15 + comp_new->cpu_flags; - if (!check_key(id, "%s/%s", name, backend->name)) + if (!check_key(id, "%s", name)) return; declare_func(void, const SwsOpExec *, const void *, int bx, int y, int bx_end, int y_end); @@ -304,6 +304,9 @@ static void check_ops(const char *name, const unsigned ranges[NB_PLANES], goto done; } + /* Check with the C backend to establish a reference */ + check_compiled(name, read_op, write_op, ranges, &comp_ref, &comp_ref); + /* Iterate over every other backend, and test it against the C reference */ for (int n = 0; ff_sws_op_backends[n]; n++) { const SwsOpBackend *backend = ff_sws_op_backends[n]; @@ -312,7 +315,6 @@ static void check_ops(const char *name, const unsigned ranges[NB_PLANES], if (!checkasm_get_cpu_info()) { /* Also test once with the existing C reference to set the baseline */ - check_compiled(name, backend, read_op, write_op, ranges, &comp_ref, &comp_ref); } SwsCompiledOp comp_new = {0}; @@ -324,7 +326,9 @@ static void check_ops(const char *name, const unsigned ranges[NB_PLANES], goto done; } - check_compiled(name, backend, read_op, write_op, ranges, &comp_ref, &comp_new); + /* Distinguish backends from each-other even with same CPU flags */ + checkasm_set_func_variant("%s_%s", backend->name, checkasm_get_cpu_suffix()); + check_compiled(name, read_op, write_op, ranges, &comp_ref, &comp_new); ff_sws_compiled_op_unref(&comp_new); } -- 2.52.0 _______________________________________________ ffmpeg-devel mailing list -- [email protected] To unsubscribe send an email to [email protected]
