diff --git a/crates/metal2vulkan-validation/src/bin/candidate_common.rs b/crates/metal2vulkan-validation/src/bin/candidate_common.rs index 6d54e4774..e49cfce9b 100644 --- a/crates/metal2vulkan-validation/src/bin/candidate_common.rs +++ b/crates/metal2vulkan-validation/src/bin/candidate_common.rs @@ -55,7 +55,6 @@ fn run() -> Result<(), ExecutorError> { let mut environment_id = None; let mut device_type = None; let mut profiles_layer = None; - let mut without_generated_commands = false; let mut args = std::env::args().skip(1); while let Some(arg) = args.next() { match arg.as_str() { @@ -76,7 +75,6 @@ fn run() -> Result<(), ExecutorError> { device_type = Some(DeviceType::parse(&required(&mut args, "--device-type")?)?) } "--profiles-layer" => profiles_layer = Some(required(&mut args, "--profiles-layer")?), - "--without-generated-commands" => without_generated_commands = true, "--gpu-wait-timeout" => set_wait_timeout(parse_wait_timeout(&required( &mut args, "--gpu-wait-timeout", @@ -85,8 +83,7 @@ fn run() -> Result<(), ExecutorError> { println!( "usage: corpus-vulkan [--corpus DIR] [--private-corpus DIR] --case-id HASH --metal-environment-id ID --environment-id ID --device-type cpu|gpu \\\n\ [--air-sha256 HASH] [--source-index FILE] \\\n\ - [--gpu-wait-timeout SECONDS] [--profiles-layer P] \\\n\ - [--without-generated-commands]\n\ + [--gpu-wait-timeout SECONDS] [--profiles-layer P]\n\ cpu matches only a CPU Vulkan implementation.\n\ --air-sha256 HASH, the case's AIR, reads the case from only the case shard HASH\n\ selects (refused if the case there is over another AIR); without it every case\n\ @@ -112,11 +109,6 @@ fn run() -> Result<(), ExecutorError> { robustImageAccess2), so the product compiles the robust containment encodings,\n\ and a case is not_supported{{not_enabled}} (exit 4) on a device that cannot enable\n\ one it states.\n\ - It enables VK_EXT_device_generated_commands where the device supports it,\n\ - so an indirect command buffer's device replay is the extension's token stream.\n\ - --without-generated-commands leaves it disabled, so the\n\ - replay records one indirect dispatch per command and region (K14c's path); the run is\n\ - compared and printed but not stored: the slot holds the default's evidence.\n\ The executor compares only against the case's Metal observation in the\n\ --metal-environment-id environment recorded by the current oracle for the\n\ checked case; without one it reports needs_metal_qualification{{...}} (exit 6)\n\ @@ -140,9 +132,6 @@ fn run() -> Result<(), ExecutorError> { if let Some(profile) = &profiles_layer { metal2vulkan_validation::candidate::restrict_devices_to(profile)?; } - if without_generated_commands { - metal2vulkan_validation::candidate::run_without_generated_commands()?; - } let observation = engine::execute( &root, case, @@ -158,16 +147,6 @@ fn run() -> Result<(), ExecutorError> { if let Some(withheld) = observation.environment.get("withheld_validation_messages") { println!("withheld validation messages: {withheld}"); } - if without_generated_commands { - println!( - "not stored: --without-generated-commands slot={} command_replay={}", - observation.environment_id, - observation - .environment - .get("command_replay") - .unwrap_or(&serde_json::Value::Null) - ); - } if observation.status == metal2vulkan_validation::observation::CandidateStatus::Mismatch { return Err("candidate output does not match the exact Metal observation".into()); } diff --git a/crates/metal2vulkan-validation/src/candidate.rs b/crates/metal2vulkan-validation/src/candidate.rs index bdd3c07e9..ceb838afd 100644 --- a/crates/metal2vulkan-validation/src/candidate.rs +++ b/crates/metal2vulkan-validation/src/candidate.rs @@ -1,5 +1,4 @@ use crate::gpu::DeviceType; -use std::sync::OnceLock; /// The exit statuses of the candidate executor's processes (`corpus-vulkan`): one per [`ExecutorError`](crate::check::admission::ExecutorError) kind that is not a failure, so a caller that runs them as processes /// (`corpus-vulkan --batch`) reads the kind from the status. A failure exits 1, and so does a @@ -73,40 +72,6 @@ pub(crate) fn requested_restriction() -> Option { platform::requested_restriction() } -/// Whether every engine context this process opens enables `VK_EXT_device_generated_commands` -/// where its device supports it, so the device replay takes the generated-commands path: decided -/// once, by [`run_without_generated_commands`] (or a device worker's -/// [`decide_generated_commands`]) or by the first read without it (enabled). -static GENERATED_COMMANDS: OnceLock = OnceLock::new(); - -/// Open every engine context this process opens without `VK_EXT_device_generated_commands` -/// (a command's `--without-generated-commands`), so the device replay takes K14c's path on a device -/// that has the extension. A measurement of that path, never the default's evidence: the engine -/// executor compares and returns its observation but does not store it. Call it once, before any -/// device opens. -pub fn run_without_generated_commands() -> Result<(), String> { - decide_generated_commands(false) -} - -/// Decide this process's generated-commands setting ([`run_without_generated_commands`]); a -/// device worker applies its parent's before it opens a device. -pub(crate) fn decide_generated_commands(enabled: bool) -> Result<(), String> { - if *GENERATED_COMMANDS.get_or_init(|| enabled) == enabled { - Ok(()) - } else { - Err("the generated-commands setting is already decided: pass \ - --without-generated-commands once, before any device opens" - .into()) - } -} - -/// Whether this process's engine contexts enable `VK_EXT_device_generated_commands` where -/// their device supports it ([`run_without_generated_commands`]); reading it decides that they do -/// if nothing was set. -pub fn requested_generated_commands() -> bool { - *GENERATED_COMMANDS.get_or_init(|| true) -} - /// Write every validation-layer message that fails a row to stderr as the layer reports it, for /// this whole process (the engine device worker's setting). pub(crate) fn echo_validation_messages() { diff --git a/crates/metal2vulkan-validation/src/candidate/engine.rs b/crates/metal2vulkan-validation/src/candidate/engine.rs index 4a0a170f1..ec29c53a4 100644 --- a/crates/metal2vulkan-validation/src/candidate/engine.rs +++ b/crates/metal2vulkan-validation/src/candidate/engine.rs @@ -110,7 +110,7 @@ pub mod variants; /// how it decides a match. A change no recorded row can observe (a case kind no earlier executor /// ran, or one it refused) needs no bump; its commit says why. The commit that bumps it says what /// changed; this comment keeps no history. -pub const ENGINE_EXECUTOR_ABI: &str = "vulkan-engine-v208"; +pub const ENGINE_EXECUTOR_ABI: &str = "vulkan-engine-v209"; /// One kernel case in the terms the binder takes: what this executor supports of an /// [`AuthoredCase`] (buffers, device buffer arrays, argument-buffer buffers and textures, @@ -2030,9 +2030,7 @@ fn run_on_context(prepared: &PreparedCase, worker: &CompileWorker) -> RunAttempt } /// [`execute_case`] of a case [`prepare_case`] accepted: the device half in a device worker -/// (`run_on_device`), the comparison and the row here. Without generated commands -/// (`candidate::run_without_generated_commands`) the row is compared and returned but not stored: -/// it measures another path, and the slot is the default's. +/// (`run_on_device`), the comparison and the row here. pub fn execute_prepared( root: &Path, prepared: PreparedCase, @@ -2089,7 +2087,6 @@ pub fn execute_prepared( input_sha256: checked.primary.input_sha256.clone(), wait_timeout_ms: u64::try_from(wait_timeout().as_millis()).unwrap_or(u64::MAX), restricted_to, - generated_commands: super::requested_generated_commands(), venue, source_index: crate::source::source_index(), }; @@ -2097,10 +2094,9 @@ pub fn execute_prepared( let run = match result { Ok(run) => run, // A typed refusal on an opened device is evidence too: stored in the slot the row would - // have taken, with that device's facts. Without generated commands nothing is stored, as - // for a row. + // have taken, with that device's facts. Err(ExecutorError::NotSupported(not_supported)) => { - if let Some(opened) = refused_on.filter(|_| input.generated_commands) { + if let Some(opened) = refused_on { store.upsert_refusal(RefusalObservation { case_id: case.case_id.clone(), air_sha256: case.air_sha256.clone(), @@ -2166,12 +2162,7 @@ pub fn execute_prepared( if !observation.dependency_matches(&dependencies) { return Err("constructed candidate observation failed its own dependency check".into()); } - // A run without generated commands (`--without-generated-commands`) measures the device - // replay's other path on a device whose default run takes the generated-commands path: - // compared and returned, never stored over the default's evidence in the same slot. - if super::requested_generated_commands() { - store.upsert_candidate(observation.clone())?; - } + store.upsert_candidate(observation.clone())?; Ok(observation) } diff --git a/crates/metal2vulkan-validation/src/candidate/platform/device.rs b/crates/metal2vulkan-validation/src/candidate/platform/device.rs index 66e24c787..ba76cf140 100644 --- a/crates/metal2vulkan-validation/src/candidate/platform/device.rs +++ b/crates/metal2vulkan-validation/src/candidate/platform/device.rs @@ -1691,11 +1691,6 @@ impl VulkanContext { &available, ) .map_err(|error| format!("the engine's enable list: {error}"))?; - // The device replay's generated-commands path: an engine context enables - // `VK_EXT_device_generated_commands` where its device supports it, unless this process runs - // without it. - let generated_commands = crate::candidate::requested_generated_commands() - && enables::enable_generated_commands(&mut enables, &supported, &available); // The runtime probe's own context enables what it measures. let runtime_probe = (purpose == Purpose::RuntimeProbe) .then(|| enables::enable_runtime_probe(&mut enables, &available)); @@ -1779,11 +1774,9 @@ impl VulkanContext { let opened_description = description .and_then(|description| crate::acceptance::opened_description(description, &enabled)) .map(|mut description| { - // The description records what the context enabled: the generated-commands - // facts only where it enabled the extension. - if !generated_commands { - description.generated_commands = None; - } + // The description records what the context enabled: no context enables + // `VK_EXT_device_generated_commands`, so it states no generated-commands facts. + description.generated_commands = None; description }); if let Ok(description) = &opened_description { diff --git a/crates/metal2vulkan-validation/src/candidate/platform/enables.rs b/crates/metal2vulkan-validation/src/candidate/platform/enables.rs index 23596bd6e..3fbab6778 100644 --- a/crates/metal2vulkan-validation/src/candidate/platform/enables.rs +++ b/crates/metal2vulkan-validation/src/candidate/platform/enables.rs @@ -69,43 +69,6 @@ unsafe impl vk::ExtendsPhysicalDeviceFeatures2 for Maintenance8Features {} // SAFETY: as above. unsafe impl vk::ExtendsDeviceCreateInfo for Maintenance8Features {} -/// `VkPhysicalDeviceDeviceGeneratedCommandsFeaturesEXT`, which `ash 0.38` predates, laid out as -/// the registry defines it (`sType`, `pNext`, `VkBool32 deviceGeneratedCommands`, -/// `dynamicGeneratedPipelineLayout`; extension number 573, so its structure type is -/// `1000000000 + 572 * 1000`). The product's query reads the same structure -/// (`ash_interop::query`). -#[repr(C)] -#[derive(Clone, Copy)] -pub(super) struct GeneratedCommandsFeatures { - s_type: vk::StructureType, - p_next: *mut std::ffi::c_void, - device_generated_commands: vk::Bool32, - dynamic_generated_pipeline_layout: vk::Bool32, -} - -impl Default for GeneratedCommandsFeatures { - fn default() -> Self { - GeneratedCommandsFeatures { - s_type: ::STRUCTURE_TYPE, - p_next: std::ptr::null_mut(), - device_generated_commands: vk::FALSE, - dynamic_generated_pipeline_layout: vk::FALSE, - } - } -} - -// SAFETY: the layout is the registry's `VkPhysicalDeviceDeviceGeneratedCommandsFeaturesEXT`, which -// begins with `sType` and `pNext` as every chained structure must, and this is its structure type. -unsafe impl vk::TaggedStructure for GeneratedCommandsFeatures { - const STRUCTURE_TYPE: vk::StructureType = vk::StructureType::from_raw(1_000_572_000); -} - -// SAFETY: the registry lists `VkPhysicalDeviceFeatures2` and `VkDeviceCreateInfo` in the -// structure's `structextends`. -unsafe impl vk::ExtendsPhysicalDeviceFeatures2 for GeneratedCommandsFeatures {} -// SAFETY: as above. -unsafe impl vk::ExtendsDeviceCreateInfo for GeneratedCommandsFeatures {} - /// `VkPhysicalDeviceShaderFmaFeaturesKHR`, which `ash 0.38` predates, laid out as the registry /// defines it (`sType`, `pNext`, `VkBool32 shaderFmaFloat16`, `shaderFmaFloat32`, /// `shaderFmaFloat64`; extension number 580, so its structure type is `1000000000 + 579 * 1000`). @@ -283,14 +246,11 @@ pub(super) enum Structure { /// `VkPhysicalDeviceImageRobustnessFeatures` (`robustImageAccess`, core only from 1.3). ImageRobustness, PortabilitySubset, - /// `VkPhysicalDeviceDeviceGeneratedCommandsFeaturesEXT`: the device replay's - /// generated-commands path, enabled only by [`enable_generated_commands`]. - GeneratedCommands, } impl Structure { /// Every extension structure, in chain order. - const EXTENSIONS: [Structure; 45] = [ + const EXTENSIONS: [Structure; 44] = [ Structure::SubgroupSizeControl, Structure::Demote, Structure::Terminate, @@ -335,7 +295,6 @@ impl Structure { Structure::Robustness2, Structure::ImageRobustness, Structure::PortabilitySubset, - Structure::GeneratedCommands, ]; /// The device extensions any one of which exposes the structure at API 1.2 (empty for the @@ -399,7 +358,6 @@ impl Structure { Structure::Robustness2 => &[c"VK_EXT_robustness2", c"VK_KHR_robustness2"], Structure::ImageRobustness => &[c"VK_EXT_image_robustness"], Structure::PortabilitySubset => &[c"VK_KHR_portability_subset"], - Structure::GeneratedCommands => &[c"VK_EXT_device_generated_commands"], } } @@ -411,9 +369,6 @@ impl Structure { fn requires(self) -> &'static [&'static CStr] { match self { Structure::LocalRead | Structure::Maintenance5 => &[c"VK_KHR_dynamic_rendering"], - // Below 1.3, `VK_KHR_maintenance5` (or `VK_KHR_extended_flags`, which no device here - // lists), which itself requires `VK_KHR_dynamic_rendering`. - Structure::GeneratedCommands => &[c"VK_KHR_maintenance5", c"VK_KHR_dynamic_rendering"], Structure::AtomicFloat2 => &[c"VK_EXT_shader_atomic_float"], Structure::BorderColorSwizzle => &[c"VK_EXT_custom_border_color"], Structure::RayQuery => &[ @@ -643,7 +598,6 @@ pub(super) struct FeatureChain { /// defaults to all-false: enabling `VK_KHR_portability_subset` without chaining it asks for /// none of it. pub(super) portability_subset: vk::PhysicalDevicePortabilitySubsetFeaturesKHR<'static>, - pub(super) generated_commands: GeneratedCommandsFeatures, } /// Chains every structure of `$chain` whose [`Structure`] `$linked` holds onto `$info`, in @@ -694,8 +648,7 @@ macro_rules! link_extensions { FeedbackLoop => feedback_loop, Robustness2 => robustness2, ImageRobustness => image_robustness, - PortabilitySubset => portability_subset, - GeneratedCommands => generated_commands + PortabilitySubset => portability_subset ) }; (@ $info:ident, $chain:ident, $linked:ident; $($variant:ident => $field:ident),*) => { @@ -761,8 +714,7 @@ impl FeatureChain { feedback_loop, robustness2, image_robustness, - portability_subset, - generated_commands + portability_subset ); } @@ -1213,8 +1165,6 @@ members! { PortabilitySubset.portability_subset.image_view_format_swizzle => Some(F::ImageViewFormatSwizzle); PortabilitySubset.portability_subset.point_polygons => Some(F::PointPolygons); - GeneratedCommands.generated_commands.device_generated_commands => None, - registry = "deviceGeneratedCommands"; } /// The engine's vocabulary features [`engine_list`] never enables, each with why. None of @@ -1395,7 +1345,6 @@ const EXTENSIONS: &[ExtensionName] = { e(c"VK_KHR_maintenance5", Some(X::KhrMaintenance5)), e(c"VK_KHR_dynamic_rendering", Some(X::KhrDynamicRendering)), e(c"VK_KHR_portability_subset", Some(X::KhrPortabilitySubset)), - e(c"VK_EXT_device_generated_commands", None), e( c"VK_KHR_format_feature_flags2", Some(X::KhrFormatFeatureFlags2), @@ -1567,37 +1516,6 @@ pub(super) fn old_engine_list(supported: &FeatureChain, available: &Available) - enables } -/// Enable `VK_EXT_device_generated_commands` and its `deviceGeneratedCommands` on top of a new -/// engine's `enables`, where the device supports the feature and the list already enables -/// `VK_KHR_maintenance5` (the extension's requirement at API 1.2, and the source of the -/// `VkPipelineCreateFlags2CreateInfo` its pipelines are created with), or, in a context at a -/// version that has it as core (1.4), its `maintenance5`: the device replay then runs the -/// generated-commands path. Whether it did. -pub(super) fn enable_generated_commands( - enables: &mut Enables, - supported: &FeatureChain, - available: &Available, -) -> bool { - let member = MEMBERS - .iter() - .find(|member| member.structure == Structure::GeneratedCommands) - .expect("deviceGeneratedCommands is listed"); - let maintenance5 = enables.extensions.contains(c"VK_KHR_maintenance5") - || (Structure::Maintenance5.core_at(enables.version) - && MEMBERS - .iter() - .filter(|member| member.structure == Structure::Maintenance5) - .all(|member| enabled(enables, member))); - if !member.is_set(supported) || !maintenance5 { - return false; - } - if !enables.expose(Structure::GeneratedCommands, available) { - return false; - } - member.set(&mut enables.chain); - true -} - /// What the runtime probe's context enabled beyond the engine's list /// ([`enable_runtime_probe`]). #[derive(Clone, Copy, Debug, Default, PartialEq, Eq)] diff --git a/crates/metal2vulkan-validation/src/candidate/platform/enables/tests.rs b/crates/metal2vulkan-validation/src/candidate/platform/enables/tests.rs index 340b84357..2f7c70771 100644 --- a/crates/metal2vulkan-validation/src/candidate/platform/enables/tests.rs +++ b/crates/metal2vulkan-validation/src/candidate/platform/enables/tests.rs @@ -190,7 +190,7 @@ fn a_member_the_vocabulary_does_not_name_carries_its_registry_name() { } } } - assert_eq!(unnamed, 11, "members the vocabulary does not name"); + assert_eq!(unnamed, 10, "members the vocabulary does not name"); // Every one of them is a name some committed capture states: a misspelled name would read as // a device that does not support the member, on every device. let captures: Vec = committed_profiles() @@ -231,14 +231,13 @@ fn no_context_enables_a_member_the_device_does_not_report() { ("restricted", restriction.read_at(version), version), ] { let (supported, available) = modelled(&stem, &description, version); - let mut enables = engine_list( + let enables = engine_list( old_engine_list(&supported, &available), &description, &supported, &available, ) .unwrap_or_else(|error| panic!("{stem} {kind}: {error}")); - enable_generated_commands(&mut enables, &supported, &available); for member in MEMBERS { if member.is_set(&enables.chain) { assert!( @@ -367,8 +366,7 @@ fn the_old_engine_list_is_unchanged() { F::SeparateStencilMaskRef, F::ImageViewFormatSwizzle, F::PointPolygons, - // `maintenance5` was always chained for the generated-commands path; the vocabulary - // names it. + // `maintenance5` is always chained (`old_engine_list`); the vocabulary names it. F::Maintenance5, ]) ); @@ -1575,9 +1573,8 @@ fn chain_lines(enables: &Enables) -> Vec { lines } -/// Every committed profile's context, with the generated-commands extension where the profile -/// lists it: at API 1.2 as a device context queries it, and at the profile's own version as a -/// restricted context opens it. Each is named ` ` and given with its +/// Every committed profile's context: at API 1.2 as a device context queries it, and at the +/// profile's own version as a restricted context opens it. Each is named ` ` and given with its /// [`chain_lines`]. fn opened_chains() -> Vec<(String, Vec)> { use super::super::profiles::ProfileRestriction; @@ -1595,14 +1592,13 @@ fn opened_chains() -> Vec<(String, Vec)> { ]; for (kind, description, version) in contexts { let (supported, available) = modelled(&stem, &description, version); - let mut enables = engine_list( + let enables = engine_list( old_engine_list(&supported, &available), &description, &supported, &available, ) .unwrap_or_else(|error| panic!("{stem} {kind}: {error}")); - enable_generated_commands(&mut enables, &supported, &available); out.push((format!("{stem} {kind}"), chain_lines(&enables))); } } diff --git a/crates/metal2vulkan-validation/src/worker/device.rs b/crates/metal2vulkan-validation/src/worker/device.rs index fe4a73d87..1982fa739 100644 --- a/crates/metal2vulkan-validation/src/worker/device.rs +++ b/crates/metal2vulkan-validation/src/worker/device.rs @@ -21,16 +21,14 @@ //! half reads; the environment (the loader's and the layers' variables, `METAL2VULKAN_*`, //! `HOME`) is inherited. //! 2. The child ([`serve_if_requested`]) sets the wait bound, reads private sources through the -//! parent's source index if it was handed one, restricts its contexts to P and -//! sets its generated-commands setting before it opens any device, turns on the -//! validation layer's echo (`candidate::echo_validation_messages`: each failing message goes -//! to stderr as the layer reports it, at most as many as a row keeps, so a crash still shows -//! them), admits and prepares the case again, requires the parent's input digest, runs it, +//! parent's source index if it was handed one, restricts its contexts to P before it opens +//! any device, turns on the validation layer's echo (`candidate::echo_validation_messages`: +//! each failing message goes to stderr as the layer reports it, at most as many as a row +//! keeps, so a crash still shows them), admits and prepares the case again, requires the parent's input digest, runs it, //! and reports `Result` with its build identity: its product //! fingerprint ([`TRANSLATOR_FINGERPRINT`]) and its validation-crate fingerprint //! ([`VALIDATION_FINGERPRINT`]), since it runs this crate's executor (binding, readback, the -//! comparison class, the census, the environment) as well as the product; and with whether its -//! contexts enabled `VK_EXT_device_generated_commands`. +//! comparison class, the census, the environment) as well as the product. //! 3. The parent waits without a deadline or a memory ceiling: a GPU child is never killed while //! it may have work in flight. The run is therefore bounded only as far as the child bounds //! itself: every device wait (`gpu::wait`) and its compile (its compile worker) are; a driver @@ -38,11 +36,10 @@ //! held the tool before the device moved out. The parent then classifies the exit (`Ended`) //! before it writes anything, so a GPU child's crash writes the tripwire first; only then does //! it relay the child's stderr, ignoring a closed stream. A report is decoded and refused -//! unless the child's build identity and generated-commands setting are the parent's and its -//! census names the parent's restriction; the hang protocol's exit comes back to -//! `execute`, which leaves with the same status once the scratch files are gone, as the -//! in-process wait did; a signal is a [`DeviceCrash`]; any other exit is `Failed`, with the -//! stderr. +//! unless the child's build identity is the parent's and its census names the parent's +//! restriction; the hang protocol's exit comes back to `execute`, which leaves with the same +//! status once the scratch files are gone, as the in-process wait did; a signal is a +//! [`DeviceCrash`]; any other exit is `Failed`, with the stderr. use super::compile::CompileWorker; use super::{bounded, report, MonitoredChild, ProcessControl, Reported}; @@ -91,10 +88,6 @@ pub(crate) struct DeviceInput { /// worker restricts its own to it before it opens a device, and the census of its run must name /// it. pub(crate) restricted_to: Option, - /// Whether the parent's contexts enable `VK_EXT_device_generated_commands` where their device - /// supports it (`--without-generated-commands` clears it): the worker opens its own the same - /// way, and its report must name it. - pub(crate) generated_commands: bool, /// The C3 venue the parent records the run under, if any: the worker holds the device it opens /// to the venue's profile before it runs anything, and its run or refusal must record that /// profile. @@ -179,9 +172,6 @@ struct DeviceOutput { product_fingerprint: String, /// The worker's [`VALIDATION_FINGERPRINT`]: it may run another executor. validation_fingerprint: String, - /// Whether the worker's contexts enable `VK_EXT_device_generated_commands` where their device - /// supports it: a run on the other path than the parent's is not the parent's evidence. - generated_commands: bool, result: Result, /// For a typed refusal after the device opened, that device ([`OpenedDevice`]). refused_on: Option, @@ -343,9 +333,8 @@ fn start( /// The outcome a worker that exited 0 reported in the last line of `stdout_path`, as every /// worker's report is ([`super::report`]: a library in the worker may write a line before it), -/// refused unless the worker is this build and ran under `input`'s generated-commands setting and -/// restriction. A device it names beside a refusal must have run under the same restriction, and -/// only a typed refusal names one. +/// refused unless the worker is this build and ran under `input`'s restriction. A device it names +/// beside a refusal must have run under the same restriction, and only a typed refusal names one. fn reported(stdout_path: &Path, input: &DeviceInput) -> DeviceOutcome { let mut refused_on = None; let result = reported_run(stdout_path, input, &mut refused_on); @@ -376,22 +365,6 @@ fn reported_run( ) .into()); } - if result.generated_commands != input.generated_commands { - let path = |enabled: bool| { - if enabled { - "with VK_EXT_device_generated_commands where supported" - } else { - "without VK_EXT_device_generated_commands" - } - }; - return Err(format!( - "the device worker opened its devices {}, and this tool asked for them {}; its run \ - is not this tool's evidence", - path(result.generated_commands), - path(input.generated_commands) - ) - .into()); - } if let Some(opened) = result.refused_on { if !matches!(result.result, Err(ExecutorError::NotSupported(_))) { return Err( @@ -531,13 +504,11 @@ fn serve() -> Result<(), String> { if let Some(profile) = &input.restricted_to { crate::candidate::restrict_devices_to(profile)?; } - crate::candidate::decide_generated_commands(input.generated_commands)?; crate::candidate::echo_validation_messages(); let DeviceOutcome { result, refused_on } = crate::candidate::engine::run_on_device(&input); report(&DeviceOutput { product_fingerprint: TRANSLATOR_FINGERPRINT.into(), validation_fingerprint: VALIDATION_FINGERPRINT.into(), - generated_commands: crate::candidate::requested_generated_commands(), result, refused_on, }) diff --git a/crates/metal2vulkan-validation/src/worker/device/tests.rs b/crates/metal2vulkan-validation/src/worker/device/tests.rs index af9fe4c88..9cc4779a9 100644 --- a/crates/metal2vulkan-validation/src/worker/device/tests.rs +++ b/crates/metal2vulkan-validation/src/worker/device/tests.rs @@ -17,7 +17,6 @@ fn input(device: DeviceType) -> DeviceInput { input_sha256: "11".repeat(32), wait_timeout_ms: 7_000, restricted_to: None, - generated_commands: true, venue: None, source_index: None, } @@ -141,7 +140,6 @@ fn output(result: Result) -> DeviceOutput { DeviceOutput { product_fingerprint: TRANSLATOR_FINGERPRINT.into(), validation_fingerprint: VALIDATION_FINGERPRINT.into(), - generated_commands: true, result, refused_on: None, } @@ -336,19 +334,12 @@ fn the_input_and_every_typed_result_cross_the_boundary() { input(DeviceType::Cpu), restricted(DeviceType::Cpu, "gate-lavapipe"), restricted(DeviceType::Cpu, "runtime-floor"), - DeviceInput { - generated_commands: false, - ..restricted(DeviceType::Cpu, "gate-lavapipe") - }, ] { let own = run_restricted_to(input.restricted_to.clone()); let results = results.iter().cloned().chain([Ok(own)]); for result in results { let scratch = ScratchDir::new("device-worker-test").unwrap(); - let report = DeviceOutput { - generated_commands: input.generated_commands, - ..output(result.clone()) - }; + let report = output(result.clone()); let worker = reporting(&scratch, &report); let expected = match result { // An unrestricted run is the restricted parent's refusal ([`reported`]). @@ -547,40 +538,6 @@ fn a_crash_names_its_signal() { assert_eq!(crash(99).outcome(), "device_crash{signal99}"); } -/// A worker that opened its devices on the other generated-commands path than its parent asked -/// for ran the other device replay: its run, or its refusal, is not the parent's evidence, and a -/// run without the extension would be stored only under the default. -#[cfg(unix)] -#[test] -fn a_worker_run_on_another_generated_commands_path_is_refused() { - let refused: Result = - Err(NotSupported::NotEnabled(vec!["deviceGeneratedCommands".into()]).into()); - for asked in [true, false] { - let input = DeviceInput { - generated_commands: asked, - ..input(DeviceType::Cpu) - }; - for result in [Ok(run()), refused.clone()] { - let scratch = ScratchDir::new("device-worker-test").unwrap(); - let report = DeviceOutput { - generated_commands: !asked, - ..output(result) - }; - let worker = reporting(&scratch, &report); - match ran(worker, &input, no_tripwire) { - Err(ExecutorError::Failed(error)) => { - assert!( - error.starts_with("the device worker opened its devices"), - "{error}" - ); - assert!(error.contains("not this tool's evidence"), "{error}"); - } - other => panic!("{other:?}"), - } - } - } -} - /// A typed refusal after the device opened crosses the boundary with that device's facts; a device /// named beside anything but a typed refusal, or one opened under another restriction than the /// parent asked for, is not this tool's evidence. diff --git a/crates/metal2vulkan-validation/tests/integration/device_worker.rs b/crates/metal2vulkan-validation/tests/integration/device_worker.rs index 65dfd97cc..ffe2a43e9 100644 --- a/crates/metal2vulkan-validation/tests/integration/device_worker.rs +++ b/crates/metal2vulkan-validation/tests/integration/device_worker.rs @@ -17,11 +17,11 @@ fn serving() -> PathBuf { /// 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`, with `VK_EXT_device_generated_commands` enabled where supported or not (`generated_commands`), -/// claiming a checked-input digest the case does not have. -fn input(restricted_to: Option<&str>, generated_commands: bool) -> String { +/// 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":{},"generated_commands":{generated_commands}}}"#, + 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() ) @@ -46,16 +46,14 @@ fn serve(program: &Path, input: &str) -> Output { } /// 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 and the generated-commands path its parent asked -/// for, before it opens a device: unrestricted, and restricted to a committed profile. +/// 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, generated_commands) in - [(None, true), (Some("gate-lavapipe"), true), (None, false)] - { - let output = serve(&path, &input(restricted_to, generated_commands)); + 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) @@ -69,10 +67,6 @@ fn every_case_running_tool_serves_the_device_worker() { result["validation_fingerprint"], VALIDATION_FINGERPRINT, "{program}" ); - assert_eq!( - result["generated_commands"], generated_commands, - "{program}" - ); let failed = result["result"]["Err"]["Failed"] .as_str() .unwrap_or_else(|| panic!("{program}: {report}")); @@ -90,7 +84,7 @@ fn every_case_running_tool_serves_the_device_worker() { fn a_worker_applies_the_parents_restriction_first() { let path = serving(); let program = path.display(); - let output = serve(&path, &input(Some("no-such-profile"), true)); + 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!(