The own context enabled VK_EXT_device_generated_commands where its device supported it so that the device replay of an indirect command buffer could take the extension's token stream. --without-generated-commands turned that off so the other replay path could be measured. The replays are gone (dc03c9e1b5), and nothing the executor runs reads the extension now. In the translator, only the device replay reads a description's generated-commands facts (Device::generated_commands). This change removes the enable and its switch: - enables.rs: GeneratedCommandsFeatures, Structure::GeneratedCommands (with its chain field, link and requirement arms), the deviceGeneratedCommands member, the extension's EXTENSIONS row, and enable_generated_commands. - device.rs: the context never enables the extension. Its opened description states no generated-commands facts (description.generated_commands = None, now unconditional: with_enabled leaves that field alone). - candidate.rs: the GENERATED_COMMANDS setting, run_without_generated_commands, decide_generated_commands and requested_generated_commands. - corpus-vulkan (candidate_common.rs): --without-generated-commands, its usage text, and its "not stored" line. - engine::execute_prepared: a row and a refusal on an opened device are always stored. - The device worker: the generated_commands field of its input and report, and the parent's check that they agree. One unit test is deleted (a_worker_run_on_another_generated_commands_path_is_refused); the integration test serve loop and the restriction test drop their no-DGC arm. - The profile bounds over a description's generated_commands facts stay (profiles.rs): a queried description still states them, and a restricted context compares them. ENGINE_EXECUTOR_ABI v208 -> v209 (development's number + 1 at this rebase, after texture buffers took v208). Why: on a device that lists the extension (lavapipe, RADV, ANV ARL, NVIDIA RTX 50), the context's enabled extension list and its opened description change. A row records both, and the row's translator fingerprint derives from the opened profile. The member table loses deviceGeneratedCommands, so the members the vocabulary does not name go from 11 to 10 (a_member_the_vocabulary_does_not_name_carries_its_registry_name). The pinned opened chains (enables/opened_chains.txt) are blessed at the next named pin. A bless run at this change (m3-max-63862, bless_opened_chains) moves 22 of the 32 contexts: - 20 are the device and restricted contexts of the ten profiles that list the extension (amd-780m-radv, amd-780m-hawkpoint-radv, amd-rdna2-apu-radv, amd-rdna3-radv, gate-lavapipe, gate-lavapipe-x86_64, intel-arl-anv, lavapipe, nvidia-rtx50-linux, nvidia-rtx5080-laptop). Each loses exactly one member and one extension. - The other 2 are runtime-floor's device and restricted contexts, which gain 4 members (49 -> 53 and 57 -> 61) with the same extensions. That move is not from this change, which only removes. It comes from817463704e(texture buffers), which added six texel-buffer descriptor-indexing features to profiles/runtime-floor.json after the last chains bless (03d898aac0). Four of them are expected to be the ones the engine enables, the update-after-bind and non-uniform-indexing members that device/derive.rs lists; that is read from the code, not checked. Verified: - m3-max-63797 (gem10, at f6f4c015dd, this change before the count fix, onb7e3247961): fmt, clippy (all features, --cfg m2v_gpu, --cfg m2v_cpu_icd) and Rustdoc green. Validation nextest failed only the unnamed-member count, now fixed, and the opened-chains pin. - m3-max-63862 (um870, at f8479dd1cf, with the fix): fmt and clippy green. Validation nextest ran 1328 tests: 1327 passed, and the opened-chains pin failed as accounted above. bless_opened_chains passed. - m3-max-63796 (gem10, at f6f4c015dd): the own context's device tests (candidate::tests) on lavapipe passed, 54 tests. Every context opens without the extension. - This commit is the same patch rebased onto0f2067150f. The commits sinceb7e3247961touch rt, conformance and one translator file (pipeline/artifact.rs), and no validation file.
112 lines
5.4 KiB
Rust
112 lines
5.4 KiB
Rust
//! Every tool that runs engine cases serves the device worker: started with
|
|
//! `--engine-device-worker`, it reads the parent's input from stdin, applies the parent's
|
|
//! profiles-layer restriction, and reports a typed result with its build identity and
|
|
//! framebuffer-fetch policy on stdout, so the parent's device half never runs in the parent.
|
|
|
|
use metal2vulkan_validation::observation::TRANSLATOR_FINGERPRINT;
|
|
use metal2vulkan_validation::worker::device::{VALIDATION_FINGERPRINT, WORKER_ARG};
|
|
use std::io::Write as _;
|
|
use std::path::{Path, PathBuf};
|
|
use std::process::{Command, Output, Stdio};
|
|
|
|
/// The binary that executes engine cases (`candidate::engine::execute_prepared`).
|
|
fn serving() -> PathBuf {
|
|
bin_exe!("corpus-vulkan")
|
|
}
|
|
|
|
/// A public authored case (`single-thread-store-constant`), whose AIR the public fixtures give.
|
|
const CASE: &str = r#"{"acceleration_structures":[],"air_sha256":"dc4e4be315732ae7ea24fe171945c4c25b42ca65e10f83530eed6cc95f80b50b","argument_buffer_buffers":[],"argument_buffer_intersection_function_tables":[],"argument_buffer_textures":[],"authored_by":"metal2vulkan project","buffers":[{"binding":0,"initial_bytes_b64":"q6urqw==","role":"output"}],"case_id":"1e54315eb0ffcac633d4992c577f3e6ac384ed1bdf2321887c1f37242c00c887","compare":{"kind":"exact"},"device_buffer_arrays":[],"dispatch":{"grid":[1,1,1],"threads_per_threadgroup":[1,1,1]},"entry":"store_const","execution_safety":"loop_free","function_constants":[],"intersection_function_tables":[],"kernel_stage_inputs":[],"name":"single-thread-store-constant","output":{"binding":0,"kind":"buffer","length":4,"offset":0},"public_source":"crates/metal2vulkan-validation/fixtures/public/kernel_store_const.ll","rationale":"A single invocation writes the integer constant 42 into one explicitly poisoned output word.","render_targets":[],"samplers":[],"stage":"kernel","texture_arrays":[],"textures":[],"threadgroup_memory":[],"vertex_inputs":[],"visible_function_references":[],"visible_function_tables":[]}"#;
|
|
|
|
/// The worker input for [`CASE`] restricted to `restricted_to`, claiming a checked-input digest
|
|
/// the case does not have.
|
|
fn input(restricted_to: Option<&str>) -> String {
|
|
format!(
|
|
r#"{{"root":"/nonexistent/device-worker-corpus","case":{CASE},"device":"Cpu","input_sha256":"{}","wait_timeout_ms":10000,"restricted_to":{}}}"#,
|
|
"0".repeat(64),
|
|
serde_json::to_string(&restricted_to).unwrap()
|
|
)
|
|
}
|
|
|
|
/// `program` started as a device worker on `input`.
|
|
fn serve(program: &Path, input: &str) -> Output {
|
|
let mut child = Command::new(program)
|
|
.arg(WORKER_ARG)
|
|
.stdin(Stdio::piped())
|
|
.stdout(Stdio::piped())
|
|
.stderr(Stdio::piped())
|
|
.spawn()
|
|
.unwrap();
|
|
child
|
|
.stdin
|
|
.take()
|
|
.unwrap()
|
|
.write_all(input.as_bytes())
|
|
.unwrap();
|
|
child.wait_with_output().unwrap()
|
|
}
|
|
|
|
/// The worker's own check disagrees with its parent's input digest, and it reports that as the
|
|
/// run's typed failure, with its build identity, before it opens a device: unrestricted, and
|
|
/// restricted to a committed profile.
|
|
#[test]
|
|
fn every_case_running_tool_serves_the_device_worker() {
|
|
let path = serving();
|
|
let program = path.display();
|
|
for restricted_to in [None, Some("gate-lavapipe")] {
|
|
let output = serve(&path, &input(restricted_to));
|
|
let stderr = String::from_utf8_lossy(&output.stderr);
|
|
assert!(output.status.success(), "{program}: {stderr}");
|
|
let report: serde_json::Value = serde_json::from_slice(&output.stdout)
|
|
.unwrap_or_else(|error| panic!("{program}: {error}: {stderr}"));
|
|
let result = &report["result"];
|
|
assert_eq!(
|
|
result["product_fingerprint"], TRANSLATOR_FINGERPRINT,
|
|
"{program}"
|
|
);
|
|
assert_eq!(
|
|
result["validation_fingerprint"], VALIDATION_FINGERPRINT,
|
|
"{program}"
|
|
);
|
|
let failed = result["result"]["Err"]["Failed"]
|
|
.as_str()
|
|
.unwrap_or_else(|| panic!("{program}: {report}"));
|
|
assert!(
|
|
failed.contains(&format!("its parent as {}", "0".repeat(64))),
|
|
"{program}: {failed}"
|
|
);
|
|
}
|
|
}
|
|
|
|
/// The worker restricts its contexts to the profile its parent's are restricted to before it
|
|
/// checks the case or opens a device: a profile it cannot apply stops it there (exit 1, named on
|
|
/// stderr), with no report.
|
|
#[test]
|
|
fn a_worker_applies_the_parents_restriction_first() {
|
|
let path = serving();
|
|
let program = path.display();
|
|
let output = serve(&path, &input(Some("no-such-profile")));
|
|
let stderr = String::from_utf8_lossy(&output.stderr);
|
|
assert_eq!(output.status.code(), Some(1), "{program}: {stderr}");
|
|
assert!(
|
|
stderr.starts_with("engine device worker: unknown profile \"no-such-profile\""),
|
|
"{program}: {stderr}"
|
|
);
|
|
assert!(output.stdout.is_empty(), "{program}");
|
|
}
|
|
|
|
/// An input the worker cannot decode is the worker's own failure (exit 1, named on stderr), not a
|
|
/// tool's usage error.
|
|
#[test]
|
|
fn a_worker_refuses_an_input_it_cannot_decode() {
|
|
let path = serving();
|
|
let program = path.display();
|
|
let output = serve(&path, "{}");
|
|
let stderr = String::from_utf8_lossy(&output.stderr);
|
|
assert_eq!(output.status.code(), Some(1), "{program}: {stderr}");
|
|
assert!(
|
|
stderr.starts_with("engine device worker: decode the device worker's input"),
|
|
"{program}: {stderr}"
|
|
);
|
|
assert!(output.stdout.is_empty(), "{program}");
|
|
}
|