E6032
E6032 — Anacrossloop that the topology or its place cannot have: a topology with nolevels:or one whose arch cannot launch them (without-fauto-schedule-levels), a level the topology does not name, a loop outside aspawn onregion or in the wrong order, a size that is not known when the kernel is compiled or is over the limit, or a jump out of the loop. Also a lane reduction (lanes::sumand the others) outside the code of a loop of blocks or subgroups, or with a tensor that is too large. Also two passes of the loop that may write the same element, or a pass that may read an element that another pass writes. A row from aDistincttensor parameter, as iny[idx[b]], keeps the passes apart.
What the compiler reports
Error[E6032] at {{.*}}.vx:[[@LINE+1]]:14: `lanes::sum` must be the whole value of a `let`
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
//
//
// A lane reduction must be the whole value of a `let`, so `y[r] = lanes::sum(..)` gets E6032.
// That is the only error. `y[r]` is an `f32`, which cannot point into a stack frame, so the
// store gets no E4005. The compiler used to give E4005 first.
pub fn matvec_by_block(y : &mut Tensor<f32, [?], Memory::HBM>, w : &Tensor<f32, [?, 512], Memory::HBM>, x : &Tensor<f32, [512], Memory::HBM>, rows : i32) -> void {
spawn on(Topology::Device) {
for r in 0..rows across blocks {
let mut part = unsafe { Tensor<f32, [256], Memory::SMEM>::uninit() };
for l in 0..256 across lanes {
part[l] = w[r][l] * x[l] + w[r][256 + l] * x[256 + l];
}
y[r] = lanes::sum(&part, 256);
}
}
return;
}
fn main() -> i32 {
return 0;
}
From tests/frontend/fail/lane_reduction_stored_straight_into_memory.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.
E6031A tensor shape that folds to a negative extent, or whose size is more than 2^63 - 1 bytes, the most an allocation can ask for. The size is known, and it is not one the generated code can allocate: it would wrap.
E6033An index into a tensor in a
scope: thread space that is not known when compiling. Such a tensor stays in registers, and a register has no address. So each index must be a constant, or made of constants and the variables of for loops with constant bounds, at most 1024 passes each. The code generator unrolls those loops.