E6010

E6010 — The working set placed in a memory space (the sum of its tiles) exceeds capacity. Downgraded to W1028 when the space is declared overcommit.

What the compiler reports

E6010 … working set

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
//
// The cumulative budget check (E6010): the *sum* of the tiles placed in a memory space must
// fit its capacity, even when each tile fits individually. This is the collective-overflow
// the per-tile check (E6009) misses. Here three tiles for an SMEM scratchpad are 128 KiB
// each and the scratchpad is 228 KiB, so any one fits but three do not (384 KiB > 228 KiB).
//

Memory Local_SRAM {
  scope: sm, capacity: 228 KiB
}

fn main() -> i32 {
  let mut qt = Tensor<f32, [128, 256]>::uninit();
  let mut kt = Tensor<f32, [128, 256]>::uninit();
  let mut vt = Tensor<f32, [128, 256]>::uninit();
  for i in 0..128 {
    for j in 0..256 {
      qt[i][j] = 1.0;
      kt[i][j] = 1.0;
      vt[i][j] = 1.0;
    }
  }
  let q = transfer(qt, Memory::Local_SRAM);
  let k = transfer(kt, Memory::Local_SRAM);
  let v = transfer(vt, Memory::Local_SRAM);
  // Read after the last placement: a tile's life runs to its last reader, so tiles
  // nobody reads are released where they are made and never share the space.
  let _rq = transfer(q, Memory::CPU_DRAM);
  let _rk = transfer(k, Memory::CPU_DRAM);
  let _rv = transfer(v, Memory::CPU_DRAM);
  return 0;
}

From tests/frontend/fail/memory_working_set_overflow.vx, which asserts this diagnostic on every commit.

Related