Repository navigation
Conversation
|
Thanks. Parking this on the meeting. #14373 follows the issue report’s reading (no-region load can see a named-region store). If the call is explicit no-region, I’ll rework/close it. |
|
Wrote up the store/load asymmetry on the issue. |
|
Better summary of the two options is here: #14323 (comment) |
a482899 to
db762f6
Compare
|
Rebased on main. Tried the explicit-no-region store change locally; notes on the issue. |
|
Parking on the meeting: explicit no-region vs no-region as fence. Fine either way. |
Regionless stores had been treated as fences over every named region. That disagreed with the older alias-analysis behavior, where no-region was its own disjoint bucket for both loads and stores, and it disagreed with how regionless loads already worked. Put regionless stores back in the "other" bucket, keep loads on that same bucket, and leave true fences as the only thing that touches every region. Docs and alias tests updated to match. Assisted-by: Claude
db762f6 to
962fcf8
Compare
Preserve the existing PR commits and integrate the pinned upstream changes without rewriting the branch history. Validate merged tree c76532a on Linux x86-64 with Rust 1.98.0: locked clif-util build, cargo fmt, the 50 alias filetests, and the six backend filetests added or changed since the previous base. Additional private regionless join and loop probes also passed; these are not part of the upstream test suite. This is scoped validation, not full cross-platform CI or maintainer approval. Assisted-by: OpenAI Codex
Preserve volatile accesses as fences while integrating upstream alias-region extent handling. Align the issue-13508 initializer with its named-region contract and correct regionless-slot comments. Native validation: 52 alias fixtures, three focused regionless join/loop/DSE fixtures, selected volatile and readonly cases, and 235 codegen unit tests. A volatile-guard mutant is rejected; restoring the source reproduces the original compiler artifact. Assisted-by: Codex:GPT-6.1-Sol
This comment was marked as outdated.
This comment was marked as outdated.
|
I'm not a bot, I'm human |
|
/vouch Sorry about the bot auto-closing -- that was an over-aggressive condition (not just "last 24 hours") on its first run. It looks like this has been sitting for a while with @fitzgen as a reviewer -- Nick, are you able to review? (I'm happy to take over if not) |
fitzgen
left a comment
There was a problem hiding this comment.
Thanks! Just a couple nitpicks to address before this can merge.
And sorry for the delayed review!
| fn observe_trapping_others_including_fence( | ||
| &self, | ||
| func: &Function, | ||
| observed_stores: &mut FxHashMap<Inst, Observer>, | ||
| observer: Inst, | ||
| ) { | ||
| let can_trap = |slot: LastStore| { | ||
| slot.inst() | ||
| .is_some_and(|s| func.dfg.insts[s].memflags_trap_code(&func.dfg).is_some()) | ||
| }; | ||
|
|
||
| for (_region, slot) in self.regions.iter() { | ||
| if can_trap(*slot) { | ||
| observe(func, observed_stores, *slot, observer); | ||
| } | ||
| } | ||
| if can_trap(self.last_fence) { | ||
| observe(func, observed_stores, self.last_fence, observer); | ||
| } | ||
| } |
There was a problem hiding this comment.
This is basically the same as observe_trapping_others but specialized to the other region. Can we instead make observe_trapping_others take excluding: Option<AliasRegion> where passing excluding == None means the other region?
| LastStore::NoStore => self.last_fence, | ||
| slot => slot, | ||
| } | ||
| } |
There was a problem hiding this comment.
And can we replace this with making last_store_for_region take an Option<AliasRegion> where None means the other region?
let last_store = match region {
Some(r) => self.regions[r],
None => self.other,
};
match last_store {
LastStore::NoStore => self.last_fence,
slot => slot,
}| ;; Initialize to `-1`. | ||
| v3 = iconst.i64 -1 | ||
| store notrap v3, v0 | ||
| store notrap region0 v3, v0 | ||
|
|
||
| ;; Memory fence nop. | ||
| v4 = atomic_cas v2, v0, v0 | ||
|
|
||
| ;; Load with region (fills cache v5+4 -> v4). | ||
| v5 = load.i32 region0 v0 | ||
| ; check: v5 = load.i32 region0 v0 | ||
|
|
||
| ;; Load with region again (gets cached v4). | ||
| v6 = load.i32 region0 v0 | ||
| ; check: v6 -> v5 | ||
|
|
||
| ;; Store without region (clobbers cache). | ||
| ;; Regionless store to a different pointer: does not invalidate region0. | ||
| v7 = iconst.i32 42 | ||
| store notrap v7, v1 | ||
|
|
||
| ;; Load with region (shouldn't get cached v4). |
There was a problem hiding this comment.
Rather than deleting all these comments, can you update them as necessary?
Assisted-by: Cursor
|
Done!!! Thanks again!!! |
Regionless stores were being treated as fences over every named region. That was a behavior change from the older alias analysis, where no-region was its own disjoint bucket for both loads and stores.
This restores that older shape:
otheronlyotheronlyAlso updates the docs/
memflagswording and the alias tests that had encoded the fence-for-stores behavior (issue-13508,no-region, etc.).For #14323: under explicit no-region, mixing a regionless access and a named-region access on the same address is outside the frontend invariant. Happy to close that issue once this lands, or rework again if the meeting picks the other rule.
Fixes #14323
Assisted-by: Claude