Validation: the authored compile census compiles the mesh pipelines no candidate draws

Since the executor lost its runtime path, a run's preparation refuses an object or mesh case by
mesh_render_pipeline before it maps, so the census, which prepares through the same function,
refused the 15 committed object and mesh cases too, and the candidate's mesh mapping and compile
(engine/mesh.rs, PipelineRequest::MeshDraw, variants::compile_mesh_for_shape, Mapped::Mesh) ran
nowhere. The census now prepares through engine::prepare_compile: the run's preparation, except
that mesh_render_pipeline alone does not stop it. So each object or mesh case's mesh render
pipeline compiles on every profile-leg again, as the candidate would build it, and keeps its
compile evidence. A run still refuses such a case device-free (prepare_case, in the parent and
in the device worker).

AUTHORED_COMPILE_CENSUS_VERSION 6: the compiles a mesh case's cell is made of changed. The
census table is re-blessed on development.

Test: the_census_compiles_the_mesh_pipelines_no_candidate_draws (integration): the committed
public mesh case and object case are refused by a run's preparation with mesh_render_pipeline
alone, prepared by the census's, list one compile of the case's own pipeline, and compile on the
lavapipe profile in a real compile worker. It fails without the change (the cell is refused).
This commit is contained in:
Anees Iqbal committed 2026-11-20 06:28:32 -08:00
1 parent 142ba1c50d
commit b5cbdb2b4a
5 files changed
+117 -12

No files matched your search

+3 -1
View File
@@ -136,7 +136,9 @@ vertex or primitive and writes no device memory: it has no effect a stage observ
without rasterization and its case observes the empty output (`"output": {"kind": "none"}`). The Metal oracle draws a case through
`MTLMeshRenderPipelineDescriptor` and the case's own stage's setters. The engine's candidate
does not draw one: an object or mesh case requires `mesh_render_pipeline`, which no candidate
runs, so its Metal observation stands with its Vulkan side unsupported. An object case's
runs, so its Metal observation stands with its Vulkan side unsupported. The authored compile
census still compiles its mesh render pipeline, as the candidate would build it, on each
profile-leg. An object case's
`threadgroup_memory` sets its arguments' lengths through `setObjectThreadgroupMemoryLength:atIndex:`.
Dynamic Metal `threadgroup` arguments are declared through `threadgroup_memory` binding/length
@@ -9,7 +9,9 @@
//! census closes that gap:
//!
//! - **The request.** A case is admitted and prepared by the executor's own device-free half
//! (`engine::prepare_case`), and every pipeline a run compiles before it reads device output
//! (`engine::prepare_compile`: its run's preparation, except that an object or mesh case, whose
//! mesh render pipeline the executor does not draw, is prepared to compile it), and every
//! pipeline a run compiles before it reads device output
//! comes from `engine::case_compiles`: the case's own, and on a device where the device
//! replay runs, each registered replay variant. Each compiles in a compile worker (the 20-s and
//! 500-MiB per-attempt ceilings, a process-group kill). The pipelines of host-replayed commands
@@ -46,7 +48,8 @@
use crate::candidate::engine::artifact::CaseArtifact;
use crate::candidate::engine::{
case_compiles, prepare_case, CompileFailure, CompileSubject, PreparedCase, ENGINE_EXECUTOR_ABI,
case_compiles, prepare_compile, CompileFailure, CompileSubject, PreparedCase,
ENGINE_EXECUTOR_ABI,
};
use crate::case::AuthoredCase;
use crate::check::admission::{admit, ExecutionRequest, ExecutorError, NotSupported};
@@ -86,7 +89,10 @@ mod tests;
/// replay its templates, each executed command buffer uncovered (`engine::case_compiles`).
/// 5: an object or mesh case compiles its mesh render pipeline, where it was refused
/// (`engine::mesh::mesh_request`).
pub const AUTHORED_COMPILE_CENSUS_VERSION: u32 = 5;
/// 6: an object or mesh case whose only stop is that the executor draws no mesh render pipeline
/// (`mesh_render_pipeline`) compiles it, where the run's preparation refuses it
/// (`engine::prepare_compile`).
pub const AUTHORED_COMPILE_CENSUS_VERSION: u32 = 6;
/// The expectation file's name under the corpus root (`validation/corpus`).
pub const EXPECTATIONS: &str = "authored-compile.tsv";
@@ -461,9 +467,9 @@ pub trait CaseCompiler: Sync {
fn compile(&self, case: &AuthoredCase, profiles: &[&CensusProfile]) -> CaseResult;
}
/// The executor's admission and preparation of `case` over the corpus at `root`, then every
/// pipeline [`case_compiles`] lists for each of `devices`, each in a compile worker of `worker`:
/// one cell per device, in order.
/// The executor's admission and compile preparation ([`prepare_compile`]) of `case` over the
/// corpus at `root`, then every pipeline [`case_compiles`] lists for each of `devices`, each in a
/// compile worker of `worker`: one cell per device, in order.
pub fn compile_case(
root: &Path,
worker: &CompileWorker,
@@ -478,7 +484,7 @@ pub fn compile_case(
case.clone(),
ExecutionRequest::EngineCandidate { device },
)
.and_then(|admitted| prepare_case(device, admitted));
.and_then(|admitted| prepare_compile(device, admitted));
match prepared {
Ok(prepared) => devices
.iter()
@@ -1992,7 +1992,8 @@ pub fn execute_case(
)
}
/// An admitted case that passed the executor's device-free checks ([`prepare_case`]).
/// An admitted case that passed the executor's device-free checks ([`prepare_case`]), or the
/// compile census's ([`prepare_compile`]).
pub struct PreparedCase {
device: DeviceType,
checked: CheckedCase,
@@ -2378,9 +2379,34 @@ enum Mapped {
pub fn prepare_case(
device: DeviceType,
admitted: AdmittedCase,
) -> Result<PreparedCase, ExecutorError> {
prepare(device, admitted, false)
}
/// [`prepare_case`] for the authored compile census (`authored_compile`): a case whose only stop
/// is the mesh render pipeline the executor does not draw
/// ([`ToolingRequirement::MeshRenderPipeline`]) is prepared too, its draw mapped
/// ([`mesh::mesh_case`]), so [`case_compiles`] lists the pipeline a run of it would compile. A
/// run's preparation refuses such a case before any device, its device worker's included.
pub fn prepare_compile(
device: DeviceType,
admitted: AdmittedCase,
) -> Result<PreparedCase, ExecutorError> {
prepare(device, admitted, true)
}
/// [`prepare_case`], or with `compile_only` [`prepare_compile`].
fn prepare(
device: DeviceType,
admitted: AdmittedCase,
compile_only: bool,
) -> Result<PreparedCase, ExecutorError> {
let checked = admitted.into_checked_for(ExecutionRequest::EngineCandidate { device })?;
crate::executor_contract::require_executor(&checked.requirements(), Executor::EngineCandidate)
let mut requirements = checked.requirements();
if compile_only {
requirements.remove(&ToolingRequirement::MeshRenderPipeline);
}
crate::executor_contract::require_executor(&requirements, Executor::EngineCandidate)
.map_err(NotSupported::Requirements)?;
let case = &checked.primary.case;
let mapped = match case.stage {
@@ -2876,7 +2902,8 @@ fn run_on_context(prepared: &PreparedCase, backend: Backend, worker: &CompileWor
backend,
)
}
// The checker's requirements refuse a mesh case before it maps (`prepare_case`).
// A run's preparation refuses a mesh case before it maps (`prepare_case`); only the
// compile census prepares one (`prepare_compile`).
Mapped::Mesh(_) => RunAttempt::of(Err(NotSupported::Requirements(
[ToolingRequirement::MeshRenderPipeline].into(),
)
@@ -125,7 +125,9 @@ pub enum ToolingRequirement {
DepthOutsideUnitRange,
/// An object or mesh function's row or case (`executor_contract::mesh`), or a case that runs a
/// pipeline template of one: the engine's candidate draws no mesh render pipeline. The Metal
/// oracle draws it, so a case of it stays Metal-qualified ([`Self::qualifies_on_metal`]).
/// oracle draws it, so a case of it stays Metal-qualified ([`Self::qualifies_on_metal`]), and
/// the authored compile census still compiles an object or mesh case's pipeline
/// (`engine::prepare_compile`).
MeshRenderPipeline,
/// A replayed pipeline template the engine's candidate does not replay
/// (`candidate::engine::replay_templates`): a compute template that binds more than buffers
@@ -328,3 +328,71 @@ fn case_compiles_lists_the_replay_variants_where_the_device_replay_runs() {
assert_eq!(drawn.host_replayed, 1);
assert_eq!(drawn.compiles.len(), 1);
}
/// An object or mesh case, which no candidate draws (`mesh_render_pipeline`), still compiles its
/// mesh render pipeline in the census: a run's preparation refuses the committed public mesh and
/// object cases by that requirement alone, the census's prepares them, and each one's pipeline,
/// its partners' stages with it, compiles in the worker as its one compile.
#[test]
fn the_census_compiles_the_mesh_pipelines_no_candidate_draws() {
use metal2vulkan_validation::authored_compile::{compile_case, CensusProfile};
use metal2vulkan_validation::candidate::engine::{
case_compiles, prepare_case, prepare_compile, CompileSubject,
};
use metal2vulkan_validation::check::admission::{
admit, ExecutionRequest, ExecutorError, NotSupported,
};
use metal2vulkan_validation::gpu::DeviceType;
use metal2vulkan_validation::requirement::ToolingRequirement;
if !llvm_as_available() {
return;
}
let worker = {
let program = bin_exe!("corpus-triage");
let _ = Command::new(&program).arg("--help").output();
CompileWorker::program(program)
};
let lavapipe = CensusProfile::load(&ProfileLeg::parse("lavapipe").unwrap()).unwrap();
let device = DeviceType::Cpu;
for name in [
"a-mesh-grid-of-threadgroups-draws-through-its-fragment",
"an-object-function-launches-its-mesh-partner-with-a-payload",
] {
let (scratch, case) = corpus_with_templates(name);
let admitted = || {
admit(
scratch.path(),
case.clone(),
ExecutionRequest::EngineCandidate { device },
)
.unwrap_or_else(|error| panic!("{name}: admission: {error}"))
};
let refused = prepare_case(device, admitted()).err();
assert!(
matches!(&refused, Some(ExecutorError::NotSupported(NotSupported::Requirements(stops)))
if stops.iter().eq([&ToolingRequirement::MeshRenderPipeline])),
"{name}: {refused:?}"
);
let prepared = prepare_compile(device, admitted())
.unwrap_or_else(|error| panic!("{name}: preparation: {error}"));
let planned = case_compiles(&prepared, &lavapipe.device).unwrap();
assert_eq!(planned.host_replayed, 0, "{name}");
assert_eq!(
planned
.compiles
.iter()
.map(|compile| compile.subject)
.collect::<Vec<_>>(),
[CompileSubject::Case],
"{name}"
);
let cells = compile_case(scratch.path(), &worker, &case, &[&lavapipe.device]);
assert_eq!(cells.len(), 1, "{name}");
assert_eq!(
cells[0].outcome,
Ok(CellOutcome::Compiled),
"{name}: {cells:?}"
);
assert_eq!(cells[0].compiles, 1, "{name}");
}
}