1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
//! WGPU trap sidecar integration tests.
use vyre_driver::VyreBackend;
use vyre_driver_wgpu::WgpuBackend;
use vyre_libs::scan::dispatch_io::pack_u32_slice as pack_words;
#[test]
fn inflate_fixed_huffman_reports_wgpu_trap_tag() {
let backend = WgpuBackend::acquire().expect("Fix: GPU required for WGPU trap sidecar test");
let program = vyre_libs::decode::inflate("input", "output", 5);
let input = pack_words(&[0x03, 0, 0, 0, 0]);
let len_sidecar = vec![0u8; 4];
let error = backend
.dispatch(
&program,
&[input, len_sidecar],
&vyre_driver::DispatchConfig::default(),
)
.expect_err("Fix: BTYPE=1 must propagate Node::Trap through WGPU.");
let message = error.to_string();
// What the sidecar has to preserve is the trap's OWN tag, verbatim, from
// the shader that raised it. The assertion below therefore checks the
// pieces that identify the trap, not a particular phrasing: the wgpu
// framing, the operation that refused the input, the BTYPE that was
// rejected, and an actionable Fix clause. An earlier version required the
// word "fixed-Huffman" and failed once the tag was reworded to name the
// op and the remedy instead, which is strictly more useful to an operator.
for needle in [
"wgpu dispatch trapped",
"vyre-primitives::decode::inflate_stored",
"BTYPE=1",
"Fix:",
] {
assert!(
message.contains(needle),
"Fix: trap sidecar must carry `{needle}` from the original tag, got: {message}",
);
}
// The sidecar's own framing must survive too: which lane trapped, and the
// tag code that maps back to the trap table.
assert!(
message.contains("lane=") && message.contains("tag_code="),
"Fix: trap sidecar must report the lane and tag code, got: {message}",
);
}