E6028
E6028 — A recursive cycle that places tiles in a space with a declared capacity. The recursion depth is not known at compile time, so the true peak is unbounded and the placement is refused conservatively. Downgraded to W1028 when the space is declared overcommit.
What the compiler reports
E6028 … 'deep' calls itself and places up to 3145728 bytes in memory space 'W' per activation … unbounded
The fragments the test suite holds the compiler to. An ellipsis marks text the test does not constrain; the emitted message also carries a source location.
A program that triggers it
//
// Part of the Vx Project, under the Apache License v2.0 with LLVM Exceptions.
// See LICENSE for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
// One 3 MiB tile per activation, and the depth is a runtime value: the peak is
// depth * 3 MiB against a 4 MiB space, with nothing at compile time to bound
// it. The fold refuses the cycle conservatively. A future `requires` capacity
// contract on the recursive function is the principled lift: the body would
// check as own footprint + recursive requires within the declared bound.
//
Memory CPU_DRAM {}
Memory W {
within: Memory::CPU_DRAM, capacity: 4 MiB, managed: explicit
}
Topology Dev {
arch: nvptx64,
memory: Memory::W,
visible: [Memory::W],
transfer Memory::CPU_DRAM -> Memory::W : 10
}
fn deep(n: i32) -> i32 {
let x = Tensor<f32, [1024, 768]>::uninit();
let _sx = transfer(x, Memory::W);
if n <= 0 {
return 0;
}
return deep(n - 1);
}
fn main() -> i32 {
return deep(64);
}
From tests/frontend/fail/recursion_with_residency_is_refused.vx, which asserts this diagnostic on every commit.
Related
Topologies and memoryThe chapter covering the rule this code enforces.
All diagnosticsEvery code the compiler can emit, grouped by stage.
E6027A working set that overflows a space only across call boundaries: the peak along some call path — what each caller still holds when it calls, plus the deepest callee's own peak — exceeds the space's declared capacity, while every function on the path fits by itself (that case is E6010's). Computed by folding per-function capacity summaries over the call graph, after the per-function checks. Downgraded to W1028 when the space is declared
overcommit.