Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
selftests.h
Go to the documentation of this file.
1/*
2 This file is part of Ansel,
3 Copyright (C) 2026 Aurélien PIERRE.
4
5 Ansel is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
9
10 Ansel is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with darktable. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19#pragma once
20
21// CPU/GPU parity self-tests of the harmonic OpenCL port (each vs a CPU replica).
22// Public API of this highlights harmonic-transposition module (a compiled TU). Include
23// this header to call into the module; internals are static in the .c. See common.h.
24
25#include "common/opencl.h"
27
28#ifdef HAVE_OPENCL
29// Self-test (enable with HL_SPCL_TEST=1): factor + solve the 13-point biharmonic system on a
30// disc hole with both the CPU and the GPU sparse Cholesky solver, print the maximum
31// CPU-vs-GPU relative difference. Runs once per process.
32void _sp_chol_cl_selftest(const int devid, void *gd_void, const dt_dev_pixelpipe_t *pipe);
33#endif
34
35#ifdef HAVE_OPENCL
36// Self-test (enable with HL_BLURCL_TEST=1): blur a synthetic 4-channel plane with the CPU and
37// the GPU recursive gaussians, print the maximum CPU-vs-GPU absolute difference. Runs once per
38// process.
39void _region_blur_cl_selftest(const int devid, const dt_dev_pixelpipe_t *pipe);
40#endif
41
42#ifdef HAVE_OPENCL
43// self-test (HL_FILLCL_TEST=1): fill a synthetic plane with the CPU and GPU coarse-to-fine
44// Jacobi, print max abs difference over the filled cells. Run once per process.
45void _cf_harmonic_fill_cl_selftest(const int devid, void *gd_void, const dt_dev_pixelpipe_t *pipe);
46#endif
47
48#ifdef HAVE_OPENCL
49// Self-test (enable with HL_CFCL_TEST=1): compares the GPU joint coefficient-field stage
50// (_cf_joint_stage_cl) against an inline CPU replica of the exact production loops (pack,
51// blur, fit, fills, eval) on a synthetic correlated region with a green-clipped disc.
52// Prints the maximum CPU-vs-GPU absolute difference of est over the evaluated targets.
53void _cf_joint_stage_cl_selftest(const int devid, void *gd_void, const dt_dev_pixelpipe_t *pipe);
54#endif
55
56#ifdef HAVE_OPENCL
57// Self-test (enable with HL_CFCL_TEST=1, part 2): the COMPLETE coefficient-field stage
58// (_cf_stage_cl: joint + pair + deep cascade) against an inline CPU replica, on a
59// green-clipped disc with an inner red-clipped core (the occluded topology: strict targets,
60// multi-clip pair targets and the depth-split blend all exercised). Prints the maximum
61// CPU-vs-GPU absolute difference of est and of the fit-quality plane bsc.
62void _cf_stage_cl_selftest(const int devid, void *gd_void, const dt_dev_pixelpipe_t *pipe);
63#endif
64
65#ifdef HAVE_OPENCL
66// Self-test (enable with HL_HFCL_TEST=1): the high-frequency detail-band stage (_hf_stage_cl)
67// GPU vs an inline CPU replica, on the two-disc topology with textured content and a synthetic
68// fit-quality plane. Prints the maximum CPU-vs-GPU absolute difference.
69void _hf_stage_cl_selftest(const int devid, void *gd_void, const dt_dev_pixelpipe_t *pipe);
70#endif
71
72#ifdef HAVE_OPENCL
73// Self-test (enable with HL_DOMECL_TEST=1): clip floors + hue-coupled self-dome stage
74// (_selfdome_stage_cl) GPU vs the CPU production functions, on the two-disc topology with a
75// synthetic depth plane. Prints the maximum CPU-vs-GPU absolute difference. If a region dump
76// from HL_REG_DUMP exists in /tmp, replays that real region through both dome paths first.
77void _selfdome_stage_cl_selftest(const int devid, void *gd_void, const dt_dev_pixelpipe_t *pipe);
78#endif
79
80#ifdef HAVE_OPENCL
81// Self-test (enable with HL_CORECL_TEST=1): all-clip joint core (_joint_core_stage_cl) GPU vs
82// the CPU production path on a synthetic all-clip disc + partial-clip annulus; prints the
83// maximum CPU-vs-GPU absolute difference. Runs once per process.
84void _joint_core_stage_cl_selftest(const int devid, void *gd_void, const dt_dev_pixelpipe_t *pipe);
85#endif
86
87#ifdef HAVE_OPENCL
88// self-test (HL_ANISOCL_TEST=1): divergence-form aniso chroma GPU vs the CPU production path
89// on an all-clip disc with a textured surround, once per process
90void _aniso_stage_cl_selftest(const int devid, void *gd_void, const dt_dev_pixelpipe_t *pipe);
91#endif
92
93#ifdef HAVE_OPENCL
94// Self-test (enable with HL_REGCL_TEST=1): the full GPU region orchestrator
95// (_region_guided_filter_cl) vs the production CPU _region_guided_filter on one synthetic
96// staggered-clip blob; prints the mean and maximum CPU-vs-GPU absolute difference. Runs once
97// per process.
98void _region_guided_filter_cl_selftest(const int devid, void *gd_void, const dt_dev_pixelpipe_t *pipe);
99#endif
100
101#ifdef HAVE_OPENCL
102// Self-test (enable with HL_KNEECL_TEST=1): GPU knee estimate + apply
103// (_hl_knee_estimate_cl / _hl_knee_apply_cfa_cl) vs the CPU production path on a synthetic
104// Bayer (RGGB) mosaic with a soft saturation rolloff; prints the maximum CPU-vs-GPU
105// difference. Runs once per process.
106void _knee_cl_selftest(const int devid, void *gd_void, const dt_dev_pixelpipe_t *pipe);
107#endif
void _hf_stage_cl_selftest(const int devid, void *gd_void, const dt_dev_pixelpipe_t *pipe)
Definition selftests.c:918
void _region_guided_filter_cl_selftest(const int devid, void *gd_void, const dt_dev_pixelpipe_t *pipe)
Definition selftests.c:1779
void _knee_cl_selftest(const int devid, void *gd_void, const dt_dev_pixelpipe_t *pipe)
Definition selftests.c:1885
void _joint_core_stage_cl_selftest(const int devid, void *gd_void, const dt_dev_pixelpipe_t *pipe)
Definition selftests.c:1394
void _selfdome_stage_cl_selftest(const int devid, void *gd_void, const dt_dev_pixelpipe_t *pipe)
Definition selftests.c:1166
void _aniso_stage_cl_selftest(const int devid, void *gd_void, const dt_dev_pixelpipe_t *pipe)
Definition selftests.c:1592
void _cf_harmonic_fill_cl_selftest(const int devid, void *gd_void, const dt_dev_pixelpipe_t *pipe)
Definition selftests.c:193
void _cf_stage_cl_selftest(const int devid, void *gd_void, const dt_dev_pixelpipe_t *pipe)
Definition selftests.c:562
void _region_blur_cl_selftest(const int devid, const dt_dev_pixelpipe_t *pipe)
Definition selftests.c:143
void _cf_joint_stage_cl_selftest(const int devid, void *gd_void, const dt_dev_pixelpipe_t *pipe)
Definition selftests.c:300
void _sp_chol_cl_selftest(const int devid, void *gd_void, const dt_dev_pixelpipe_t *pipe)
Definition selftests.c:39