W1023
W1023 — spawn on(Topology::Current): the region runs where the code around it already runs.
What the compiler reports
Warning[W1023] at {{.*}}warnings_for_casts_transfers_and_spawns.vx:28:3: `spawn on(Topology::Current)`
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
//
//
// Three lines that compile but do not do what they look like:
//
// - `100000 as i8` gives -96 (W1014); `100 as i8` fits, so it gets no warning;
// - a transfer into the memory the tensor is already in only copies it (W1022);
// - `spawn on(Topology::Current)` runs where the code around it runs (W1023).
// ONCE-COUNT-1: Warning[W1014]
// ONCE-NOT: Warning[W1014]
fn main() -> i32 {
let small = 100000 as i8;
let fine = 100 as i8;
let t = Tensor<f32, [4]>::new();
let s = transfer(t, Memory::CPU_DRAM);
spawn on(Topology::Current) {
print(small);
}
print(fine);
print(s[0]);
return 0;
}
From tests/frontend/pass/warnings_for_casts_transfers_and_spawns.vx, which asserts this diagnostic on every commit.
Related
A tour of VxThe chapter covering the rule this code enforces.
All diagnosticsEvery code the compiler can emit, grouped by stage.
W1022A
transfer into the memory the value is already in. It only makes a copy.
W1024Implicit cross-topology transfer inserted via a Relocatable impl (a real data movement happens silently at the use site; write the transfer explicitly to silence). Relocatable answers "may this value move implicitly?" and is keyed on a user type. That is a different question from "what code moves bytes across this hardware edge?", which is impl Transfer<Memory::A, Memory::B> for Topology::X. Both were called Transfer before Vx#353.