Skip to main content

rlx_flow/
value.rs

1// RLX — versatile ML compiler + runtime.
2// Copyright (C) 2026 Eugene Hauptmann, Nataliya Kosmyna.
3//
4// This program is free software: you can redistribute it and/or modify
5// it under the terms of the GNU General Public License as published by
6// the Free Software Foundation, version 3.
7//
8// This program is distributed in the hope that it will be useful,
9// but WITHOUT ANY WARRANTY; without even the implied warranty of
10// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11// GNU General Public License for more details.
12//
13// You should have received a copy of the GNU General Public License
14// along with this program. If not, see <https://www.gnu.org/licenses/>.
15
16//! Tensor handle flowing through block stages — wraps internal HIR node id.
17
18use rlx_ir::{HirNodeId, Shape};
19
20/// Output of a block stage. Model authors see shape + opaque id only.
21#[derive(Debug, Clone)]
22pub struct FlowValue {
23    pub(crate) id: HirNodeId,
24    pub shape: Shape,
25}
26
27impl FlowValue {
28    pub fn new(id: HirNodeId, shape: Shape) -> Self {
29        Self { id, shape }
30    }
31
32    pub fn shape(&self) -> &Shape {
33        &self.shape
34    }
35
36    /// Tier-2 escape: read internal node id (prefer new blocks over this).
37    pub fn hir_id(&self) -> HirNodeId {
38        self.id
39    }
40}