Skip to main content

Module scope_tree

Module scope_tree 

Source
Expand description

Canonical scope tree for a workload’s runtime hierarchy.

ScenarioNode (in nmbrs-workload) is the static authored tree — what the user wrote in YAML. ScopeTree is the runtime hierarchy — what Polydat and the scheduler see. Every non-trivial scenario node gets a 1:1 scope here, with parent pointers, depth, pragma sets, and a slot for a compiled kernel.

This module is structural only — it builds the tree and exposes traversal helpers. Pragma attachment, kernel compilation, and execution scheduling live in subsequent steps of SRD 18b §“Migration”:

  1. (this module) introduce the data structure
  2. nest each scope’s PragmaSet in its parent’s at scope-tree construction (M2 follow-up)
  3. replace text-substitution of iteration vars with extern binding (compile leaf phases once)
  4. pluggable scheduler reading the schedule=<level0>/... spec
  5. hierarchical display surface

Until those steps land, ScopeTree is built but not consumed by the runner — the existing executor continues to drive traversal directly off ScenarioNode. Building the tree is cheap and deterministic; intermediate sysrefs (TUI display, dryrun=phase) can already start consuming it.

Structs§

AncestorsIter
Walk from a node up through its ancestors to the root.
DfsIter
Depth-first pre-order iterator over (idx, &ScopeNode).
ScopeNode
One node in the runtime scope tree. Carries enough metadata for the scheduler to walk and the compiler to fill in.
ScopeTree
A workload’s runtime scope hierarchy. Built once per session. Stable indices into nodes; parent / child pointers are ScopeNodeIdx. Use the helpers on this struct for traversal — direct nodes access is fine for read-only inspection but the navigation helpers are easier to read.

Enums§

ScopeKind
What kind of scope a ScopeNode represents. Mirrors the ScenarioNode variants 1:1, with two extra kinds for the implicit workload root and the named scenario layer that wraps the user’s authored children. SRD 18b §“Canonical traversal”.

Functions§

bindings_label
One-line display label for a scenario-level bindings: scope.
set_kernel_install_visitor
Register a visitor that fires on every install_kernel call. Replaces any prior visitor; pass None to clear. Called by the runner at session start when dryrun=kernels is set.

Type Aliases§

KernelInstallVisitor
Ride-along visitor for kernel-installation events. Set by the runner when dryrun=kernels is requested so each install_kernel fires the printer as the planning walk encounters the scope. None (the default) keeps install a no-cost hot path.
ScopeNodeIdx
Index into the ScopeTree.nodes vector. Stable for the lifetime of the tree.