From d29aa940353b1af1b3f9ab351e0af59b9dffead7 Mon Sep 17 00:00:00 2001 From: Chao Wang <26245345+ChaoWao@users.noreply.github.com> Date: Wed, 22 Jul 2026 19:17:12 -0700 Subject: [PATCH] Fix: scalar_data_test check tensor reads uninitialized device slot MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The `check` output tensor was sized 10, but the orchestration writes only check[0..8] via set_tensor_data (9 values). Output-tensor slots are not seeded from the host buffer on device, so the never-written check[9] read whatever the device output buffer held: 0.0 when the test runs in isolation (matching the zero golden), but recycled buffer residue (~9.4e-4) under the full onboard suite that shares one device — an intermittent golden mismatch on st-onboard-a2a3. Size `check` to exactly the 9 written slots. Verified onboard on a2a3: a size-9 sentinel-seeded run passes (all slots overwritten), and the failing slot-9 residue is gone. Co-Authored-By: Claude Opus 4.8 (1M context) --- .../scalar_data_test/test_scalar_data.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/examples/a2a3/tensormap_and_ringbuffer/scalar_data_test/test_scalar_data.py b/examples/a2a3/tensormap_and_ringbuffer/scalar_data_test/test_scalar_data.py index 590bda5cb2..49771dcd8b 100644 --- a/examples/a2a3/tensormap_and_ringbuffer/scalar_data_test/test_scalar_data.py +++ b/examples/a2a3/tensormap_and_ringbuffer/scalar_data_test/test_scalar_data.py @@ -60,7 +60,10 @@ def generate_args(self, params): Tensor("a", torch.full((SIZE,), 2.0, dtype=torch.float32)), Tensor("b", torch.arange(SIZE, dtype=torch.float32)), Tensor("result", torch.zeros(SIZE, dtype=torch.float32)), - Tensor("check", torch.zeros(10, dtype=torch.float32)), + # Exactly 9 slots: the orchestration writes check[0..8] via + # set_tensor_data. Output-tensor slots are not seeded from the host, + # so any extra slot reads undefined device memory. + Tensor("check", torch.zeros(9, dtype=torch.float32)), ) def compute_golden(self, args, params):