W1033
W1033 — The loop of aspawnregion runs on one thread although each pass writes only memory of its own, so its passes could run at the same time. The warning points at what stops it: a call the compiler cannot show writes nothing, inline MLIR, a read of a row another pass writes, bounds not known when compiling, and the like. A region that callsbarrier()asks for blocks and threads, so it is warned about whenever it runs on one thread, with the first thing that stopped the split: two threads that may write the same element, abreakout of a loop that holds abarrier(), a write to block-shared memory with nobarrier()after it, and the like.
What the compiler reports
Warning[W1033]
{{^}}4 3 2 1{{$}}
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 `spawn` region fills a tile, calls `barrier()`, and then reads the tile in the other order.
// The region runs on one thread, so the compiler warns (W1033). Both code generators run it.
//
fn main() -> i32 {
let mut out = Tensor<f32, [4]>::new();
spawn on(Topology::CPU) {
let mut part = Tensor<f32, [4]>::new();
for t in 0..4 {
part[t] = (t as f32) + 1.0;
}
barrier();
for t in 0..4 {
out[t] = part[3 - t];
}
}
println!("{} {} {} {}", out[0], out[1], out[2], out[3]);
return 0;
}
From tests/backend/pass/a_barrier_in_a_spawn_region.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.
W1031A proof obligation could not be discharged because no SMT solver was available, so the property is **unverified** rather than proved. Distinct from W1027, which means the solver ran and found a violation. Emitted only under
VX_ALLOW_UNVERIFIED; without it a missing solver is an error, because silence used to be indistinguishable from success (Vx#374).
W1034The program writes a variable that a closure copied, and uses the closure after the write. The closure keeps the value that it copied, so it does not see the write. A later release makes this an error (K4).