diff --git a/crates/metal2vulkan/src/cache/artifacts.rs b/crates/metal2vulkan/src/cache/artifacts.rs index 56d8bfa6a..542a410e4 100644 --- a/crates/metal2vulkan/src/cache/artifacts.rs +++ b/crates/metal2vulkan/src/cache/artifacts.rs @@ -143,7 +143,7 @@ impl RenderPipeline { /// The pipeline's content digest: [`ComputePipeline::content_digest`]'s definition over a /// render pipeline. It covers every field but `key` and `profile`: each stage's module, the /// layout, the vertex input, the fixed-function state, the runtime dependencies, the interface, - /// the requirements, the variant bits and a mesh pipeline's answers. It is equal across builds whose pipelines for an + /// the requirements and the variant bits. It is equal across builds whose pipelines for an /// input say the same thing, changes whenever covered content changes, and authenticates /// nothing, as the compute pipeline's. pub fn content_digest(&self) -> Hash256 { @@ -158,7 +158,6 @@ impl RenderPipeline { interface, requirements, variant_bits, - mesh_info, } = self; Node::fields(&mut [ ("stages", stages.digest()), @@ -169,7 +168,6 @@ impl RenderPipeline { ("interface", interface.digest()), ("requirements", requirements.digest()), ("variant_bits", variant_bits.digest()), - ("mesh_info", mesh_info.digest()), ]) .root("render pipeline") } diff --git a/crates/metal2vulkan/src/cache/codec.rs b/crates/metal2vulkan/src/cache/codec.rs index 470537207..e7a0e8d0f 100644 --- a/crates/metal2vulkan/src/cache/codec.rs +++ b/crates/metal2vulkan/src/cache/codec.rs @@ -33,9 +33,9 @@ use crate::metal; use crate::metal::format::{ExtendedRange, WordAttachment, WordField}; use crate::metal::{CompareFunction, TextureWriteRoundingMode}; use crate::pipeline::artifact::{ - ComputePipeline, ComputePipelineMetalInfo, MeshPipelineMetalInfo, ModuleStats, PrecisionNote, - Reconvergence, RenderPipeline, RuntimeDependency, SpecClause, SpecConstant, SpecTest, - SpecializationLayout, SpecializedNote, StageModule, StrategyCensus, StrategyUse, + ComputePipeline, ComputePipelineMetalInfo, ModuleStats, PrecisionNote, Reconvergence, + RenderPipeline, RuntimeDependency, SpecClause, SpecConstant, SpecTest, SpecializationLayout, + SpecializedNote, StageModule, StrategyCensus, StrategyUse, }; use crate::pipeline::descriptor::TessellationDescriptor; use crate::pipeline::facts::{Mechanism, RuntimeFact, UniformViewChoice}; @@ -1368,12 +1368,7 @@ codec_struct! { } RenderPipeline { key, profile, stages, layout, vertex_input, graphics, dependencies, interface, - requirements, variant_bits, mesh_info, - } - MeshPipelineMetalInfo { - max_total_threads_per_object_threadgroup, max_total_threads_per_mesh_threadgroup, - object_thread_execution_width, mesh_thread_execution_width, - max_total_threadgroups_per_mesh_grid, + requirements, variant_bits, } StageModule { stage, entry_point, spirv, specialization, required_subgroup_size, stage_flags, diff --git a/crates/metal2vulkan/src/cache/mod.rs b/crates/metal2vulkan/src/cache/mod.rs index 1430cef06..370ce262e 100644 --- a/crates/metal2vulkan/src/cache/mod.rs +++ b/crates/metal2vulkan/src/cache/mod.rs @@ -71,7 +71,7 @@ pub const SEMANTICS_VERSION: u32 = 2223; /// re-typed in an encoded type, its `codec` body or its `envelope`. A variant removed while its tag /// stays unused needs no bump: an entry holding it fails to decode, which is a miss. The commit that /// bumps it says what changed; this comment keeps no history. -pub const ARTIFACT_FORMAT_VERSION: u32 = 566; +pub const ARTIFACT_FORMAT_VERSION: u32 = 567; /// The version of what this crate's runtime does with a compiled pipeline: instantiating a binding /// plan (`BindingPlan::instantiate_*`: descriptor ranges, push bytes, root, argument, and handle diff --git a/crates/metal2vulkan/src/error/mod.rs b/crates/metal2vulkan/src/error/mod.rs index dad318777..ba6d22582 100644 --- a/crates/metal2vulkan/src/error/mod.rs +++ b/crates/metal2vulkan/src/error/mod.rs @@ -1831,9 +1831,7 @@ pub enum ComputePipelineProblem { /// refuses, measured on an M3 Max under macOS 27.0.1 (`mesh_pipeline_limits.m`, plain and with /// `MTL_DEBUG_LAYER=1`, which agree). Metal's creation fails over some, an error, and its /// descriptor validation ends the process at the rest, with or without API validation; each -/// variant says which. The thread limit is Metal's 1024, not a lower one of this device's (the -/// compiled pipeline's [`MeshPipelineMetalInfo`](crate::pipeline::MeshPipelineMetalInfo) -/// answers that one). +/// variant says which. The thread limit is Metal's 1024, not a lower one of this device's. #[non_exhaustive] #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] pub enum MeshPipelineProblem { diff --git a/crates/metal2vulkan/src/library/compiled.rs b/crates/metal2vulkan/src/library/compiled.rs index 35090a90e..3dfa214be 100644 --- a/crates/metal2vulkan/src/library/compiled.rs +++ b/crates/metal2vulkan/src/library/compiled.rs @@ -343,9 +343,9 @@ pub struct FunctionArtifact { pub specialized: Vec, } -/// What a kernel's `ComputePipelineMetalInfo`, and an object or mesh function's -/// `MeshPipelineMetalInfo`, need from its compile. A vertex or fragment function has the default: -/// no attribute, not flattened, no threadgroup memory. +/// What a kernel's `ComputePipelineMetalInfo`, and an object or mesh function's checks against its +/// mesh descriptor, need from its compile. A vertex or fragment function has the default: no +/// attribute, not flattened, no threadgroup memory. #[non_exhaustive] #[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)] pub struct KernelFacts { diff --git a/crates/metal2vulkan/src/pipeline/artifact.rs b/crates/metal2vulkan/src/pipeline/artifact.rs index 3d262386b..de2457cd8 100644 --- a/crates/metal2vulkan/src/pipeline/artifact.rs +++ b/crates/metal2vulkan/src/pipeline/artifact.rs @@ -42,9 +42,6 @@ pub struct RenderPipeline { pub requirements: Requirements, /// Specialization and variant bits the pipeline can take. pub variant_bits: u32, - /// A mesh render pipeline's answers to Metal's mesh queries (`Device::compile_mesh_pipeline`); - /// `None` for a render pipeline of a vertex function. - pub mesh_info: Option, } impl RenderPipeline { @@ -480,37 +477,6 @@ impl RuntimeDependency { } } -/// Answers to Metal's queries of a mesh render pipeline's state (`MTLRenderPipelineState`'s -/// mesh properties), as an M3 Max under macOS 27.0.1 answers them on a first compile of the -/// functions (`mesh_pipeline_limits.m`). Each thread limit is Metal's: the least of the -/// descriptor's maximum, the stage function's own `[[max_total_threads_per_threadgroup(n)]]`, -/// the threads of the stage's required threadgroup size and 1024 (Metal refuses a descriptor -/// maximum other than the function's or the required size's threads, and any of them above -/// 1024, [`MeshPipelineProblem`](crate::error::MeshPipelineProblem)), held to this device's -/// limit for the stage where that is lower: `maxTaskWorkGroupInvocations` and -/// `maxMeshWorkGroupInvocations`. -#[non_exhaustive] -#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)] -#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -pub struct MeshPipelineMetalInfo { - /// `maxTotalThreadsPerObjectThreadgroup`: the object stage's thread limit (above); 0 for a - /// pipeline without an object function, where the M3 Max answers 3 (docs/API.md, accepted - /// differences). - pub max_total_threads_per_object_threadgroup: u32, - /// `maxTotalThreadsPerMeshThreadgroup`: the mesh stage's thread limit (above). - pub max_total_threads_per_mesh_threadgroup: u32, - /// `objectThreadExecutionWidth`: 32, the width of the simdgroups an object function runs - /// in, as a kernel's (`MetalDeviceProperties::thread_execution_width`); 0 for a pipeline - /// without an object function, where the M3 Max answers 32. - pub object_thread_execution_width: u32, - /// `meshThreadExecutionWidth`: 32, as [`object_thread_execution_width`](Self::object_thread_execution_width). - pub mesh_thread_execution_width: u32, - /// `maxTotalThreadgroupsPerMeshGrid`: the descriptor's maximum, else Metal's 2^20 (an object - /// function's `[[max_total_threadgroups_per_mesh_grid(n)]]` changes neither), held to the - /// device's `maxMeshWorkGroupTotalCount` where that is lower. - pub max_total_threadgroups_per_mesh_grid: u32, -} - /// Answers to Metal's per-pipeline compute queries. #[non_exhaustive] #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] diff --git a/crates/metal2vulkan/src/pipeline/compile/api.rs b/crates/metal2vulkan/src/pipeline/compile/api.rs index 9133a1a3c..9841688fc 100644 --- a/crates/metal2vulkan/src/pipeline/compile/api.rs +++ b/crates/metal2vulkan/src/pipeline/compile/api.rs @@ -34,8 +34,8 @@ use crate::library::{CompiledFunction, FunctionArtifact, FunctionCompileKey}; use crate::lower::select::LowerInputs; use crate::lower::simd::workgroup::arena_bytes; use crate::pipeline::artifact::{ - ComputePipeline, ComputePipelineMetalInfo, MeshPipelineMetalInfo, PrecisionNote, - RenderPipeline, RuntimeDependency, StageModule, + ComputePipeline, ComputePipelineMetalInfo, PrecisionNote, RenderPipeline, RuntimeDependency, + StageModule, }; use crate::pipeline::compile::key::{ function_key, mesh_descriptor_key, pipeline_key, queried_render_descriptor_key, @@ -673,7 +673,6 @@ impl Device { let dependencies = dependencies(&artifacts, self); let (graphics, requirements) = graphics_requirements(requirements, &linked, &artifacts, p)?; let profile = self.profile_fingerprint(); - let mesh_info = self.mesh_info(d, object.as_ref(), &mesh); Ok(RenderPipeline { key: pipeline_key( b"mesh", @@ -690,69 +689,9 @@ impl Device { interface: linked.interface, requirements, variant_bits: artifacts.iter().fold(0, |bits, a| bits | a.variant_bits), - mesh_info: Some(mesh_info), }) } - /// Answers to Metal's queries of the mesh render pipeline of descriptor `d`, of object function - /// `object` (where it has one) and mesh function `mesh` ([`MeshPipelineMetalInfo`]). - fn mesh_info( - &self, - d: &MeshPipelineDescriptor, - object: Option<&CompiledFunction>, - mesh: &CompiledFunction, - ) -> MeshPipelineMetalInfo { - let p = self.profile(); - let limits = &p.fields().limits; - // Each stage's threadgroups run in the task and mesh stages. - let (object_limit, mesh_limit) = ( - limits.mesh.max_task_work_group_invocations, - limits.mesh.max_mesh_work_group_invocations, - ); - // Metal's on a first compile: the least of 1024, the function's own maximum, the - // descriptor's (Metal's 0 is none) and the threads of the stage's required size (Metal's - // all-zero size is none), within the device's. - let threads = - |f: &CompiledFunction, given: Option, required: Option<[u32; 3]>, device: u32| { - let required = required_size(required).map(|axes| { - let threads: u64 = axes.iter().map(|&axis| u64::from(axis)).product(); - u32::try_from(threads).unwrap_or(u32::MAX) - }); - [f.artifact().kernel.max_total_threads, given, required] - .into_iter() - .flatten() - .filter(|&n| n > 0) - .fold(METAL_MAX_THREADS.min(device), u32::min) - }; - let width = self.metal_properties().thread_execution_width; - // The descriptor's, else Metal's: an object function's - // `[[max_total_threadgroups_per_mesh_grid(n)]]` changes nothing Metal answers. - let grid = d - .max_total_threadgroups_per_mesh_grid - .filter(|&n| n > 0) - .unwrap_or(METAL_MESH_GRID_THREADGROUPS); - let grid = grid.min(limits.mesh.max_mesh_work_group_total_count); - MeshPipelineMetalInfo { - max_total_threads_per_object_threadgroup: object.map_or(0, |o| { - threads( - o, - d.max_total_threads_per_object_threadgroup, - d.required_threads_per_object_threadgroup, - object_limit, - ) - }), - max_total_threads_per_mesh_threadgroup: threads( - mesh, - d.max_total_threads_per_mesh_threadgroup, - d.required_threads_per_mesh_threadgroup, - mesh_limit, - ), - object_thread_execution_width: object.map_or(0, |_| width), - mesh_thread_execution_width: width, - max_total_threadgroups_per_mesh_grid: grid, - } - } - /// A stage from its source: compiled now under `inputs`, or taken as compiled (link and /// relocate only) when it was compiled for this device's profile. /// [`Device::stage`] of a render pipeline's fragment stage `src`, reading a `Function` @@ -1109,7 +1048,6 @@ impl Device { interface: linked.interface, requirements, variant_bits: artifacts.iter().fold(0, |bits, a| bits | a.variant_bits), - mesh_info: None, }) } @@ -1463,11 +1401,6 @@ const TILE_MAX_THREADS: u32 = TILE_MAX_SIDE * TILE_MAX_SIDE; /// Apple's GPUs' threads a threadgroup (a threadgroup of 2048 ran nothing on an M4). const METAL_MAX_THREADS: u32 = 1024; -/// `maxTotalThreadgroupsPerMeshGrid` of a mesh render pipeline whose descriptor sets none, as an -/// M3 Max under macOS 27.0.1 answers it, whatever its object function's -/// `[[max_total_threadgroups_per_mesh_grid(n)]]`. -const METAL_MESH_GRID_THREADGROUPS: u32 = 1 << 20; - /// The most bytes of a mesh render pipeline's `payloadMemoryLength` Metal makes a pipeline of (an /// M3 Max under macOS 27.0.1). const METAL_MAX_PAYLOAD: u32 = 16384; @@ -1917,8 +1850,8 @@ fn primitive_varyings_written(a: &FunctionArtifact) -> std::collections::BTreeSe .collect() } -/// The mesh descriptor fields the artifact depends on: its fixed-function state, as a render -/// pipeline's ([`render_fields`]), and the limits its `mesh_info` answers within. +/// The mesh descriptor fields the artifact's key holds: its fixed-function state, as a render +/// pipeline's ([`render_fields`]), and its thread and grid maxima. fn mesh_fields(d: &MeshPipelineDescriptor) -> String { format!( "{:?} {:?} {:?} {:?}", diff --git a/crates/metal2vulkan/src/pipeline/descriptor.rs b/crates/metal2vulkan/src/pipeline/descriptor.rs index 3d783bd52..9266a3252 100644 --- a/crates/metal2vulkan/src/pipeline/descriptor.rs +++ b/crates/metal2vulkan/src/pipeline/descriptor.rs @@ -740,29 +740,17 @@ pub struct MeshPipelineDescriptor { /// `float` outputs to half-float color attachments round by it. pub texture_write_rounding_mode: metal::TextureWriteRoundingMode, /// `maxTotalThreadsPerObjectThreadgroup`: `None` for Metal's 0, the object function's - /// `[[max_total_threads_per_threadgroup(n)]]` or else Metal's 1024. The compiled pipeline's - /// [`MeshPipelineMetalInfo::max_total_threads_per_object_threadgroup`] answers it within the - /// device's limit. Refused as Metal refuses it - /// ([`MeshPipelineProblem`](crate::error::MeshPipelineProblem)): above 1024, or beside a + /// `[[max_total_threads_per_threadgroup(n)]]` or else Metal's 1024. Refused as Metal refuses + /// it ([`MeshPipelineProblem`](crate::error::MeshPipelineProblem)): above 1024, or beside a /// function's maximum of other threads. A draw is not held to it. - /// - /// [`MeshPipelineMetalInfo::max_total_threads_per_object_threadgroup`]: crate::pipeline::MeshPipelineMetalInfo::max_total_threads_per_object_threadgroup pub max_total_threads_per_object_threadgroup: Option, /// `maxTotalThreadsPerMeshThreadgroup`: as /// [`max_total_threads_per_object_threadgroup`](Self::max_total_threads_per_object_threadgroup), - /// of the mesh stage, answered as - /// [`MeshPipelineMetalInfo::max_total_threads_per_mesh_threadgroup`]; also refused beside a - /// required mesh threadgroup size of other threads. - /// - /// [`MeshPipelineMetalInfo::max_total_threads_per_mesh_threadgroup`]: crate::pipeline::MeshPipelineMetalInfo::max_total_threads_per_mesh_threadgroup + /// of the mesh stage; also refused beside a required mesh threadgroup size of other threads. pub max_total_threads_per_mesh_threadgroup: Option, - /// `maxTotalThreadgroupsPerMeshGrid`: `None` for Metal's 0, which answers 2^20 whatever the - /// object function's `[[max_total_threadgroups_per_mesh_grid(n)]]`. The compiled pipeline's - /// [`MeshPipelineMetalInfo::max_total_threadgroups_per_mesh_grid`] answers it, within the - /// device's limit where it runs mesh functions natively; Metal takes any count, above the - /// object function's attribute too. An object function's grid is not held to it. - /// - /// [`MeshPipelineMetalInfo::max_total_threadgroups_per_mesh_grid`]: crate::pipeline::MeshPipelineMetalInfo::max_total_threadgroups_per_mesh_grid + /// `maxTotalThreadgroupsPerMeshGrid`: `None` for Metal's 0. Metal takes any count, above the + /// object function's `[[max_total_threadgroups_per_mesh_grid(n)]]` too. An object function's + /// grid is not held to it. pub max_total_threadgroups_per_mesh_grid: Option, /// `objectThreadgroupSizeIsMultipleOfThreadExecutionWidth`: a promise to Metal's optimizer /// that each draw's object threadgroup is a multiple of 32 threads. No compiled module diff --git a/crates/metal2vulkan/src/pipeline/mod.rs b/crates/metal2vulkan/src/pipeline/mod.rs index a248be621..bcdf46762 100644 --- a/crates/metal2vulkan/src/pipeline/mod.rs +++ b/crates/metal2vulkan/src/pipeline/mod.rs @@ -19,8 +19,7 @@ //! - one [`PipelineLayout`]: dense descriptor set layouts and push-constant ranges, to create as //! they are (no renumbering); //! - a render pipeline's [`VertexInputState`] and [`GraphicsState`] (with a -//! [`TessellationState`] when it tessellates, and a mesh render pipeline's answers to Metal's -//! mesh queries, [`MeshPipelineMetalInfo`]), or a compute pipeline's answers to Metal's +//! [`TessellationState`] when it tessellates), or a compute pipeline's answers to Metal's //! per-pipeline queries ([`ComputePipelineMetalInfo`]); //! - the [`PipelineInterface`]: every statically used Metal argument slot ([`SlotRef`]), how the //! shader accesses it, and each buffer's proven byte window; @@ -105,9 +104,9 @@ pub(crate) mod tile_map; pub(crate) mod vertex; pub use artifact::{ - ComputePipeline, ComputePipelineMetalInfo, EntryMath, MeshPipelineMetalInfo, ModuleStats, - PrecisionNote, Reconvergence, RenderPipeline, RuntimeDependency, SpecClause, SpecConstant, - SpecTest, SpecializationLayout, SpecializedNote, StageModule, StrategyCensus, StrategyUse, + ComputePipeline, ComputePipelineMetalInfo, EntryMath, ModuleStats, PrecisionNote, + Reconvergence, RenderPipeline, RuntimeDependency, SpecClause, SpecConstant, SpecTest, + SpecializationLayout, SpecializedNote, StageModule, StrategyCensus, StrategyUse, }; pub use descriptor::{ ColorAttachmentDescriptor, ComputePipelineDescriptor, DynamicLibraries, FunctionDescriptor, diff --git a/crates/metal2vulkan/src/tests/engine_mesh.rs b/crates/metal2vulkan/src/tests/engine_mesh.rs index 4dbb0908c..6e4d3be9c 100644 --- a/crates/metal2vulkan/src/tests/engine_mesh.rs +++ b/crates/metal2vulkan/src/tests/engine_mesh.rs @@ -1339,142 +1339,6 @@ fn a_mesh_functions_buffer_writes_need_no_stage_store_feature() { } } -/// A mesh render pipeline's answers to Metal's mesh queries (`RenderPipeline::mesh_info`), on -/// every committed profile with `VK_EXT_mesh_shader`: each stage's thread limit is the least of the -/// descriptor's maximum, the function's `[[max_total_threads_per_threadgroup(n)]]`, the threads of -/// the stage's required size and 1024, within the device's limit for the stage (the task and mesh -/// stages' invocations); the widths are -/// 32; the mesh grid is the descriptor's maximum, else 2^20 whatever the object function's -/// `[[max_total_threadgroups_per_mesh_grid(n)]]`, within the device's `maxMeshWorkGroupTotalCount`. -/// Without an object function the object stage answers 0 -/// and 0. Each as an M3 Max answers on a first compile (`mesh_pipeline_limits.m`). -#[test] -fn a_mesh_pipeline_answers_metals_mesh_queries_within_the_device() { - use crate::budget::Budget; - use crate::library::Library; - use crate::pipeline::descriptor::{FunctionDescriptor, MeshPipelineDescriptor, StageSource}; - use crate::pipeline::MeshPipelineMetalInfo; - let (Some(draws), Some(outputs)) = (fixture("mesh_draws"), fixture("mesh_outputs")) else { - return; - }; - let (draws, outputs) = ( - Library::from_air(&draws).expect("library"), - Library::from_air(&outputs).expect("library"), - ); - let stage = |lib: &Library, name: &str| { - StageSource::Function(FunctionDescriptor::new( - lib.function(name).expect("function"), - )) - }; - let budget = Budget::standard(); - for (stem, p) in mesh_profiles() { - let dev = device(&stem); - let l = &p.fields().limits; - let (object, mesh, total) = ( - l.mesh.max_task_work_group_invocations, - l.mesh.max_mesh_work_group_invocations, - l.mesh.max_mesh_work_group_total_count, - ); - let info = |d: &MeshPipelineDescriptor| { - dev.compile_mesh_pipeline(d, &budget) - .unwrap_or_else(|e| panic!("{stem}: {e}")) - .mesh_info - .unwrap_or_else(|| panic!("{stem}: a mesh pipeline's answers")) - }; - let mut d = MeshPipelineDescriptor::new(stage(&draws, "mesh_draws_mesh")); - d.object = Some(stage(&draws, "mesh_draws_object")); - d.rasterization_enabled = false; - let answers = |o: u32, m: u32, ow: u32, g: u32| MeshPipelineMetalInfo { - max_total_threads_per_object_threadgroup: o, - max_total_threads_per_mesh_threadgroup: m, - object_thread_execution_width: ow, - mesh_thread_execution_width: 32, - max_total_threadgroups_per_mesh_grid: g, - }; - assert_eq!( - info(&d), - answers(object.min(1024), mesh.min(1024), 32, total.min(1 << 20)), - "{stem}" - ); - // The descriptor's maxima, a grid past 2^20 among them, and a required size of the - // object maximum's threads. - let mut limited = d.clone(); - limited.max_total_threads_per_object_threadgroup = Some(64); - limited.max_total_threads_per_mesh_threadgroup = Some(32); - limited.max_total_threadgroups_per_mesh_grid = Some(8); - assert_eq!( - info(&limited), - answers(object.min(64), mesh.min(32), 32, total.min(8)), - "{stem}" - ); - limited.max_total_threadgroups_per_mesh_grid = Some(1 << 21); - limited.required_threads_per_object_threadgroup = Some([32, 2, 1]); - assert_eq!( - info(&limited), - answers(object.min(64), mesh.min(32), 32, total.min(1 << 21)), - "{stem}" - ); - // A required size alone gives its stage its threads (an M3 Max's first compile answers 64 - // for `required-object-32x2` and 32 for `required-mesh-16x2`). - let mut required = d.clone(); - required.required_threads_per_object_threadgroup = Some([32, 2, 1]); - assert_eq!( - info(&required), - answers(object.min(64), mesh.min(1024), 32, total.min(1 << 20)), - "{stem}" - ); - required.required_threads_per_object_threadgroup = None; - required.required_threads_per_mesh_threadgroup = Some([16, 2, 1]); - assert_eq!( - info(&required), - answers(object.min(1024), mesh.min(32), 32, total.min(1 << 20)), - "{stem}" - ); - // The functions' own maxima (`mesh_outputs_object`'s 64 threads, `mesh_outputs_triangles`' - // 32 threads), and the descriptor's equal ones; the object function's 16 threadgroups - // change no grid. - let mut own = MeshPipelineDescriptor::new(stage(&outputs, "mesh_outputs_triangles")); - own.object = Some(stage(&outputs, "mesh_outputs_object")); - own.rasterization_enabled = false; - let theirs = answers(object.min(64), mesh.min(32), 32, total.min(1 << 20)); - assert_eq!(info(&own), theirs, "{stem}"); - own.max_total_threads_per_object_threadgroup = Some(64); - own.max_total_threads_per_mesh_threadgroup = Some(32); - assert_eq!(info(&own), theirs, "{stem}"); - own.max_total_threadgroups_per_mesh_grid = Some(32); - assert_eq!( - info(&own).max_total_threadgroups_per_mesh_grid, - total.min(32), - "{stem}" - ); - // A required size below the function's own maximum gives its stage its threads (an M3 - // Max's first compile answers 32 for `required-object-32-attribute-64`). - own.max_total_threads_per_object_threadgroup = None; - own.max_total_threads_per_mesh_threadgroup = None; - own.max_total_threadgroups_per_mesh_grid = None; - own.required_threads_per_mesh_threadgroup = Some([16, 1, 1]); - assert_eq!( - info(&own), - answers(object.min(64), mesh.min(16), 32, total.min(1 << 20)), - "{stem}" - ); - // Without an object function. - let mut alone = MeshPipelineDescriptor::new(stage(&draws, "mesh_draws_grid")); - alone.rasterization_enabled = false; - assert_eq!( - info(&alone), - answers(0, mesh.min(1024), 0, total.min(1 << 20)), - "{stem}" - ); - alone.required_threads_per_mesh_threadgroup = Some([16, 2, 1]); - assert_eq!( - info(&alone), - answers(0, mesh.min(32), 0, total.min(1 << 20)), - "{stem}" - ); - } -} - /// A mesh render pipeline descriptor Metal refuses is refused as Metal's rule /// (`InvalidDescriptor(MeshPipeline)`, measured on an M3 Max, `mesh_pipeline_limits.m`), on every /// committed profile with `VK_EXT_mesh_shader`, and the descriptors beside each are made: a required size with an axis of diff --git a/crates/metal2vulkan/tests/api_signatures.tsv b/crates/metal2vulkan/tests/api_signatures.tsv index 4544d7cc0..2199fa1e1 100644 --- a/crates/metal2vulkan/tests/api_signatures.tsv +++ b/crates/metal2vulkan/tests/api_signatures.tsv @@ -3177,11 +3177,6 @@ field metal2vulkan::pipeline::MeshPipelineDescriptor.required_threads_per_object field metal2vulkan::pipeline::MeshPipelineDescriptor.stencil_format pub stencil_format: Option field metal2vulkan::pipeline::MeshPipelineDescriptor.support_indirect_command_buffers pub support_indirect_command_buffers: bool field metal2vulkan::pipeline::MeshPipelineDescriptor.texture_write_rounding_mode pub texture_write_rounding_mode: metal::TextureWriteRoundingMode -field metal2vulkan::pipeline::MeshPipelineMetalInfo.max_total_threadgroups_per_mesh_grid pub max_total_threadgroups_per_mesh_grid: u32 -field metal2vulkan::pipeline::MeshPipelineMetalInfo.max_total_threads_per_mesh_threadgroup pub max_total_threads_per_mesh_threadgroup: u32 -field metal2vulkan::pipeline::MeshPipelineMetalInfo.max_total_threads_per_object_threadgroup pub max_total_threads_per_object_threadgroup: u32 -field metal2vulkan::pipeline::MeshPipelineMetalInfo.mesh_thread_execution_width pub mesh_thread_execution_width: u32 -field metal2vulkan::pipeline::MeshPipelineMetalInfo.object_thread_execution_width pub object_thread_execution_width: u32 field metal2vulkan::pipeline::ModuleStats.blocks pub blocks: u32 field metal2vulkan::pipeline::ModuleStats.constructs pub constructs: u32 field metal2vulkan::pipeline::ModuleStats.functions pub functions: u32 @@ -3248,7 +3243,6 @@ field metal2vulkan::pipeline::RenderPipeline.graphics pub graphics: GraphicsStat field metal2vulkan::pipeline::RenderPipeline.interface pub interface: PipelineInterface field metal2vulkan::pipeline::RenderPipeline.key pub key: PipelineKey field metal2vulkan::pipeline::RenderPipeline.layout pub layout: PipelineLayout -field metal2vulkan::pipeline::RenderPipeline.mesh_info pub mesh_info: Option field metal2vulkan::pipeline::RenderPipeline.profile pub profile: Hash256 field metal2vulkan::pipeline::RenderPipeline.requirements pub requirements: Requirements field metal2vulkan::pipeline::RenderPipeline.stages pub stages: Vec @@ -8041,7 +8035,6 @@ struct metal2vulkan::pipeline::LinkedFunctions #[derive(Clone, Debug, Default, P struct metal2vulkan::pipeline::LinkedSource #[derive(Clone, Copy, Debug)] pub struct LinkedSource<'a> struct metal2vulkan::pipeline::LoweringInputs #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] #[non_exhaustive] pub struct LoweringInputs struct metal2vulkan::pipeline::MeshPipelineDescriptor #[derive(Clone, Debug, PartialEq, Eq)] #[non_exhaustive] pub struct MeshPipelineDescriptor -struct metal2vulkan::pipeline::MeshPipelineMetalInfo #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)] #[non_exhaustive] pub struct MeshPipelineMetalInfo struct metal2vulkan::pipeline::ModuleStats #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)] #[non_exhaustive] pub struct ModuleStats struct metal2vulkan::pipeline::PipelineInterface #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug, Default, PartialEq, Eq, Hash)] #[non_exhaustive] pub struct PipelineInterface struct metal2vulkan::pipeline::PipelineLayout #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug, Default, PartialEq, Eq, Hash)] #[non_exhaustive] pub struct PipelineLayout diff --git a/crates/metal2vulkan/tests/api_surface.rs b/crates/metal2vulkan/tests/api_surface.rs index f3cb66055..2c380b61b 100644 --- a/crates/metal2vulkan/tests/api_surface.rs +++ b/crates/metal2vulkan/tests/api_surface.rs @@ -320,7 +320,6 @@ surface! { struct EntryPlan N; enum EntryRef E; struct LinkedSource O; - struct MeshPipelineMetalInfo N; struct StageEntries O; struct StandaloneModule N; struct ModuleStats N;