From 9bbae83bccd1f1968bd2e34f10a4502d60210a58 Mon Sep 17 00:00:00 2001 From: Drake Stapleton <213298340+drakestapleton@users.noreply.github.com> Date: Sat, 7 Nov 2026 02:08:23 -0600 Subject: [PATCH] prefill: make scoped-check independent of argument evaluation order Minimal migration fix to an existing C test. Lines 37 and 54 called scoped() inside the same so_all(...) argument list that read the opened and keyed counters the call updates. C leaves the order of evaluating function arguments unspecified. x86-64 gcc 13 -O2 read the counters before the call, so x86-host-tests and native-x86-host failed with "scoped call reached its own kernel key". aarch64 called it first, so those jobs passed. The return code is now computed in its own statement before check(). A scan of the stack for the same pattern found no other instance: - the so_all/so_any sites in om/ and tools/ - the counter reads in every __wrap_ test Successor: scoped-check becomes an .om test under om/prefill-shape, tracked under DRA-154. Agent: D8Finish366 (omp subagent of omp-queen-spark) --- om/prefill-shape/.crumb | 8 ++++---- om/prefill-shape/scoped-check.c | 6 ++++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/om/prefill-shape/.crumb b/om/prefill-shape/.crumb index 0ab8d560..17648801 100644 --- a/om/prefill-shape/.crumb +++ b/om/prefill-shape/.crumb @@ -3,14 +3,14 @@ "generated": { "children": [], "children_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "compiled_at": "2026-11-06T12:54:44Z", + "compiled_at": "2026-11-07T08:08:03Z", "compiler": "crumb-compile/1", - "digest": "sha256:27423bc28e80b9b7a73f29238db49e7610b8049a123a663e4d21ab11c1de575a", + "digest": "sha256:0c17d933eeb407f349271c4cd0c419b6adc64b8917b19c1dc955dddb6cdb4761", "evidence_files": 0, "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "files": 29, - "generated_at_commit": "b7a56718ba8b3695af27779816536451e5bbb412", - "source_tree": "sha256:65fe631f3c501685256b473f1802bb6a1ff4701e4ccc417e8de6435baf245901" + "generated_at_commit": "d4daaa3557c979d8212a6488e939fe2ce52ede4f", + "source_tree": "sha256:9bf0b0fc1865dbc051da09fe70668526102597f31e1b8dd172deee223c06533f" } }, "layer": "native-policy", diff --git a/om/prefill-shape/scoped-check.c b/om/prefill-shape/scoped-check.c index 5c1108ac..5004108c 100644 --- a/om/prefill-shape/scoped-check.c +++ b/om/prefill-shape/scoped-check.c @@ -34,7 +34,8 @@ int main(void) { for(unsigned i=0;i<3;i++) { unsigned rt=(unsigned)so_call(41,so_eq(i,1),8,4,0),group=(unsigned)so_call(41,so_eq(i,1),4,0,0); expect(rt,8,group,0); - check(so_all(so_eq((uint64_t)(int64_t)scoped(rt,group),(uint64_t)(int64_t)OMEGA_GPU_PF_TOO_LARGE),so_eq(opened,1),so_eq(keyed,1)),"scoped call reached its own kernel key"); + int src=scoped(rt,group); + check(so_all(so_eq((uint64_t)(int64_t)src,(uint64_t)(int64_t)OMEGA_GPU_PF_TOO_LARGE),so_eq(opened,1),so_eq(keyed,1)),"scoped call reached its own kernel key"); expect(2,4,1,1); int rc=omega_gpu_pf_qgemm(256,128,OMEGA_GPU_PF_PLAIN,16,1,0,32,48,64,NULL); check(so_all(so_eq((uint64_t)(int64_t)rc,(uint64_t)(int64_t)OMEGA_GPU_PF_TOO_LARGE),so_eq(opened,1),so_eq(keyed,1)),"legacy settings unchanged after scoped call"); @@ -51,7 +52,8 @@ int main(void) { check(so_eq(omega_gpu_pf_qgemm_reading_option(0,0),UINT32_MAX),"zero reading rows refused"); check(so_eq(omega_gpu_pf_qgemm_reading_option(64,4),UINT32_MAX),"unknown reading option refused"); expect(8,8,6,0); - check(so_all(so_eq((uint64_t)(int64_t)scoped(8,6),(uint64_t)(int64_t)OMEGA_GPU_PF_BAD_ARGS),so_eq(opened,0),so_eq(keyed,0)),"invalid options refused before device access"); + int brc=scoped(8,6); + check(so_all(so_eq((uint64_t)(int64_t)brc,(uint64_t)(int64_t)OMEGA_GPU_PF_BAD_ARGS),so_eq(opened,0),so_eq(keyed,0)),"invalid options refused before device access"); omega_gpu_pf_qgemm_set_shape(0,0,0);omega_gpu_pf_qgemm_set_group(0);omega_gpu_pf_qgemm_test_set_mutant(0); printf("scoped qgemm isolation: %s\n",failed?"FAIL":"PASS");return failed?1:0; }