srdatalog.ir.dialects.relation.d2l.ops¶
relation.d2l ops — Device2LevelIndex segment-aware nodes.
D2L FULL_VER reads expose two view slots (HEAD + FULL); operators that
consume them have to visit both segments. The legacy emitter does this
with a for (_seg = 0; _seg < view_count; ...) loop wrapping the join
body, reassigning the view variable per iteration. D2lSegmentLoop
captures that pattern as a first-class IIR op.
See also relation.d2l.__init__.view_count for the per-source slot
arithmetic.
Module Contents¶
Classes¶
Iterate over a D2L source’s segments (HEAD then FULL). |
Data¶
API¶
- class srdatalog.ir.dialects.relation.d2l.ops.D2lSegmentLoop[source]¶
Bases:
srdatalog.ir.core.OpIterate over a D2L source’s segments (HEAD then FULL).
Two emit shapes:
Single-line (multi-source nested CJ — legacy
_nested_column_join_multi): whenlocal_view_var == '', lowers tofor (int <seg_var> = 0; <seg_var> < <view_count>; <seg_var>++) { [auto ]<view_var> = views[<base_slot> + <seg_var>]; <body> }declare=Falserebinds the kernel-startview_var;declare=Truedeclares a fresh per-segment view (single-source nested CJ case, N5.3).Two-line (root CJ multi non-first source — legacy
_root_cj_multiphase 2): whenlocal_view_varis non-empty, lowers tofor (int <seg_var> = 0; <seg_var> < <view_count>; <seg_var>++) { auto <local_view_var> = views[<base_slot> + <seg_var>]; <view_var> = <local_view_var>; <body> }The local var is the SHORT name (
view_<rel>_<src_idx>) the immediately-following prefix narrowing references; the fixed canonical kernel-start view is rebound so downstream code that uses the LONG name also sees the current segment’s array. The assignment line is omitted whenlocal_view_var == view_var(matches legacyif fixed_view_var != view_varguard).Indent semantics (both shapes): the wrapped
bodyemits at one level deeper than the segment loop’sforpreamble, butEmitCtx.segment_depthis bumped so any innerIntersectIteranchors its body lines / body op back to the outer indent — matching the legacyseg_indent-vs-ind(ctx)indent quirk.- body: srdatalog.ir.core.Op¶
None
- srdatalog.ir.dialects.relation.d2l.ops.__all__¶
[‘D2lSegmentLoop’]