summaryrefslogtreecommitdiff
path: root/src/modules/checkers/checkers.c
diff options
context:
space:
mode:
authorVito Caputo <vcaputo@pengaru.com>2023-07-08 20:15:06 -0700
committerVito Caputo <vcaputo@pengaru.com>2023-07-08 21:22:24 -0700
commit4bad0667dd6ddfa1a43339ae37b3535550e8e264 (patch)
tree33ee3f2077520ed5503c1a83b0612da96d2d40a1 /src/modules/checkers/checkers.c
parent83f390da70600491b30aa328ace166ccdfd02b50 (diff)
modules/checkers: stop setting til_frame_plan_t.cpu_affinity
In the early days of checkers when I introduced fill_module= with the per-cpu contexts to still allow threaded rendering, the whole seed passing to contexts thing wasn't as well sorted out. This meant the contexts often produced vastly different outputs despite being the same module, same seed, and same settings. The consequence of that was that w/fill_module checkers would produce crazy randomized output when you expected the same output in the filled cells. But by using .cpu_affinity (which I had to implement just for this use case actually) at least the different outputs would become stable. It was a band-aid over a different problem that still needed sorting out. Nowadays, it seems like this is improved enough at least for alphazed to look correct without the affinity hack, so I'm removing it because it really kills checkers threaded performance. Whatever modules remain uncooperative WRT seed reproducibility, they'll just need to be fixed up.
Diffstat (limited to 'src/modules/checkers/checkers.c')
-rw-r--r--src/modules/checkers/checkers.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/src/modules/checkers/checkers.c b/src/modules/checkers/checkers.c
index 5d76a88..f04ebf0 100644
--- a/src/modules/checkers/checkers.c
+++ b/src/modules/checkers/checkers.c
@@ -224,17 +224,19 @@ static int checkers_fragmenter(til_module_context_t *context, const til_fb_fragm
static void checkers_prepare_frame(til_module_context_t *context, til_stream_t *stream, unsigned ticks, til_fb_fragment_t **fragment_ptr, til_frame_plan_t *res_frame_plan)
{
- checkers_context_t *ctxt = (checkers_context_t *)context;
-
- /* XXX: note cpu_affinity is required when fill_module is used, to ensure module_contexts
- * have a stable relationship to fragnum. Otherwise the output would be unstable because the
- * module contexts would be randomly distributed across the filled checkers frame-to-frame.
- * This is unfortunate since cpu_affinity is likely to be slower than just letting the render
- * threads render fragments in whatever order (the preferred default). fill_module here
- * is actually *the* reason til_frame_plan_t.cpu_affinity got implemented, before this there
- * wasn't even a til_frame_plan_t container; a bare til_fragmenter_t was returned.
+ /* XXX: once upon a time this used .cpu_affinity = 1, to
+ * get a stable mapping of per-cpu-context to filled cell
+ * via/fill_module. But that slows things down
+ * substantially as-implemented in til_threads since it
+ * makes threads wait for their next fragnum to come up.
+ * Since seed-ifying everything, and the seed is the same
+ * across the contexts, they _should_ have identical
+ * outputs. So I got rid of it for the perf gain, and
+ * modules which aren't behaving well WRT
+ * same-seeds-same-settings-but-different-output, fix
+ * them.
*/
- *res_frame_plan = (til_frame_plan_t){ .fragmenter = checkers_fragmenter, .cpu_affinity = !!ctxt->setup->fill_module };
+ *res_frame_plan = (til_frame_plan_t){ .fragmenter = checkers_fragmenter };
}
© All Rights Reserved