Commit graph

200 commits

Author SHA1 Message Date
bb69cf02e3 Chain-Load: demonstrate pruning and separated graph segments
Through introduction of a ''pruning rule'', it is possible
to create exit nodes in the middle of the graph. With increased
intensity of pruning, it is possible to ''choke off'' the generation
and terminate the graph; in such a case a new seed node is injected
automatically. By combination with seed rules, an equilibrium of
graph start and graph termination can be achieved.

Following this path, it should be possible to produce a pattern,
which is random but overall stable and well suited to simulate
a realistic processing load.

However, finding proper parameters turns out quite hard in practice,
since the behaviour is essentially contingent and most combinations
either lead to uninteresting trivial small graph chunks, or to
large, interconnected and exponentially expanding networks
2023-12-01 04:50:11 +01:00
38f27f967f Chain-Load: demonstrate seeding new chains
... seeding happens at random points in the middle of the chain
... when combined with reduction, the resulting processing pattern
    resembles the real processing pattern of media calcualtions
2023-11-30 21:06:10 +01:00
229541859d Chain-Load: demonstrate use of reduction rule
... special rule to generate a fixed expansion on each seed
... consecutive reductions join everything back into one chain
... can counterbalance expansions and reductions
2023-11-30 03:20:23 +01:00
aafd277ebe Chain-Load: rework the pattern for dynamic rules
...as it turns out, the solution embraced first was the cleanest way
to handle dynamic configuration of parameters; just it did not work
at that time, due to the reference binding problem in the Lambdas.
Meanwhile, the latter has been resolved by relying on the LazyInit
mechanism. Thus it is now possible to abandon the manipulation by
side effect and rather require the dynamic rule to return a
''pristine instance''.

With these adjustments, it is now possible to install a rule
which expands only for some kinds of nodes; this is used here
to crate a starting point for a **reduction rule** to kick in.
2023-11-30 02:13:39 +01:00
3d5fdce1c7 Chain-Load: demonstrate use of the expansion rule
...played a lot with the parameters
...behaviour and DOT graphs look plausible
...document three typical examples with statistics
2023-11-29 02:58:55 +01:00
dd6929ccc5 Chain-Load: validate and improve statistics
- present the weight centres relative to overall level count
- detect sub-graphs and add statistics per subgraph
- include an evaluation for ''all nodes''
- include number of levels and subgraphs
2023-11-28 22:46:59 +01:00
852a86bbda Chain-Load: generate statistics report
...test and fix the statistics computation...
2023-11-28 16:25:22 +01:00
c3bef6d344 Chain-Load: implement graph statistic computation
- iterate over all nodes and classify them
- group per level
- book in per level statistics into the Indicator records
- close global averages

...just coded, not yet tested...
2023-11-28 03:03:55 +01:00
d968da989e Chain-Load: define data structure for graph statistics
The graph will be used to generate a computational load
for testing the Scheduler; thus we need to compute some
statistical indicators to characterise this load.

As starting point sum counts and averages will be aggregated,
accounting for particular characterisation of nodes per level.
2023-11-28 02:18:38 +01:00
a780d696e5 Chain-Load: verify connectivity and recalculation
It seams indicated to verify the generated connectivity
and the hash calculation and recalculation explicitly
at least for one example topology; choosing a topology
comprised of several sub-graphs, to also verify the
propagation of seed values to further start-nodes.

In order to avoid addressing nodes directly by index number,
those sub-graphs can be processed by ''grouping of nodes'';
all parts are congruent because topology is determined by
the node hashes and thus a regular pattern can be exploited.

To allow for easy processing of groups, I have developed a
simplistic grouping device within the IterExplorer framework.
2023-11-27 21:58:37 +01:00
619a5173b0 Chain-Load: handle node seed and recalculation
- with the new pruning option, start-Nodes can now be anywhere
- introduce predicates to detect start-Nodes and exit-Nodes
- ensure each new seed node gets the global seed on graph construction
- provide functionality to re-propagate a seed and clear hashes
- provide functionality to recalculate the hashes over the graph
2023-11-26 22:28:12 +01:00
1ff9225086 Chain-Load: ability to prune chains
...using an additional pruneRule...
...allows to generate a wood instead of a single graph
...without shuffling, all part-graphs will be identical
2023-11-26 20:57:13 +01:00
ecbe5e5855 Chain-Load: generate new start node automatically
this is only a minor rearrangement in the Algorithm,
but allows to re-boot computation should node connectivity
go to zero. With current capabilities, this could not happen,
but I'm considering to add a »pruning« parameter to create the
possibility to generate multiple shorter chains instead of one
complete chain -- which more closely emulates reality for
Scheduler load patterns.
2023-11-26 18:25:10 +01:00
dbe71029b7 Chain-Load: now able to define RandomDraw rules
...all existing tests reproduced
...yet notation is hopefully more readable

Old:
  graph.expansionRule([](size_t h,double){ return Cap{8, h%16, 63}; })

New:
  graph.expansionRule(graph.rule().probability(0.5).maxVal(4))
2023-11-26 03:04:59 +01:00
5033674b00 Chain-Load: define bindings to use the new RandomDraw component
RandomDraw as a library component was extracted and (grossly) augmented
to cut down the complexity exposed to the user of TestChainLoad.
To control the generated topology, random-selected parameters
must be configured, defining a probability profile; while
this can be achieved with simple math, getting it correct
turned out surprisingly difficult.
2023-12-03 04:59:18 +01:00
0686c534cf Chain-Load: verify topology building -- and fix a Bug
...start with putting the topology generator to work

- turns out it is still challenging to write the ctrl-rules
- and one example tree looked odd in the visualisation
- which (on investigation) indicated unsound behaviour

...this is basically harmless, but involves an integer wrap-around
in a variable not used under this conditions (toReduce), but also
a rather accidental and no very logical round-up of the topology.

With this fix, the code branch here is no longer overloaded with two
distinct concerns, which I consider an improvement
2023-11-17 18:54:51 +01:00
960c461bb4 Chain-Load: verify simple linear hash-chain
by default, a linear chain without any forking is generated,
and the result hash is computed by hash-chaining from the seed.

Verify proper connections and validate computed hash
2023-11-17 02:15:50 +01:00
1f2a635973 Chain-Load: get the first non-trivial topology to work
..as can be expected, had do chase down some quite hairy problems,
especially since consumption of the fixed amount of nodes is not
directly linked to the ''beat'' of the main loop and thus boundary
conditions and exhausted storage can happen basically anywhere.

Used a simple expansion rule and got a nod graph,
which looks coherent in DOT visualisation.
2023-11-17 01:11:12 +01:00
686b98ff1e Chain-Load: mapping helper for control-rules
writing a control-value rule for topology generation typically
involves some modulus and then arthmetic operations to map
only part of the value range to the expected output range.

These calculations are generic, noisy and error-prone.
Thus introduce a helper type, which allows the client just
to mark up the target range of the provided value to map and
transform to the actually expected result range, including some
slight margin to absorb rounding errors. Moreover, all calculations
done in double, to avoid the perils of unsigned-wrap-around.
2023-11-16 21:38:06 +01:00
cc56117574 Chain-Load: integrate topology visualisation (DOT)
- provide as ''operator'' on the TestChainLink instance
- show shortened Node-Hash as label on each Node
2023-11-16 18:42:36 +01:00
76f250a5cf Library: extract Graphviz-DOT generation helpers
...these were developed driven by the immediate need
to visualise ''random generated computation patterns''
for ''Scheduler load testing.''

The abstraction level of this DSL is low
and structures closely match some clauses of the DOT language;
this approach may not yet be adequate to generate more complex
graph structures and was extracted as a starting point
for further refinements....
2023-11-16 17:20:36 +01:00
1c4b1a2973 Chain-Load: draft - generate DOT diagram from calculation topology
With all the preceding DSL work, this turns out to be surprisingly easy;
the only minor twist is the grouping of nodes into (time)levels,
which can be achieved with a "lagging" update from the loop body

Note: next step will be to extract the DSL helpers into a Library header
2023-11-16 17:19:29 +01:00
65fa16b626 Chain-Load: work out DSL for generating DOT scripts
...using a pre-established example as starting point

It seems that building up this kind of generator code
from a set of free functions in a secluded namespace
is the way most suitable to the nature of the C++ language
2023-11-16 03:19:19 +01:00
1c392eeae3 Chain-Load: explore ways to visualise topology
..the idea is to generate a Graphviz-DOT diagram description
by traversing the internal data structures of TestChainLoad.

- refreshed my Graphviz knowledge
- work out a diagram scheme that can be easily generated
- explore ways to structure code generation as a DSL to keep it legible
2023-11-15 03:09:36 +01:00
aa3c25e092 Chain-Load: implement generation mechanism
...introduce statistical control functions (based on hash)
...add processing stage for current set of nodes
...process forking, reduction and injection of new nodes
2023-11-12 23:31:08 +01:00
60dc34a799 Chain-Load: skeleton of topology-generation
...use a pass over the nodes, with some alternating set
of current and next nodes, which are to be connected
2023-11-12 19:36:27 +01:00
ea84935f2a Chain-Load: improve Node-link storage
- use a specialised class, layered on top of std::array
- use additional storage to mark filling degree
- check/fail on link owerflow directly there

We still use fixed size inline storage for the node links,
yet adding this comparatively small overhead in storage helps
getting the code simpler and adding links is now constant-complexity
2023-11-12 16:56:39 +01:00
7bc2c80d3a Chain-Load: calculation node - basic properties
A »Node« represents one junction point in the dependency graph,
knows his predecessors and successors and carries out one step
of the chained hash calculation.
2023-11-12 04:14:11 +01:00
3ff25c1e9f Chain-Load: design considerations
...develop the idea for building the necessary DAG data structure...
2023-11-12 03:02:49 +01:00
c8f13ca3e6 Chain-Load: initial draft
...design a pattern to generate a reproducible computation load
2023-11-11 01:05:54 +01:00
3135887914 Scheduler: connect BlockFlow capacity announcement
...refine the handling of FrameRates close to the definition bounds
...implement the actual rule to scale allocator capacity on announcement
...hook up into the seedCalcStream() with a default of +25FPS

+ test coverage
2023-11-10 23:52:20 +01:00
ecf1a5a301 Scheduler: implement the remaining API functions
...this completes the definition of the Scheduler-Service implementation
2023-11-10 05:07:49 +01:00
2baf058198 Scheduler: high-level schedule-Render-Job test complete 2023-11-09 04:04:53 +01:00
5c6354882d Scheduler: solve problem with transport from entrance-queue
The test case "scheduleRenderJob()" -- while deliberately operated
quite artificially with a disabled WorkForce (so the test can check
the contents in the queue and then progress manually -- led to discovery
of an open gap in the logic: in the (rare) case that a new task is
added ''from the outside'' without acquiring the Grooming-Token, then
the new task could sit in the entrace queue, in worst case for 50ms,
until the next Scheduler-»Tick« routinely sweeps this queue. Under
normal conditions however, each dispatch of another activity will
also sweep the entrance queue, yet if there happens to be no other
task right now, a new task could be stuck.

Thinking through this problem also helped to amend some aspects
of Grooming-Token handling and clarified the role of the API-functions.
2023-11-08 20:58:32 +01:00
892099412c Scheduler: integrate sanity check on timings
...especially to prevent a deadline way too far into the future,
since this would provoke the BlockFlow (epoch based) memory manager
to run out of space.

Just based on gut feeling, I am now imposing a limit of 20seconds,
which, given current parametrisation, with a minimum spacing of 6.6ms
and 500 Activities per Block would at maximum require 360 MiB for
the Activities, or 3000 Blocks. With *that much* blocks, the
linear search would degrade horribly anyway...
2023-11-07 18:37:20 +01:00
0ed7dba641 Scheduler: automatically step up capacity on new task
WorkForce scales down automatically after 2 seconds when
workers fall idle; thus we need to step up automatically
with each new task.

Later we'll also add some capacity management to both the
LoadController and the Job-Planning, but for now this rather
crude approach should suffice.

NOTE: most of the cases in SchedulerService_test verify parts
of the component integration and thus need to bypass this
automatism, because the test code wants to invoke the
work-Function directly (without any interference
from running workers)
2023-11-07 17:00:24 +01:00
8056bebf9c Scheduler: allow to manipulate nominal full capacity
While building increasingly complex integration tests for the Scheduler,
it turns out helpful to be able to manipulate the "full concurreency"
as used by Scheduler, WorkForce and LoadController.

In the current test, I am facing a problem that new entries from the
threadsafe entrance queue are not propagated to the priority queue
soon enough; partly this is due to functionality still to be added
(scaling up when new tasks are passed in) -- but this will further
complicate the test setup.
2023-11-07 16:12:56 +01:00
86a909b850 Scheduler: implement the render job builder
...simply by delegating to the underlying builder notation
on activity::Term as provided by the Activity-Language
2023-11-06 23:54:46 +01:00
86b90fbf84 Scheduler: draft high-level API for building a Job schedule
The invocation structure is effectively determined by the
Activity-chain builder from the Activity-Language; but, taking
into account the complexity of the Scheduler code developed thus far,
it seems prudent to encapsulate the topic of "Activities" altogether
and expose only a convenience builder-API towards the Job-Planning
2023-11-06 06:00:00 +01:00
72258c06bd Scheduler: reconciled into clearer design
The problem with passing the deadline was just a blatant symptom
that something with the overall design was not quite right, leading
to mix-up of interfaces and implementation functions, and more and more
detail parameters spreading throughout the call chains.

The turning point was to realise the two conceptual levels
crossing and interconnected within the »Scheduler-Service«

- the Activity-Language describes the patterns of processing
- the Scheduler components handle time-bound events

So by turning the (previously private) queue entry into an
ActivationEvent, the design could be balanced.
This record becomes the common agens within the Scheduler,
and builds upon / layers on top of the common agens of the
Language, which is the Activity record.
2023-11-04 04:49:13 +01:00
747e522c7e Scheduler: design-problems while integrating deadline
the attempt to integrate additional deadline and significance parameters
unveils a design problem due to the layering of contexts

- the Activity-Language attempts to abstract away the ''Scheduler mechanics''
- but this implementation logic now needs to pass additional parameters
- and notably there is the possibility of direct re-scheduling from within
  the Activity-Dispatch

The symptom of this problem is that it's no longer possible
to implement the ExecutionCtx.post() function in the real Scheduler-context
2023-11-03 03:33:23 +01:00
b49de0738d Scheduler: implement automatic clean-up of outdated entries
Hooked into the existing processing logic at Layer-2,
and relying on the information functions of Layer-1
2023-11-03 01:17:10 +01:00
b1e0ce1a79 Scheduler: define expected filtering behaviour for significant tasks 2023-11-03 00:31:33 +01:00
d622b59dfd Scheduler: support for classification data in Layer-1
- this is prerequisite to check for significance of the head entry
- implement and verify the information functions at Layer-1
2023-11-02 23:25:44 +01:00
7887941c89 Scheduler: prepare for dropping obsoleted entries
...it is clear that there must be a way to flush the scheduler queues
an thereby silently drop any obsoleted or irrelevant entries. This topic
turns out to be somewhat involved, as it requires to consider the
deadline (due to the memory management, which is based on deadlines).
Furthermore there is a relation to yet another challenging conceptual
requirement, which is the support for other operation modes beyond
just time-bound rendering; these concerns make it desirable to
expand the internal representation of entries in the queue.

Concerns regarding performance are postponed deliberately,
until we can demonstrate the Scheduler-Service running under
regular operational conditions.
2023-11-02 16:46:08 +01:00
5c5dc40f3f Scheduler: processing of peak loads works
This is the first kind of integration,
albeit still with a synthetic load.

- placed two excessive load peaks in the scheduling timeline
- verified load behaviour
- verified timings
- verified that the scheduler shuts down automatically when done
2023-11-01 04:24:44 +01:00
4937577557 (WIP) instrumentation for investigation of sleep-behaviour 2023-11-01 02:06:02 +01:00
9f7711d26b Scheduler: complete and cover load indicator
- sample distance to scheduler head whenever a worker asks for work
- moving average with N = worker-pool size and damp-factor 2
- multiply with the current concurrency fraction
2023-10-31 02:29:50 +01:00
a087e52ab1 Scheduler: draft a load indicator
...using a state fusion
based on both the threadpool size and the average distance
or lag to the next task to be scheduled.
2023-10-30 20:22:06 +01:00
6a7a2832bf Scheduler: simplify usage of microbenchmark helper
as an aside, the header lib/test/microbenchmark.hpp
turns out to be prolific for this kind of investigation.

However, it is somewhat obnoxious that the »test subject«
must expose the signature <size_t(size_t)>.

Thus, with some metaprogramming magic, an generic adaptor
can be built to accept a range of typical alternatives,
and even the quite obvious signature void(void).
Since all these will be wrapped directly into a lambda,
the optimiser will remove these adaptations altogether.
2023-10-30 20:17:16 +01:00