[CI] (P13 W3b): memo-key purity has no exempted arm once the legacy memos are gone

This commit is contained in:
2026-10-06 04:04:47 -04:00
parent a0bff7cee1
commit 5e547add80
2 changed files with 35 additions and 33 deletions
+4 -5
View File
@@ -3537,11 +3537,10 @@ jobs:
# arms stayed because they are the PULL build's only arms and G1 pins that build's .text. # arms stayed because they are the PULL build's only arms and G1 pins that build's .text.
# Nothing checked that a NEW frontend-pointer key could not appear outside them. # Nothing checked that a NEW frontend-pointer key could not appear outside them.
# #
# MOBILEGL_PIPE_LEGACY_MEMOS IS A POLICY EXEMPTION, NOT AN ABSENCE. It defaults ON # P13 W3b: NO EXEMPTED ARM ANY MORE. The legacy pointer-keyed arms (MOBILEGL_PIPE_LEGACY_MEMOS)
# (CMakeLists.txt:43) and no job here clears it, so the split builds in this workflow DO # retired with the pull build, and the !MOBILEGL_BUILD_DISAGGREGATED arms are compiled into
# compile those arms - TwinLookupMemo among them. The gate's rule is "the legacy arm may # the library FCL embeds, so they get the same rule: no frontend-pointer key in any memo
# keep pointer keys", which is a decision; only !MOBILEGL_BUILD_DISAGGREGATED is code a # family, in any build.
# split build genuinely never sees.
# #
# --self-test runs the negative controls and then the real scan in one invocation, as its # --self-test runs the negative controls and then the real scan in one invocation, as its
# sibling does; the scan also asserts that every memo family's anchor still matches and # sibling does; the scan also asserts that every memo family's anchor still matches and
+31 -28
View File
@@ -2,20 +2,16 @@
"""P3b/P4b Espryt memo re-keying, with explicit compatibility limits. """P3b/P4b Espryt memo re-keying, with explicit compatibility limits.
P4a/P5f re-keyed the resolved-binding, sampler-pass, image-sweep and twin-registry P4a/P5f re-keyed the resolved-binding, sampler-pass, image-sweep and twin-registry
memos onto {slot, gen} handles and applier serials. The legacy pointer-keyed arms memos onto {slot, gen} handles and applier serials. The legacy pointer-keyed arms lived
were not deleted: they are the PULL build's only arms and G1 pins that build's behind MOBILEGL_PIPE_LEGACY_MEMOS until P13 W3b retired that macro with the pull build;
.text, so they retire with the pull path itself (Config.h:395-399). TwinLookupMemo went with them, so it is no longer a family here.
WHAT THE TWO GUARDS MEAN HERE IS A POLICY EXEMPTION, NOT AN ABSENCE, and the first SINCE P13 W3b THERE IS NO EXEMPTED ARM. The gate used to skip the `#if
version of this docstring got that wrong. MOBILEGL_PIPE_LEGACY_MEMOS defaults ON MOBILEGL_PIPE_LEGACY_MEMOS` arms and the `!MOBILEGL_BUILD_DISAGGREGATED` arms as policy
(CMakeLists.txt:43) and nothing in test.yml clears it, so a CI split build DOES exemptions; the first is gone from the tree, and the second is compiled into the library FCL
compile the #if MOBILEGL_PIPE_LEGACY_MEMOS arms - TwinLookupMemo (DirectGLES.cpp:114) embeds (the push monolith without MG_Remote), so it is shipped code and gets the same rule.
sits inside one and is compiled into every lane this repo runs. The rule is therefore The rule is now "no frontend-pointer KEY in any named memo family, in any build", and nothing
"the legacy arm is ALLOWED to keep pointer keys", not "the split build never sees else; the one allow-list entry below is a named, dated carve-out.
them". !MOBILEGL_BUILD_DISAGGREGATED is the genuinely-absent one.
This gate does not pretend the pointer types disappeared; it rejects a frontend-pointer
KEY outside those two exempted arms, inside the named memo families, and nothing else.
It does not evaluate the preprocessor - it recognises the conditional spellings the It does not evaluate the preprocessor - it recognises the conditional spellings the
tree actually uses - and it does not look at DirectVulkan, whose own key inventory is tree actually uses - and it does not look at DirectVulkan, whose own key inventory is
P7 wave 2's. P7 wave 2's.
@@ -67,7 +63,6 @@ LIFETIME_KEY = r"GetLifetimeId\s*\(\s*\)"
FAMILIES = [ FAMILIES = [
("ResolvedTextureBindingMemo", r"struct\s+ResolvedTextureBindingMemo\s*\{"), ("ResolvedTextureBindingMemo", r"struct\s+ResolvedTextureBindingMemo\s*\{"),
("UnitSamplerLookupMemo", r"struct\s+UnitSamplerLookupMemo\s*\{"), ("UnitSamplerLookupMemo", r"struct\s+UnitSamplerLookupMemo\s*\{"),
("TwinLookupMemo", r"class\s+TwinLookupMemo\s*\{"),
("SamplerPassMemo", r"struct\s+SamplerPassMemo\s*\{"), ("SamplerPassMemo", r"struct\s+SamplerPassMemo\s*\{"),
("StateBackendObjectRegistry", r"class\s+StateBackendObjectRegistry\s*\{"), ("StateBackendObjectRegistry", r"class\s+StateBackendObjectRegistry\s*\{"),
] ]
@@ -78,8 +73,8 @@ IMAGE_SWEEP = r"^\s*static\s+.*\bg_imageSweep\w*"
# gate becomes a list of things that are allowed to be wrong. # gate becomes a list of things that are allowed to be wrong.
ALLOW = [ ALLOW = [
("MobileGL/MG_Backend/DirectGLES/Managers.h", "using BackendMap", ("MobileGL/MG_Backend/DirectGLES/Managers.h", "using BackendMap",
"the legacy arm's map IS the pull build's only arm; deleting it moves pull .text and " "StateBackendObjectRegistry's non-slot map: unreachable since P13 W3b made the slot arm "
"fails G1's 0/0/0/0, so it retires with the pull path (P13), not here"), "unconditional, deleted with the rest of the monolith glue in P13 W6"),
] ]
# WHAT USED TO BE HERE, AND WHY IT IS NOT. Five more entries, and every one of them was a # WHAT USED TO BE HERE, AND WHY IT IS NOT. Five more entries, and every one of them was a
# carve-out for something no rule could have flagged in the first place: # carve-out for something no rule could have flagged in the first place:
@@ -100,7 +95,13 @@ def code_only(source: str) -> str:
def legacy_lines(code: str) -> set[int]: def legacy_lines(code: str) -> set[int]:
"""Line numbers (1-based) sitting in an arm a split build does not compile. """Line numbers (1-based) sitting in an exempted arm. Since P13 W3b: none (see the module
docstring); kept as a function so the self-test can say so."""
return set()
def _retired_legacy_lines(code: str) -> set[int]:
"""The pre-W3b exemption, kept only for the self-test's record of what changed.
NOT a preprocessor. It recognises `#if MOBILEGL_PIPE_LEGACY_MEMOS`, NOT a preprocessor. It recognises `#if MOBILEGL_PIPE_LEGACY_MEMOS`,
`#if !MOBILEGL_BUILD_DISAGGREGATED`, and the `#else` of `#if !MOBILEGL_BUILD_DISAGGREGATED`, and the `#else` of
@@ -213,8 +214,17 @@ def self_test() -> None:
" MG_State::GLState::ProgramObject* key = nullptr;\n};\n"), " MG_State::GLState::ProgramObject* key = nullptr;\n};\n"),
(gles, "struct UnitSamplerLookupMemo {\n" (gles, "struct UnitSamplerLookupMemo {\n"
" SamplerObject* frontend = nullptr;\n};\n"), " SamplerObject* frontend = nullptr;\n};\n"),
(gles, "class TwinLookupMemo {\n" # P13 W3b: the arms that used to be exempt are not any more.
" UnorderedMap<StateObject*, Slot> m_slots;\n};\n"), (gles, "struct UnitSamplerLookupMemo {\n"
"#if MOBILEGL_PIPE_LEGACY_MEMOS\n"
" SamplerObject* frontend = nullptr;\n"
"#endif\n};\n"),
(gles, "struct ResolvedTextureBindingMemo {\n"
"#if MOBILEGL_BUILD_DISAGGREGATED\n"
" MG_Pipe::MGPipeHandle drawProgram{};\n"
"#else\n"
" ProgramObject* program = nullptr;\n"
"#endif\n};\n"),
(gles, "struct ResolvedTextureBindingMemo {\n" (gles, "struct ResolvedTextureBindingMemo {\n"
" Uint64 id = program->GetLifetimeId();\n};\n"), " Uint64 id = program->GetLifetimeId();\n};\n"),
(gles, " static ITextureObject* g_imageSweepOwner = nullptr;\n"), (gles, " static ITextureObject* g_imageSweepOwner = nullptr;\n"),
@@ -227,16 +237,10 @@ def self_test() -> None:
assert violations(path, source), f"negative control did not turn red: {source!r}" assert violations(path, source), f"negative control did not turn red: {source!r}"
# POSITIVE CONTROLS: each is a shape the tree deliberately keeps, and a gate that # POSITIVE CONTROLS: each is a shape the tree deliberately keeps, and a gate that
# reddened on them would be reverted within a day rather than fixed. # reddened on them would be reverted within a day rather than fixed.
assert not violations(gles, "struct UnitSamplerLookupMemo {\n"
"#if MOBILEGL_PIPE_LEGACY_MEMOS\n"
" SamplerObject* frontend = nullptr;\n"
"#endif\n};\n"), "a LEGACY_MEMOS arm must stay green"
assert not violations(gles, "struct ResolvedTextureBindingMemo {\n" assert not violations(gles, "struct ResolvedTextureBindingMemo {\n"
"#if MOBILEGL_BUILD_DISAGGREGATED\n" "#if MOBILEGL_BUILD_DISAGGREGATED\n"
" MG_Pipe::MGPipeHandle drawProgram{};\n" " MG_Pipe::MGPipeHandle drawProgram{};\n"
"#else\n" "#endif\n};\n"), "a handle key must stay green in any arm"
" ProgramObject* program = nullptr;\n"
"#endif\n};\n"), "the #else of a DISAGGREGATED arm must stay green"
assert not violations(gles, "struct ResolvedTextureBindingMemo {\n" assert not violations(gles, "struct ResolvedTextureBindingMemo {\n"
" const void* program = nullptr;\n};\n"), \ " const void* program = nullptr;\n};\n"), \
"the type-erased monolith key must stay green without needing an exemption" "the type-erased monolith key must stay green without needing an exemption"
@@ -298,8 +302,7 @@ def main() -> int:
print("\n".join(failures)) print("\n".join(failures))
return 1 return 1
print(f"espryt memo key purity gate: PASS ({len(FAMILIES)} families anchored, " print(f"espryt memo key purity gate: PASS ({len(FAMILIES)} families anchored, "
f"{len(ALLOW)} allow-list entr(y/ies), all consulted; the legacy pointer-keyed arm " f"{len(ALLOW)} allow-list entr(y/ies), all consulted; no exempted arm since P13 W3b)")
f"behind MOBILEGL_PIPE_LEGACY_MEMOS is a policy exemption, not an absence)")
return 0 return 0