diff --git a/crates/metal2vulkan/src/ash_interop/query.rs b/crates/metal2vulkan/src/ash_interop/query.rs index aff004511..ce17b7301 100644 --- a/crates/metal2vulkan/src/ash_interop/query.rs +++ b/crates/metal2vulkan/src/ash_interop/query.rs @@ -2,7 +2,7 @@ //! //! The result is what the physical device **supports**. A description must record what the //! consumer **enables** (`device::description`), so the consumer removes every feature and -//! extension it does not enable at `vkCreateDevice` before calling `Device::new`. +//! extension it does not enable at `vkCreateDevice` before calling `Device::from_queries`. //! //! Which structures are chained follows the same exposure rule as the Khronos JSON reader //! (`device::khronos`), at the **effective** API version `min(instance, device)` (the Vulkan @@ -957,12 +957,12 @@ impl DeviceDescription { /// limits and properties the core consumes, and the format properties of exactly /// [`FormatSupport::queries_for`] its version and available extensions. /// - /// The result describes what the device **supports**; remove what the consumer does not - /// enable before `Device::new`. `instance_api_version` is the `VkApplicationInfo::apiVersion` + /// The result describes what the device **supports**; remove what the consumer does not enable + /// before `Device::from_queries`. `instance_api_version` is the `VkApplicationInfo::apiVersion` /// the instance was created with (e.g. `vk::ApiVersion::from_packed(app_info.api_version)`): /// the Vulkan spec limits the device's core functionality to `min(instance, device)` version, - /// so the description's `api_version`, the structures chained, and every feature sourced from - /// a core version follow that minimum, never the device's own version alone. Only the + /// so the description's `api_version`, the structures chained, and every feature sourced from a + /// core version follow that minimum, never the device's own version alone. Only the /// physical-device query entry points are called; nothing is created and no device is opened. /// /// Errors: an effective version below Vulkan 1.2 is `Unsupported{VulkanVersion}` (nothing diff --git a/crates/metal2vulkan/src/device/description.rs b/crates/metal2vulkan/src/device/description.rs index 556d956fd..cc7ff0d40 100644 --- a/crates/metal2vulkan/src/device/description.rs +++ b/crates/metal2vulkan/src/device/description.rs @@ -2,7 +2,7 @@ //! //! A description records what the consumer **enables**, not what the hardware has: output may //! only declare what was enabled at `vkCreateDevice`. It is the only input of -//! `Device::new`; Khronos profile JSON is parsed into a description +//! `Device::from_queries`; Khronos profile JSON is parsed into a description //! ([`DeviceDescription::from_khronos_json`]), never directly into a `DeviceProfile`. //! //! Absence means "not supported": a feature, extension, or format usage the description does not @@ -24,7 +24,7 @@ use crate::vk; #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] pub struct DeviceDescription { /// The device's Vulkan version (`VkPhysicalDeviceProperties::apiVersion`, capped by the - /// instance version the consumer uses). Below 1.2 is refused by `Device::new`. + /// instance version the consumer uses). Below 1.2 is refused by `Device::from_queries`. pub api_version: ApiVersion, /// `VkPhysicalDeviceDriverProperties::driverID`, when known. pub driver_id: Option, diff --git a/crates/metal2vulkan/src/device/enables.rs b/crates/metal2vulkan/src/device/enables.rs index 0c1cb7e94..6cc4c9f49 100644 --- a/crates/metal2vulkan/src/device/enables.rs +++ b/crates/metal2vulkan/src/device/enables.rs @@ -16,8 +16,8 @@ //! //! - [`DeviceDescription::recommended_enables`]: what the core can use on a device described by //! what it supports (`DeviceDescription::query`); the consumer merges it into its own list. -//! - [`DeviceDescription::with_enabled`]: that description restricted to what the consumer -//! enabled, the input of `Device::new` (which checks the exposure invariant and the feature +//! - [`DeviceDescription::with_enabled`]: that description restricted to what the consumer enabled, +//! the input of `Device::from_queries` (which checks the exposure invariant and the feature //! dependencies). //! - [`DeviceDescription::required_enables`]: what a compiled artifact's [`Requirements`] need //! enabled on the device. @@ -845,8 +845,8 @@ impl Device { } } -/// `Device::new`'s check of the description invariants: every listed feature is exposed by the -/// description's version or listed extensions, and every listed feature's [`FEATURE_NEEDS`] +/// `Device::from_queries`'s check of the description invariants: every listed feature is exposed by +/// the description's version or listed extensions, and every listed feature's [`FEATURE_NEEDS`] /// companion is listed. The rule of [`BUFFER_UPDATE_AFTER_BIND_VUID`] is not checked here: a /// committed profile read whole lists both sides of it on three profiles, and the profile the core /// derives from such a description translates exactly as from its creatable restriction. diff --git a/crates/metal2vulkan/src/device/tests/enables.rs b/crates/metal2vulkan/src/device/tests/enables.rs index f072dcf18..04b8be0d5 100644 --- a/crates/metal2vulkan/src/device/tests/enables.rs +++ b/crates/metal2vulkan/src/device/tests/enables.rs @@ -1,5 +1,5 @@ //! Enable sets: `recommended_enables`, `with_enabled`, `required_enables`, and the exposure -//! invariant `Device::new` checks. +//! invariant `Device::from_queries` checks. use std::collections::BTreeSet; @@ -45,11 +45,11 @@ fn floor_with(extensions: &[VkExtension], features: &[VkFeature]) -> DeviceDescr d } -/// On every committed profile the recommendation lists only what the description lists, is -/// closed (`with_enabled` accepts it, `Device::new` accepts the result), and is a fixed point: -/// the device made from it needs exactly it, as does the device made from the full description. -/// It leaves out exactly the buffer update-after-bind features of the three profiles that list -/// them with `robustBufferAccess` and without `robustBufferAccessUpdateAfterBind`. +/// On every committed profile the recommendation lists only what the description lists, is closed +/// (`with_enabled` accepts it, `Device::from_queries` accepts the result), and is a fixed point: +/// the device made from it needs exactly it, as does the device made from the full description. It +/// leaves out exactly the buffer update-after-bind features of the three profiles that list them +/// with `robustBufferAccess` and without `robustBufferAccessUpdateAfterBind`. #[test] fn recommendations_are_closed_fixed_points_on_every_committed_profile() { let mut left_out = Vec::new(); @@ -473,9 +473,9 @@ fn with_enabled_refuses_sets_breaking_a_co_enable_rule() { } } -/// `Device::new` refuses a description listing a feature without its companion; every committed -/// profile lists both or neither. No companion needs one itself, which the one-pass recommendation -/// relies on. +/// `Device::from_queries` refuses a description listing a feature without its companion; every +/// committed profile lists both or neither. No companion needs one itself, which the one-pass +/// recommendation relies on. #[test] fn device_new_refuses_a_feature_without_its_companion() { for &(f, needs, vuid) in FEATURE_NEEDS { @@ -717,7 +717,7 @@ fn required_enables_follow_version_dependencies_formats_and_flags() { ); } -/// `Device::new` refuses a description listing a feature it does not expose. +/// `Device::from_queries` refuses a description listing a feature it does not expose. #[test] fn device_new_refuses_unexposed_features() { let mut d = profile("vk12-floor"); diff --git a/crates/metal2vulkan/src/device/tests/profile.rs b/crates/metal2vulkan/src/device/tests/profile.rs index dfa791c60..24f0ea10d 100644 --- a/crates/metal2vulkan/src/device/tests/profile.rs +++ b/crates/metal2vulkan/src/device/tests/profile.rs @@ -1,4 +1,4 @@ -//! `Device::new`, profile derivation, the fingerprint, and `requirements ⊆ profile`. +//! `Device::from_queries`, profile derivation, the fingerprint, and `requirements ⊆ profile`. use super::*; use crate::device::profile::{ diff --git a/crates/metal2vulkan/src/error/mod.rs b/crates/metal2vulkan/src/error/mod.rs index a11fdb666..5dd029391 100644 --- a/crates/metal2vulkan/src/error/mod.rs +++ b/crates/metal2vulkan/src/error/mod.rs @@ -1,7 +1,7 @@ //! Errors: every way compiling or binding can fail, as typed values to match on. //! -//! Compiling returns [`Error`]: `Device::new`, `Library::parse`, every `Device::compile_*` call, -//! `Device::render_pipeline_key`, and the [`metal`](crate::metal) mappings. Planning and +//! Compiling returns [`Error`]: `Device::from_queries`, `Library::parse`, every `Device::compile_*` +//! call, `Device::render_pipeline_key`, and the [`metal`](crate::metal) mappings. Planning and //! instantiating a binding returns [`BindError`]. Decoding cached bytes returns //! [`ArtifactError`](crate::cache::ArtifactError), which is always a cache miss. Match variants, //! not messages: `Display` is for logs. diff --git a/crates/metal2vulkan/src/lower/dispatch.rs b/crates/metal2vulkan/src/lower/dispatch.rs index f299dc3fe..e382a3f07 100644 --- a/crates/metal2vulkan/src/lower/dispatch.rs +++ b/crates/metal2vulkan/src/lower/dispatch.rs @@ -139,8 +139,8 @@ //! `MultiRegion` 0 it runs at its pipeline's size, its position `(base + WorkgroupId) · (sx, sy, //! sz)` plus its position in the workgroup: an indirect dispatch, whose region's grid 0 wraps to //! `u32::MAX`, so every invocation is live, or a direct one in workgroups of a size its runtime -//! picks, whose invocations past the grid return before the body as a tile's do. `Device::new`'s -//! profile answers Metal's partial threadgroup as above. +//! picks, whose invocations past the grid return before the body as a tile's do. Every profile +//! (`Device::from_queries`) answers Metal's partial threadgroup as above. //! //! **Flat grids**. A flat variant (`LoweringInputs::flat_grid`, of a device replay or not) of a //! kernel that does not observe its threadgroup partition runs any grid in threadgroups of its own diff --git a/crates/metal2vulkan/src/metal/format/mod.rs b/crates/metal2vulkan/src/metal/format/mod.rs index 3b865acae..d4898ef7d 100644 --- a/crates/metal2vulkan/src/metal/format/mod.rs +++ b/crates/metal2vulkan/src/metal/format/mod.rs @@ -12,10 +12,10 @@ //! bits 0–4); Vulkan packed formats are named from the most significant bit. The table below pairs //! them by layout (`B5G6R5Unorm` ↔ `R5G6B5_UNORM_PACK16`). //! -//! A candidate whose Vulkan format enum value a core version or an extension defines -//! (`A8_UNORM`, the ASTC HDR and PVRTC blocks) is usable only where the profile exposes the value -//! ([`vk::Format::exposure`]): `Device::new` keeps only exposed formats in the profile's tables, -//! and a refusal names the version or extension that would expose it. +//! A candidate whose Vulkan format enum value a core version or an extension defines (`A8_UNORM`, +//! the ASTC HDR and PVRTC blocks) is usable only where the profile exposes the value +//! ([`vk::Format::exposure`]): `Device::from_queries` keeps only exposed formats in the profile's +//! tables, and a refusal names the version or extension that would expose it. use std::collections::BTreeSet; use std::sync::OnceLock; diff --git a/crates/metal2vulkan/src/pipeline/artifact.rs b/crates/metal2vulkan/src/pipeline/artifact.rs index f38fec92e..680a54b04 100644 --- a/crates/metal2vulkan/src/pipeline/artifact.rs +++ b/crates/metal2vulkan/src/pipeline/artifact.rs @@ -1515,14 +1515,8 @@ pub enum PrecisionNote { /// on NVIDIA) for a 32-bit float one (at 0bcc0163e5: an RTX 3090 and an /// RTX 5080 Laptop GPU on NVIDIA's 615.71.09, a Radeon 780M on RADV, an Iris Xe of RPL-P on /// ANV and lavapipe, Mesa 26.2.4, the 14 blends Metal measured over the two sweeps, each handed - /// the output widened to `float`; RADV and ANV, which enable `storageInputOutput16`, receive - /// it as a 16-bit `half` under `Device::new`, `StageIo::half_outputs`, which is not measured - /// there, and widened under `Device::from_queries`); and 1 or 2 - /// codes of an 8-bit or extended-range format. MoltenVK 1.4.2 on the M3 Max (macOS 27.0.1), - /// which receives the 16-bit `half`, stores the value of Metal's measured rule in every channel - /// of every measured blend draw of the sweep into `R16Float`, `RG16Float` and `RGBA16Float` - /// (28 of 28 each), and into `R32Float`, `RG32Float` and - /// `RGBA32Float` 28, 28 and 26 of 28, the two off at one channel by a zero's sign. + /// the output widened to `float`, as every device receives it); and 1 or 2 codes of an 8-bit or + /// extended-range format. /// /// Also: a `float` color output (a scalar or vector of AIR's `float`) of a module compiled /// without fast math to a 16-bit float attachment that blends by one and zero, added, for @@ -1730,12 +1724,7 @@ pub enum PrecisionNote { /// two units in the last place of a `float` there into a 32-bit float one (MoltenVK on the M3 /// Max, handed the output widened to `float`, against plain Metal over every blended draw of /// the sweep; the device's `float` blend modelled on the same draws, three units). A consumer - /// may relay it as a known difference. Where the device enables `storageInputOutput16` the - /// output reaches it under `Device::new` as a 16-bit `half` (`StageIo::half_outputs`; under - /// `Device::from_queries` it is widened to `float` on every device): MoltenVK 1.4.2 on the M3 - /// Max (macOS 27.0.1) then stores Metal's codes at every word of every blend of the - /// conformance family `half-output-blends-*` (a loaded `half4`, 21 blends into each 16- and - /// 32-bit float format); a computed output is not measured there. + /// may relay it as a known difference. The output reaches every device widened to `float`. /// /// A fragment function that fetches a blended `R16Float`, `RG16Float` or `RGBA16Float` /// attachment in the interlocked storage form computes the blend itself, no Vulkan blend diff --git a/crates/metal2vulkan/src/pipeline/stage_io.rs b/crates/metal2vulkan/src/pipeline/stage_io.rs index 8fb73d2a9..ce3be41ab 100644 --- a/crates/metal2vulkan/src/pipeline/stage_io.rs +++ b/crates/metal2vulkan/src/pipeline/stage_io.rs @@ -49,10 +49,8 @@ //! namespace tag, so no AIR user key can collide with another role's key. Keys stay opaque to //! link; it reads the role here, never the bytes. //! -//! Every interface variable is 32-bit (narrow varyings are widened at the interface, so no varying -//! needs `storageInputOutput16`), but a `half` color output on a device that enables -//! `storageInputOutput16` under `Device::new` ([`StageIo::half_outputs`]; never under -//! `Device::from_queries`), declared with 16-bit `float` lanes; +//! Every interface variable is 32-bit (narrow varyings and `half` color outputs are widened at the +//! interface, so none needs `storageInputOutput16`); //! [`IoType::source_bits`] keeps the AIR element width for format checks. An attribute or color //! takes one whole location; a user varying takes one location at //! component 0 unless link packs varyings into shared locations, for which the module decorates @@ -382,12 +380,9 @@ pub struct StageIo { #[cfg_attr(feature = "serde", serde(default))] pub half_fast_colors: Vec, /// The color outputs declared with 16-bit `float` lanes, in the order of the entry's outputs: - /// each `half` color output (a scalar or vector of AIR's `half`) through a variable of its own - /// type on a device that enables `storageInputOutput16` and `shaderFloat16` under - /// `Device::new` (never under `Device::from_queries`), but to an - /// attachment held with its channels rotated, so the device receives the `half` as Metal's - /// attachment does. Every other user variable is declared 32-bit (a narrower value widened). - /// Empty for every other function. + /// none, as every device receives a `half` color output widened to `float` (the stage plan + /// declares no output 16-bit). Every user variable is declared 32-bit (a narrower value + /// widened). #[cfg_attr(feature = "serde", serde(default))] pub half_outputs: Vec, /// The index builtins, `Layer` and `ViewportIndex`, a fragment function reads as 0 on a device diff --git a/crates/metal2vulkan/src/repro.rs b/crates/metal2vulkan/src/repro.rs index d17386b98..7ed9d8764 100644 --- a/crates/metal2vulkan/src/repro.rs +++ b/crates/metal2vulkan/src/repro.rs @@ -34,7 +34,7 @@ use crate::pipeline::{ /// The device a runtime bundle's command compiles for, as `device.json` holds it and the command /// line's `--device` reads it: the description and policy the runtime's compile device was built -/// from, which build the same `Device` (`Device::new`). +/// from, which build the same `Device` (`Device::from_queries`). #[non_exhaustive] #[derive(Clone, Debug, PartialEq, Eq, serde::Serialize, serde::Deserialize)] pub struct ReproDevice { diff --git a/crates/metal2vulkan/src/spirv/requirements/mod.rs b/crates/metal2vulkan/src/spirv/requirements/mod.rs index d2a7db2c6..de62e9385 100644 --- a/crates/metal2vulkan/src/spirv/requirements/mod.rs +++ b/crates/metal2vulkan/src/spirv/requirements/mod.rs @@ -11,17 +11,17 @@ //! //! Conventions: //! -//! - **Features imply their exposure; extensions are what every device needs.** A requirement -//! lists the gating *feature* (e.g. `shaderDemoteToHelperInvocation`, which exists through -//! `VK_EXT_shader_demote_to_helper_invocation` or Vulkan 1.3), and `extensions` lists exactly -//! the device extensions the module needs on **every** device: the extension of each required -//! feature that no core version exposes (`VkFeature::exposure`; e.g. -//! `VK_EXT_fragment_shader_interlock`, `VK_KHR_maintenance8`), added in one closing step, and -//! the extension of a declaration the registry gates by exposure alone with no feature and no -//! core version (`VK_EXT_shader_stencil_export`). An extension a core version promoted +//! - **Features imply their exposure; extensions are what every device needs.** A requirement lists +//! the gating *feature* (e.g. `shaderDemoteToHelperInvocation`, which exists through +//! `VK_EXT_shader_demote_to_helper_invocation` or Vulkan 1.3), and `extensions` lists exactly the +//! device extensions the module needs on **every** device: the extension of each required feature +//! that no core version exposes (`VkFeature::exposure`; e.g. `VK_EXT_fragment_shader_interlock`, +//! `VK_KHR_maintenance8`), added in one closing step, and the extension of a declaration the +//! registry gates by exposure alone with no feature and no core version +//! (`VK_EXT_shader_stencil_export`). An extension a core version promoted //! (`VK_KHR_shader_terminate_invocation`) depends on the device's version, so it is not listed: -//! the description lists the feature only where it is exposed (`Device::new` checks it), and -//! `DeviceDescription::required_enables` names the extension below that version. +//! the description lists the feature only where it is exposed (`Device::from_queries` checks it), +//! and `DeviceDescription::required_enables` names the extension below that version. //! - **A capability with a version or an extension beside its feature is enabled on the device.** //! `StorageImageReadWithoutFormat` and `StorageImageWriteWithoutFormat` are enabled by //! `shaderStorageImage{Read,Write}WithoutFormat`, by Vulkan 1.3, or by diff --git a/crates/metal2vulkan/src/tests/engine_workgroup_layout.rs b/crates/metal2vulkan/src/tests/engine_workgroup_layout.rs index 442fc6c63..f23df0102 100644 --- a/crates/metal2vulkan/src/tests/engine_workgroup_layout.rs +++ b/crates/metal2vulkan/src/tests/engine_workgroup_layout.rs @@ -8,8 +8,8 @@ //! Each fixture of `validation/fixtures/public/` and its `engine/` directory whose text reaches //! threadgroup memory, a SIMD-group or quad function, or a mesh or object stage (`addrspace(3)`, //! `@air.simd_`, `@air.quad_`, `air.mesh`, `air.object`) is compiled, every entry its ABI declares, -//! on every committed profile under `Device::new`'s default policy and under -//! `Device::from_queries` with the identity domains (the runtime's), and each module compiled +//! on every committed profile under the default policy and under the identity domains (the +//! runtime's), each from `Device::from_queries`, and each module compiled //! is read: it declares none of the three capabilities, its requirements name neither the //! extension (Vulkan's or SPIR-V's) nor its features, and each part compiles modules that //! declare `Workgroup` variables. Each part counts the modules whose threadgroup arena is sized at diff --git a/crates/metal2vulkan/src/tests/golden_hashes.rs b/crates/metal2vulkan/src/tests/golden_hashes.rs index 611dcc7e1..0cee7b23e 100644 --- a/crates/metal2vulkan/src/tests/golden_hashes.rs +++ b/crates/metal2vulkan/src/tests/golden_hashes.rs @@ -915,8 +915,8 @@ fn diff(committed: &Table, observed: &Observed) -> Diff { d } -/// The stale cells by kind, in the words the matrix reads (scripts/matrix/results.py): a cell -/// under a changed profile fingerprint is one whose device, built by `Device::new`, changed. +/// The stale cells by kind, in the words the matrix reads (scripts/matrix/results.py): a cell under +/// a changed profile fingerprint is one whose device, built by `Device::from_queries`, changed. fn stale_counts(stale: &[String]) -> String { let count = |kind: &str| stale.iter().filter(|l| l.starts_with(kind)).count(); format!( diff --git a/docs/VALIDATION.md b/docs/VALIDATION.md index 8242cc5f6..c8da5a022 100644 --- a/docs/VALIDATION.md +++ b/docs/VALIDATION.md @@ -298,8 +298,8 @@ recorded as `time harness-gpu-/` where the row has one; it is park judged. `run` and `show` print, under each leg's line, every harness row's time, its GPU time and, where the leg counted them, its instructions per run (with the runtime's own). -The old runtime's translations do not move. The golden hash table compiles through -`Device::new`, the old runtime's path. When its test reports a cell that changed under an unchanged +The golden hash table's translations do not move. The table compiles through +`Device::from_queries`. When its test reports a cell that changed under an unchanged key, or one under a changed profile fingerprint, the leg fails with `OLD PATH MOVED`. The one exception is a range where a commit since the table's last bless has a subject that starts with `old-runtime regression fix`. New, gone and re-keyed fixture rows only need a bless.