E6032

E6032 — An across loop that the topology or its place cannot have: a topology with no levels: or one whose arch cannot launch them (without -fauto-schedule-levels), a level the topology does not name, a loop outside a spawn on region 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::sum and 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 a Distinct tensor parameter, as in y[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