E6001
E6001 — Topology mismatch in function call
What the compiler reports
E6001 … requires topology … NPU
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 generic half of E6001, and a different code path from the one in
// call_needs_its_topology.vx.
//
// A call resolves in one of two places: a concrete function found in the
// environment, or a monomorphized instance found after substitution. Both carry
// a topology and both have to check it, and the check is written twice -- so a
// test that only exercises the concrete path leaves the generic one free to
// silently drop the requirement, which is the failure this file exists to catch.
//
// The instance is what is checked, not the template: `scaled<4>` is a device
// function no matter which argument produced it.
//
fn scaled<const N : i32>(x : f32) on Topology::NPU[0] -> f32 {
return x * (N as f32);
}
fn main() -> i32 {
// The instance is device-bound; the call site is the host.
let v : f32 = scaled<4>(1.5);
print(v);
return 0;
}
From tests/frontend/fail/generic_call_needs_its_topology.vx, which asserts this diagnostic on every commit.