Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
184 commits
Select commit Hold shift + click to select a range
e24dae3
feat(veryl)!: run `#[test]` initial blocks as process kernels
tignear Oct 9, 2026
d2310ea
fix(veryl): address review findings of the testbench kernels
tignear Oct 10, 2026
3659b4d
Merge branch 'feature/1123-clock-waits' into feature/1123-veryl-kernels
tignear Oct 10, 2026
2b75903
Merge branch 'feature/1123-clock-waits' into feature/1123-veryl-kernels
tignear Oct 10, 2026
a0d0eee
Merge branch 'feature/1123-clock-waits' into feature/1123-veryl-kernels
tignear Oct 10, 2026
8a25ed2
Merge branch 'feature/1123-clock-waits' into feature/1123-veryl-kernels
tignear Oct 10, 2026
1973cd9
fix(veryl): address the second review round of the testbench kernels
tignear Oct 10, 2026
2a0b8aa
Merge branch 'feature/1123-clock-waits' into feature/1123-veryl-kernels
tignear Oct 10, 2026
9b31a3b
Merge branch 'feature/1123-clock-waits' into feature/1123-veryl-kernels
tignear Oct 10, 2026
b55e504
fix(runtime): take the due processes of settle_at with their releases
tignear Oct 10, 2026
16def71
Merge branch 'feature/1123-clock-waits' into feature/1123-veryl-kernels
tignear Oct 10, 2026
e11fe79
Merge branch 'feature/1123-clock-waits' into feature/1123-veryl-kernels
tignear Oct 10, 2026
aa866fe
Merge branch 'feature/1123-clock-waits' into feature/1123-veryl-kernels
tignear Oct 10, 2026
d16fb8b
Merge feature/1123-clock-waits into feature/1123-veryl-kernels
tignear Oct 11, 2026
8897b7a
fix(veryl): preserve process expression effects and runtime state
tignear Oct 11, 2026
fd348c2
Merge latest clock and timed-suite fixes into feature/1123-veryl-kernels
tignear Oct 11, 2026
047fbce
fix(veryl): adapt external projection to process storage
tignear Oct 11, 2026
46a1b03
Merge commit '841f160b843bf35107279cb35e996b4c121e9309' into HEAD
tignear Oct 12, 2026
2df766d
fix(native): advance container schema for kernel host state
tignear Oct 12, 2026
37ab0d5
Merge commit '1cf29b0f71acf59aeb0c9dae397241894bb0abfd' into HEAD
tignear Oct 12, 2026
fa5813a
fix(veryl): settle break edges and preserve reachable call order
tignear Oct 12, 2026
989c72e
Merge commit 'aea6e7cdc4cba7fd73695a41a325be78618bf652' into HEAD
tignear Oct 12, 2026
6484abd
fix(native): version combined kernel and clock-phase metadata
tignear Oct 12, 2026
95612b8
Merge commit 'a2e90797a7fdd8fa1bcfa428ecbd8edf659b006a' into HEAD
tignear Oct 12, 2026
5117889
Merge commit 'ca7e626ef858fba414396797c8592f2fdb680267' into HEAD
tignear Oct 12, 2026
7468059
fix(runtime): preserve grouped tick budgets after clock validation
tignear Oct 12, 2026
e258baa
fix(veryl): retain kernel edges and honor termination during settles
tignear Oct 12, 2026
ef6921c
Merge commit '94d8523f3' into HEAD
tignear Oct 12, 2026
da31c75
style(runtime): format merged clock scheduling calls
tignear Oct 12, 2026
ff6d898
Merge commit '75968b639' into HEAD
tignear Oct 12, 2026
543b7c0
Merge commit '3265fda34' into HEAD
tignear Oct 12, 2026
3884a30
Merge commit '371ff0c29' into HEAD
tignear Oct 12, 2026
6aa1067
Merge commit 'd5efa1fed' into HEAD
tignear Oct 12, 2026
d5b3df7
Merge commit '049e5d735' into HEAD
tignear Oct 12, 2026
eb3c399
fix(veryl): retain reachable clocks and honor init finish
tignear Oct 12, 2026
48d84ed
Merge commit '4df0b609c615f50639e82b4f3f11026089ab1b9b' into HEAD
tignear Oct 12, 2026
c2696a2
fix(testbench): batch reset assertion with its first clock edge
tignear Oct 12, 2026
1ff1732
Merge commit '4465425b9c62b419bcdc9fa3b1b162229d5a4b5f' into HEAD
tignear Oct 12, 2026
15b1f83
Merge commit '4e3aef490c3a0265ea4418418c06b8cb42a22afd' into HEAD
tignear Oct 12, 2026
9561694
fix(testbench): settle host effects and preserve empty component strings
tignear Oct 12, 2026
ae384f7
Merge commit '944ee21b4' into HEAD
tignear Oct 12, 2026
be46828
fix(testbench): preserve kernel yields and completion contracts
tignear Oct 12, 2026
824f248
Merge commit '62f4766b5dac367eaee90337f8f10638b27120e4' into HEAD
tignear Oct 12, 2026
d8d33cd
fix(testbench): resume selected copybacks and restore clock budgets
tignear Oct 12, 2026
2789f6d
Merge commit '737167d8d' into HEAD
tignear Oct 12, 2026
6c7bb3d
Merge commit '504fe093e' into HEAD
tignear Oct 12, 2026
92b3505
Merge commit 'dc487f09d61ead50be9c9447787d951c68b43c46' into HEAD
tignear Oct 12, 2026
00f53fa
test(runtime): retain mixed process roots at O2
tignear Oct 12, 2026
413fba1
fix(testbench): retain executed clock effects at kernel finish
tignear Oct 12, 2026
c731686
fix(testbench): select static case arms and distinguish function bodies
tignear Oct 12, 2026
ac6e70d
Merge commit '148c4e6d407fcf20fbb85e60f4e0810ec1ed0c79' into HEAD
tignear Oct 12, 2026
8a51c65
fix(testbench): prune self-determined constant case branches
tignear Oct 12, 2026
a4579de
fix(runtime): preserve executed SDK clock changes at finish
tignear Oct 12, 2026
1935574
Merge validated active-region and finish fixes from #1158
tignear Oct 12, 2026
fc08d63
Merge validated timed-suite and clock-runtime review fixes
tignear Oct 12, 2026
6da8e13
fix(runtime): compare unknown baselines when checking unsettled edges
tignear Oct 12, 2026
b38b20d
Merge commit 'fe4ae0041a25defc0fd1bdb4b21791dc3fb12ad5' into HEAD
tignear Oct 12, 2026
b58ee27
Merge review fixes while retaining four-state edges and kernel timing
tignear Oct 13, 2026
4fab7a8
style: format stacked merge resolutions
tignear Oct 13, 2026
3b148c4
Merge scoped callable key and output assertion corrections
tignear Oct 13, 2026
48c3a7d
fix(veryl): retain byte assertion payloads in process kernels
tignear Oct 13, 2026
5443bbe
fix(tests): compare concurrent kernel assertion bytes
tignear Oct 13, 2026
e95c147
Merge commit 'f84c3a2e45ead1866fd93c805a2d803b535c0f35' into HEAD
tignear Oct 13, 2026
0287b5c
Merge commit 'ecc712286eef9743ed4a4b59e7f2dd3d9e8eddab' into HEAD
tignear Oct 13, 2026
a096497
Merge commit '60fcf543f3e0e10df669b5dfeed0877e664af404' into HEAD
tignear Oct 13, 2026
174d078
Merge commit 'f3446a46ba7e8fcf957678c51dc750a8bbeac0ca' into HEAD
tignear Oct 13, 2026
d350abe
Merge commit '75106860ba9a29cf3b8e9b26ef5f750f446cea60' into HEAD
tignear Oct 13, 2026
97c3e66
docs(runtime): clarify coincident clock tick accounting
tignear Oct 13, 2026
2bdaa55
Merge commit '3553fb0ae' into HEAD
tignear Oct 13, 2026
fb246e3
fix(runtime): adapt queued event probes to generic kernel slots
tignear Oct 13, 2026
a1e2525
fix(runtime): preserve budget-blocked resumptions and verify fatal se…
tignear Oct 13, 2026
9a91b32
Merge commit '511aad808' into HEAD
tignear Oct 13, 2026
7d45d90
Merge commit 'd71fabc78' into HEAD
tignear Oct 13, 2026
f3e5b6c
Merge commit '0029e0cbe' into HEAD
tignear Oct 13, 2026
301832d
Merge commit '011196f7a' into HEAD
tignear Oct 13, 2026
ce5b317
Merge commit '5452bdf87' into HEAD
tignear Oct 13, 2026
5d0fad3
test(runtime): distinguish retained and legacy unknown edge metadata
tignear Oct 13, 2026
19b198b
fix(veryl): execute file requests and reset automatic kernel storage
tignear Oct 13, 2026
ba4b2d7
Merge commit '69c579f8df181da691995b32fb1452d5e235b2ec' into HEAD
tignear Oct 13, 2026
a8e172e
test(veryl): preserve file requests through native image roundtrips
tignear Oct 13, 2026
840243d
Merge commit '2ba62a3f9c306a2b8ac0dfd3e68f1f46576502d4' into HEAD
tignear Oct 13, 2026
7847146
fix(veryl): retain four-state process argument storage and X defaults
tignear Oct 13, 2026
1a8c057
fix(veryl): preserve dynamic assertion messages and settle event yiel…
tignear Oct 14, 2026
d73450f
Merge commit '021ac9cff' into HEAD
tignear Oct 14, 2026
406314f
fix(runtime): retain falling phases alongside testbench tick budgets
tignear Oct 14, 2026
a61425d
Merge commit '7fef3f63c' into HEAD
tignear Oct 14, 2026
f5b7190
Merge commit '1fbec408f' into HEAD
tignear Oct 14, 2026
9539e4c
test(testbench): keep FF fatal coverage on the bytecode runner
tignear Oct 14, 2026
994ec5d
Merge commit '6c48c4687' into HEAD
tignear Oct 14, 2026
033caee
Merge commit '89acc270b' into HEAD
tignear Oct 14, 2026
5804071
Merge commit '752cc652e' into HEAD
tignear Oct 14, 2026
865cdbb
Merge commit 'e99f7ac6d' into HEAD
tignear Oct 14, 2026
1006c82
fix(veryl): retain branch dirtiness and hierarchical event edges
tignear Oct 14, 2026
e9cd922
Merge commit '40f6f96a9' into HEAD
tignear Oct 14, 2026
8a2dfd5
Merge commit 'fc4c612d2' into HEAD
tignear Oct 14, 2026
718dd24
fix(veryl): scope testbench execution and private loop updates
tignear Oct 14, 2026
1c3f568
Merge commit 'da7b23942' into HEAD
tignear Oct 14, 2026
4e6d260
fix(runtime): preserve clean process continuations and kernel tick fu…
tignear Oct 14, 2026
b98acd4
fix(veryl): prune skipped case calls and reset kernel event counts
tignear Oct 14, 2026
3c514f8
ci(lydite): cache replay builds and allow cold verification
tignear Oct 14, 2026
dafef54
fix(veryl): follow execution paths when discovering process clocks
tignear Oct 14, 2026
dbadce9
Merge commit 'f7e85742718c90289963f96a4375dc342782df61' into HEAD
tignear Oct 14, 2026
44c26e0
fix(native): validate process release and host-request storage
tignear Oct 14, 2026
5182c44
Merge commit 'a3f6c0388c760378193a22b8d30099ea8f947b57' into HEAD
tignear Oct 14, 2026
329869f
fix(native): preserve four-state host argument storage validation
tignear Oct 14, 2026
1f978e6
fix(native): check testbench boundaries and empty string backing slots
tignear Oct 14, 2026
b504b6c
Merge commit '84ccbf59670c9145554810def51a07da4990bdcf' into HEAD
tignear Oct 14, 2026
ece35b0
Merge commit 'e736c7605e94ae2a7bda2325a234da9df0895f0d' into HEAD
tignear Oct 14, 2026
70ace66
Merge commit '894b8c71eb60391857bfbd43be43663b43f18277' into HEAD
tignear Oct 14, 2026
83fbaf1
fix(veryl): end expression continuations and preserve clean host requ…
tignear Oct 14, 2026
0953255
Merge commit 'a1d7aeaffb2818df24eca3345bda56d64d05adf9' into HEAD
tignear Oct 14, 2026
87378b9
Merge commit '3fa2116b17aae77f915978fac49b54a98fdc335c' into HEAD
tignear Oct 14, 2026
d788736
Merge commit '8d287c552bdeb1bf6029b7c6d3f466bb6a0b027d' into HEAD
tignear Oct 14, 2026
17b631b
fix(runtime): preserve component host settles when resuming kernels
tignear Oct 14, 2026
c8e2842
Merge commit '8056fb801827459c9c4b5374e10973e7c69496bd' into HEAD
tignear Oct 14, 2026
6713ba2
fix(veryl): settle component output writes before finishing
tignear Oct 14, 2026
79aaf47
Merge commit '98ef56bd1f6f1c80053d66f5e4dc9e894aa2f4ad' into HEAD
tignear Oct 14, 2026
1b23b03
fix(veryl): sample host waiters at the current kernel timestamp
tignear Oct 14, 2026
50dafaa
fix(veryl): propagate terminating host and event argument flow
tignear Oct 14, 2026
cdf6242
Merge commit '8ccbe3ab3' into HEAD
tignear Oct 14, 2026
d20b53f
Merge commit '64f5239e3' into HEAD
tignear Oct 14, 2026
dfc76da
fix(runtime): retain process edge counts and bound native controls
tignear Oct 14, 2026
a5404f6
Merge commit '0f7b79b34' into HEAD
tignear Oct 14, 2026
b76abc0
Merge commit '74e51cabb9307d6ed942f6b7ec4756687227014e' into HEAD
tignear Oct 14, 2026
b0e7388
fix(runtime): complete pending clock falls during retries
tignear Oct 14, 2026
e32ba57
fix(runtime): sum distinct edge counters and bind host scratch
tignear Oct 14, 2026
3963c88
Merge commit '7d0989673eb4646a1c8f039920898298138e8c7c' into HEAD
tignear Oct 14, 2026
3842f2d
Merge commit '6178a7c9ad20cd4fb98131bf6c975da7241b9bfb' into HEAD
tignear Oct 14, 2026
37f1b8b
test(napi): reject escaped clock writes before checkpointing
tignear Oct 14, 2026
f908072
fix(arm64): mask rounded wide value and unknown loads
tignear Oct 14, 2026
af5045c
fix(testbench): reset RTL termination before repeated runs
tignear Oct 14, 2026
4c14e21
Merge commit '3a6b3ce85f462dba0aac50d1f987b378b8c33cf5' into HEAD
tignear Oct 14, 2026
273d9aa
Merge commit '8aa0ed5a08' into HEAD
tignear Oct 14, 2026
decca20
fix(runtime): retain settled process edges and bind release order
tignear Oct 14, 2026
9ecb877
Merge commit '8162bb7b7f20499f39589f1c2a4a3c74182f8705' into HEAD
tignear Oct 14, 2026
465622d
fix(test): preserve integrated regression module boundaries
tignear Oct 14, 2026
689786f
Merge commit '80e4e9737fc03c0aa31ee0ff3172eb7bad305520' into HEAD
tignear Oct 14, 2026
d9be5dc
fix(testbench): preserve host paths and compiled process boundaries
tignear Oct 15, 2026
8b8753d
Merge commit 'f1f3e1a33054ad9c134feb0eb1fce2fd4c2d0b3a' into HEAD
tignear Oct 15, 2026
aa88942
fix(testbench): snapshot outgoing calls and bind emitted counters
tignear Oct 15, 2026
e4903b0
Merge commit '22812d08b2807de72019c8bdb0782475bc9b11f6' into HEAD
tignear Oct 15, 2026
649538b
test(runtime): cover coincident direct and derived kernel pulses
tignear Oct 15, 2026
e7b4f31
fix(runtime): retain component-settle edges before kernel continuation
tignear Oct 15, 2026
b0f78ae
Merge commit 'b2128155738ea033f185f6f408ac51c91358415d' into HEAD
tignear Oct 15, 2026
a73cb03
fix(veryl): publish prior testbench writes before completion
tignear Oct 15, 2026
4d1eb71
Merge commit '7ffa018bbffa43244e112a3fa9c18d7d9d62f479' into HEAD
tignear Oct 15, 2026
9b8999c
fix(veryl): preserve termination in constant-valued loop bounds
tignear Oct 15, 2026
d1f0d02
test(runtime): publish the last edge before terminating edge-count st…
tignear Oct 15, 2026
72b181b
Merge commit '089f18379' into HEAD
tignear Oct 15, 2026
2c09cd3
Merge commit '94c5094a57ddffd7d8a40ff3e881dbdc36a5f66a' into HEAD
tignear Oct 15, 2026
3aff5f9
fix(runtime): retain FF edges from zero-count releases
tignear Oct 15, 2026
b567419
Merge commit '86cc996bf994a5c5334cc69e59728df3c15c7eb9' into HEAD
tignear Oct 15, 2026
23876b3
Merge commit '312c8584c3708c101ff23e7710cb2959a8004cc2' into HEAD
tignear Oct 15, 2026
5582d97
Merge commit '09a2ca085b409159fce65024a5cf1786519c8d50' into HEAD
tignear Oct 15, 2026
beec427
Merge selected-case timing repair through #1160
tignear Oct 15, 2026
40e5fc9
Merge generated-clock drive ownership repair from #1160
tignear Oct 15, 2026
4136a02
Merge first-iteration exit timing repair through #1160
tignear Oct 15, 2026
939c232
Merge typed loop-count proof repair through #1160
tignear Oct 15, 2026
5526675
fix(testbench): reset generated clocks before component startup
tignear Oct 15, 2026
1437a80
Merge reviewed startup and fused-loop repairs through #1160
tignear Oct 15, 2026
baccbfc
Merge commit 'f66b668188fe1b474e3cd89ab50ae16d4d3f826d' into HEAD
tignear Oct 15, 2026
9179848
fix(testbench): pass time when sampling blocking FF waiters
tignear Oct 15, 2026
47f2473
Merge commit 'b1a080b480313352610193380eb501e3ea7daf86' into HEAD
tignear Oct 15, 2026
dae1653
Merge commit '0a3349e476ec435971c7a85d5530eb6713d6e400' into HEAD
tignear Oct 15, 2026
88b8477
Merge commit '6abcc64b8316ea55a77729c2a09794f61f00d6b9' into HEAD
tignear Oct 15, 2026
077ea00
fix(veryl): settle derived inputs before component initialization
tignear Oct 15, 2026
7dd2fea
Merge active-region, staging and Windows CI review fixes from feature…
tignear Oct 15, 2026
fb84449
Merge bare-call shadowing coverage from feature/1123-clock-waits
tignear Oct 15, 2026
c1fc275
Merge initializer and connection staging review fixes from feature/11…
tignear Oct 15, 2026
f81b32b
Merge clean waiter settle and initializer review care from feature/11…
tignear Oct 15, 2026
4543717
test(veryl): adapt clean waiter regression to release-aware kernels
tignear Oct 15, 2026
bcdd8ee
fix(testbench): preserve host order and clean continuation state
tignear Oct 15, 2026
1724159
Merge commit 'ab25b39dacdec1003d16dd0a650745ffe5a746fa' into HEAD
tignear Oct 15, 2026
ff76599
test(testbench): scope subprocess marker access to output regression
tignear Oct 15, 2026
d9cb41d
Merge commit '034b9aaac40b38124a900b907108a3be4dbf308e' into HEAD
tignear Oct 15, 2026
17b13d0
Merge commit 'df9114257441ce5e11a1adcb85ab15486b7e499b' into HEAD
tignear Oct 15, 2026
0efb367
Merge commit '1b8130fdaee2dff3e52b0ed46d4a43bb8624f7e9' into HEAD
tignear Oct 15, 2026
1054fb3
Merge commit '6b75225111b9b4a59c966d660b57a1af017aa324' into HEAD
tignear Oct 15, 2026
d8ab2ac
Merge commit 'f334c81bda023151c5931547952c5cbb7941bc4a' into HEAD
tignear Oct 15, 2026
95dff9e
ci: restore focused validation from feature/1123-clock-waits
tignear Oct 15, 2026
01d6561
Merge commit '0dc137224be2d833d1088f732377678c88534b85' into HEAD
tignear Oct 15, 2026
e238edc
Merge remote-tracking branch 'origin/feature/1123-veryl-kernels' into…
tignear Oct 15, 2026
183cde7
Merge commit '5e5fce0e69c39b469cc2d814f55937655e4b9d10' into HEAD
tignear Oct 15, 2026
acfd080
ci: inherit the corrected Mergify CLI action reference
tignear Oct 15, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 23 additions & 2 deletions crates/celox-backend-arm64/src/isel/instruction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -341,12 +341,25 @@ pub(super) fn lower_instruction(
let chunk_vreg = ctx.alloc_vreg(SpillDesc::sim_state(
*addr, bit_pos, chunk_bits, false,
));
let raw = if matches!(chunk_bits, 8 | 16 | 32 | 64) {
chunk_vreg
} else {
ctx.alloc_vreg(SpillDesc::transient())
};
block.push(MInst::Load {
dst: chunk_vreg,
dst: raw,
base: BaseReg::SimState,
offset: chunk_byte_off,
size: chunk_size,
});
if raw != chunk_vreg {
ctx.emit_and_imm(
block,
chunk_vreg,
raw,
mask_for_width(chunk_bits),
);
}
chunks.push((chunk_vreg, chunk_bits));
bit_pos += chunk_bits;
remaining -= chunk_bits;
Expand All @@ -366,12 +379,20 @@ pub(super) fn lower_instruction(
let chunk_byte_off = ctx.mask_byte_offset(addr, m_bit_pos);
let chunk_size = ISelContext::op_size_for_width(chunk_bits);
let mv = ctx.alloc_vreg(SpillDesc::transient());
let raw = if matches!(chunk_bits, 8 | 16 | 32 | 64) {
mv
} else {
ctx.alloc_vreg(SpillDesc::transient())
};
block.push(MInst::Load {
dst: mv,
dst: raw,
base: BaseReg::SimState,
offset: chunk_byte_off,
size: chunk_size,
});
if raw != mv {
ctx.emit_and_imm(block, mv, raw, mask_for_width(chunk_bits));
}
mchunks.push((mv, chunk_bits));
m_bit_pos += chunk_bits;
m_remaining -= chunk_bits;
Expand Down
1 change: 1 addition & 0 deletions crates/celox-backend-arm64/src/isel/tests.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
mod partial_load;
mod shifts;
mod strided;

Expand Down
121 changes: 121 additions & 0 deletions crates/celox-backend-arm64/src/isel/tests/partial_load.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
//! A rounded wide load must not import padding or neighbouring value/mask bytes.
use super::*;

#[test]
fn rounded_wide_value_loads_keep_adjacent_bits_out_of_comparisons() {
check(false);
}
#[test]
fn rounded_wide_mask_loads_keep_adjacent_bits_out_of_comparisons() {
check(true);
}

fn check(four_state: bool) {
for width in [100usize, 65, 72, 73, 80, 81, 96, 97, 113, 127, 128] {
let input = AbsoluteAddr {
instance_id: InstanceId(0),
var_id: StateObjectId(0),
};
let output = AbsoluteAddr {
var_id: StateObjectId(1),
..input
};
let address = |absolute| RegionedAbsoluteAddr::from_absolute_addr(STABLE_REGION, absolute);
let loaded = RegisterId(0);
let zero = RegisterId(1);
let equal = RegisterId(2);
let widened = RegisterId(3);
let unit = ExecutionUnit {
entry_block_id: SirBlockId(0),
blocks: [(
SirBlockId(0),
BasicBlock {
id: SirBlockId(0),
params: vec![],
instructions: vec![
SIRInstruction::Load(loaded, address(input), SIROffset::Static(0), width),
SIRInstruction::Imm(zero, SIRValue::new(0u8)),
SIRInstruction::Unary(widened, UnaryOp::Ident, zero),
SIRInstruction::Binary(equal, loaded, BinaryOp::Eq, widened),
SIRInstruction::Store(
address(output),
SIROffset::Static(0),
1,
equal,
vec![],
vec![],
),
],
terminator: SIRTerminator::Return,
},
)]
.into_iter()
.collect(),
register_map: [(loaded, width), (zero, 8), (widened, width), (equal, 1)]
.into_iter()
.map(|(r, width)| {
(
r,
if four_state {
RegisterType::Logic { width }
} else {
RegisterType::Bit {
width,
signed: false,
}
},
)
})
.collect(),
};
let mut layout = layout_for(input, width, four_state);
layout.offsets.insert(output, 64);
layout.widths.insert(output, 1);
layout.is_4states.insert(output, four_state);
layout.total_size = 96;
layout.working_base_offset = 96;
layout.sparse_base_offset = 96;
layout.sparse_active_bits_offset = 96;
layout.merged_total_size = 96;
layout.triggered_bits_offset = 96;
layout.scratch_base_offset = 96;
let image = crate::scalar::emit_prepared_eu(
&unit,
&layout,
four_state,
"wide_load",
false,
None,
|| false,
)
.unwrap();
assert!(!image.code.is_empty());
#[cfg(all(target_arch = "aarch64", target_os = "linux"))]
{
let jit = crate::jit_mem::JitCode::new(&image.code).unwrap();
let mut state = vec![0xa5u8; 96];
for bit in 0..width {
state[bit / 8] &= !(1 << (bit % 8));
if four_state {
state[width.div_ceil(8) + bit / 8] &= !(1 << (bit % 8));
}
}
assert_eq!(unsafe { jit.call(&mut state) }, 0);
assert_eq!(state[64] & 1, 1, "width={width} four_state={four_state}");
if four_state {
assert_eq!(state[65] & 1, 0, "width={width} mask");
}
let high = width - 1;
state[high / 8] |= 1 << (high % 8);
assert_eq!(unsafe { jit.call(&mut state) }, 0);
assert_eq!(state[64] & 1, 0, "width={width} last value bit");
if four_state {
assert_eq!(state[65] & 1, 0, "width={width} known mismatch");
state[width.div_ceil(8) + high / 8] |= 1 << (high % 8);
assert_eq!(unsafe { jit.call(&mut state) }, 0);
assert_eq!(state[64] & 1, 1, "width={width} X value");
assert_eq!(state[65] & 1, 1, "width={width} last mask bit");
}
}
}
}
25 changes: 23 additions & 2 deletions crates/celox-backend-x86/src/backend/native/isel/instruction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -345,12 +345,25 @@ pub(super) fn lower_instruction(
let chunk_vreg = ctx.alloc_vreg(SpillDesc::sim_state(
*addr, bit_pos, chunk_bits, false,
));
let raw = if matches!(chunk_bits, 8 | 16 | 32 | 64) {
chunk_vreg
} else {
ctx.alloc_vreg(SpillDesc::transient())
};
Comment thread
tignear marked this conversation as resolved.
Resolved
block.push(MInst::Load {
dst: chunk_vreg,
dst: raw,
base: BaseReg::SimState,
offset: chunk_byte_off,
size: chunk_size,
});
if raw != chunk_vreg {
ctx.emit_and_imm(
block,
chunk_vreg,
raw,
mask_for_width(chunk_bits),
);
}
chunks.push((chunk_vreg, chunk_bits));
bit_pos += chunk_bits;
remaining -= chunk_bits;
Expand All @@ -370,12 +383,20 @@ pub(super) fn lower_instruction(
let chunk_byte_off = ctx.mask_byte_offset(addr, m_bit_pos);
let chunk_size = ISelContext::op_size_for_width(chunk_bits);
let mv = ctx.alloc_vreg(SpillDesc::transient());
let raw = if matches!(chunk_bits, 8 | 16 | 32 | 64) {
mv
} else {
ctx.alloc_vreg(SpillDesc::transient())
};
block.push(MInst::Load {
dst: mv,
dst: raw,
base: BaseReg::SimState,
offset: chunk_byte_off,
size: chunk_size,
});
if raw != mv {
ctx.emit_and_imm(block, mv, raw, mask_for_width(chunk_bits));
}
mchunks.push((mv, chunk_bits));
m_bit_pos += chunk_bits;
m_remaining -= chunk_bits;
Expand Down
110 changes: 110 additions & 0 deletions crates/celox-backend-x86/src/backend/native/isel/tests/wide.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1538,6 +1538,116 @@ fn four_state_sar_uses_sign_fill_past_the_logical_source_words() {
}
}

#[test]
fn widened_zero_compares_equal_to_a_zero_wide_load() {
for four_state in [false, true] {
let a = AbsoluteAddr {
instance_id: InstanceId(0),
var_id: VarId(0),
};
let o = AbsoluteAddr {
instance_id: InstanceId(0),
var_id: VarId(1),
};
let address = |a| RegionedAbsoluteAddr::from_absolute_addr(STABLE_REGION, a);
let [loaded, zero, widened, equal, result] = std::array::from_fn(RegisterId);
let unit = ExecutionUnit {
entry_block_id: SirBlockId(0),
blocks: [(
SirBlockId(0),
BasicBlock {
id: SirBlockId(0),
params: vec![],
instructions: vec![
SIRInstruction::Load(loaded, address(a), SIROffset::Static(0), 100),
SIRInstruction::Imm(zero, SIRValue::new(0u8)),
SIRInstruction::Unary(widened, UnaryOp::Ident, zero),
SIRInstruction::Binary(equal, loaded, BinaryOp::Eq, widened),
SIRInstruction::Unary(result, UnaryOp::ToTwoState, equal),
SIRInstruction::Store(
address(o),
SIROffset::Static(0),
1,
result,
vec![],
vec![],
),
],
terminator: SIRTerminator::Return,
},
)]
.into_iter()
.collect(),
register_map: [
(loaded, RegisterType::Logic { width: 100 }),
(
zero,
RegisterType::Bit {
width: 32,
signed: false,
},
),
(
widened,
RegisterType::Bit {
width: 100,
signed: false,
},
),
(equal, RegisterType::Logic { width: 1 }),
(
result,
RegisterType::Bit {
width: 1,
signed: false,
},
),
]
.into_iter()
.collect(),
};
unit.verify();
let mut layout = empty_layout();
let output_offset = if four_state { 32 } else { 16 };
let state_size = output_offset + 1;
layout.four_state = four_state;
layout.offsets = [(a, 0), (o, output_offset)].into_iter().collect();
layout.widths = [(a, 100), (o, 1)].into_iter().collect();
layout.is_4states = [(a, four_state), (o, false)].into_iter().collect();
layout.total_size = state_size;
layout.working_base_offset = state_size;
layout.sparse_base_offset = state_size;
layout.merged_total_size = state_size;
layout.triggered_bits_offset = state_size;
layout.scratch_base_offset = state_size;
let mut function = lower_execution_unit(&unit, &layout, four_state);
mir_legalize::legalize(&mut function);
mir_opt::optimize(&mut function);
let allocation = regalloc::run_regalloc(&mut function).unwrap();
mir_opt::post_regalloc_peephole(&mut function, &allocation.assignment);
function.verify();
let emitted = emit::emit(
&function,
&allocation.assignment,
allocation.spill_frame_size,
)
.unwrap();
let jit = JitCode::new(&emitted.code).unwrap();
let mut state = vec![0u8; state_size];
state[12] = 0xf0;
if four_state {
state[25] = 0xf0;
state[26] = 6;
state[28] = 0xff;
} else {
state[13] = 6;
state[15] = 0xff;
}
assert_eq!(unsafe { jit.call(&mut state) }, 0);
assert_eq!(state[output_offset] & 1, 1, "four_state={four_state}");
}
}

#[test]
fn loaded_slices_survive_bulk_writes_across_padded_array_elements() {
for commit in [false, true] {
Expand Down
Loading
Loading