qat.experimental.analysis.post_processing module
Extract runtime-ready post-processing metadata from experimental results IR.
This module analyses results-dialect operations (for example results.map and
results.post_select) and produces a compact representation used by runtime execution.
The extracted model includes per-measurement acquire metadata, record-level post-selection
rules, record assignments, and the set of returned measurement aliases.
- class PostProcessingAnalysis(acquire_data=<factory>, post_selects=<factory>, assigns=<factory>, returns=<factory>)
Bases:
objectContainer for post-processing metadata extracted from results IR.
The fields in this model are runtime-oriented:
acquire_datacaptures per-measurement acquire mode, shape, and granular post-processing chain.post_selectscaptures record-level filtering predicates.assignscaptures record alias materialisation (including grouped and array-style aliases).returnscaptures the final set of record aliases to emit.
Note
post_selectsare intentionally kept separate fromacquire_data[alias].post_processing. Even when a predicate references a single alias, post-selection is applied to the full record, not to an individual measurement processing chain.- Variables:
acquire_data – Runtime acquire metadata by measurement alias.
post_selects – Record-level post-selection rules.
assigns – Runtime
Assigninstructions derived from record construction and grouping operations.returns – Final set of measurement aliases to include in output records.
-
acquire_data:
dict[str,AcquireData]
-
post_selects:
list[PostSelect]
-
returns:
set[str]
- extract_post_processing_instructions(top_level, acquire_shape)
Extract post-processing metadata from a top-level IR operation.
The traversal supports either a module-like container or a function-like container as long as it contains at most one
results.mapoperation and any number ofresults.post_selectoperations. This is designed for the current “legacy” implementation of runtime, which uses post-processing instructions in a prescribed way that is not very extensible. This analysis will ensure those restrictions are met, and will raise an exception if they are not.This analysis pass will not have a place in the future with a more sophisticated runtime, and will be replaced with something more flexible and extensible.
The returned
PostProcessingAnalysisis ready to be embedded in an executable for runtime consumption.- Parameters:
top_level¶ (
Operation) – The operation to extract the post-processing instructions from.acquire_shape¶ (
int|tuple[int,...]) – Acquisition shape to attach to each extractedAcquireData. Anintis normalised to a single-element tuple.
- Return type:
- Returns:
The post-processing instructions extracted from the operation.
- Raises:
PassFailedException – If unsupported operations, predicates, or incompatible result-flow patterns are encountered.