---
title: Within-Support Reshaping
url: https://www.emergentmind.com/topics/within-support-reshaping
type: topic
---

# Within-Support Reshaping

Within-support reshaping encompasses a family of methods and architectural mechanisms that modify a system—statistical model or hardware array—so that desired constraints (e.g., functional shape properties, compatibility with workloads) are enforced while remaining strictly within the support: observed covariates in machine learning, or the physical processing element (PE) grid in hardware. In machine learning, within-support reshaping imposes monotonicity or convexity on predictors (e.g., random forests) at observed data points, preserving accuracy and predictive structure without model retraining. In hardware architectures, within-support reshaping refers to reconfiguring a fixed PE array into multiple logical shapes via lightweight intra-support routing, enhancing utilization and efficiency for diverse workloads. These approaches exploit the support set’s combinatorial structure to restrict reshaping to feasible, tractable subspaces, enabling both efficient algorithms and practical hardware.

## 1. Mathematical Formalism and General Projection Framework

In statistical learning, suppose a pre-trained prediction rule $\hat{f}: \mathbb{R}^d \rightarrow \mathbb{R}$ needs to satisfy shape constraints such as monotonicity or convexity in a subset of coordinates $\mathcal{R} \subset \{1,...,d\}$. The objective is to project $\hat{f}$ onto the function class
$$
\mathcal{F} = \{ g: \mathbb{R}^d \rightarrow \mathbb{R}\ \mid\  g \text{ is monotone or convex in each } v\in\mathcal{R}\}
$$
by solving
$$
g^* = \arg\min_{g \in \mathcal{F}} \|g - \hat{f}\|^2_2
$$
where the $L_2$ norm is over the relevant distribution. Restricting to finite samples $X = \{x^1, ..., x^n\}$ gives the problem
$$
g^* = \arg\min_{g \in \mathcal{F}} \sum_{i=1}^n (g(x^i) - \hat{f}(x^i))^2.
$$
Directly solving this with combinatorial shape constraints is computationally intractable in high dimensions.

Within-support reshaping restricts this optimization to a finite “grid” constructed from the observed support by coordinate swapping. For observation $i$ and reshaped coordinate $v$, the pseudo-points $x^{i,k,v}$ are formed by replacing the $v$-th coordinate of $x^i$ with $x^k_v$ (for $k=1...,n$), yielding a manageable but expressive set. The black-box reshaping (BBOPT) problem enforces monotonicity/convexity on these sequences, with intersection constraints to ensure function consistency across coordinates. For $R = |\mathcal{R}| > 1$, this results in intersecting isotonic regression (IISO) subproblems, solvable in $O(n\log R)$ per observation, yielding an overall complexity of $O(n^2\log R)$ [1805.06439].

In hardware, the concept translates to the architectural domain: mapping a square $R_p \times R_p$ PE array into up to $R_p+1$ logical shapes $(R_l \times C_l)$ by internally reconfiguring data paths within the physical support, avoiding long wiring or external resources [2302.07520].

## 2. Algorithms for High-Dimensional Model Reshaping

The within-support approach for enforcing shape constraints scales efficiently even in high dimensions:

- **Single coordinate ($R=1$):** Each $i$-th subproblem reduces to classic isotonic regression (solvable in $O(n)$ via PAVA).
- **Multiple coordinates ($R>1$):** Subproblems require IISO. Each comprises $R$ monotone sequences intersecting at one position, minimized collectively. The solution involves:
  1. PAVA on left/right tails of each sequence around intersection.
  2. Piecewise-quadratic cost as a function of common intersection value, minimized in $O(n\log R)$.
  3. Reconstruction of monotone sequences using the minimizer.

**Random forest reshaping** further exploits tree structure: for each tree, leaf values are post-processed. Constraints are defined by the tree's axis-aligned splits on shape-constrained variables. Isotonic regression is performed over a DAG of leaves (exact, $O(m^4)$) or via an over-constrained bipartite structure at each split, leading to a fast $O(\#\text{splits}\cdot L \log L)$ algorithm [1805.06439]. Both strategies guarantee monotonicity or convexity on the support grid, and do not alter model structure or require retraining.

## 3. Hardware Within-Support Reshaping Mechanisms

The ReDas systolic array exemplifies hardware-oriented within-support reshaping by enabling fine-grained dynamic reconfiguration within the PE grid:

- **Roundabout Data Paths:** The $R_p \times R_p$ PE array is partitioned into four contiguous rectangular subarrays, connected in a logically ring-like ("roundabout") fashion. Only short, bidirectional links between adjacent PEs are required. The array can realize $R_p + 1$ logical shapes, e.g., a $128\times128$ array supports 129 shapes. The logical shape parameters $(R_l, C_l)$ obey
  $$
  0 < R_l \le \frac{1}{2}R_p, \ C_l = 4(R_p-R_l) \quad \text{or} \quad 0 < C_l \le \frac{1}{2}R_p, \ R_l = 4(R_p-C_l),
  $$
  plus the square case $(R_l, R_l) = (R_p, R_p)$ [2302.07520].

- **PE Microarchitecture:** Each PE exposes four bidirectional neighbor links and internal crossbars to classify, steer, and reorder data as needed for output-stationary (OS), weight-stationary (WS), or input-stationary (IS) dataflows. Dynamic selection of the dataflow and pass-through logic is programmed via control signals, with the core multiply-accumulate (MAC) operation left unchanged.

- **Multi-Mode Buffers:** Distributed SRAM banks surround the array, each mini-bank switchable among weight-issuer, input-issuer, output-receiver, or idle modes. Memory allocation between stationary and non-stationary operands is dynamically optimized as $D_{sta} + D_{non} \le D_{phy}$. This matches the exact per-tile buffer requirement for the logical shape and dataflow.

## 4. Efficient Mapping and Dynamic Reconfiguration

ReDas uses a lightweight analytical mapper to jointly explore:
- **Hardware configuration space:** $\{(R_l,C_l)\} \times \{\text{WS,OS,IS}\} \times \{D_{sta},D_{non}\}$
- **GEMM mapping space:** $\{M_t,K_t,N_t\} \times \{\text{loop order}\}$

To avoid intractable full enumeration ($>10^{10}$ candidates per layer), interval sampling prunes the configuration space. Each candidate is assessed in $O(1)$ using analytical runtime and buffer models:
- Total runtime:
  $$
  T_{\it total} = T_{\it start} + \mathrm{NUM}_t \cdot \max\{T_{\it exe}, T_{\it rdwt}\} + T_{\it end}
  $$
  where $\mathrm{NUM}_t = \lceil M/M_t \rceil \lceil N/N_t \rceil \lceil K/K_t \rceil$.
- Tile compute time under WS:
  $$
  T_{\it exe}=
  \begin{cases}
    R_l + (R_l + C_l + M_t-1) + 4R_l & R_l < C_l \\
    C_l + (R_l + C_l + M_t-1) + 4C_l & R_l > C_l \\
    R_l + (R_l + C_l + M_t-1) & R_l = C_l \\
  \end{cases}
  $$
  The $\pm 4\min(R_l, C_l)$ term accounts for extra corner turns in the roundabout.
- DRAM transfer costs are modeled by per-word costs and tile sizes [2302.07520].

Mapping finishes in $\sim0.7\,\mathrm{s}$ per GEMM layer, with a 0–2% runtime gap versus exhaustive search.

## 5. Empirical Performance and Guarantees

**Prediction rule reshaping**: Black-box and forest-specific methods guarantee exact enforcement of pre-specified shape constraints on the observed data grid. Predictive accuracy is typically unaffected; empirical results across regression and classification benchmarks (e.g., Diabetes, Zillow, Adult, Spam) show reshaped predictors maintain statistical performance of the original models, with monotonicity or convexity visually and quantitatively certified. The over-constrained forest estimator achieves near-equivalent performance to exact isotonic regression, with substantially lower computation [1805.06439].

**Hardware reshaping (ReDas)**: In benchmark DNN inference (ResNet-50, EfficientNet-B0, Tiny-YOLO-V2, Faster-RCNN, ViT, BERT-Large, GNMT, DeepSpeech2), ReDas on a $128\times128$ array (28 nm, 700 MHz, 4 MB SRAM) attains:

| DNN model    | Speedup (vs TPU)  | EDP reduction (vs TPU) |
|--------------|-------------------|------------------------|
| ResNet-50    | 4.1×              | 7.8×                   |
| EfficientNet | 3.9×              | 7.2×                   |
| Tiny-YOLO    | 4.8×              | 8.5×                   |
| Faster-RCNN  | 3.7×              | 7.5×                   |
| ViT          | 6.0×              | 9.1×                   |
| BERT-Large   | 4.3×              | 8.0×                   |
| GNMT         | 5.7×              | 8.9×                   |
| DeepSpeech2  | 8.2×              | 10.6×                  |
| **Geomean**  | **4.6×**          | **8.3×**               |

ReDas achieves up to $8.3\times$ reduction in energy-delay product and $4.6\times$ speedup compared to a fixed shape WS–TPU baseline. Power efficiency and area–delay product gains are also substantial (2.1 × and 3.5 × vs. SARA, respectively) [2302.07520].

## 6. Practical Considerations and Scope

Both statistical and hardware within-support reshaping frameworks operate as non-intrusive, post-training/post-fabrication interventions that do not alter the underlying topology (tree structure or PE array). In machine learning, they guarantee shape constraints on the observed support and potentially any test point created by coordinate swapping; they do not guarantee constraints for inputs far from the training set but are sufficient for practical deployment when the support is dense. Choosing which coordinates to constrain is a domain-dependent tradeoff: over-constraining in non-monotone directions risks introducing bias.

For hardware, the mapping and reshaping apply strictly to the spatial footprint of the PE array—no external logic or long bypasses—so efficiency is preserved without added area or power penalty. The buffer allocator leverages mini-bank flexibility for optimal resource allocation per layer/dataflow.

A plausible implication is that within-support reshaping frameworks can serve as practical, efficient solutions in settings where structural invariance is vital (e.g., model compliance, adaptive accelerator architectures) and out-of-sample generalization or maximal hardware utilization is required without compromising existing design integrity.

Source: https://www.emergentmind.com/topics/within-support-reshaping