Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
test_pipe_cache_policy.c
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 Ansel. If not, see <http://www.gnu.org/licenses/>.
17*/
18
31
32#include <stdarg.h>
33#include <stddef.h>
34// cmocka.h declares `extern jmp_buf global_expect_assert_env' at file scope without including
35// <setjmp.h> itself. Same suppression as test_metadata_notify.c, and for the same reason.
36#include <setjmp.h> // NOLINT(misc-include-cleaner)
37#include <stdint.h>
38#include <cmocka.h>
39
47
50{
51 (void)state;
54
55 gboolean upstream = FALSE;
57
58 // It requires nothing of its OWN output -- nobody downstream asked for it ...
60 // ... but the node before it must publish to host, because this one reads on the CPU.
62}
63
75
87{
88 (void)state;
90
91 gboolean upstream = FALSE;
93
94 // The inherited requirement reaches this node's own output ...
96 // ... AND keeps travelling to the node before it. An `=' here would make this FALSE.
98}
99
102{
103 (void)state;
104 const size_t offsets[] = {
107 offsetof(dt_dev_pipe_cache_policy_inputs_t, global_hist_input_on),
109 };
110
111 for(size_t i = 0; i < sizeof(offsets) / sizeof(offsets[0]); i++)
112 {
114 *(gboolean *)((char *)&in + offsets[i]) = TRUE;
115
116 gboolean upstream = FALSE;
119 }
120}
121
124{
125 (void)state;
126 const size_t offsets[] = {
128 offsetof(dt_dev_pipe_cache_policy_inputs_t, user_requested_cache),
130 offsetof(dt_dev_pipe_cache_policy_inputs_t, global_hist_output_on),
131 };
132
133 for(size_t i = 0; i < sizeof(offsets) / sizeof(offsets[0]); i++)
134 {
136 *(gboolean *)((char *)&in + offsets[i]) = TRUE;
137
138 gboolean upstream = FALSE;
140 // None of these four says anything about what the node BEFORE this one must do.
142 }
143}
144
154
168
169// clang-format off
170// modelines: These editor modelines have been set for all relevant files by tools/update_modelines.py
171// vim: shiftwidth=2 expandtab tabstop=2 cindent
172// kate: tab-indents: off; indent-width 2; replace-tabs on; indent-mode cstyle; remove-trailing-spaces modified;
173// clang-format on
#define TRUE
Definition ashift_lsd.c:162
#define FALSE
Definition ashift_lsd.c:158
typedef void((*dt_cache_allocate_t)(void *userdata, dt_cache_entry_t *entry))
Whether one pipeline node must keep a host-RAM copy of its output.
static gboolean dt_dev_pipe_cache_policy_decide(const dt_dev_pipe_cache_policy_inputs_t *in, const gboolean inherited_requirement, gboolean *upstream_requirement)
Decide one node's host-cache requirement, walking the pipe from the end backwards.
const float uint32_t state[4]
Everything the decision depends on, named.
static void _gpu_node_requires_nothing_on_its_own(void **state)
static void _each_own_output_reason_raises_own(void **state)
static void _each_own_input_reason_raises_upstream(void **state)
int main(void)
static dt_dev_pipe_cache_policy_inputs_t _gpu_node_with_no_needs(void)
static void _gpu_node_propagates_an_inherited_requirement(void **state)
static void _null_upstream_pointer_is_allowed(void **state)
static void _cpu_only_node_needs_its_input_on_host(void **state)