conformance: gc skip header and sampled per-step siblings for vector suites

This commit is contained in:
dev committed 2026-10-14 11:28:26 +03:00
1 parent 3f1dc84676
commit 0d6566632c
15 files changed
+442 -2

No files matched your search

+13
View File
@@ -243,3 +243,16 @@ check and is not part of the composite. A later non-zero exit or failing
record from it would reopen Q-060. The result adds no normative depth limit,
trap or diagnostic.
## Cheaper per-step collection for vector suites (2026-10-14)
Six vector suites (`fmt_i64/isize/u64/usize_vectors`, `text_base64/hex_vectors`,
roughly 12 million steps each) made `--collect-every-step` take about 4-10
hours per test. The conformance header `gc: skip` now runs such a test normally
under that mode, and each has a sampled `_gc` sibling (20-21 vectors: limits,
tail and evenly spaced inputs) that is collected at every step. The full
suites still run in ordinary and `--stress` modes. The corpus is 1,799 tests;
all pass, and the thirteen vector files complete under per-step collection in
about 48 minutes. This changes which inputs are collected per step, not the
collector, the language or any diagnostic; the Q-060 validation result above
used the original full suites.
+1
View File
@@ -35,6 +35,7 @@ Planned header extensions (added by the phase that needs them):
| `stdin:` / `vfs:` / `seed:` / `stdout:` / `stderr:` / `file:` / `blocked:` | P2 (implemented) | deterministic world inputs and expected observable output |
| `grant:` / `not_instantiated:` | P2 (implemented) | capability grants for `@main`; expected instantiation failure |
| `fuel:` | P0 (implemented) | instruction limit; default 1 000 000 (spec 11 §7.1) |
| `gc: skip` | implemented | under `--collect-every-step` the test runs without collection; only for vector suites whose step count (about 12 million, roughly 2.8 ms per step under collection) makes per-step collection impractical. Each such test has a sampled `_gc` sibling that is collected at every step, so the same code paths stay covered. Ordinary and `--stress` runs execute the full suite |
| `seed:` / `schedules:` / `quantum:` | P3 | scheduler seed / schedule budget / instructions per forced scheduling point (spec 11 §7.2) |
| `profile:` | P2 | runtime profile (`hosted`, `deterministic`, …) |
@@ -1,6 +1,7 @@
// expect: run
// result: 1
// fuel: 20000000
// gc: skip
// phase: 6
// spec: docs/spec/16-standard-library.md §2.8
// Decimal oracle: Python str(value); fixed seed 202010. Small values, powers
@@ -0,0 +1,59 @@
// expect: run
// result: 1
// fuel: 20000000
// phase: 6
// spec: docs/spec/16-standard-library.md §2.8
// Sampled copy of fmt_i64_vectors.aji (21 of 984 vectors: limits, tail, evenly spaced)
// for `--collect-every-step`; the full suite carries `// gc: skip`.
// Decimal oracle: Python str(value); fixed seed 202010. Small values, powers
// of ten/two and their neighbors, signed limits, and 48 seeded unsigned inputs.
module test.fmt_i64_gc
import std.fmt;
fn check(value: i64, expected: slice<u8>) -> void
effects []
{
for capacity in 0usize..23usize {
var storage: [u8; 26] = [165; 26];
match std.fmt.write_i64(mut storage[1..1 + capacity], value as! i64) {
std.fmt.WriteResult::ok(count) => {
assert(capacity >= expected.len);
assert(count == expected.len);
for i in 0..count { assert(storage[1 + i] == expected[i]); }
for i in count + 1..storage.len { assert(storage[i] == 165); }
}
std.fmt.WriteResult::short_output => {
assert(capacity < expected.len);
for i in 0..storage.len { assert(storage[i] == 165); }
}
}
assert(storage[0] == 165);
}
}
fn main() -> u8
effects []
{
check((-9223372036854775807i64 - 1i64), b"-9223372036854775808");
check(-9223372036854775807i64, b"-9223372036854775807");
check(-8840889545696419459i64, b"-8840889545696419459");
check(-8741427099435404153i64, b"-8741427099435404153");
check(-8601570958497122972i64, b"-8601570958497122972");
check(-100000000000001i64, b"-100000000000001");
check(-67108865i64, b"-67108865");
check(-245i64, b"-245");
check(-164i64, b"-164");
check(-83i64, b"-83");
check(-2i64, b"-2");
check(79i64, b"79");
check(160i64, b"160");
check(241i64, b"241");
check(33554432i64, b"33554432");
check(70368744177664i64, b"70368744177664");
check(6472241654744496554i64, b"6472241654744496554");
check(8601570958497122972i64, b"8601570958497122972");
check(8741427099435404153i64, b"8741427099435404153");
check(8840889545696419459i64, b"8840889545696419459");
check(9223372036854775807i64, b"9223372036854775807");
return 1;
}
@@ -1,6 +1,7 @@
// expect: run
// result: 1
// fuel: 20000000
// gc: skip
// phase: 6
// spec: docs/spec/16-standard-library.md §2.8
// Decimal oracle: Python str(value); fixed seed 202010. Small values, powers
@@ -0,0 +1,62 @@
// expect: run
// result: 1
// fuel: 20000000
// phase: 6
// spec: docs/spec/16-standard-library.md §2.8
// Sampled copy of fmt_isize_vectors.aji (21 of 984 vectors: limits, tail, evenly spaced)
// for `--collect-every-step`; the full suite carries `// gc: skip`.
// Decimal oracle: Python str(value); fixed seed 202010. Small values, powers
// of ten/two and their neighbors, signed limits, and 48 seeded unsigned inputs.
module test.fmt_isize_gc
import std.fmt;
fn check(value: i64, expected: slice<u8>) -> void
effects []
{
let maximum = ((0usize -% 1usize) >> 1) as! isize;
let minimum = -maximum - 1isize;
if value < minimum as! i64 or value > maximum as! i64 { return; }
for capacity in 0usize..23usize {
var storage: [u8; 26] = [165; 26];
match std.fmt.write_isize(mut storage[1..1 + capacity], value as! isize) {
std.fmt.WriteResult::ok(count) => {
assert(capacity >= expected.len);
assert(count == expected.len);
for i in 0..count { assert(storage[1 + i] == expected[i]); }
for i in count + 1..storage.len { assert(storage[i] == 165); }
}
std.fmt.WriteResult::short_output => {
assert(capacity < expected.len);
for i in 0..storage.len { assert(storage[i] == 165); }
}
}
assert(storage[0] == 165);
}
}
fn main() -> u8
effects []
{
check((-9223372036854775807i64 - 1i64), b"-9223372036854775808");
check(-9223372036854775807i64, b"-9223372036854775807");
check(-8840889545696419459i64, b"-8840889545696419459");
check(-8741427099435404153i64, b"-8741427099435404153");
check(-8601570958497122972i64, b"-8601570958497122972");
check(-100000000000001i64, b"-100000000000001");
check(-67108865i64, b"-67108865");
check(-245i64, b"-245");
check(-164i64, b"-164");
check(-83i64, b"-83");
check(-2i64, b"-2");
check(79i64, b"79");
check(160i64, b"160");
check(241i64, b"241");
check(33554432i64, b"33554432");
check(70368744177664i64, b"70368744177664");
check(6472241654744496554i64, b"6472241654744496554");
check(8601570958497122972i64, b"8601570958497122972");
check(8741427099435404153i64, b"8741427099435404153");
check(8840889545696419459i64, b"8840889545696419459");
check(9223372036854775807i64, b"9223372036854775807");
return 1;
}
@@ -1,6 +1,7 @@
// expect: run
// result: 1
// fuel: 20000000
// gc: skip
// phase: 6
// spec: docs/spec/16-standard-library.md §2.8
// Decimal oracle: Python str(value); fixed seed 202010. Small values, powers
@@ -0,0 +1,59 @@
// expect: run
// result: 1
// fuel: 20000000
// phase: 6
// spec: docs/spec/16-standard-library.md §2.8
// Sampled copy of fmt_u64_vectors.aji (21 of 523 vectors: limits, tail, evenly spaced)
// for `--collect-every-step`; the full suite carries `// gc: skip`.
// Decimal oracle: Python str(value); fixed seed 202010. Small values, powers
// of ten/two and their neighbors, signed limits, and 48 seeded unsigned inputs.
module test.fmt_u64_gc
import std.fmt;
fn check(value: u64, expected: slice<u8>) -> void
effects []
{
for capacity in 0usize..23usize {
var storage: [u8; 26] = [165; 26];
match std.fmt.write_u64(mut storage[1..1 + capacity], value as! u64) {
std.fmt.WriteResult::ok(count) => {
assert(capacity >= expected.len);
assert(count == expected.len);
for i in 0..count { assert(storage[1 + i] == expected[i]); }
for i in count + 1..storage.len { assert(storage[i] == 165); }
}
std.fmt.WriteResult::short_output => {
assert(capacity < expected.len);
for i in 0..storage.len { assert(storage[i] == 165); }
}
}
assert(storage[0] == 165);
}
}
fn main() -> u8
effects []
{
check(0u64, b"0");
check(1u64, b"1");
check(2u64, b"2");
check(3u64, b"3");
check(4u64, b"4");
check(46u64, b"46");
check(88u64, b"88");
check(130u64, b"130");
check(172u64, b"172");
check(214u64, b"214");
check(256u64, b"256");
check(524288u64, b"524288");
check(1000000000u64, b"1000000000");
check(1099511627776u64, b"1099511627776");
check(2251799813685248u64, b"2251799813685248");
check(2181996174858958743u64, b"2181996174858958743");
check(14322322805036888198u64, b"14322322805036888198");
check(16856184049892812909u64, b"16856184049892812909");
check(16995872497743105300u64, b"16995872497743105300");
check(17599502550275446939u64, b"17599502550275446939");
check(18446744073709551615u64, b"18446744073709551615");
return 1;
}
@@ -1,6 +1,7 @@
// expect: run
// result: 1
// fuel: 20000000
// gc: skip
// phase: 6
// spec: docs/spec/16-standard-library.md §2.8
// Decimal oracle: Python str(value); fixed seed 202010. Small values, powers
@@ -0,0 +1,60 @@
// expect: run
// result: 1
// fuel: 20000000
// phase: 6
// spec: docs/spec/16-standard-library.md §2.8
// Sampled copy of fmt_usize_vectors.aji (21 of 523 vectors: limits, tail, evenly spaced)
// for `--collect-every-step`; the full suite carries `// gc: skip`.
// Decimal oracle: Python str(value); fixed seed 202010. Small values, powers
// of ten/two and their neighbors, signed limits, and 48 seeded unsigned inputs.
module test.fmt_usize_gc
import std.fmt;
fn check(value: u64, expected: slice<u8>) -> void
effects []
{
if value > (0usize -% 1usize) as! u64 { return; }
for capacity in 0usize..23usize {
var storage: [u8; 26] = [165; 26];
match std.fmt.write_usize(mut storage[1..1 + capacity], value as! usize) {
std.fmt.WriteResult::ok(count) => {
assert(capacity >= expected.len);
assert(count == expected.len);
for i in 0..count { assert(storage[1 + i] == expected[i]); }
for i in count + 1..storage.len { assert(storage[i] == 165); }
}
std.fmt.WriteResult::short_output => {
assert(capacity < expected.len);
for i in 0..storage.len { assert(storage[i] == 165); }
}
}
assert(storage[0] == 165);
}
}
fn main() -> u8
effects []
{
check(0u64, b"0");
check(1u64, b"1");
check(2u64, b"2");
check(3u64, b"3");
check(4u64, b"4");
check(46u64, b"46");
check(88u64, b"88");
check(130u64, b"130");
check(172u64, b"172");
check(214u64, b"214");
check(256u64, b"256");
check(524288u64, b"524288");
check(1000000000u64, b"1000000000");
check(1099511627776u64, b"1099511627776");
check(2251799813685248u64, b"2251799813685248");
check(2181996174858958743u64, b"2181996174858958743");
check(14322322805036888198u64, b"14322322805036888198");
check(16856184049892812909u64, b"16856184049892812909");
check(16995872497743105300u64, b"16995872497743105300");
check(17599502550275446939u64, b"17599502550275446939");
check(18446744073709551615u64, b"18446744073709551615");
return 1;
}
@@ -1,6 +1,7 @@
// expect: run
// result: 0
// fuel: 20000000
// gc: skip
// phase: 6
// spec: docs/spec/16-standard-library.md §2.6
module test.text
@@ -0,0 +1,82 @@
// expect: run
// result: 0
// fuel: 20000000
// phase: 6
// spec: docs/spec/16-standard-library.md §2.6
// Sampled copy of text_base64_vectors.aji (20 of 572 vectors: limits, tail, evenly spaced)
// for `--collect-every-step`; the full suite carries `// gc: skip`.
module test.text_gc
import std.encoding.base64;
import std.bytes;
fn fixture(data: slice<u8>, encoded: slice<u8>) -> void
effects []
{
for capacity in 0usize..encoded.len + 2 {
var dst: [u8; 132] = [165; 132];
match std.encoding.base64.encode(mut dst[1..1 + capacity], ref data) {
std.encoding.base64.EncodeResult::ok(count) => {
assert(capacity >= encoded.len); assert(count == encoded.len);
assert(std.bytes.equal(ref dst[1..1 + count], ref encoded));
}
std.encoding.base64.EncodeResult::short_output => { assert(capacity < encoded.len); }
}
for i in 0..dst.len {
if capacity < encoded.len or i == 0 or i > encoded.len { assert(dst[i] == 165); }
}
}
for capacity in 0usize..data.len + 2 {
var dst: [u8; 132] = [165; 132];
match std.encoding.base64.decode(mut dst[1..1 + capacity], ref encoded) {
std.encoding.base64.DecodeResult::ok(count) => {
assert(capacity >= data.len); assert(count == data.len);
assert(std.bytes.equal(ref dst[1..1 + count], ref data));
}
std.encoding.base64.DecodeResult::invalid_input => { trap; }
std.encoding.base64.DecodeResult::short_output => { assert(capacity < data.len); }
}
for i in 0..dst.len {
if capacity < data.len or i == 0 or i > data.len { assert(dst[i] == 165); }
}
}
}
fn invalid(encoded: slice<u8>) -> void
effects []
{
// Invalid input takes precedence over insufficient capacity, without writes.
for capacity in 0usize..12usize {
var dst: [u8; 16] = [165; 16];
match std.encoding.base64.decode(mut dst[1..1 + capacity], ref encoded) {
std.encoding.base64.DecodeResult::invalid_input => {}
std.encoding.base64.DecodeResult::ok(count) => { trap; }
std.encoding.base64.DecodeResult::short_output => { trap; }
}
for i in 0..dst.len { assert(dst[i] == 165); }
}
}
fn main() -> u8
effects []
{
var empty: [u8; 1] = zero;
fixture(ref empty[0..0], ref empty[0..0]);
fixture(b"\x00", b"\x41\x41\x3d\x3d");
fixture(b"\x01", b"\x41\x51\x3d\x3d");
fixture(b"\x02", b"\x41\x67\x3d\x3d");
fixture(b"\x03", b"\x41\x77\x3d\x3d");
fixture(b"\x32", b"\x4d\x67\x3d\x3d");
fixture(b"\x61", b"\x59\x51\x3d\x3d");
fixture(b"\x90", b"\x6b\x41\x3d\x3d");
fixture(b"\xbf", b"\x76\x77\x3d\x3d");
fixture(b"\xee", b"\x37\x67\x3d\x3d");
invalid(b"\x5a\x67");
invalid(b"\x5a\x6d\x39\x76\x41\x25\x41\x41");
invalid(b"\x5a\x6d\x39\x76\x41\x94\x41\x41");
invalid(b"\x5a\x6d\x39\x76\x41\xc3\x41\x41");
invalid(b"\x5a\x6d\x39\x76\x41\xf2\x41\x41");
invalid(b"\x66\x30\x3d\x3d");
invalid(b"\x66\x2f\x2f\x3d");
invalid(b"\x2f\x2f\x39\x3d");
invalid(b"\x2f\x2f\x2b\x3d");
invalid(b"\x2f\x2f\x2f\x3d");
return 0;
}
@@ -1,6 +1,7 @@
// expect: run
// result: 0
// fuel: 20000000
// gc: skip
// phase: 6
// spec: docs/spec/16-standard-library.md §2.6
module test.text
@@ -0,0 +1,89 @@
// expect: run
// result: 0
// fuel: 20000000
// phase: 6
// spec: docs/spec/16-standard-library.md §2.6
// Sampled copy of text_hex_vectors.aji (21 of 518 vectors: limits, tail, evenly spaced)
// for `--collect-every-step`; the full suite carries `// gc: skip`.
module test.text_gc
import std.encoding.hex;
import std.bytes;
fn fixture(data: slice<u8>, encoded: slice<u8>) -> void
effects []
{
for capacity in 0usize..encoded.len + 2 {
var dst: [u8; 132] = [165; 132];
match std.encoding.hex.encode(mut dst[1..1 + capacity], ref data) {
std.encoding.hex.EncodeResult::ok(count) => {
assert(capacity >= encoded.len); assert(count == encoded.len);
assert(std.bytes.equal(ref dst[1..1 + count], ref encoded));
}
std.encoding.hex.EncodeResult::short_output => { assert(capacity < encoded.len); }
}
for i in 0..dst.len {
if capacity < encoded.len or i == 0 or i > encoded.len { assert(dst[i] == 165); }
}
}
for capacity in 0usize..data.len + 2 {
var dst: [u8; 132] = [165; 132];
match std.encoding.hex.decode(mut dst[1..1 + capacity], ref encoded) {
std.encoding.hex.DecodeResult::ok(count) => {
assert(capacity >= data.len); assert(count == data.len);
assert(std.bytes.equal(ref dst[1..1 + count], ref data));
}
std.encoding.hex.DecodeResult::invalid_input => { trap; }
std.encoding.hex.DecodeResult::short_output => { assert(capacity < data.len); }
}
for i in 0..dst.len {
if capacity < data.len or i == 0 or i > data.len { assert(dst[i] == 165); }
}
}
}
fn invalid(encoded: slice<u8>) -> void
effects []
{
// Invalid input takes precedence over insufficient capacity, without writes.
for capacity in 0usize..12usize {
var dst: [u8; 16] = [165; 16];
match std.encoding.hex.decode(mut dst[1..1 + capacity], ref encoded) {
std.encoding.hex.DecodeResult::invalid_input => {}
std.encoding.hex.DecodeResult::ok(count) => { trap; }
std.encoding.hex.DecodeResult::short_output => { trap; }
}
for i in 0..dst.len { assert(dst[i] == 165); }
}
}
fn main() -> u8
effects []
{
var empty: [u8; 1] = zero;
fixture(ref empty[0..0], ref empty[0..0]);
fixture(b"\x00", b"\x30\x30");
fixture(b"\x01", b"\x30\x31");
fixture(b"\x02", b"\x30\x32");
fixture(b"\x03", b"\x30\x33");
fixture(b"\x2d", b"\x32\x64");
fixture(b"\x57", b"\x35\x37");
fixture(b"\x81", b"\x38\x31");
fixture(b"\xab", b"\x61\x62");
fixture(b"\xd5", b"\x64\x35");
fixture(b"\xff", b"\x66\x66");
invalid(b"\x30\x0e");
invalid(b"\x30\x48");
invalid(b"\x30\x78");
invalid(b"\x30\xa2");
invalid(b"\x30\xcc");
invalid(b"\x30\xf6");
invalid(b"\x30\xfc");
invalid(b"\x30\xfd");
invalid(b"\x30\xfe");
invalid(b"\x30\xff");
var dst: [u8; 4] = zero;
match std.encoding.hex.decode(mut dst, b"aBcD01fF") {
std.encoding.hex.DecodeResult::ok(count) => { assert(count == 4); assert(std.bytes.equal(ref dst, b"\xab\xcd\x01\xff")); }
std.encoding.hex.DecodeResult::invalid_input => { trap; }
std.encoding.hex.DecodeResult::short_output => { trap; }
}
return 0;
}
+11 -2
View File
@@ -60,6 +60,10 @@ const Header = struct {
/// root) whose observable run must equal this one's.
equivalent: ?[]const u8 = null,
modules: []const ModuleBinding = &.{},
/// `gc: skip` runs the test normally under `--collect-every-step`: for
/// vector suites whose step count makes per-step collection impractical.
/// A smaller sibling test keeps the same code paths under collection.
step_gc: bool = true,
};
pub fn main(init: std.process.Init) !void {
@@ -369,7 +373,7 @@ fn runSeed(arena: std.mem.Allocator, module: aji.air.Module, want: Expect.Run, h
.output = &output,
.quantum = header.quantum,
.task_limit = header.task_limit,
.collect_every_step = collect_every_step and k == 1,
.collect_every_step = collect_every_step and header.step_gc and k == 1,
// Every run test also checks the verifier's DRF guarantee (spec 04 §21).
.detect_races = true,
.schedule_seed = schedule_seed,
@@ -492,7 +496,7 @@ fn formatExpect(e: Expect, w: *std.Io.Writer) std.Io.Writer.Error!void {
}
}
const HeaderError = error{ BadModule, BadGrant, MissingExpect, MissingPhase, MissingSpec, MissingRunResult, UnknownKey, UnknownCode, BadExpect, OutOfMemory, InvalidCharacter, Overflow };
const HeaderError = error{ BadModule, BadGrant, MissingExpect, MissingPhase, MissingSpec, MissingRunResult, BadGc, UnknownKey, UnknownCode, BadExpect, OutOfMemory, InvalidCharacter, Overflow };
fn parseHeader(arena: std.mem.Allocator, source: []const u8) HeaderError!Header {
var expect: ?Expect = null;
@@ -510,6 +514,7 @@ fn parseHeader(arena: std.mem.Allocator, source: []const u8) HeaderError!Header
var want_stderr: ?[]const u8 = null;
var spec: ?[]const u8 = null;
var equivalent: ?[]const u8 = null;
var step_gc = true;
var modules: std.ArrayList(ModuleBinding) = .empty;
var lines = std.mem.splitScalar(u8, source, '\n');
@@ -596,6 +601,9 @@ fn parseHeader(arena: std.mem.Allocator, source: []const u8) HeaderError!Header
try modules.append(arena, .{ .name = value[0..eq], .path = value[eq + 1 ..] });
} else if (std.mem.eql(u8, key, "equivalent")) {
equivalent = value;
} else if (std.mem.eql(u8, key, "gc")) {
if (!std.mem.eql(u8, value, "skip")) return error.BadGc;
step_gc = false;
} else return error.UnknownKey;
}
if (expect) |*e| switch (e.*) {
@@ -620,6 +628,7 @@ fn parseHeader(arena: std.mem.Allocator, source: []const u8) HeaderError!Header
.spec = spec orelse return error.MissingSpec,
.equivalent = equivalent,
.modules = modules.items,
.step_gc = step_gc,
};
}