[Refactor, Test] (.github/workflows, docs/ci, docs/Disaggregated, MG_Impl/Pipe, MG_IntegrationTest, MG_IntegrationTest/Scenarios, MG_Test/Pipe, MobileGL, scripts/data): read MOBILEGL_PIPE_VERIFY_CORRUPT only in verify builds

- ArmVerify reads it through LookupSetting; Features.PipeVerifyCorrupt is gone
- unit PipeInputsTest.EveryCorruptedFieldIsNamedByTheComparator replaces negative control A2
- integration-verify's controls A and A2 and integration-verify-split's control A with its log copy step are retired
- PipeVerifyArmingScenario.Armed no longer skips when the knob is set
- skip census: the new case is a listed skip in the unit, unit-split and unit-strict lanes
This commit is contained in:
2026-10-18 10:02:01 -04:00
parent f5df1f893e
commit 9b5a60b2f7
10 changed files with 88 additions and 147 deletions
+4 -11
View File
@@ -463,18 +463,12 @@ namespace MobileGL::MG_Config {
// the semantic gate that replaces byte identity, and it catches the dangerous
// direction - a dirty bit that fires too RARELY - which no purity gate can see.
Bool PipeVerify = false;
// The three knobs of the MOBILEGL_PIPE_VERIFY build (P1 brief D2). Compiled only
// under MOBILEGL_PIPE_PUSH so the pull build's FeaturesTable does not change size.
// MOBILEGL_PIPE_VERIFY_FATAL: the first divergence aborts (default). 0 logs and
// counts instead, for triage and for the lane that must survive to read its own
// log. Tri-state parse like PipeLegacyMemos: only an explicit falsy value turns it
// off.
// log. Tri-state parse: only an explicit falsy value turns it off. The comparator's
// negative control, MOBILEGL_PIPE_VERIFY_CORRUPT, has no field here: only a verify
// build reads it, when the comparator arms (MG_Impl/Pipe/PipeFill.cpp, ArmVerify).
Bool PipeVerifyFatal = true;
// MOBILEGL_PIPE_VERIFY_CORRUPT: a field name from kMGPipeInputFieldNames[]; the
// comparator perturbs that field in the SNAPSHOT arm before the entry compare, so a
// green verify run goes red naming it (negative control A). Unknown name is
// Fatal{PipeVerifyBadKnob}.
String PipeVerifyCorrupt;
// MOBILEGL_PIPE_POISON_OMIT: <Verb>:<FieldName>; the filler skips the STAMP (not
// the value) of that field for that verb, an omission indistinguishable from a
// forgotten FillPoints.def row, so that verb's read of it is
@@ -513,8 +507,7 @@ namespace MobileGL::MG_Config {
// in MG_Backend/Init.cpp compiles away entirely rather than becoming a branch nobody can
// take. A FeaturesTable member is a runtime field in every build, which is the opposite
// of that; it would also resize MG_Config::Features and break G1 (the pull build's
// symbol set must not move) for the same reason the MOBILEGL_PIPE_VERIFY knobs above sit
// behind their own #if.
// symbol set must not move).
//
// ONE CONSEQUENCE, STATED SO IT IS NOT REDISCOVERED: in a build without the option,
// MOBILEGL_TRANSPORT=inproc is ACCEPTED BY THE ENVIRONMENT AND SILENTLY IGNORED - the
-1
View File
@@ -452,7 +452,6 @@ namespace MobileGL::MG_ConfigLoader {
// Defaults ON: read as a tri-state so only an explicitly falsy value turns it off.
features.PipeVerifyFatal =
QueryEnvQuirkOverride("MOBILEGL_PIPE_VERIFY_FATAL") != MG_Config::QuirkOverride::ForceOff;
QueryEnvVariable("MOBILEGL_PIPE_VERIFY_CORRUPT", features.PipeVerifyCorrupt, "");
QueryEnvVariable("MOBILEGL_PIPE_POISON_OMIT", features.PipePoisonOmit, "");
features.PipeStats = QueryEnvFlag("MOBILEGL_PIPE_STATS");
features.PipeIndexMirrorMb = QueryEnvUint32("MOBILEGL_PIPE_INDEX_MIRROR_MB", 64, 0, 4096);
+12 -11
View File
@@ -10,8 +10,7 @@
// the push arm that reads MG_State::pGLContext. Holds the per-verb filler, the F-class
// forwarders, IsLive, the MOBILEGL_PIPE_POISON_OMIT knob and - in a verify build - the
// second arm (SnapshotFromGLContext), the entry compare, the compare-at-read hook and the
// MOBILEGL_PIPE_VERIFY_CORRUPT / _FATAL knobs. Compiled only under MOBILEGL_PIPE_PUSH
// (CMakeLists.txt appends it to SOURCE_FILES there).
// MOBILEGL_PIPE_VERIFY_CORRUPT knob, which only this build reads.
#include <MG_State/GLState/Core.h>
#include <MG_State/GLState/BufferState/BufferState.h>
// C-1: the vertex-elements CSO's death path raises the backend notice from here, between the
@@ -44,6 +43,8 @@
#if MOBILEGL_PIPE_VERIFY
#include <MG_Impl/Pipe/Verb/VerbPort.h>
#include <MG_Impl/Pipe/Verb/GpuWriteSet.h>
// MG_ConfigLoader::LookupSetting: ArmVerify reads MOBILEGL_PIPE_VERIFY_CORRUPT itself.
#include <Init.h>
#endif
#if MOBILEGL_BUILD_DISAGGREGATED
@@ -543,7 +544,6 @@ namespace MobileGL::MG_Pipe {
Bool Fatal = true;
Bool InHook = false; // a re-read that re-enters an accessor is not re-verified
Optional<MGPipeInputField> Corrupt;
String CorruptKnob; // the MOBILEGL_PIPE_VERIFY_CORRUPT value the last arm saw
std::atomic<Uint64> Divergences{0};
Uint64 Summarised = 0; // how many of them the summary line has reported so far
// THE SUMMARY IS WRITTEN FROM MobileGL::Destroy, NOT FROM HERE (V1 fix round 2). This
@@ -568,24 +568,25 @@ namespace MobileGL::MG_Pipe {
};
VerifyState g_verify;
// Armed on the first fill and re-armed when any of the three verify knobs'
// Features value (PipeVerify, PipeVerifyFatal, PipeVerifyCorrupt) differs from what
// the last arm latched (the same reason as ParsePoisonOmissionKnob: one arm per lane
// process, a fresh arm for a forked test child that turns a knob after its parent
// filled). Cost: two Bool compares and one String compare per fill, verify builds only.
// Armed on the first fill and re-armed when PipeVerify or PipeVerifyFatal differs from
// what the last arm latched: one arm per lane process, a fresh arm for a forked test
// child that turns a knob after its parent filled. Each arm that enables the comparator
// reads MOBILEGL_PIPE_VERIFY_CORRUPT the way the loader resolves every knob (the
// environment, then the system configuration), so the knob exists in this build only.
// Cost: two Bool compares per fill, verify builds only.
void ArmVerify() {
const auto& features = MG_Config::Features;
if (g_verify.Parsed && g_verify.Enabled == features.PipeVerify &&
g_verify.Fatal == features.PipeVerifyFatal && g_verify.CorruptKnob == features.PipeVerifyCorrupt) {
g_verify.Fatal == features.PipeVerifyFatal) {
return;
}
g_verify.Parsed = true;
g_verify.Enabled = features.PipeVerify;
g_verify.Fatal = features.PipeVerifyFatal;
g_verify.CorruptKnob = features.PipeVerifyCorrupt;
g_verify.Corrupt = Optional<MGPipeInputField>{};
if (!g_verify.Enabled) return;
const String& corrupt = g_verify.CorruptKnob;
String corrupt;
(void)MG_ConfigLoader::LookupSetting("MOBILEGL_PIPE_VERIFY_CORRUPT", corrupt);
if (!corrupt.empty()) {
const auto field = MGPipeFindInputField(corrupt.c_str());
if (!field) {
+5 -8
View File
@@ -1001,9 +1001,7 @@ mgl_itest_lane("DirectVulkan.PointSizeDemotion." "PointSizeDemotionScenario.*"
# --- MOBILEGL_PIPE_VERIFY lanes (ARCHITECTURE.md §13.2), under `if (MOBILEGL_PIPE_VERIFY)` below
# They exist only in a -DMOBILEGL_PIPE_VERIFY=ON build, so `ctest -L integration-verify
# --no-tests=error` fails when the option is lost. The ambient Verify. entries must not set
# MOBILEGL_PIPE_VERIFY_CORRUPT or MOBILEGL_PIPE_POISON_OMIT: CI's negative controls export them
# in the job environment, and a property of the same name would override them.
# --no-tests=error` fails when the option is lost.
# --- handle ABA: one always-on monolith HandleRecycle.Handles lane per backend -------------
# MGITEST_HANDLE_ARM selects the arm (the scenario skips in the ambient entries). The lanes run
# the default subsystem mask, so they measure the {slot, gen} key that ships.
@@ -1293,9 +1291,9 @@ if (MOBILEGL_PIPE_VERIFY)
${MGL_ITEST_VULKAN_ENV})
# Negative control A (G4). MOBILEGL_PIPE_VERIFY_FATAL=0 so the process SURVIVES its own
# divergence and the case can read the report back out of the log; the CI step that exports
# the same corruption against the ambient lane, where FATAL keeps its default of 1, asserts
# the other half - that a divergence aborts and reds the entry.
# divergence and the case can read the report back out of the log; the other half, that with
# FATAL at its default of 1 a divergence aborts, is PipeInputsTest's
# VerifyCorruptKnobNamesTheFieldAtEntry.
mgl_itest_join_environment(MGL_ITEST_GLES_VERIFY_CORRUPT_ENVIRONMENT
"MOBILEGL_TRANSPORT=monolith"
"MOBILEGL_BACKEND_TYPE=DirectGLES" "MOBILEGL_PIPE_VERIFY=1"
@@ -3641,8 +3639,7 @@ if (MOBILEGL_BUILD_DISAGGREGATED AND MOBILEGL_PIPE_VERIFY)
# four entries with the split environment underneath and nothing else changed: each is
# green when its control REPORTS, so each goes red the day the comparator or the poison
# stops reaching the split arm. test.yml's integration-verify-split job requires each of
# them to pass by name, and control A's CI half - the same knob exported against the
# ambient VerifySplit. entries, where ctest has to FAIL - runs there too.
# them to pass by name.
#
# A (G4): the corruption perturbs the snapshot arm at the CLIENT's entry compare, so the
# report lands in the client role's log, which is the half LibraryLog() reads.
@@ -221,11 +221,6 @@ void main() { o_color = vec4(0.25, 0.5, 0.75, 1.0); }
"set, so the library has nowhere to record that it armed; the Verify. "
"ctest entries set both";
}
if (StringKnobIsSet("MOBILEGL_PIPE_VERIFY_CORRUPT")) {
GTEST_SKIP() << "MOBILEGL_PIPE_VERIFY_CORRUPT is armed in this process, so a divergence "
"is the EXPECTED outcome and asserting on its absence here would be "
"backwards; the VerifyCorrupted. lane owns that half";
}
const MGITest::PipeStatsWindow::LogMark before = LibraryLogMark();
ASSERT_NO_FATAL_FAILURE(DrawOneFrame());
@@ -257,9 +252,8 @@ void main() { o_color = vec4(0.25, 0.5, 0.75, 1.0); }
//
// It runs in its own lane (VerifyCorrupted.) because the knob is process-wide, and with
// MOBILEGL_PIPE_VERIFY_FATAL=0 so the process survives its own divergence and this case can
// read the report back out of the log. The CI step that runs the SAME knob against the
// ambient lane - where FATAL keeps its default - asserts the other half: there, the
// divergence must abort and ctest must go red.
// read the report back out of the log. With FATAL at its default the divergence aborts
// instead, which PipeInputsTest.VerifyCorruptKnobNamesTheFieldAtEntry asserts.
TEST_F(PipeVerifyArmingScenario, CorruptedFieldIsReported) {
if (!Ready()) return;
+50 -6
View File
@@ -336,6 +336,50 @@ TEST_F(PipeInputsTest, CorruptedSnapshotFieldIsNamedWithItsSerial) {
#endif
}
// The same control for EVERY field, which is where P13 W3c moved the capability cross-check the
// residual block used to carry: two snapshots of one live context compare equal over all fields,
// and corrupting any one field that has storage makes the compare name exactly that field. The
// seven forwarded fields have no storage, so there is nothing to corrupt and nothing to compare.
TEST_F(PipeInputsTest, EveryCorruptedFieldIsNamedByTheComparator) {
#if !MOBILEGL_PIPE_VERIFY
GTEST_SKIP() << "verify not compiled in (MOBILEGL_PIPE_VERIFY=OFF)";
#else
constexpr MGPipeFieldMask kEveryField{{~Uint64{0}, ~Uint64{0}}};
const auto name = [](MGPipeInputField field) {
return field == MGPipeInputField::kFieldCount ? "<none>" : kMGPipeInputFieldNames[static_cast<SizeT>(field)];
};
// A fresh block per snapshot: the snapshot copies only what the context holds (the binding
// points past the touched count keep their storage), so a reused block would carry one
// field's corruption into the next field's compare.
const auto snapshot = [&] {
auto block = MakeUnique<PipeInputs>();
SnapshotFromGLContext(*block, kEveryField);
return block;
};
const auto reference = snapshot();
MGPipeInputField named = MGPipeInputField::kFieldCount;
ASSERT_TRUE(MGPipeVerifyInputs(*reference, *snapshot(), kEveryField, &named))
<< "two snapshots of one context differ at " << name(named);
SizeT corruptedFields = 0;
for (SizeT f = 0; f < kMGPipeInputFieldCount; ++f) {
const auto field = static_cast<MGPipeInputField>(f);
const auto corrupted = snapshot();
if (kMGPipeInputFieldSticky[f]) {
EXPECT_FALSE(MGPipeApplyVerifyCorruption(*corrupted, field)) << name(field) << " is forwarded";
continue;
}
ASSERT_TRUE(MGPipeApplyVerifyCorruption(*corrupted, field)) << name(field) << " has no storage to corrupt";
++corruptedFields;
named = MGPipeInputField::kFieldCount;
EXPECT_FALSE(MGPipeVerifyInputs(*reference, *corrupted, kEveryField, &named))
<< "the comparator does not see a corrupted " << name(field);
EXPECT_EQ(named, field) << "a corrupted " << name(field) << " was reported as " << name(named);
}
EXPECT_EQ(corruptedFields, kMGPipeInputFieldCount - kMGPipeForwardedFieldCount);
#endif
}
// The compare-at-read arm (P1 brief D8, the arm that is real in P1): a value that changes in
// the live context between the verb boundary and the read is Fatal{PipeVerifyDiffer,
// "Field@Verb", verb=<serial>, where=read}; the same read before the mutation completes.
@@ -370,9 +414,9 @@ TEST_F(PipeInputsTest, MutatedFieldIsNamedAtRead) {
#endif
}
// The MOBILEGL_PIPE_VERIFY_CORRUPT parser through Features: the fill after the child arms it
// logs both arming lines and the entry compare names the corrupted field at that fill's
// serial, where=entry.
// The MOBILEGL_PIPE_VERIFY_CORRUPT knob through the environment, where the lanes set it: the
// fill after the child sets it logs both arming lines and the entry compare names the
// corrupted field at that fill's serial, where=entry.
TEST_F(PipeInputsTest, VerifyCorruptKnobNamesTheFieldAtEntry) {
#if !MOBILEGL_PIPE_VERIFY
GTEST_SKIP() << "verify not compiled in (MOBILEGL_PIPE_VERIFY=OFF)";
@@ -384,7 +428,7 @@ TEST_F(PipeInputsTest, VerifyCorruptKnobNamesTheFieldAtEntry) {
const Uint64 serial = gPipeInputs->FilledState().CurrentVerbSerial + 1;
const ChildResult r = RunInChild([] {
MG_Config::Features.PipeVerify = true;
MG_Config::Features.PipeVerifyCorrupt = "GetRenderStateParameters";
::setenv("MOBILEGL_PIPE_VERIFY_CORRUPT", "GetRenderStateParameters", 1);
MGPipeValidateForVerb(MGPipeVerb::DrawArrays);
::_exit(3);
});
@@ -409,7 +453,7 @@ TEST_F(PipeInputsTest, BadVerifyCorruptKnobIsFatalNamingTheKnob) {
ASSERT_FALSE(g_logPath.empty()) << "main() did not set MOBILEGL_LOG_FILE_PATH";
const ChildResult r = RunInChild([] {
MG_Config::Features.PipeVerify = true;
MG_Config::Features.PipeVerifyCorrupt = "NoSuchField";
::setenv("MOBILEGL_PIPE_VERIFY_CORRUPT", "NoSuchField", 1);
MGPipeValidateForVerb(MGPipeVerb::DrawArrays);
::_exit(3);
});
@@ -439,7 +483,7 @@ TEST_F(PipeInputsTest, VerifyFatalOffLogsTheDivergenceAndContinues) {
const ChildResult r = RunInChild([] {
MG_Config::Features.PipeVerify = true;
MG_Config::Features.PipeVerifyFatal = false;
MG_Config::Features.PipeVerifyCorrupt = "GetRenderStateParameters";
::setenv("MOBILEGL_PIPE_VERIFY_CORRUPT", "GetRenderStateParameters", 1);
MGPipeValidateForVerb(MGPipeVerb::DrawArrays);
MGPipeValidateForVerb(MGPipeVerb::DrawElements);
std::exit(0);