[Test] (MG_Util, MG_State): remove the TEMP stage-timing probes - the async-compile measurement campaign is done

This commit is contained in:
2026-08-10 09:56:05 -04:00
parent c3412ca394
commit d868e1c476
6 changed files with 8 additions and 228 deletions
@@ -13,7 +13,6 @@
#include <MG_Util/Converters/GLToStr/GLEnumConverter.h>
#include <MG_Util/Converters/MGToGL/ProgramEnumConverter.h>
#include <MG_Util/Converters/SPIRVCrossToGL/SpvcTypeConverter.h>
#include <MG_Util/Debug/TempStageProbe.h> // TEMP-STAGE-PROBE
#include <MG_Util/ShaderTranspiler/ShaderCompiler.h>
#include <MG_Util/ShaderTranspiler/ShaderSourceProcessor.h>
#include <MG_Util/ShaderTranspiler/Types.h>
@@ -294,15 +293,6 @@ namespace MobileGL::MG_State::GLState {
const GlslangThreadAllocatorGuard glslangGuard;
using namespace MG_Util::ShaderTranspiler;
// TEMP-STAGE-PROBE: "linktask-total" (whole link body, superset of glslang-link /
// spirv-gen / spirv-opt / reflection / spvc-routing / the ConsumeShaders re-parse)
// plus the every-25-links running-total dump of every stage.
// Declared FIRST so it is destroyed LAST: the dump then already includes this link's
// own contribution to every stage, including "linktask-total".
const MG_Util::Debug::TempStageProbeLinkTick tempStageProbeLinkTick;
const MG_Util::Debug::TempStageProbeScope tempStageProbeLinkTask(
MG_Util::Debug::kTempStageProbeLinkTaskTotal);
MOBILEGL_ASSERT(in.env != nullptr, "ProgramLinkTask: the CompileEnv snapshot is missing");
const CompileEnv& env = *in.env;
@@ -342,12 +332,7 @@ namespace MobileGL::MG_State::GLState {
.explicitOpaqueUniformBindings = &artifacts.explicitOpaqueUniformBindings};
MGLOG_D("ProgramObject %u: Calling ShaderCompiler::LinkProgram", in.externalIndex);
// TEMP-STAGE-PROBE: "glslang-link" - TProgram::link + mapIO.
auto result = [&] {
const MG_Util::Debug::TempStageProbeScope tempStageProbeGlslangLink(
MG_Util::Debug::kTempStageProbeGlslangLink);
return ShaderCompiler::LinkProgram(attrib);
}();
auto result = ShaderCompiler::LinkProgram(attrib);
if (result) {
artifacts.linkStatus = true;
artifacts.program = result.value();
@@ -416,13 +401,7 @@ namespace MobileGL::MG_State::GLState {
// AND read the OPTIMIZED SPIR-V, so BuildGlobalUboRouting still runs strictly after
// both DoReflection and GenerateSpirv.
MGLOG_D("ProgramObject %u: Starting reflection", in.externalIndex);
// TEMP-STAGE-PROBE: "reflection" - buildReflection + the GL location assignment.
const bool tempStageProbeReflectionOk = [&] {
const MG_Util::Debug::TempStageProbeScope tempStageProbeReflection(
MG_Util::Debug::kTempStageProbeReflection);
return static_cast<bool>(DoReflection(env));
}();
if (!tempStageProbeReflectionOk) {
if (!DoReflection(env)) {
DeferLog(std::format("ProgramObject {}: Link failed during reflection: {}", in.externalIndex,
artifacts.infoLog));
return;
@@ -10,7 +10,6 @@
#include <MG_State/GLState/ProgramState/ShaderCompileTask.h> // GlslangThreadAllocatorGuard
#include <MG_Util/Async/ShaderCompilePool.h>
#include <MG_Util/Debug/TempStageProbe.h> // TEMP-STAGE-PROBE
#include <MG_Util/ShaderTranspiler/ShaderCompiler.h>
#include <MG_Util/ShaderTranspiler/SpvcSession.h>
#include <MG_Util/ShaderTranspiler/Types.h>
@@ -102,11 +101,6 @@ namespace MobileGL::MG_State::GLState {
return;
}
// TEMP-STAGE-PROBE: "spirvtask-total" (whole phase-B body, superset of spirv-gen /
// spirv-null / spirv-opt / spvc-routing).
const MG_Util::Debug::TempStageProbeScope tempStageProbeSpirvTask(
MG_Util::Debug::kTempStageProbeSpirvTaskTotal);
MGLOG_D("ProgramObject %u: Starting SPIR-V generation", externalIndex);
GenerateSpirv(handoff, externalIndex);
// GlslangToSpv was the only consumer of the parsed ASTs; everything after this point
@@ -138,12 +132,7 @@ namespace MobileGL::MG_State::GLState {
handoff.shaders.clear();
MGLOG_D("ProgramObject %u: Building global-UBO routing tables", externalIndex);
{
// TEMP-STAGE-PROBE: "spvc-routing" - the SPIRV-Cross session per SPIR-V module.
const MG_Util::Debug::TempStageProbeScope tempStageProbeSpvcRouting(
MG_Util::Debug::kTempStageProbeSpvcRouting);
BuildGlobalUboRouting(handoff, externalIndex);
}
BuildGlobalUboRouting(handoff, externalIndex);
MGLOG_D("ProgramObject %u: Binary generation finished (generatedSpirv size=%zu)", externalIndex,
artifacts.generatedSpirv.size());
}
@@ -166,12 +155,7 @@ namespace MobileGL::MG_State::GLState {
.program = *handoff.reflection.program,
};
MGLOG_D("ProgramObject %u: GenerateSpirv - requesting SPIR-V binary from program", externalIndex);
// TEMP-STAGE-PROBE: "spirv-gen" - GlslangToSpv for every stage of this program.
auto binaryResult = [&] {
const MG_Util::Debug::TempStageProbeScope tempStageProbeSpirvGen(
MG_Util::Debug::kTempStageProbeSpirvGen);
return ShaderCompiler::GetSpirvBinaryFromProgram(binaryAttrib);
}();
auto binaryResult = ShaderCompiler::GetSpirvBinaryFromProgram(binaryAttrib);
if (!binaryResult) {
DeferLog(std::format("ProgramObject {}: GenerateSpirv - GetSpirvBinaryFromProgram failed", externalIndex));
MOBILEGL_ASSERT(binaryResult, "GetSpirvBinaryFromProgram failed");
@@ -182,24 +166,8 @@ namespace MobileGL::MG_State::GLState {
artifacts.generatedSpirv.size());
// Linked SPIR-V generated, sanitize and optimize it
{
// TEMP-STAGE-PROBE: "spirv-null" - the same Optimizer::Run with ZERO passes,
// on the pre-optimize binary: pure BuildModule + serialize + IRContext
// teardown. Its device/desktop share ratio against "spirv-opt" is the
// allocator-pathology discriminator. Costs one extra plumbing round per
// module; diagnostic build only.
const MG_Util::Debug::TempStageProbeScope tempStageProbeSpirvNull(
MG_Util::Debug::kTempStageProbeSpirvNull);
for (auto& spv : artifacts.generatedSpirv) {
Vector<uint32_t> nullOut;
(void)ShaderCompiler::TempProbeNullOptimizeBinary(spv, nullOut);
}
}
Bool allOptimized = true;
{
// TEMP-STAGE-PROBE: "spirv-opt" - the spirv-tools optimizer run over every module.
const MG_Util::Debug::TempStageProbeScope tempStageProbeSpirvOpt(
MG_Util::Debug::kTempStageProbeSpirvOpt);
for (auto& spv : artifacts.generatedSpirv) {
auto success = ShaderCompiler::SanitizeAndOptimizeBinary(spv, spv);
if (!success) {
@@ -9,7 +9,6 @@
#include "ShaderCompileTask.h"
#include <MG_Util/Converters/MGToGL/ProgramEnumConverter.h>
#include <MG_Util/Debug/TempStageProbe.h> // TEMP-STAGE-PROBE
#include <MG_Util/ShaderTranspiler/ShaderCompiler.h>
#include <MG_Util/ShaderTranspiler/ShaderSourceProcessor.h>
#include <MG_Util/ShaderTranspiler/Types.h>
@@ -156,13 +155,7 @@ namespace {
MobileGL::MG_State::GLState::ShaderPreprocessResult result;
result.preprocessedSource = source;
{
// TEMP-STAGE-PROBE: "preprocess". Only reached on a ShaderPreprocessCache miss,
// so its call count is the miss count, not the glCompileShader count.
const MobileGL::MG_Util::Debug::TempStageProbeScope tempStageProbePreprocess(
MobileGL::MG_Util::Debug::kTempStageProbePreprocess);
PreprocessShaderSource(stage, result.preprocessedSource, env);
}
PreprocessShaderSource(stage, result.preprocessedSource, env);
if (stage == ShaderStage::Compute) {
if (const std::optional<String> localSizeError =
@@ -214,10 +207,6 @@ namespace MobileGL::MG_State::GLState {
// status + log, so turn a throw into exactly that - a completed job whose result
// is "this shader did not compile", with a log the application can read.
// (JobNode still catches: it is the last resort for anything below.)
// TEMP-STAGE-PROBE: "compiletask-total" - whole ShaderCompileTask body (superset of
// "preprocess" + "parse"); the difference is the task's own bookkeeping.
const MG_Util::Debug::TempStageProbeScope tempStageProbeCompileTask(
MG_Util::Debug::kTempStageProbeCompileTaskTotal);
try {
RunCompilePipeline();
} catch (const std::exception& e) {
@@ -338,14 +327,7 @@ namespace MobileGL::MG_State::GLState {
// Re-parse against the SAME environment the original parse used,
// not against whatever the backend reports now.
.env = artifacts.env.get()};
// TEMP-STAGE-PROBE: "parse-reparse" - the link-time consume-once re-parse. This goes
// through ShaderCompiler::CompileShader, so it is ALSO counted in "parse"; it is
// recorded separately so the "parse" total can be split into first-parse vs re-parse.
auto result = [&] {
const MG_Util::Debug::TempStageProbeScope tempStageProbeReparse(
MG_Util::Debug::kTempStageProbeParseReparse);
return ShaderCompiler::CompileShader(attrib);
}();
auto result = ShaderCompiler::CompileShader(attrib);
if (!result) {
// Should be unreachable: the same source parsed successfully at Compile().
outReparseLog = result.error().log;