Skip to main content

rlx_flow/
value.rs

1// RLX — versatile ML compiler + runtime.
2// Copyright (C) 2026 Eugene Hauptmann, Nataliya Kosmyna.
3
4//! Tensor handle flowing through block stages — wraps internal HIR node id.
5
6use rlx_ir::{HirNodeId, Shape};
7
8/// Output of a block stage. Model authors see shape + opaque id only.
9#[derive(Debug, Clone)]
10pub struct FlowValue {
11    pub(crate) id: HirNodeId,
12    pub shape: Shape,
13}
14
15impl FlowValue {
16    pub fn new(id: HirNodeId, shape: Shape) -> Self {
17        Self { id, shape }
18    }
19
20    pub fn shape(&self) -> &Shape {
21        &self.shape
22    }
23
24    /// Tier-2 escape: read internal node id (prefer new blocks over this).
25    pub fn hir_id(&self) -> HirNodeId {
26        self.id
27    }
28}