Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
test_pipe_cache_policy.c File Reference
#include "develop/pipe_cache_policy.h"
#include <stdarg.h>
#include <stddef.h>
#include <setjmp.h>
#include <stdint.h>
#include <cmocka.h>
+ Include dependency graph for test_pipe_cache_policy.c:

Go to the source code of this file.

Functions

static dt_dev_pipe_cache_policy_inputs_t _gpu_node_with_no_needs (void)
 
static void _cpu_only_node_needs_its_input_on_host (void **state)
 
static void _gpu_node_requires_nothing_on_its_own (void **state)
 
static void _gpu_node_propagates_an_inherited_requirement (void **state)
 
static void _each_own_input_reason_raises_upstream (void **state)
 
static void _each_own_output_reason_raises_own (void **state)
 
static void _null_upstream_pointer_is_allowed (void **state)
 
int main (void)
 

Function Documentation

◆ _cpu_only_node_needs_its_input_on_host()

static void _cpu_only_node_needs_its_input_on_host ( void **  state)
static

A node that cannot run on the GPU at all: it produces host data by construction.

Definition at line 49 of file test_pipe_cache_policy.c.

References dt_dev_pipe_cache_policy_decide(), FALSE, L, state, dt_dev_pipe_cache_policy_inputs_t::supports_opencl, and void().

Referenced by main().

◆ _each_own_input_reason_raises_upstream()

static void _each_own_input_reason_raises_upstream ( void **  state)
static

Each of the five own-input reasons must raise the upstream requirement by itself.

Definition at line 101 of file test_pipe_cache_policy.c.

References _gpu_node_with_no_needs(), dt_dev_pipe_cache_policy_decide(), FALSE, i, L, state, TRUE, and void().

Referenced by main().

◆ _each_own_output_reason_raises_own()

static void _each_own_output_reason_raises_own ( void **  state)
static

Each of the four own-output reasons must raise this node's own requirement by itself.

Definition at line 123 of file test_pipe_cache_policy.c.

References _gpu_node_with_no_needs(), dt_dev_pipe_cache_policy_decide(), FALSE, i, L, state, TRUE, and void().

Referenced by main().

◆ _gpu_node_propagates_an_inherited_requirement()

static void _gpu_node_propagates_an_inherited_requirement ( void **  state)
static

THE REGRESSION. An enabled, GPU-capable node that needs no host input of its own must PASS THROUGH a requirement inherited from further downstream, not replace it.

This was an ‘=’ rather than an ‘||’. Toggling on a GPU module with no host needs of its own (iop/rawoverexposed.c: NO_HISTORY_STACK, GPU-capable, no GUI or histogram reason) erased the TRUE that a CPU-only module further downstream (dither) had correctly established. colorout then skipped its GPU-to-host readback, and dither read the stale bytes left in the cacheline's previous life – every hash and ROI in the chain individually correct.

Definition at line 86 of file test_pipe_cache_policy.c.

References _gpu_node_with_no_needs(), dt_dev_pipe_cache_policy_decide(), FALSE, L, state, TRUE, and void().

Referenced by main().

◆ _gpu_node_requires_nothing_on_its_own()

static void _gpu_node_requires_nothing_on_its_own ( void **  state)
static

Definition at line 64 of file test_pipe_cache_policy.c.

References _gpu_node_with_no_needs(), dt_dev_pipe_cache_policy_decide(), FALSE, L, state, TRUE, and void().

Referenced by main().

◆ _gpu_node_with_no_needs()

static dt_dev_pipe_cache_policy_inputs_t _gpu_node_with_no_needs ( void  )
static

Which pipeline nodes must keep a host-RAM copy of their output.

These tests exist because nothing else can see this. The per-piece cache_output_on_ram flag changes no exported pixel – the export path drives the pipe directly and never reaches the seal that computes it – changes no hash, and produces no log unless someone is already looking. When it was wrong, the symptom was a downstream module reading stale host bytes from a rekeyed cacheline, only with OpenCL enabled, and it was found by dumping GPU buffers.

The propagation test below is that bug, pinned. A GPU-capable node with no reason of its own to want host data.

Definition at line 41 of file test_pipe_cache_policy.c.

References L, dt_dev_pipe_cache_policy_inputs_t::supports_opencl, and TRUE.

Referenced by _each_own_input_reason_raises_upstream(), _each_own_output_reason_raises_own(), _gpu_node_propagates_an_inherited_requirement(), _gpu_node_requires_nothing_on_its_own(), and _null_upstream_pointer_is_allowed().

◆ _null_upstream_pointer_is_allowed()

static void _null_upstream_pointer_is_allowed ( void **  state)
static

A NULL out-param is allowed: the last node in the walk has nobody upstream to tell.

Definition at line 146 of file test_pipe_cache_policy.c.

References _gpu_node_with_no_needs(), dt_dev_pipe_cache_policy_decide(), FALSE, L, state, TRUE, and void().

Referenced by main().

◆ main()