From 2bbf15766811d7b9fbeb90f7319acf9cf5600790 Mon Sep 17 00:00:00 2001 From: Anees Iqbal Date: Sat, 21 Nov 2026 02:36:16 -0800 Subject: [PATCH] DevicePolicy::default() is the identity domains; the resident-table domains become RESIDENT_TABLES What: DevicePolicy::default() now returns the identity pointer and handle domains, the policy metal2vulkan-runtime compiles under. DevicePolicy::UNTRUSTED is renamed RESIDENT_TABLES. It stays for the validation executor's own context (candidate/platform/compute.rs and the engine tests that build a resident root and a handle table themselves) and for the translator's tests of that lowering, which name it where they took default() before. The runtime takes default() instead of setting the two fields itself. Every tool that took default() now compiles under the runtime's policy: - the command line's --profile; - the compile worker; - the authored compile census, the corpus translation audit and corpus-pipeline; - acceptance, the tier table and specialization attempts; - the golden table, whose devices take default() (its policy field goes). Why: the planner's ruling (b), one policy constructor, so a tool and the runtime agree on the policy. The description can still differ: --profile takes the profile's description, while the runtime takes the device's, restricted to the features it enables. repro.rs and README say so. Docs: - README's --profile paragraph and the command's help text. - API.md section 1: the identity domains are listed first, as the default; the resident-table domains are the validation executor's. - device/mod.rs, policy.rs and profile.rs. - api_signatures.tsv renames the const. - api_preview's buffer carries a device address equal to its gpuAddress, as the runtime makes it. No SEMANTICS bump. For a given description and policy, the translator's output is unchanged. The profile fingerprint covers the policy, so every cached artifact and golden cell whose output moves does so under a changed key; the golden check reads those cells as re-keyed, a bless due. No bless here. Consumer search (consumer-uses.sh) at the consumer's development e76e2ffeb4 and 46 lane refs younger than a day: - UNTRUSTED, RESIDENT_TABLES, PointerDomain, HandleDomain and from_queries: 0 hits. - DevicePolicy: 13 lane refs only, all in the deleted runtime's policy struct (fields this tree no longer has); none on development. Expected census at this commit, not yet rerun: m3-max-62608's identity column, taken at 58bea6ca1c through a scratch policy switch. - Translation audit, of 17,206 rows: 15,176 translated on runtime-floor, 15,266 on lavapipe, 15,476 on amd-rdna3-radv and 15,459 on nvidia-rtx50-linux. - Authored compile census: 6,266 of 7,128 cells. Verified: - cargo fmt --all; - scripts/refusal-surface/refusal_surface.py leaves docs/REFUSALS.md as it was. --- README.md | 11 +- crates/metal2vulkan-harness/src/tests.rs | 12 +- crates/metal2vulkan-runtime/src/device.rs | 10 +- .../src/candidate/engine/graphics/tests.rs | 6 +- .../src/candidate/engine/public_cases.rs | 2 +- .../src/candidate/engine/tests.rs | 10 +- .../engine/tests/argument_buffer_members.rs | 6 +- .../src/candidate/engine/variants.rs | 2 +- .../src/candidate/platform/compute.rs | 17 ++- .../src/coverage/tier_table.rs | 4 +- crates/metal2vulkan-validation/src/engine.rs | 4 +- .../executor_contract/out_of_bounds/tests.rs | 8 +- crates/metal2vulkan/examples/api_preview.rs | 7 +- crates/metal2vulkan/src/ash_interop/tests.rs | 2 +- .../src/bind/depth_stencil_copy/tests.rs | 6 +- crates/metal2vulkan/src/bind/heap/tests.rs | 4 +- crates/metal2vulkan/src/bind/neutral/tests.rs | 2 +- .../src/bind/plan/resources/tests.rs | 41 +++--- .../metal2vulkan/src/bind/plan/slots/tests.rs | 10 +- .../src/bind/replay/draws/tests.rs | 4 +- crates/metal2vulkan/src/bind/replay/tests.rs | 4 +- .../src/bind/sample_interleave/tests.rs | 6 +- .../src/bind/sample_planes/tests.rs | 6 +- crates/metal2vulkan/src/cache/tests.rs | 6 +- crates/metal2vulkan/src/device/mod.rs | 2 +- crates/metal2vulkan/src/device/policy.rs | 27 +++- crates/metal2vulkan/src/device/profile.rs | 15 ++- .../src/device/tests/description.rs | 10 +- .../metal2vulkan/src/device/tests/enables.rs | 26 ++-- .../src/device/tests/from_queries.rs | 10 +- .../src/device/tests/mechanism.rs | 3 +- .../metal2vulkan/src/device/tests/profile.rs | 46 +++---- .../src/device/tests/render_vocabulary.rs | 8 +- .../metal2vulkan/src/lower/dispatch/tests.rs | 4 +- .../src/lower/fragment/fetch/tests.rs | 4 +- .../src/lower/fragment/stencil/tests.rs | 2 +- .../src/lower/sampler/anisotropic/tests.rs | 8 +- .../src/lower/sampler/constexpr.rs | 2 +- .../src/lower/sync/barrier/tests.rs | 6 +- .../src/lower/sync/memory_model/tests.rs | 9 +- crates/metal2vulkan/src/main.rs | 3 +- crates/metal2vulkan/src/memory/plan/tests.rs | 4 +- crates/metal2vulkan/src/metal/format/tests.rs | 4 +- crates/metal2vulkan/src/metal/format/word.rs | 10 +- crates/metal2vulkan/src/metal/sampler.rs | 26 ++-- crates/metal2vulkan/src/metal/state.rs | 4 +- crates/metal2vulkan/src/metal/vertex.rs | 14 +- .../src/pipeline/compile/numbered.rs | 2 +- .../src/pipeline/compile/partition.rs | 2 +- .../src/pipeline/compile/tests.rs | 79 +++++++----- .../src/pipeline/link/tessellation/tests.rs | 4 +- .../metal2vulkan/src/pipeline/link/tests.rs | 2 +- .../src/pipeline/link/tests/render.rs | 10 +- .../src/pipeline/rotated_blend/tests.rs | 8 +- .../src/pipeline/testing/tests.rs | 2 +- .../src/reflection/linked_tests.rs | 8 +- crates/metal2vulkan/src/reflection/tests.rs | 2 +- crates/metal2vulkan/src/repro.rs | 5 +- crates/metal2vulkan/src/spirv/testing.rs | 4 +- .../src/tests/constant_blob_footprint.rs | 4 +- .../src/tests/core_image_libraries.rs | 2 +- .../tests/engine_absent_value_arguments.rs | 2 +- .../metal2vulkan/src/tests/engine_access.rs | 2 +- .../src/tests/engine_aggregate_access.rs | 2 +- crates/metal2vulkan/src/tests/engine_agx.rs | 8 +- .../metal2vulkan/src/tests/engine_air_2_9.rs | 8 +- .../src/tests/engine_alpha_coverage.rs | 2 +- .../src/tests/engine_amplification.rs | 10 +- crates/metal2vulkan/src/tests/engine_arena.rs | 2 +- .../src/tests/engine_argument_tables.rs | 10 +- crates/metal2vulkan/src/tests/engine_arith.rs | 76 +++++------ .../src/tests/engine_async_copy.rs | 2 +- .../metal2vulkan/src/tests/engine_atomics.rs | 4 +- .../src/tests/engine_bias_reach.rs | 6 +- .../metal2vulkan/src/tests/engine_bicubic.rs | 4 +- .../metal2vulkan/src/tests/engine_binder.rs | 2 +- .../src/tests/engine_bit_manipulation.rs | 2 +- .../src/tests/engine_buffer_table.rs | 2 +- .../src/tests/engine_chosen_pointers.rs | 12 +- .../src/tests/engine_convert_rounding.rs | 2 +- crates/metal2vulkan/src/tests/engine_copy.rs | 4 +- .../src/tests/engine_coverage_loop.rs | 2 +- .../src/tests/engine_cross_class.rs | 8 +- .../src/tests/engine_dead_fetch.rs | 2 +- .../src/tests/engine_dead_reads.rs | 4 +- .../src/tests/engine_declared_varyings.rs | 2 +- .../src/tests/engine_depth_range.rs | 8 +- .../src/tests/engine_device_replay.rs | 6 +- .../metal2vulkan/src/tests/engine_dispatch.rs | 14 +- .../src/tests/engine_divergent_barriers.rs | 6 +- .../src/tests/engine_draw_bases.rs | 4 +- .../src/tests/engine_dynamic_libraries.rs | 4 +- .../src/tests/engine_dynamic_roots.rs | 8 +- .../src/tests/engine_extended_range.rs | 11 +- .../blended_pipelines.rs | 2 +- .../src/tests/engine_extended_range/heap.rs | 2 +- .../tests/engine_extended_range/targets.rs | 2 +- .../src/tests/engine_fetch_blend16.rs | 2 +- .../src/tests/engine_fetch_blend16_narrow.rs | 2 +- .../src/tests/engine_fetch_blend8.rs | 2 +- .../src/tests/engine_fetch_generic_blend.rs | 2 +- .../src/tests/engine_fill_moduli.rs | 4 +- .../src/tests/engine_float_call_notes.rs | 2 +- .../src/tests/engine_fpc_frames.rs | 11 +- .../metal2vulkan/src/tests/engine_fragment.rs | 46 +++---- .../src/tests/engine_fragment_depth_clamp.rs | 8 +- .../src/tests/engine_fragment_imageblock.rs | 4 +- .../engine_function_constant_interface.rs | 2 +- .../engine_function_constant_pointers.rs | 2 +- .../src/tests/engine_gated_texture_slots.rs | 2 +- .../src/tests/engine_generic_pointers.rs | 4 +- .../src/tests/engine_gep_index.rs | 2 +- .../src/tests/engine_global_builtins.rs | 12 +- .../src/tests/engine_graphics_binder.rs | 12 +- .../src/tests/engine_half_hold.rs | 8 +- .../src/tests/engine_half_moves.rs | 10 +- .../metal2vulkan/src/tests/engine_handles.rs | 14 +- .../src/tests/engine_heap_binder.rs | 12 +- .../src/tests/engine_heap_residency.rs | 2 +- .../src/tests/engine_heap_storage_reads.rs | 6 +- .../src/tests/engine_heap_texel_buffers.rs | 2 +- .../src/tests/engine_helper_threads.rs | 10 +- .../metal2vulkan/src/tests/engine_identity.rs | 120 ++++++++++-------- .../src/tests/engine_identity_domain.rs | 8 +- .../src/tests/engine_identity_interlock.rs | 2 +- .../src/tests/engine_identity_render.rs | 2 +- .../src/tests/engine_identity_spill.rs | 2 +- .../src/tests/engine_image_shapes.rs | 2 +- .../src/tests/engine_imageblock.rs | 2 +- .../src/tests/engine_index_words.rs | 2 +- .../src/tests/engine_indirect_commands.rs | 2 +- crates/metal2vulkan/src/tests/engine_inert.rs | 2 +- .../src/tests/engine_inline_asm.rs | 4 +- .../src/tests/engine_integer_median3.rs | 2 +- .../src/tests/engine_kernel_lod.rs | 2 +- .../src/tests/engine_kernel_stage_in.rs | 2 +- .../src/tests/engine_lane_reads.rs | 2 +- .../src/tests/engine_lazy_operands.rs | 2 +- .../src/tests/engine_line_band.rs | 4 +- crates/metal2vulkan/src/tests/engine_link.rs | 4 +- .../src/tests/engine_linked_signatures.rs | 2 +- .../metal2vulkan/src/tests/engine_linking.rs | 14 +- .../src/tests/engine_loop_unrolling.rs | 2 +- .../metal2vulkan/src/tests/engine_matmul2d.rs | 6 +- crates/metal2vulkan/src/tests/engine_mesh.rs | 12 +- .../src/tests/engine_metal_denormals.rs | 2 +- .../src/tests/engine_metal_math.rs | 6 +- .../src/tests/engine_metal_readings.rs | 2 +- .../src/tests/engine_metal_routines.rs | 2 +- .../src/tests/engine_metered_walks.rs | 4 +- .../metal2vulkan/src/tests/engine_metering.rs | 8 +- .../src/tests/engine_moved_writers.rs | 2 +- .../src/tests/engine_multisample.rs | 26 ++-- .../src/tests/engine_must_fallback.rs | 2 +- .../src/tests/engine_name_independence.rs | 2 +- .../src/tests/engine_narrow_wrap.rs | 2 +- .../src/tests/engine_native_half.rs | 14 +- .../src/tests/engine_native_maths.rs | 10 +- .../src/tests/engine_nonwritable.rs | 4 +- crates/metal2vulkan/src/tests/engine_nuw.rs | 4 +- .../src/tests/engine_offset_arms.rs | 12 +- .../src/tests/engine_padded_blends.rs | 2 +- .../metal2vulkan/src/tests/engine_places.rs | 6 +- .../src/tests/engine_pointer_cells.rs | 2 +- .../src/tests/engine_pointer_memory.rs | 4 +- .../src/tests/engine_pointer_values.rs | 6 +- .../src/tests/engine_pooled_cells.rs | 2 +- .../src/tests/engine_primitive_ids.rs | 11 +- .../src/tests/engine_private_memory.rs | 16 ++- .../src/tests/engine_private_render_state.rs | 4 +- .../src/tests/engine_profile_f.rs | 4 +- .../src/tests/engine_pull_model.rs | 10 +- .../metal2vulkan/src/tests/engine_quad_ops.rs | 4 +- .../src/tests/engine_qualified_signature.rs | 2 +- .../metal2vulkan/src/tests/engine_rate_map.rs | 2 +- .../src/tests/engine_ray_tracing.rs | 11 +- .../src/tests/engine_read_through_constant.rs | 4 +- .../src/tests/engine_recursion.rs | 14 +- .../src/tests/engine_refused_families.rs | 2 +- .../src/tests/engine_region_viewports.rs | 5 +- .../src/tests/engine_render_target_slice.rs | 2 +- crates/metal2vulkan/src/tests/engine_roll.rs | 8 +- .../src/tests/engine_rotated_colors.rs | 5 +- .../src/tests/engine_rotated_weights.rs | 4 +- .../metal2vulkan/src/tests/engine_sampler.rs | 10 +- .../src/tests/engine_sampler_completion.rs | 2 +- .../src/tests/engine_sampler_tail.rs | 2 +- .../src/tests/engine_sampler_unk.rs | 4 +- .../src/tests/engine_separate_samplers.rs | 2 +- .../metal2vulkan/src/tests/engine_seq_cst.rs | 2 +- .../src/tests/engine_shared_switch.rs | 2 +- crates/metal2vulkan/src/tests/engine_simd.rs | 22 ++-- .../src/tests/engine_simd_emulated.rs | 58 ++++----- .../src/tests/engine_simd_lockstep.rs | 30 ++--- .../src/tests/engine_simd_matrix.rs | 14 +- .../src/tests/engine_simd_partly_live.rs | 6 +- .../src/tests/engine_simd_past_n.rs | 6 +- .../src/tests/engine_simd_products.rs | 4 +- .../src/tests/engine_simd_unit_axes.rs | 2 +- .../metal2vulkan/src/tests/engine_skeleton.rs | 22 ++-- .../src/tests/engine_snapshot_exact.rs | 16 +-- .../src/tests/engine_specialized_folds.rs | 2 +- .../src/tests/engine_specialized_name.rs | 4 +- .../src/tests/engine_spirv_cross_forms.rs | 2 +- .../src/tests/engine_srgb_decode.rs | 6 +- .../metal2vulkan/src/tests/engine_stage_io.rs | 6 +- .../src/tests/engine_stage_io_tail.rs | 8 +- .../src/tests/engine_stage_root_attributes.rs | 2 +- .../metal2vulkan/src/tests/engine_stencil.rs | 2 +- .../metal2vulkan/src/tests/engine_stitched.rs | 4 +- .../src/tests/engine_storage_view_variant.rs | 2 +- .../src/tests/engine_swizzled_storage.rs | 5 +- .../metal2vulkan/src/tests/engine_tables.rs | 14 +- .../src/tests/engine_target_indices.rs | 2 +- .../src/tests/engine_tessellation.rs | 6 +- .../src/tests/engine_texel_rows.rs | 2 +- .../metal2vulkan/src/tests/engine_texture.rs | 10 +- .../src/tests/engine_texture_atomic_unk.rs | 2 +- .../src/tests/engine_texture_interp.rs | 4 +- .../src/tests/engine_texture_levels.rs | 16 +-- .../src/tests/engine_texture_oob.rs | 2 +- .../src/tests/engine_texture_tail.rs | 8 +- .../src/tests/engine_texture_ulong.rs | 6 +- .../src/tests/engine_texture_unit_bit_test.rs | 4 +- .../src/tests/engine_texture_unk.rs | 2 +- .../src/tests/engine_threadgroup_floats.rs | 2 +- crates/metal2vulkan/src/tests/engine_tile.rs | 8 +- .../src/tests/engine_tiny_products.rs | 6 +- .../src/tests/engine_typed_clamp.rs | 2 +- .../src/tests/engine_typed_threadgroup.rs | 2 +- .../src/tests/engine_uniform_varyings.rs | 2 +- .../src/tests/engine_unread_attribute.rs | 2 +- .../src/tests/engine_vertex_fetch.rs | 6 +- .../src/tests/engine_vertex_variants.rs | 10 +- .../metal2vulkan/src/tests/engine_volatile.rs | 4 +- crates/metal2vulkan/src/tests/engine_wide.rs | 2 +- .../src/tests/engine_widest_pin.rs | 2 +- .../src/tests/engine_word_attachments.rs | 4 +- .../src/tests/engine_word_phases.rs | 2 +- .../src/tests/engine_workgroup_layout.rs | 2 +- .../src/tests/engine_ycbcr_in_place.rs | 10 +- .../src/tests/engine_zeroed_colors.rs | 10 +- .../src/tests/engine_zeroed_threadgroup.rs | 4 +- crates/metal2vulkan/src/tests/fuzz_interp.rs | 10 +- .../metal2vulkan/src/tests/golden_hashes.rs | 17 ++- .../metal2vulkan/src/tests/ledger_resident.rs | 2 +- .../src/tests/library_entries_decode_once.rs | 2 +- .../metal2vulkan/src/tests/owned_divisions.rs | 3 +- .../src/tests/profile_fingerprint_derived.rs | 12 +- .../src/tests/public_fixtures_engine.rs | 4 +- .../metal2vulkan/src/tests/relocated_once.rs | 2 +- .../src/tests/stage_in_unread_key.rs | 2 +- .../src/tests/stage_input_siblings.rs | 2 +- crates/metal2vulkan/tests/api_signatures.tsv | 4 +- crates/metal2vulkan/tests/api_surface.rs | 6 +- .../tests/engine_bounded_growth.rs | 3 +- docs/API.md | 25 ++-- 257 files changed, 1027 insertions(+), 907 deletions(-) diff --git a/README.md b/README.md index a76cf8d95..9c8879316 100644 --- a/README.md +++ b/README.md @@ -79,11 +79,12 @@ metal2vulkan kernel.ll kernel.spv --profile device.json --emit-meta kernel.json - `--profile` is required: the crate ships no device description. Any Khronos profiles JSON works; [`crates/metal2vulkan-validation/profiles/`](crates/metal2vulkan-validation/profiles) has - examples, from a bare Vulkan 1.2 device to desktop GPUs and MoltenVK. A profile compiles with the - default domains (`DevicePolicy::UNTRUSTED`). `--device FILE` takes its place with a device - description and policy as JSON (`{"description": ..., "policy": ...}`), which is how a runtime's - compile device is reproduced: metal2vulkan-runtime's is the description restricted to the - features it enables, with the identity pointer and handle domains. + examples, from a bare Vulkan 1.2 device to desktop GPUs and MoltenVK. A profile compiles under + the runtime's policy (`DevicePolicy::default()`, the identity pointer and handle domains), so a + profile without `bufferDeviceAddress` and `shaderInt64` is refused. `--device FILE` takes its + place with a device description and policy as JSON (`{"description": ..., "policy": ...}`), + which is how a runtime's compile device is reproduced: metal2vulkan-runtime's is the + description restricted to the features it enables, under that policy. - Without `--function` it compiles the library's only kernel or vertex function. A kernel with `--color-format` compiles as a tile pipeline. A post-tessellation vertex function adds `.tesc.spv` and `.tese.spv` modules; on a device without `tessellationShader` it answers diff --git a/crates/metal2vulkan-harness/src/tests.rs b/crates/metal2vulkan-harness/src/tests.rs index b31e3882e..6ebe00ea4 100644 --- a/crates/metal2vulkan-harness/src/tests.rs +++ b/crates/metal2vulkan-harness/src/tests.rs @@ -1414,9 +1414,7 @@ fn the_copy_moves_every_byte_in_whole_threadgroups() { /// it, plain or with partial threadgroups. #[test] fn the_int_cells_kernel_is_apart_in_rows_and_its_uint_control_is_not() { - use metal2vulkan::device::{ - Device, DeviceDescription, DevicePolicy, HandleDomain, PointerDomain, - }; + use metal2vulkan::device::{Device, DeviceDescription, DevicePolicy}; use metal2vulkan::library::Library; use metal2vulkan::pipeline::{FunctionDescriptor, LoweringInputs, StageEntries}; let air = match crate::authored::library_air() { @@ -1428,11 +1426,9 @@ fn the_int_cells_kernel_is_apart_in_rows_and_its_uint_control_is_not() { }; let json = include_str!("../../metal2vulkan-validation/profiles/lavapipe.json"); let description = DeviceDescription::from_khronos_json(json, None).unwrap(); - let resident = Device::from_queries(description.clone(), DevicePolicy::default()).unwrap(); - let mut policy = DevicePolicy::default(); - policy.pointer_domain = PointerDomain::Identity; - policy.handle_domain = HandleDomain::Identity; - let identity = Device::from_queries(description, policy).unwrap(); + let resident = + Device::from_queries(description.clone(), DevicePolicy::RESIDENT_TABLES).unwrap(); + let identity = Device::from_queries(description, DevicePolicy::default()).unwrap(); let library = Library::from_air(&air).unwrap(); let budget = metal2vulkan::Budget::standard(); let mut partial = LoweringInputs::new(); diff --git a/crates/metal2vulkan-runtime/src/device.rs b/crates/metal2vulkan-runtime/src/device.rs index 9163ce557..63a783247 100644 --- a/crates/metal2vulkan-runtime/src/device.rs +++ b/crates/metal2vulkan-runtime/src/device.rs @@ -28,9 +28,7 @@ use crate::submit::{self, Work}; use crate::submit_calls::SubmitCalls; use crate::times::{StampPools, Ticks}; use ash::vk; -use metal2vulkan::device::{ - ApiVersion, DeviceDescription, DevicePolicy, HandleDomain, PointerDomain, -}; +use metal2vulkan::device::{ApiVersion, DeviceDescription, DevicePolicy}; use metal2vulkan::metal::{ArgumentBuffersTier, ReadWriteTextureTier}; use std::cell::Cell; use std::collections::HashMap; @@ -1330,10 +1328,8 @@ unsafe fn translator( let description = described .and_then(|description| description.with_enabled(&floor::shader_enables(capabilities))) .map_err(Error::translation)?; - let mut policy = DevicePolicy::default(); - policy.pointer_domain = PointerDomain::Identity; - policy.handle_domain = HandleDomain::Identity; - metal2vulkan::device::Device::from_queries(description, policy).map_err(Error::translation) + metal2vulkan::device::Device::from_queries(description, DevicePolicy::default()) + .map_err(Error::translation) } /// The features device creation enables: the floor's of `capabilities`, and each of `asked` the diff --git a/crates/metal2vulkan-validation/src/candidate/engine/graphics/tests.rs b/crates/metal2vulkan-validation/src/candidate/engine/graphics/tests.rs index 4e2a7ad27..96d5914e5 100644 --- a/crates/metal2vulkan-validation/src/candidate/engine/graphics/tests.rs +++ b/crates/metal2vulkan-validation/src/candidate/engine/graphics/tests.rs @@ -19,7 +19,7 @@ fn device(stem: &str) -> Device { let path = crate::engine::profiles_dir().join(format!("{stem}.json")); let text = std::fs::read_to_string(path).unwrap(); let description = DeviceDescription::from_khronos_json(&text, None).unwrap(); - Device::from_queries(description, DevicePolicy::default()).unwrap() + Device::from_queries(description, DevicePolicy::RESIDENT_TABLES).unwrap() } /// The module text a case maps with when its module's stage metadata declares no render target @@ -453,7 +453,7 @@ fn a_framebuffer_fetch_case_plans_its_ordered_input_attachment() { description .features .remove(&VkFeature::FragmentShaderPixelInterlock); - let unordered = Device::from_queries(description, DevicePolicy::default()).unwrap(); + let unordered = Device::from_queries(description, DevicePolicy::RESIDENT_TABLES).unwrap(); let (pipeline, plan, _) = planned_draw(&unordered, &render, libraries).unwrap(); let read: Vec = (pipeline.graphics.input_attachments.iter()) .map(|input| input.color_index) @@ -2116,7 +2116,7 @@ fn public_framebuffer_fetch_cases_plan_their_ordered_input_attachments() { // color the case reads as a storage image of its own attachment inside the interlock, // where the case's state lets that be exact: no input attachment, no color attachment // state for it, and a storage write of it in the plan. Where the state blocks that - // form, the default policy refuses the fetch, typed. + // form, the resident-table domains refuse the fetch, typed. for stem in interlocked.iter().map(String::as_str) { match planned_draw(&device(stem), &render, libraries) { Ok((pipeline, plan, _)) => { diff --git a/crates/metal2vulkan-validation/src/candidate/engine/public_cases.rs b/crates/metal2vulkan-validation/src/candidate/engine/public_cases.rs index 144584664..e36433000 100644 --- a/crates/metal2vulkan-validation/src/candidate/engine/public_cases.rs +++ b/crates/metal2vulkan-validation/src/candidate/engine/public_cases.rs @@ -21,7 +21,7 @@ pub(super) fn device(stem: &str) -> Device { let path = crate::engine::profiles_dir().join(format!("{stem}.json")); let text = std::fs::read_to_string(path).unwrap(); let description = DeviceDescription::from_khronos_json(&text, None).unwrap(); - Device::from_queries(description, DevicePolicy::default()).unwrap() + Device::from_queries(description, DevicePolicy::RESIDENT_TABLES).unwrap() } /// The committed cases whose AIR is a public fixture, with that fixture's source row. diff --git a/crates/metal2vulkan-validation/src/candidate/engine/tests.rs b/crates/metal2vulkan-validation/src/candidate/engine/tests.rs index 0fb9d421f..a80979370 100644 --- a/crates/metal2vulkan-validation/src/candidate/engine/tests.rs +++ b/crates/metal2vulkan-validation/src/candidate/engine/tests.rs @@ -1598,7 +1598,7 @@ fn a_device_buffer_array_plans_as_the_functions_buffer_table() { ("moltenvk-m3", true), ("runtime-floor", false), ] { - let device = device(stem, DevicePolicy::default()); + let device = device(stem, DevicePolicy::RESIDENT_TABLES); let shape = compute_shape(&compute, addressed, BufferRanges::default()).unwrap(); let (pipeline, inputs) = variants::compile_compute_for_shape( &device, @@ -1682,7 +1682,7 @@ fn the_binder_plans_the_executors_state() { }, }; for stem in ["lavapipe", "moltenvk-m3", "runtime-floor"] { - let device = device(stem, DevicePolicy::default()); + let device = device(stem, DevicePolicy::RESIDENT_TABLES); let pipeline = compile(&device, &bitcode, "count"); for address in [ BufferAddress::synthetic(0), @@ -1721,8 +1721,8 @@ fn the_binder_plans_the_executors_state() { #[test] fn identity_is_per_profile_and_per_engine_slot() { - let a = engine_fingerprint(device("lavapipe", DevicePolicy::default()).profile()); - let b = engine_fingerprint(device("moltenvk-m3", DevicePolicy::default()).profile()); + let a = engine_fingerprint(device("lavapipe", DevicePolicy::RESIDENT_TABLES).profile()); + let b = engine_fingerprint(device("moltenvk-m3", DevicePolicy::RESIDENT_TABLES).profile()); assert_ne!(a, b); assert_eq!(a.len(), 64); assert_eq!( @@ -2112,7 +2112,7 @@ fn a_long_replay_records_the_regions_its_dispatch_bound_holds() { let path = crate::engine::profiles_dir().join("gate-lavapipe.json"); let text = std::fs::read_to_string(path).unwrap(); let description = DeviceDescription::from_khronos_json(&text, None).unwrap(); - let device = Device::from_queries(description, DevicePolicy::default()).unwrap(); + let device = Device::from_queries(description, DevicePolicy::RESIDENT_TABLES).unwrap(); let variants = |n: u32| -> Vec { (1..=n) .map(|x| ReplayVariant::new(NonZeroU64::new(7).unwrap(), [x, 1, 1], [0; 31])) diff --git a/crates/metal2vulkan-validation/src/candidate/engine/tests/argument_buffer_members.rs b/crates/metal2vulkan-validation/src/candidate/engine/tests/argument_buffer_members.rs index 51551f721..21812ce48 100644 --- a/crates/metal2vulkan-validation/src/candidate/engine/tests/argument_buffer_members.rs +++ b/crates/metal2vulkan-validation/src/candidate/engine/tests/argument_buffer_members.rs @@ -379,7 +379,7 @@ fn an_argument_buffer_texture_is_the_heap_member_its_owner_names() { } Err(AssembleError::Rejected(why)) => panic!("llvm-as rejected handles.ll: {why}"), }; - let device = device("moltenvk-m3", DevicePolicy::default()); + let device = device("moltenvk-m3", DevicePolicy::RESIDENT_TABLES); let library = Library::from_air(&bitcode).unwrap(); let function = FunctionDescriptor::new(library.function(&mapped.entry).unwrap()); let shape = compute_shape(&mapped, true, BufferRanges::default()).unwrap(); @@ -559,7 +559,7 @@ fn a_pipeline_state_whose_bytes_a_kernel_reads_never_reaches_a_comparison() { let library = Library::from_air(&bitcode).unwrap(); let function = FunctionDescriptor::new(library.function(entry).unwrap()); for stem in ["moltenvk-m3", "lavapipe", "runtime-floor"] { - let device = device(stem, DevicePolicy::default()); + let device = device(stem, DevicePolicy::RESIDENT_TABLES); for addressed in [false, true] { let shape = compute_shape(&mapped, addressed, BufferRanges::default()).unwrap(); let compiled = variants::compile_compute_for_shape( @@ -694,7 +694,7 @@ fn an_argument_buffer_sampler_is_the_sampler_table_entry_its_owner_names() { panic!("llvm-as rejected tail_argument_samplers.ll: {why}") } }; - let device = device("moltenvk-m3", DevicePolicy::default()); + let device = device("moltenvk-m3", DevicePolicy::RESIDENT_TABLES); let library = Library::from_air(&bitcode).unwrap(); let function = FunctionDescriptor::new(library.function(&mapped.entry).unwrap()); let shape = compute_shape(&mapped, true, BufferRanges::default()).unwrap(); diff --git a/crates/metal2vulkan-validation/src/candidate/engine/variants.rs b/crates/metal2vulkan-validation/src/candidate/engine/variants.rs index e0fbdbd32..5552e47b9 100644 --- a/crates/metal2vulkan-validation/src/candidate/engine/variants.rs +++ b/crates/metal2vulkan-validation/src/candidate/engine/variants.rs @@ -562,7 +562,7 @@ mod tests { "\"shaderStorageImageWriteWithoutFormat\": false", ); let description = DeviceDescription::from_khronos_json(&text, None).unwrap(); - let device = Device::from_queries(description, DevicePolicy::default()).unwrap(); + let device = Device::from_queries(description, DevicePolicy::RESIDENT_TABLES).unwrap(); assert!(!device.profile().images().storage_write_without_format); let row = crate::acceptance::row::fragment_row( diff --git a/crates/metal2vulkan-validation/src/candidate/platform/compute.rs b/crates/metal2vulkan-validation/src/candidate/platform/compute.rs index d433a6cc4..2ec3b4182 100644 --- a/crates/metal2vulkan-validation/src/candidate/platform/compute.rs +++ b/crates/metal2vulkan-validation/src/candidate/platform/compute.rs @@ -151,7 +151,7 @@ pub(crate) fn native_refused_on( ) -> Result { let device = WorkerDevice::new( native.clone(), - metal2vulkan::device::DevicePolicy::default(), + metal2vulkan::device::DevicePolicy::RESIDENT_TABLES, ) .map_err(|error| format!("its own description derives no profile: {error}"))?; let profile = device.device().profile(); @@ -204,8 +204,8 @@ pub(super) fn attempt( } /// The `Device` the context `device_type` opens: its queried description restricted to what it -/// enabled, under the default policy ([`opened_device`]). What a device test compiles for, so its -/// profile is the opened device's, never a committed one. +/// enabled, under the resident-table domains ([`opened_device`]). What a device test compiles for, +/// so its profile is the opened device's, never a committed one. #[cfg(all(test, any(m2v_gpu, m2v_cpu_icd)))] pub fn opened_worker_device(device_type: DeviceType) -> Result { with_validated_context(device_type, |context| Ok(opened_device(context))) @@ -213,14 +213,19 @@ pub fn opened_worker_device(device_type: DeviceType) -> Result Result { let description = context .opened_description .clone() .map_err(ExecutorError::Failed)?; - WorkerDevice::new(description, metal2vulkan::device::DevicePolicy::default()) - .map_err(|e| product_refusal(&e)) + WorkerDevice::new( + description, + metal2vulkan::device::DevicePolicy::RESIDENT_TABLES, + ) + .map_err(|e| product_refusal(&e)) } fn run( diff --git a/crates/metal2vulkan-validation/src/coverage/tier_table.rs b/crates/metal2vulkan-validation/src/coverage/tier_table.rs index b3008194a..18d8e5fb9 100644 --- a/crates/metal2vulkan-validation/src/coverage/tier_table.rs +++ b/crates/metal2vulkan-validation/src/coverage/tier_table.rs @@ -51,7 +51,7 @@ impl TierProfile { } /// A tier-table entry: a committed profile in one leg, and the profile lowering compiles for (the -/// default untrusted policy, as every engine census row). +/// default policy, the runtime's, as every engine census row). pub struct CommittedProfile { pub tier: TierProfile, pub profile: DeviceProfile, @@ -262,7 +262,7 @@ pub fn compile_module( attributes: &attributes, resident_roots: function.reads_resident_roots(), handle_table: function.resolves_handles(), - // Every committed profile's device takes the default domains (`committed_profiles`). + // Every committed profile's device takes the default policy (`committed_profiles`). policy: DevicePolicy::default(), strategies: function.strategies(), }; diff --git a/crates/metal2vulkan-validation/src/engine.rs b/crates/metal2vulkan-validation/src/engine.rs index 5516264a8..5c6b5baff 100644 --- a/crates/metal2vulkan-validation/src/engine.rs +++ b/crates/metal2vulkan-validation/src/engine.rs @@ -985,13 +985,13 @@ pub fn committed_profiles() -> Result, String> { Ok(stems) } -/// The committed profile `stem` derived under the default (untrusted) policy, the policy every +/// The committed profile `stem` derived under the default policy (the runtime's), the policy every /// engine census row is recorded under. pub fn load_profile(stem: &str) -> Result { Ok(load_device(stem)?.profile().clone()) } -/// The engine's `Device` for committed profile `stem` under the default untrusted policy: +/// The engine's `Device` for committed profile `stem` under the default policy (the runtime's): /// what the public compile API compiles against (its profile is [`load_profile`]'s). pub fn load_device(stem: &str) -> Result { metal2vulkan::device::Device::from_queries(load_description(stem)?, DevicePolicy::default()) diff --git a/crates/metal2vulkan-validation/src/executor_contract/out_of_bounds/tests.rs b/crates/metal2vulkan-validation/src/executor_contract/out_of_bounds/tests.rs index 57de8b87b..4ef542782 100644 --- a/crates/metal2vulkan-validation/src/executor_contract/out_of_bounds/tests.rs +++ b/crates/metal2vulkan-validation/src/executor_contract/out_of_bounds/tests.rs @@ -742,7 +742,7 @@ fn thread_memory_is_contained_by_the_typed_arrays_check_only() { attributes: &BTreeMap::new(), resident_roots: true, handle_table: true, - policy: DevicePolicy::default(), + policy: DevicePolicy::RESIDENT_TABLES, strategies: &strategies, }; let target = OutOfBoundsTarget { @@ -903,12 +903,12 @@ fn the_identity_domains_leave_a_loaded_pointer_unchecked_and_mask_a_resource_id( ReadRule::ResidentTexels ); assert!( - containment(&pointer, &module(DevicePolicy::default()), profile) + containment(&pointer, &module(DevicePolicy::RESIDENT_TABLES), profile) .unwrap_err() .contains("no memory through a pointer loaded") ); assert!( - containment(&handles, &module(DevicePolicy::default()), profile) + containment(&handles, &module(DevicePolicy::RESIDENT_TABLES), profile) .unwrap_err() .contains("resolves no handle") ); @@ -954,7 +954,7 @@ fn a_draws_targets_are_contained_by_their_fetch() { attributes, resident_roots: false, handle_table: false, - policy: DevicePolicy::default(), + policy: DevicePolicy::RESIDENT_TABLES, strategies, }; let target = OutOfBoundsTarget { diff --git a/crates/metal2vulkan/examples/api_preview.rs b/crates/metal2vulkan/examples/api_preview.rs index 02a2618eb..d10a3ca00 100644 --- a/crates/metal2vulkan/examples/api_preview.rs +++ b/crates/metal2vulkan/examples/api_preview.rs @@ -79,14 +79,15 @@ fn committed_device(stem: &str) -> Result { Ok(device) } -/// A buffer bound at `offset` in a `length`-byte allocation whose Metal `gpuAddress` is -/// `0x1_0000`, without a Vulkan device address. +/// A buffer bound at `offset` in a `length`-byte allocation whose Metal `gpuAddress` and Vulkan +/// device address are both `0x1_0000`, as the runtime makes them: under the default policy, the +/// identity domains, a buffer slot is reached at its device address. fn buffer(length: u64, offset: u64) -> BoundBuffer { BoundBuffer::Buffer { length, offset, gpu_address: 0x1_0000, - device_address: None, + device_address: Some(0x1_0000), attribute_stride: None, } } diff --git a/crates/metal2vulkan/src/ash_interop/tests.rs b/crates/metal2vulkan/src/ash_interop/tests.rs index fae955b0f..734e1df30 100644 --- a/crates/metal2vulkan/src/ash_interop/tests.rs +++ b/crates/metal2vulkan/src/ash_interop/tests.rs @@ -1169,7 +1169,7 @@ fn a_queried_description_derives_a_device() { dev.v11_props.subgroup_supported_stages = avk::ShaderStageFlags::ALL; dev.v11_props.subgroup_supported_operations = avk::SubgroupFeatureFlags::from_raw(0xff); let desc = dev.query().unwrap(); - Device::from_queries(desc, DevicePolicy::default()).expect("queried description derives"); + Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES).expect("queried description derives"); } #[test] diff --git a/crates/metal2vulkan/src/bind/depth_stencil_copy/tests.rs b/crates/metal2vulkan/src/bind/depth_stencil_copy/tests.rs index d92af50dd..dc5ffbf3b 100644 --- a/crates/metal2vulkan/src/bind/depth_stencil_copy/tests.rs +++ b/crates/metal2vulkan/src/bind/depth_stencil_copy/tests.rs @@ -83,8 +83,8 @@ fn each_module_needs_what_its_docs_say() { assert!(!r.features.contains(&VkFeature::SampleRateShading), "{r:?}"); } -/// Every committed device (`validation/profiles/*.json`), derived with the default policy, by -/// file stem. +/// Every committed device (`validation/profiles/*.json`), derived with the resident-table domains, +/// by file stem. fn committed_devices() -> Vec<(String, Device)> { let dir = PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("../metal2vulkan-validation/profiles"); let mut out = Vec::new(); @@ -99,7 +99,7 @@ fn committed_devices() -> Vec<(String, Device)> { .unwrap_or_default(); let text = std::fs::read_to_string(&path).expect("read"); let desc = DeviceDescription::from_khronos_json(&text, None).expect("description"); - let device = Device::from_queries(desc, DevicePolicy::default()).expect("device"); + let device = Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES).expect("device"); out.push((stem, device)); } out.sort_by(|a, b| a.0.cmp(&b.0)); diff --git a/crates/metal2vulkan/src/bind/heap/tests.rs b/crates/metal2vulkan/src/bind/heap/tests.rs index 393b4f73d..32ba67eb5 100644 --- a/crates/metal2vulkan/src/bind/heap/tests.rs +++ b/crates/metal2vulkan/src/bind/heap/tests.rs @@ -48,7 +48,7 @@ fn shape(ty: TextureType, pf: PixelFormat, samples: u32, usage: TextureUsage) -> /// The committed `moltenvk-m3` profile. fn m3() -> DeviceProfile { - crate::pipeline::testing::profile("moltenvk-m3", crate::device::DevicePolicy::default()) + crate::pipeline::testing::profile("moltenvk-m3", crate::device::DevicePolicy::RESIDENT_TABLES) .expect("profile") } @@ -1179,7 +1179,7 @@ fn sampler_tables_admit_the_shapes_the_plan_s_checks_pass() { let floor = crate::pipeline::testing::profile_without( "runtime-floor", &[crate::device::requirements::VkFeature::SamplerAnisotropy], - crate::device::DevicePolicy::default(), + crate::device::DevicePolicy::RESIDENT_TABLES, ) .expect("profile"); let placement = HeapPlacement::ResourceId; diff --git a/crates/metal2vulkan/src/bind/neutral/tests.rs b/crates/metal2vulkan/src/bind/neutral/tests.rs index a96fa0e73..ea8a156f7 100644 --- a/crates/metal2vulkan/src/bind/neutral/tests.rs +++ b/crates/metal2vulkan/src/bind/neutral/tests.rs @@ -18,7 +18,7 @@ fn committed_devices() -> Vec<(String, Device)> { let text = std::fs::read_to_string(&p).expect("profile is readable"); let desc = DeviceDescription::from_khronos_json(&text, None).expect("profile parses"); let device = - Device::from_queries(desc, DevicePolicy::default()).expect("device derives"); + Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES).expect("device derives"); (stem, device) }) .collect(); diff --git a/crates/metal2vulkan/src/bind/plan/resources/tests.rs b/crates/metal2vulkan/src/bind/plan/resources/tests.rs index 6553f1eb0..93956e2c2 100644 --- a/crates/metal2vulkan/src/bind/plan/resources/tests.rs +++ b/crates/metal2vulkan/src/bind/plan/resources/tests.rs @@ -243,9 +243,11 @@ fn a_numeric_slot_binds_either_integer_type() { class: SlotClass::Texture, index: 1, }; - let p = - crate::pipeline::testing::profile("moltenvk-m3", crate::device::DevicePolicy::default()) - .expect("profile"); + let p = crate::pipeline::testing::profile( + "moltenvk-m3", + crate::device::DevicePolicy::RESIDENT_TABLES, + ) + .expect("profile"); let slot = TextureSlot { access: TextureAccess::new(false, false, true), ..slot_iface(TextureType::Type2D, SampledType::Uint) @@ -321,9 +323,11 @@ fn a_texture_held_for_copies_alone_is_refused_at_a_float_slot() { class: SlotClass::Texture, index: 0, }; - let p = - crate::pipeline::testing::profile("moltenvk-m3", crate::device::DevicePolicy::default()) - .expect("profile"); + let p = crate::pipeline::testing::profile( + "moltenvk-m3", + crate::device::DevicePolicy::RESIDENT_TABLES, + ) + .expect("profile"); let plan = |pixel_format, access: TextureAccess, sampled_type, ty| { let slot = TextureSlot { access, @@ -630,7 +634,7 @@ fn runtime_sampler_values_are_checked_at_plan_time() { crate::pipeline::testing::profile_without( "runtime-floor", &[crate::device::requirements::VkFeature::SamplerMirrorClampToEdge], - crate::device::DevicePolicy::default(), + crate::device::DevicePolicy::RESIDENT_TABLES, ) .expect("profile"), )); @@ -939,9 +943,11 @@ fn bicubic_texels_follow_the_bound_format() { class: SlotClass::Texture, index: 0, }; - let p = - crate::pipeline::testing::profile("moltenvk-m3", crate::device::DevicePolicy::default()) - .expect("profile"); + let p = crate::pipeline::testing::profile( + "moltenvk-m3", + crate::device::DevicePolicy::RESIDENT_TABLES, + ) + .expect("profile"); let t = slot_iface(TextureType::Type2D, SampledType::Float); let slots = BTreeMap::from([(texture, SlotInterface::Texture(t))]); let plan = |pf: Option| { @@ -1014,9 +1020,11 @@ fn sampler_state_follows_the_bound_sampler() { class: SlotClass::Sampler, index: 1, }; - let p = - crate::pipeline::testing::profile("moltenvk-m3", crate::device::DevicePolicy::default()) - .expect("profile"); + let p = crate::pipeline::testing::profile( + "moltenvk-m3", + crate::device::DevicePolicy::RESIDENT_TABLES, + ) + .expect("profile"); let slots = BTreeMap::from([( slot, SlotInterface::Sampler(SamplerSlot { @@ -1296,8 +1304,11 @@ fn an_a8_texture_buffer_without_a8_unorm_views_its_bytes_in_red() { let uniform_ty = vk::DescriptorType::UNIFORM_TEXEL_BUFFER; let storage_ty = vk::DescriptorType::STORAGE_TEXEL_BUFFER; for (profile, held) in [("lavapipe", true), ("moltenvk-m3", false)] { - let p = crate::pipeline::testing::profile(profile, crate::device::DevicePolicy::default()) - .expect("profile"); + let p = crate::pipeline::testing::profile( + profile, + crate::device::DevicePolicy::RESIDENT_TABLES, + ) + .expect("profile"); let a8 = PixelFormat::A8Unorm; assert_eq!( crate::metal::format::alpha_in_red(a8, &p), diff --git a/crates/metal2vulkan/src/bind/plan/slots/tests.rs b/crates/metal2vulkan/src/bind/plan/slots/tests.rs index 1d11877a7..78a2f17e6 100644 --- a/crates/metal2vulkan/src/bind/plan/slots/tests.rs +++ b/crates/metal2vulkan/src/bind/plan/slots/tests.rs @@ -82,7 +82,8 @@ fn a_large_buffer_needs_the_device_address_variant_on_profile_a_only() { let storage = BufferForm::Descriptor(DescriptorView::Storage); let mut seen = [false; 2]; let mut profiles = committed_profiles().expect("profiles"); - let f = crate::pipeline::testing::device_f(Default::default()).expect("Profile F"); + let f = crate::pipeline::testing::device_f(crate::device::DevicePolicy::RESIDENT_TABLES) + .expect("Profile F"); profiles.push(( crate::pipeline::testing::PROFILE_F.to_string(), f.profile().clone(), @@ -147,8 +148,11 @@ fn a_large_buffer_needs_the_device_address_variant_on_profile_a_only() { /// and the slots the pipeline was compiled keeping, so the variant's plan restates it. #[test] fn a_large_viewed_slot_asks_for_every_large_candidate_to_stay_storage() { - let p = - crate::pipeline::testing::profile("runtime-floor", Default::default()).expect("profile"); + let p = crate::pipeline::testing::profile( + "runtime-floor", + crate::device::DevicePolicy::RESIDENT_TABLES, + ) + .expect("profile"); let max = u64::from(p.fields().limits.max_uniform_buffer_range); let big = BoundKind::Buffer { device_address: false, diff --git a/crates/metal2vulkan/src/bind/replay/draws/tests.rs b/crates/metal2vulkan/src/bind/replay/draws/tests.rs index fcf5aa780..9a276ad60 100644 --- a/crates/metal2vulkan/src/bind/replay/draws/tests.rs +++ b/crates/metal2vulkan/src/bind/replay/draws/tests.rs @@ -53,13 +53,13 @@ fn devices() -> Vec<(String, Device)> { let desc = DeviceDescription::from_khronos_json(&text, None).expect("description"); ( stem, - Device::from_queries(desc, DevicePolicy::default()).expect("device"), + Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES).expect("device"), ) }) .collect(); out.sort_by(|a, b| a.0.cmp(&b.0)); // Profile F, below the runtime's floor: the form of a device without device addresses. - let f = crate::pipeline::testing::device_f(DevicePolicy::default()).expect("Profile F"); + let f = crate::pipeline::testing::device_f(DevicePolicy::RESIDENT_TABLES).expect("Profile F"); out.push((crate::pipeline::testing::PROFILE_F.to_string(), f)); out } diff --git a/crates/metal2vulkan/src/bind/replay/tests.rs b/crates/metal2vulkan/src/bind/replay/tests.rs index 6c74943e0..6f4f19a56 100644 --- a/crates/metal2vulkan/src/bind/replay/tests.rs +++ b/crates/metal2vulkan/src/bind/replay/tests.rs @@ -57,13 +57,13 @@ fn devices() -> Vec<(String, Device)> { .into_owned(); let text = std::fs::read_to_string(&path).expect("profile"); let desc = DeviceDescription::from_khronos_json(&text, None).expect("description"); - let dev = Device::from_queries(desc, DevicePolicy::default()).expect("device"); + let dev = Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES).expect("device"); (stem, dev) }) .collect(); out.sort_by(|a, b| a.0.cmp(&b.0)); // Profile F, below the runtime's floor: the form of a device without device addresses. - let f = crate::pipeline::testing::device_f(DevicePolicy::default()).expect("Profile F"); + let f = crate::pipeline::testing::device_f(DevicePolicy::RESIDENT_TABLES).expect("Profile F"); out.push((crate::pipeline::testing::PROFILE_F.to_string(), f)); out } diff --git a/crates/metal2vulkan/src/bind/sample_interleave/tests.rs b/crates/metal2vulkan/src/bind/sample_interleave/tests.rs index 9e6c02128..ea89eb0b4 100644 --- a/crates/metal2vulkan/src/bind/sample_interleave/tests.rs +++ b/crates/metal2vulkan/src/bind/sample_interleave/tests.rs @@ -68,8 +68,8 @@ fn the_merge_fragment_module_is_one_per_sample_count() { } } -/// Every committed device (`validation/profiles/*.json`), derived with the default policy, by -/// file stem. +/// Every committed device (`validation/profiles/*.json`), derived with the resident-table domains, +/// by file stem. fn committed_devices() -> Vec<(String, Device)> { let dir = PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("../metal2vulkan-validation/profiles"); let mut out = Vec::new(); @@ -84,7 +84,7 @@ fn committed_devices() -> Vec<(String, Device)> { .unwrap_or_default(); let text = std::fs::read_to_string(&path).expect("read"); let desc = DeviceDescription::from_khronos_json(&text, None).expect("description"); - let device = Device::from_queries(desc, DevicePolicy::default()).expect("device"); + let device = Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES).expect("device"); out.push((stem, device)); } out.sort_by(|a, b| a.0.cmp(&b.0)); diff --git a/crates/metal2vulkan/src/bind/sample_planes/tests.rs b/crates/metal2vulkan/src/bind/sample_planes/tests.rs index b42ce4e11..c2322a0ed 100644 --- a/crates/metal2vulkan/src/bind/sample_planes/tests.rs +++ b/crates/metal2vulkan/src/bind/sample_planes/tests.rs @@ -48,8 +48,8 @@ fn each_module_needs_what_its_docs_say() { assert!(r.features.is_empty(), "{r:?}"); } -/// Every committed device (`validation/profiles/*.json`), derived with the default policy, by -/// file stem. +/// Every committed device (`validation/profiles/*.json`), derived with the resident-table domains, +/// by file stem. fn committed_devices() -> Vec<(String, Device)> { let dir = PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("../metal2vulkan-validation/profiles"); let mut out = Vec::new(); @@ -64,7 +64,7 @@ fn committed_devices() -> Vec<(String, Device)> { .unwrap_or_default(); let text = std::fs::read_to_string(&path).expect("read"); let desc = DeviceDescription::from_khronos_json(&text, None).expect("description"); - let device = Device::from_queries(desc, DevicePolicy::default()).expect("device"); + let device = Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES).expect("device"); out.push((stem, device)); } out.sort_by(|a, b| a.0.cmp(&b.0)); diff --git a/crates/metal2vulkan/src/cache/tests.rs b/crates/metal2vulkan/src/cache/tests.rs index 17f714ce1..38e28a5f6 100644 --- a/crates/metal2vulkan/src/cache/tests.rs +++ b/crates/metal2vulkan/src/cache/tests.rs @@ -37,14 +37,14 @@ fn fixture(stem: &str) -> Option> { } } -/// Committed profile `stem` as a device with the default policy. +/// Committed profile `stem` as a device with the resident-table domains. fn device(stem: &str) -> Device { let path = Path::new(env!("CARGO_MANIFEST_DIR")) .join("../metal2vulkan-validation/profiles") .join(format!("{stem}.json")); let text = std::fs::read_to_string(&path).expect("profile"); let desc = DeviceDescription::from_khronos_json(&text, None).expect("description"); - Device::from_queries(desc, DevicePolicy::default()).expect("device") + Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES).expect("device") } /// `store_const` compiled on `dev`, with its compute pipeline. @@ -1374,7 +1374,7 @@ fn the_storage_view_variant_round_trips() { use crate::cache::VariantKey; use crate::pipeline::facts::{RuntimeFact, UniformViewChoice}; // Profile F's descriptor buffers: four storage buffers a stage, below the runtime's floor. - let dev = crate::pipeline::testing::device_f(DevicePolicy::default()).expect("device"); + let dev = crate::pipeline::testing::device_f(DevicePolicy::RESIDENT_TABLES).expect("device"); let Some(bc) = fixture("descriptor_limit_uniform_views") else { return; }; diff --git a/crates/metal2vulkan/src/device/mod.rs b/crates/metal2vulkan/src/device/mod.rs index 75c2ffade..51f5afd7c 100644 --- a/crates/metal2vulkan/src/device/mod.rs +++ b/crates/metal2vulkan/src/device/mod.rs @@ -13,7 +13,7 @@ //! //! [`Device::from_queries`] derives an opaque [`DeviceProfile`] from the description's Vulkan //! queries and a [`DevicePolicy`], the consumer's product choices (the pointer and handle -//! domains; the default is [`DevicePolicy::UNTRUSTED`]); no +//! domains; the default is the runtime's, the identity domains); no //! driver or GPU identity decides anything, and no `VkDevice` is needed. It refuses a device below Vulkan //! 1.2 and an inconsistent description or policy. A [`Device`] is cheap to clone, and every //! compile and plan takes one: diff --git a/crates/metal2vulkan/src/device/policy.rs b/crates/metal2vulkan/src/device/policy.rs index ad21a6515..fe64df91e 100644 --- a/crates/metal2vulkan/src/device/policy.rs +++ b/crates/metal2vulkan/src/device/policy.rs @@ -5,28 +5,41 @@ use crate::device::profile::{HandleDomain, PointerDomain}; /// Policy inputs of `Device::from_queries`. Every field can change emitted code, so the profile /// carries it and its fingerprint covers it. +/// +/// [`DevicePolicy::default`] is the one constructor: the runtime compiles under it, and the +/// command line, the compile worker and every validation tool take their policy from it, so a +/// tool compiles what the runtime does. [`DevicePolicy::RESIDENT_TABLES`] is the validation +/// executor's alone. #[non_exhaustive] #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] pub struct DevicePolicy { - /// How pointer values resolve to resources: `ResidentTable`, or `Identity` with - /// `handle_domain` `Identity`. + /// How pointer values resolve to resources: `Identity` with `handle_domain` `Identity` (the + /// default), or `ResidentTable` with `Table` (the validation executor's). pub pointer_domain: PointerDomain, - /// How resource handles resolve: `Table`, or `Identity` with `pointer_domain` `Identity`. + /// How resource handles resolve: `Identity` with `pointer_domain` `Identity` (the default), or + /// `Table` with `ResidentTable` (the validation executor's). pub handle_domain: HandleDomain, } impl DevicePolicy { - /// The default domains: a resident table of pointers and a handle table. - pub const UNTRUSTED: DevicePolicy = DevicePolicy { + /// A resident table of pointers and a handle table, for the validation executor alone, which + /// builds the resident root and the handle table itself. + pub const RESIDENT_TABLES: DevicePolicy = DevicePolicy { pointer_domain: PointerDomain::ResidentTable, handle_domain: HandleDomain::Table, }; } impl Default for DevicePolicy { - /// [`DevicePolicy::UNTRUSTED`]. + /// The identity domains, the runtime's: a pointer is the device address it holds and a + /// texture's or sampler's handle is its `gpuResourceID` ([`PointerDomain::Identity`], + /// [`HandleDomain::Identity`]). `Device::from_queries` refuses them on a device without + /// `bufferDeviceAddress` and `shaderInt64` (`Feature::IdentityDomains`). fn default() -> DevicePolicy { - DevicePolicy::UNTRUSTED + DevicePolicy { + pointer_domain: PointerDomain::Identity, + handle_domain: HandleDomain::Identity, + } } } diff --git a/crates/metal2vulkan/src/device/profile.rs b/crates/metal2vulkan/src/device/profile.rs index 1ac13853f..7023f3c3d 100644 --- a/crates/metal2vulkan/src/device/profile.rs +++ b/crates/metal2vulkan/src/device/profile.rs @@ -445,11 +445,14 @@ pub enum BufferAccess { #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] pub enum PointerDomain { - /// The sorted resident set of bound arguments and used resources. + /// The sorted resident set of bound arguments and used resources. It exists for the + /// validation executor only + /// ([`DevicePolicy::RESIDENT_TABLES`](crate::device::DevicePolicy::RESIDENT_TABLES)), which + /// builds the resident root itself. ResidentTable, /// Pointers are device addresses used directly: a `device` or `constant` pointer is the /// 64-bit Vulkan device address of the byte it names, as Metal's `gpuAddress` is, and a - /// buffer slot is reached at its own address, pushed, uncontained, and a pointer loaded from + /// buffer slot is reached at its own address, pushed, and a pointer loaded from /// memory or made from an integer is the address it holds, used directly. Needs /// `bufferDeviceAddress` and `shaderInt64`. So far it lowers a kernel that reaches memory /// only through its buffer slots and such addresses, and, on `Device::from_queries`' profile, @@ -464,12 +467,14 @@ pub enum PointerDomain { #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] pub enum HandleDomain { - /// The handle table plus the set-1 heap. + /// The handle table plus the set-1 heap. It exists for the validation executor only + /// ([`DevicePolicy::RESIDENT_TABLES`](crate::device::DevicePolicy::RESIDENT_TABLES)), which + /// builds the handle table itself. Table, /// A texture's or sampler's handle is its `gpuResourceID`: the low 32 bits index the /// pipeline's descriptor arrays and the high 32 bits are the word of its Metal descriptor - /// (`docs/RESOURCE-ID.md`). No function that reads a texture or a sampler compiles under it - /// yet: it is refused as [`Feature::IdentityDomains`](crate::error::Feature::IdentityDomains). + /// (`docs/RESOURCE-ID.md`). A texture or sampler use with no form under it is refused as + /// [`Feature::IdentityDomains`](crate::error::Feature::IdentityDomains). Identity, } diff --git a/crates/metal2vulkan/src/device/tests/description.rs b/crates/metal2vulkan/src/device/tests/description.rs index 24ac0e164..e0dd1d6f8 100644 --- a/crates/metal2vulkan/src/device/tests/description.rs +++ b/crates/metal2vulkan/src/device/tests/description.rs @@ -202,8 +202,8 @@ fn rgba4_opaque_black_swizzled_follows_exposure() { assert!(d.rgba4_opaque_black_swizzled); // The push window the floor needs, which a Vulkan 1.2 document leaves at 128. d.limits.max_push_constants_size = 256; - let dev = - crate::device::Device::from_queries(d, crate::device::DevicePolicy::default()).unwrap(); + let dev = crate::device::Device::from_queries(d, crate::device::DevicePolicy::RESIDENT_TABLES) + .unwrap(); assert!(dev .profile() .fields() @@ -242,8 +242,8 @@ fn the_arm_spelling_of_rasterization_order_access_is_the_ext_one() { assert!(d.has(VkFeature::RasterizationOrderColorAttachmentAccess)); // The push window the floor needs, which a Vulkan 1.2 document leaves at 128. d.limits.max_push_constants_size = 256; - let dev = - crate::device::Device::from_queries(d, crate::device::DevicePolicy::default()).unwrap(); + let dev = crate::device::Device::from_queries(d, crate::device::DevicePolicy::RESIDENT_TABLES) + .unwrap(); assert!( dev.profile() .fields() @@ -812,7 +812,7 @@ fn descriptions_and_policies_round_trip_through_serde() { pointer_domain: crate::device::PointerDomain::Identity, handle_domain: crate::device::HandleDomain::Identity, }; - let policies = [DevicePolicy::default(), identity]; + let policies = [DevicePolicy::RESIDENT_TABLES, identity]; for (stem, text) in committed_profiles() { let description = DeviceDescription::from_khronos_json(&text, None).unwrap(); let json = serde_json::to_string(&description).unwrap(); diff --git a/crates/metal2vulkan/src/device/tests/enables.rs b/crates/metal2vulkan/src/device/tests/enables.rs index 1a8a391bb..9d5d03382 100644 --- a/crates/metal2vulkan/src/device/tests/enables.rs +++ b/crates/metal2vulkan/src/device/tests/enables.rs @@ -103,10 +103,10 @@ fn recommendations_are_closed_fixed_points_on_every_committed_profile() { .clone() .with_enabled(&rec) .unwrap_or_else(|e| panic!("{stem}: {e}")); - let dev = Device::from_queries(restricted, DevicePolicy::default()) + let dev = Device::from_queries(restricted, DevicePolicy::RESIDENT_TABLES) .unwrap_or_else(|e| panic!("{stem}: {e}")); assert_eq!(dev.required_enables(), rec, "{stem}"); - let full = Device::from_queries(desc.clone(), DevicePolicy::default()).unwrap(); + let full = Device::from_queries(desc.clone(), DevicePolicy::RESIDENT_TABLES).unwrap(); assert_eq!(full.required_enables(), rec, "{stem}"); assert_eq!( rec.extensions.contains(&VkExtension::KhrPortabilitySubset), @@ -147,9 +147,9 @@ fn recommendations_keep_robust_buffer_access_and_vuid_10247() { assert_eq!(rec.features.contains(f), reported, "{reported}: {f:?}"); } let restricted = d.clone().with_enabled(&rec).unwrap(); - let dev = Device::from_queries(restricted, DevicePolicy::default()).unwrap(); + let dev = Device::from_queries(restricted, DevicePolicy::RESIDENT_TABLES).unwrap(); assert_eq!(dev.required_enables(), rec, "{reported}"); - let whole = Device::from_queries(d.clone(), DevicePolicy::default()).unwrap(); + let whole = Device::from_queries(d.clone(), DevicePolicy::RESIDENT_TABLES).unwrap(); assert_eq!(whole.required_enables(), rec, "{reported}"); } } @@ -177,13 +177,13 @@ fn a_recommendation_keeps_vuid_10247() { .features .contains(&VkFeature::DescriptorBindingSampledImageUpdateAfterBind)); let restricted = desc.clone().with_enabled(&rec).unwrap(); - let stated = Device::from_queries(restricted.clone(), DevicePolicy::default()).unwrap(); + let stated = Device::from_queries(restricted.clone(), DevicePolicy::RESIDENT_TABLES).unwrap(); assert_eq!(stated.required_enables(), rec); let mut with_buffers = restricted; with_buffers .features .extend(BUFFER_UPDATE_AFTER_BIND.iter().copied()); - let both = Device::from_queries(with_buffers, DevicePolicy::default()).unwrap(); + let both = Device::from_queries(with_buffers, DevicePolicy::RESIDENT_TABLES).unwrap(); assert_eq!(both.required_enables(), rec); let mut fields = both.profile().fields().clone(); assert!(fields.descriptors.update_after_bind_storage_buffer); @@ -286,7 +286,7 @@ fn extended_dynamic_state2_is_enabled_below_1_3_and_implied_from_it() { } let dev = Device::from_queries( d.clone().with_enabled(&rec).unwrap(), - DevicePolicy::default(), + DevicePolicy::RESIDENT_TABLES, ) .unwrap(); let enabled = &dev.profile().fields().enabled; @@ -449,13 +449,13 @@ fn device_new_refuses_a_feature_without_its_companion() { } let mut d = floor_with(&[VkExtension::ExtRobustness2], &[f]); d.features.remove(&needs); - let e = match Device::from_queries(d.clone(), DevicePolicy::default()) { + let e = match Device::from_queries(d.clone(), DevicePolicy::RESIDENT_TABLES) { Err(Error::InvalidDescriptor(DescriptorError::DeviceDescription { detail })) => detail, other => panic!("{other:?}"), }; assert!(e.contains(vuid), "{e}"); d.features.insert(needs); - Device::from_queries(d, DevicePolicy::default()).unwrap(); + Device::from_queries(d, DevicePolicy::RESIDENT_TABLES).unwrap(); } } @@ -685,7 +685,7 @@ fn required_enables_follow_version_dependencies_formats_and_flags() { fn device_new_refuses_unexposed_features() { let mut d = profile("runtime-floor"); d.features.insert(VkFeature::Maintenance8); - let e = match Device::from_queries(d.clone(), DevicePolicy::default()) { + let e = match Device::from_queries(d.clone(), DevicePolicy::RESIDENT_TABLES) { Err(Error::InvalidDescriptor(DescriptorError::DeviceDescription { detail })) => detail, other => panic!("{other:?}"), }; @@ -694,7 +694,7 @@ fn device_new_refuses_unexposed_features() { "{e}" ); d.extensions.insert(VkExtension::KhrMaintenance8); - Device::from_queries(d, DevicePolicy::default()).unwrap(); + Device::from_queries(d, DevicePolicy::RESIDENT_TABLES).unwrap(); } /// The profile's format tables hold only formats the description exposes: a queried description @@ -735,7 +735,7 @@ fn profile_format_tables_hold_only_exposed_formats() { let entry = d.formats.formats[&vk::Format::R8_UNORM]; d.formats.formats.insert(vk::Format::A8_UNORM, entry); let a8 = |d: &DeviceDescription| { - Device::from_queries(d.clone(), DevicePolicy::default()) + Device::from_queries(d.clone(), DevicePolicy::RESIDENT_TABLES) .unwrap() .profile() .supports_format(vk::Format::A8_UNORM, FormatUsage::SampledImage) @@ -764,7 +764,7 @@ fn a_storage_read_without_a_format_is_enabled_by_the_feature_the_version_or_the_ reads.spirv_capabilities.insert(SpirvCapability::of( crate::spv::Capability::StorageImageReadWithoutFormat, )); - let policy = DevicePolicy::default(); + let policy = DevicePolicy::RESIDENT_TABLES; let open = |desc: &DeviceDescription| { let enabled = desc.recommended_enables(); let opened = desc.clone().with_enabled(&enabled).unwrap(); diff --git a/crates/metal2vulkan/src/device/tests/from_queries.rs b/crates/metal2vulkan/src/device/tests/from_queries.rs index b4e7bec34..3d79f8866 100644 --- a/crates/metal2vulkan/src/device/tests/from_queries.rs +++ b/crates/metal2vulkan/src/device/tests/from_queries.rs @@ -52,7 +52,7 @@ fn from_queries_derives_one_profile_whatever_the_identity() { other.vendor_id = vendor; other.device_id = device; other.device_type = Some(kind); - Device::from_queries(other, DevicePolicy::default()) + Device::from_queries(other, DevicePolicy::RESIDENT_TABLES) .ok() .map(|d| d.profile().clone()) }) @@ -154,7 +154,7 @@ fn a_push_window_below_256_bytes_is_below_the_floor() { for stem in &below { let text = std::fs::read_to_string(dir.join(format!("{stem}.json"))).expect("readable"); let description = DeviceDescription::from_khronos_json(&text, None).expect("parses"); - match Device::from_queries(description, DevicePolicy::default()) { + match Device::from_queries(description, DevicePolicy::RESIDENT_TABLES) { Err(Error::Unsupported(u)) => { assert_eq!(u.feature, Feature::PushWindow, "{stem}"); let limit = Capability::Limit { @@ -168,7 +168,7 @@ fn a_push_window_below_256_bytes_is_below_the_floor() { } } for (stem, _) in committed_profiles() { - if let Err(e) = Device::from_queries(profile(&stem), DevicePolicy::default()) { + if let Err(e) = Device::from_queries(profile(&stem), DevicePolicy::RESIDENT_TABLES) { panic!("{stem} is committed but below the floor: {e}"); } } @@ -193,7 +193,7 @@ fn from_queries_records_the_device_denormals_of_a_float_product() { }; let mut compiled = 0; for (stem, _) in committed_profiles() { - let Ok(device) = Device::from_queries(profile(&stem), DevicePolicy::default()) else { + let Ok(device) = Device::from_queries(profile(&stem), DevicePolicy::RESIDENT_TABLES) else { continue; }; let a = compile(&bc, "mixed_products", device.profile()) @@ -253,7 +253,7 @@ fn from_queries_clears_a_narrow_value_by_an_and_on_ga10x() { .count(); (ands, extracts) }; - let queried = Device::from_queries(desc, DevicePolicy::default()).unwrap(); + let queried = Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES).unwrap(); let (ands, extracts) = counts(queried.profile()); assert!(ands > 0, "from_queries: no AND"); assert_eq!(extracts, 0, "from_queries: an extract"); diff --git a/crates/metal2vulkan/src/device/tests/mechanism.rs b/crates/metal2vulkan/src/device/tests/mechanism.rs index 19a27a467..1606477f9 100644 --- a/crates/metal2vulkan/src/device/tests/mechanism.rs +++ b/crates/metal2vulkan/src/device/tests/mechanism.rs @@ -553,7 +553,8 @@ fn profile_dependent_rows_differ_where_the_design_says() { below.features.remove(&f); } let floor = - crate::device::Device::from_queries(below, crate::device::DevicePolicy::default()).unwrap(); + crate::device::Device::from_queries(below, crate::device::DevicePolicy::RESIDENT_TABLES) + .unwrap(); let addressed = device("nvidia-rtx50-linux"); assert_eq!(mechanism(&range, floor.profile()), Mechanism::PlanTimeCheck); assert_eq!(mechanism(&range, addressed.profile()), Mechanism::Variant); diff --git a/crates/metal2vulkan/src/device/tests/profile.rs b/crates/metal2vulkan/src/device/tests/profile.rs index 1ed4e6e9f..ecc3f12b0 100644 --- a/crates/metal2vulkan/src/device/tests/profile.rs +++ b/crates/metal2vulkan/src/device/tests/profile.rs @@ -6,19 +6,20 @@ use crate::device::requirements::{Requirements, StageCreateFlag, VkLimit, VkProp use crate::error::{Capability, Feature, Needs}; pub(crate) fn device(stem: &str) -> Device { - Device::from_queries(profile(stem), DevicePolicy::default()).expect("committed profile derives") + Device::from_queries(profile(stem), DevicePolicy::RESIDENT_TABLES) + .expect("committed profile derives") } #[test] fn every_committed_profile_derives() { for (stem, text) in committed_profiles() { let desc = DeviceDescription::from_khronos_json(&text, None).unwrap(); - let dev = Device::from_queries(desc.clone(), DevicePolicy::default()) + let dev = Device::from_queries(desc.clone(), DevicePolicy::RESIDENT_TABLES) .unwrap_or_else(|e| panic!("{stem}: {e}")); let f = dev.profile().fields(); assert_eq!(f.api_version, desc.api_version, "{stem}"); // Deterministic. - let again = Device::from_queries(desc, DevicePolicy::default()).unwrap(); + let again = Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES).unwrap(); assert_eq!(dev.profile(), again.profile(), "{stem}"); assert_eq!(dev.profile().fingerprint(), again.profile().fingerprint()); // A profile satisfies the requirements of everything it enabled. @@ -56,7 +57,7 @@ fn occlusion_query_precise_follows_each_source() { stated, "{stem}" ); - let dev = Device::from_queries(desc, DevicePolicy::default()).unwrap(); + let dev = Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES).unwrap(); let enabled = &dev.profile().fields().enabled.features; assert_eq!( enabled.contains(&VkFeature::OcclusionQueryPrecise), @@ -89,7 +90,7 @@ fn depth_bias_control_follows_each_source() { let desc = DeviceDescription::from_khronos_json(&text, None).unwrap(); let has_extension = desc.extensions.contains(&VkExtension::ExtDepthBiasControl); assert_eq!(has_extension, stated.is_some(), "{stem}"); - let dev = Device::from_queries(desc.clone(), DevicePolicy::default()).unwrap(); + let dev = Device::from_queries(desc.clone(), DevicePolicy::RESIDENT_TABLES).unwrap(); let enabled = &dev.profile().fields().enabled; for (member, feature) in features { let want = stated @@ -146,7 +147,8 @@ fn memory_profiles_follow_bda_and_int64() { &[VkFeature::BufferDeviceAddress, VkFeature::ShaderInt64][..], &[VkFeature::ShaderInt64], ] { - let dev = Device::from_queries(floor_without(without), DevicePolicy::default()).unwrap(); + let dev = + Device::from_queries(floor_without(without), DevicePolicy::RESIDENT_TABLES).unwrap(); assert_eq!( dev.profile().fields().buffer_access, BufferAccess::Floor, @@ -177,7 +179,7 @@ fn addressed_needs_name_only_the_missing_features() { let bda = Capability::Feature(VkFeature::BufferDeviceAddress); let int64 = Capability::Feature(VkFeature::ShaderInt64); let needs = |without: &[VkFeature]| { - Device::from_queries(floor_without(without), DevicePolicy::default()) + Device::from_queries(floor_without(without), DevicePolicy::RESIDENT_TABLES) .unwrap() .profile() .addressed_needs() @@ -243,12 +245,12 @@ fn vertex_layer_and_viewport_outputs_follow_the_features_not_the_extension() { assert!(desc .extensions .contains(&VkExtension::ExtShaderViewportIndexLayer)); - let full = Device::from_queries(desc.clone(), DevicePolicy::default()).unwrap(); + let full = Device::from_queries(desc.clone(), DevicePolicy::RESIDENT_TABLES).unwrap(); let f = full.profile().fields(); assert!(f.fragment.output_layer && f.fragment.output_viewport_index); assert!(desc.features.remove(&VkFeature::ShaderOutputLayer)); assert!(desc.features.remove(&VkFeature::ShaderOutputViewportIndex)); - let lacking = Device::from_queries(desc, DevicePolicy::default()).unwrap(); + let lacking = Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES).unwrap(); let f = lacking.profile().fields(); assert!(!f.fragment.output_layer); assert!(!f.fragment.output_viewport_index); @@ -281,7 +283,7 @@ fn robustness2_selects_the_rba2_encoding() { fn below_1_2_is_refused() { let mut desc = profile("runtime-floor"); desc.api_version = ApiVersion { major: 1, minor: 1 }; - match Device::from_queries(desc, DevicePolicy::default()) { + match Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES) { Err(Error::Unsupported(u)) => { assert_eq!(u.feature, Feature::VulkanVersion); assert_eq!( @@ -301,16 +303,16 @@ fn the_identity_domains_come_as_a_pair_on_a_device_with_addresses() { let identity = DevicePolicy { pointer_domain: PointerDomain::Identity, handle_domain: HandleDomain::Identity, - ..DevicePolicy::default() + ..DevicePolicy::RESIDENT_TABLES }; for half in [ DevicePolicy { pointer_domain: PointerDomain::Identity, - ..DevicePolicy::default() + ..DevicePolicy::RESIDENT_TABLES }, DevicePolicy { handle_domain: HandleDomain::Identity, - ..DevicePolicy::default() + ..DevicePolicy::RESIDENT_TABLES }, ] { assert!( @@ -338,7 +340,7 @@ fn the_identity_domains_come_as_a_pair_on_a_device_with_addresses() { #[test] fn fingerprint_covers_every_policy_field() { let desc = profile("lavapipe"); - let base = DevicePolicy::default(); + let base = DevicePolicy::RESIDENT_TABLES; let fp = |p: DevicePolicy| { Device::from_queries(desc.clone(), p) .unwrap() @@ -455,7 +457,7 @@ fn allocation_sizes_are_no_profile_field() { ] { let mut other = desc.clone(); other.allocation = AllocationLimits::new(memory, buffer); - let dev = Device::from_queries(other, DevicePolicy::default()).unwrap(); + let dev = Device::from_queries(other, DevicePolicy::RESIDENT_TABLES).unwrap(); assert_eq!(dev.profile(), base.profile(), "{stem}"); assert_eq!( dev.profile().fingerprint(), @@ -563,7 +565,7 @@ fn check_reports_the_first_missing_capability() { // `computeFullSubgroups`, a device below it, names it. let without = Device::from_queries( floor_without(&[VkFeature::ComputeFullSubgroups]), - DevicePolicy::default(), + DevicePolicy::RESIDENT_TABLES, ) .unwrap(); assert_eq!( @@ -647,14 +649,14 @@ fn storage_without_format_follows_each_format() { U::StorageTexelBufferReadWithoutFormat, U::StorageTexelBufferWriteWithoutFormat, ]; - let dev = Device::from_queries(desc.clone(), DevicePolicy::default()).unwrap(); + let dev = Device::from_queries(desc.clone(), DevicePolicy::RESIDENT_TABLES).unwrap(); assert_eq!(usages(&dev, vk::Format::R32_UINT), all); assert_eq!(usages(&dev, vk::Format::B8G8R8A8_UNORM), []); let mut write_only = desc.clone(); write_only .features .remove(&VkFeature::ShaderStorageImageReadWithoutFormat); - let dev = Device::from_queries(write_only, DevicePolicy::default()).unwrap(); + let dev = Device::from_queries(write_only, DevicePolicy::RESIDENT_TABLES).unwrap(); assert_eq!( usages(&dev, vk::Format::R32_UINT), [ @@ -667,7 +669,7 @@ fn storage_without_format_follows_each_format() { // extension at 1.2 reports them as Vulkan 1.3 does. desc.khr_format_feature_flags2 = true; assert!(desc.has_format_feature_flags2()); - let dev = Device::from_queries(desc.clone(), DevicePolicy::default()).unwrap(); + let dev = Device::from_queries(desc.clone(), DevicePolicy::RESIDENT_TABLES).unwrap(); assert_eq!( usages(&dev, vk::Format::R32_UINT), [ @@ -683,7 +685,7 @@ fn storage_without_format_follows_each_format() { F::STORAGE_READ_WITHOUT_FORMAT, ), ); - let dev = Device::from_queries(desc.clone(), DevicePolicy::default()).unwrap(); + let dev = Device::from_queries(desc.clone(), DevicePolicy::RESIDENT_TABLES).unwrap(); assert_eq!( usages(&dev, vk::Format::B8G8R8A8_UNORM), [ @@ -694,7 +696,7 @@ fn storage_without_format_follows_each_format() { // The implication needs the feature. desc.features .remove(&VkFeature::ShaderStorageImageReadWithoutFormat); - let dev = Device::from_queries(desc, DevicePolicy::default()).unwrap(); + let dev = Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES).unwrap(); assert_eq!( usages(&dev, vk::Format::R32_UINT), [U::StorageImageWriteWithoutFormat] @@ -751,7 +753,7 @@ fn from_queries_half_rounding_follows_the_queries_alone() { let mut controlled = Vec::new(); for (stem, text) in committed_profiles() { let desc = DeviceDescription::from_khronos_json(&text, None).unwrap(); - let device = Device::from_queries(desc, DevicePolicy::default()).unwrap(); + let device = Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES).unwrap(); let p = device.profile(); if half_controls(p) { assert_eq!(quantize_form(p), QuantizeForm::Controlled, "{stem}"); diff --git a/crates/metal2vulkan/src/device/tests/render_vocabulary.rs b/crates/metal2vulkan/src/device/tests/render_vocabulary.rs index ba1496d02..13d7ce813 100644 --- a/crates/metal2vulkan/src/device/tests/render_vocabulary.rs +++ b/crates/metal2vulkan/src/device/tests/render_vocabulary.rs @@ -145,7 +145,7 @@ fn render_features_follow_each_source() { for (stem, text) in committed_profiles() { let json: Value = serde_json::from_str(&text).unwrap(); let desc = DeviceDescription::from_khronos_json(&text, None).unwrap(); - let dev = Device::from_queries(desc.clone(), DevicePolicy::default()).unwrap(); + let dev = Device::from_queries(desc.clone(), DevicePolicy::RESIDENT_TABLES).unwrap(); let enabled = &dev.profile().fields().enabled; for (structure, member, feature, extension) in FEATURES { let exposed = extension.is_none_or(|e| desc.extensions.contains(&e)); @@ -216,7 +216,7 @@ fn render_properties_and_limits_follow_each_source() { for (stem, text) in committed_profiles() { let json: Value = serde_json::from_str(&text).unwrap(); let desc = DeviceDescription::from_khronos_json(&text, None).unwrap(); - let dev = Device::from_queries(desc.clone(), DevicePolicy::default()).unwrap(); + let dev = Device::from_queries(desc.clone(), DevicePolicy::RESIDENT_TABLES).unwrap(); let properties = &dev.profile().fields().enabled.properties; let depth = stated_flags(&json, "supportedDepthResolveModes"); let stencil = stated_flags(&json, "supportedStencilResolveModes"); @@ -299,7 +299,7 @@ fn each_stated_color_attachment_sample_count_derives_its_property() { for (stem, text) in committed_profiles() { let json: Value = serde_json::from_str(&text).unwrap(); let desc = DeviceDescription::from_khronos_json(&text, None).unwrap(); - let dev = Device::from_queries(desc.clone(), DevicePolicy::default()).unwrap(); + let dev = Device::from_queries(desc.clone(), DevicePolicy::RESIDENT_TABLES).unwrap(); let derived: BTreeSet<(vk::Format, u32)> = dev .profile() .fields() @@ -379,7 +379,7 @@ fn the_provoking_vertex_mode_per_pipeline_follows_each_source() { for (stem, text) in committed_profiles() { let json: Value = serde_json::from_str(&text).unwrap(); let desc = DeviceDescription::from_khronos_json(&text, None).unwrap(); - let dev = Device::from_queries(desc.clone(), DevicePolicy::default()).unwrap(); + let dev = Device::from_queries(desc.clone(), DevicePolicy::RESIDENT_TABLES).unwrap(); let properties = &dev.profile().fields().enabled.properties; let exposed = desc.extensions.contains(&VkExtension::ExtProvokingVertex); let stated = stated_true( diff --git a/crates/metal2vulkan/src/lower/dispatch/tests.rs b/crates/metal2vulkan/src/lower/dispatch/tests.rs index 68e1c5b12..96d027183 100644 --- a/crates/metal2vulkan/src/lower/dispatch/tests.rs +++ b/crates/metal2vulkan/src/lower/dispatch/tests.rs @@ -778,7 +778,7 @@ fn builtin_facts_and_projections() { #[test] fn derivation_modules_are_valid() { for stem in ["moltenvk-m3", "runtime-floor"] { - let p = crate::pipeline::testing::profile(stem, DevicePolicy::default()).expect(stem); + let p = crate::pipeline::testing::profile(stem, DevicePolicy::RESIDENT_TABLES).expect(stem); for form in [LocalSizeForm::Spec, LocalSizeForm::Flat] { for mr in [false, true] { assert_valid(module(&plan(form, mr)), &p); @@ -899,7 +899,7 @@ fn the_flat_variant_s_64_bit_division_is_exact() { ) .expect("entry"); let m = mb.finalize().expect("finalize"); - let p = crate::pipeline::testing::profile("intel-arl-anv", DevicePolicy::default()) + let p = crate::pipeline::testing::profile("intel-arl-anv", DevicePolicy::RESIDENT_TABLES) .expect("profile"); assert_valid(m.clone(), &p); let bytes: Vec = cases diff --git a/crates/metal2vulkan/src/lower/fragment/fetch/tests.rs b/crates/metal2vulkan/src/lower/fragment/fetch/tests.rs index b0e8a6304..36f7aa90e 100644 --- a/crates/metal2vulkan/src/lower/fragment/fetch/tests.rs +++ b/crates/metal2vulkan/src/lower/fragment/fetch/tests.rs @@ -16,7 +16,7 @@ fn profile(stem: &str, features: &[VkFeature]) -> DeviceProfile { for f in features { desc.features.remove(f); } - Device::from_queries(desc, DevicePolicy::default()) + Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES) .expect("device") .profile() .clone() @@ -31,7 +31,7 @@ fn profile_with(stem: &str, features: &[VkFeature], flags2: bool) -> DeviceProfi for f in features { desc.features.remove(f); } - Device::from_queries(desc, DevicePolicy::default()) + Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES) .expect("device") .profile() .clone() diff --git a/crates/metal2vulkan/src/lower/fragment/stencil/tests.rs b/crates/metal2vulkan/src/lower/fragment/stencil/tests.rs index fb6d8dc66..a1a25a17d 100644 --- a/crates/metal2vulkan/src/lower/fragment/stencil/tests.rs +++ b/crates/metal2vulkan/src/lower/fragment/stencil/tests.rs @@ -15,7 +15,7 @@ fn profile(stem: &str, features: &[VkFeature]) -> DeviceProfile { for f in features { desc.features.remove(f); } - Device::from_queries(desc, DevicePolicy::default()) + Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES) .expect("device") .profile() .clone() diff --git a/crates/metal2vulkan/src/lower/sampler/anisotropic/tests.rs b/crates/metal2vulkan/src/lower/sampler/anisotropic/tests.rs index 91ea96556..60873b720 100644 --- a/crates/metal2vulkan/src/lower/sampler/anisotropic/tests.rs +++ b/crates/metal2vulkan/src/lower/sampler/anisotropic/tests.rs @@ -127,7 +127,7 @@ declare { <4 x float>, i8 } @air.sample_texture_2d_grad.v4f32(ptr addrspace(1), fn p(stem: &str) -> DeviceProfile { let mut desc = crate::pipeline::testing::description(stem).expect(stem); desc.features.remove(&VkFeature::SamplerAnisotropy); - Device::from_queries(desc, DevicePolicy::default()) + Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES) .expect(stem) .profile() .clone() @@ -136,7 +136,7 @@ fn p(stem: &str) -> DeviceProfile { /// Committed profile `stem` as described, `samplerAnisotropy` included: the device's own /// anisotropic filter. fn full(stem: &str) -> DeviceProfile { - profile(stem, DevicePolicy::default()).expect(stem) + profile(stem, DevicePolicy::RESIDENT_TABLES).expect(stem) } fn ok(bc: &[u8], entry: &str, p: &DeviceProfile) -> std::sync::Arc { @@ -344,7 +344,7 @@ fn a_bound_anisotropic_sampler_asks_for_the_variant() { let text = std::fs::read_to_string(&path).expect("profile"); let mut desc = DeviceDescription::from_khronos_json(&text, None).expect("description"); assert!(desc.features.remove(&VkFeature::SamplerAnisotropy)); - let dev = Device::from_queries(desc, DevicePolicy::default()).expect("device"); + let dev = Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES).expect("device"); let pipeline = |inputs: &LoweringInputs| { let function = Library::from_air(&bc) .and_then(|lib| lib.function("k")) @@ -617,7 +617,7 @@ fn without_sampler_anisotropy_metals_filter_is_emulated() { let fact = RuntimeFact::AnisotropicSampler { slot: SLOT }; for withheld in [false, true] { let what = format!("samplerAnisotropy withheld {withheld}"); - let p = anisotropy_of("lavapipe", DevicePolicy::default(), withheld); + let p = anisotropy_of("lavapipe", DevicePolicy::RESIDENT_TABLES, withheld); let device = !withheld; let a = ok(&constexpr, "k", &p); assert_eq!( diff --git a/crates/metal2vulkan/src/lower/sampler/constexpr.rs b/crates/metal2vulkan/src/lower/sampler/constexpr.rs index 2452d5dd4..eb07ff58a 100644 --- a/crates/metal2vulkan/src/lower/sampler/constexpr.rs +++ b/crates/metal2vulkan/src/lower/sampler/constexpr.rs @@ -314,7 +314,7 @@ mod tests { use crate::error::Needs; fn profile(stem: &str) -> DeviceProfile { - crate::pipeline::testing::profile(stem, DevicePolicy::default()).expect("profile") + crate::pipeline::testing::profile(stem, DevicePolicy::RESIDENT_TABLES).expect("profile") } /// The words of the public fixtures' constexpr samplers (bit 63 clear). diff --git a/crates/metal2vulkan/src/lower/sync/barrier/tests.rs b/crates/metal2vulkan/src/lower/sync/barrier/tests.rs index 01232eb73..a9331ec2d 100644 --- a/crates/metal2vulkan/src/lower/sync/barrier/tests.rs +++ b/crates/metal2vulkan/src/lower/sync/barrier/tests.rs @@ -195,7 +195,11 @@ fn vulkan_model_profile() -> (String, DeviceProfile) { #[test] fn emitted_barriers_order_memory_and_validate() { let (stem, vk) = vulkan_model_profile(); - let glsl = crate::pipeline::testing::profile("moltenvk-m3", Default::default()).expect("m3"); + let glsl = crate::pipeline::testing::profile( + "moltenvk-m3", + crate::device::DevicePolicy::RESIDENT_TABLES, + ) + .expect("m3"); for model in [BarrierModel::Glsl450, BarrierModel::Vulkan] { for (scope, fence) in [ (Scope::Workgroup, None), diff --git a/crates/metal2vulkan/src/lower/sync/memory_model/tests.rs b/crates/metal2vulkan/src/lower/sync/memory_model/tests.rs index 9cc51b16f..f84f28631 100644 --- a/crates/metal2vulkan/src/lower/sync/memory_model/tests.rs +++ b/crates/metal2vulkan/src/lower/sync/memory_model/tests.rs @@ -14,9 +14,12 @@ fn profiles() -> Vec<(String, crate::device::profile::DeviceProfile)> { let mut out = committed_profiles().expect("profiles"); let scope = VkFeature::VulkanMemoryModelDeviceScope; for without in [&[scope][..], &[VkFeature::VulkanMemoryModel, scope]] { - let p = - crate::pipeline::testing::profile_without("runtime-floor", without, Default::default()) - .expect("below the floor"); + let p = crate::pipeline::testing::profile_without( + "runtime-floor", + without, + crate::device::DevicePolicy::RESIDENT_TABLES, + ) + .expect("below the floor"); out.push((format!("runtime-floor without {without:?}"), p)); } out diff --git a/crates/metal2vulkan/src/main.rs b/crates/metal2vulkan/src/main.rs index d7c49ac53..6bfce3acc 100644 --- a/crates/metal2vulkan/src/main.rs +++ b/crates/metal2vulkan/src/main.rs @@ -55,7 +55,8 @@ options: --device FILE the target device as a description and a policy: the JSON form of metal2vulkan::device::DeviceDescription and DevicePolicy, {"description": ..., "policy": ...}, in place of --profile (a - runtime's compile device; --profile takes the default domains) + runtime's compile device; --profile takes the runtime's policy, + the identity domains) --function NAME the kernel or vertex function (default: the library's only one) --fragment NAME the fragment function of a render pipeline --constant ID:TYPE:VALUE function-constant value (repeatable): ID is an index or a name, TYPE a diff --git a/crates/metal2vulkan/src/memory/plan/tests.rs b/crates/metal2vulkan/src/memory/plan/tests.rs index 2dc4157fb..936af85f7 100644 --- a/crates/metal2vulkan/src/memory/plan/tests.rs +++ b/crates/metal2vulkan/src/memory/plan/tests.rs @@ -21,12 +21,12 @@ use crate::pipeline::testing::{meter, profile}; const AIR_DL: &str = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v16:16:16-v24:32:32-v32:32:32-v48:64:64-v64:64:64-v96:128:128-v128:128:128-v192:256:256-v256:256:256-v512:512:512-v1024:1024:1024-n8:16:32"; fn addressed() -> DeviceProfile { - profile("moltenvk-m3", DevicePolicy::default()).expect("moltenvk-m3") + profile("moltenvk-m3", DevicePolicy::RESIDENT_TABLES).expect("moltenvk-m3") } /// Profile F: a device without device addresses, below the runtime's floor. fn floor() -> DeviceProfile { - let dev = crate::pipeline::testing::device_f(DevicePolicy::default()).expect("Profile F"); + let dev = crate::pipeline::testing::device_f(DevicePolicy::RESIDENT_TABLES).expect("Profile F"); dev.profile().clone() } diff --git a/crates/metal2vulkan/src/metal/format/tests.rs b/crates/metal2vulkan/src/metal/format/tests.rs index 2a22dc56d..402e25427 100644 --- a/crates/metal2vulkan/src/metal/format/tests.rs +++ b/crates/metal2vulkan/src/metal/format/tests.rs @@ -22,7 +22,7 @@ pub(crate) fn committed_devices() -> Vec<(String, Device)> { .into_iter() .map(|(stem, desc)| { let device = - Device::from_queries(desc, DevicePolicy::default()).expect("device derives"); + Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES).expect("device derives"); (stem, device) }) .collect() @@ -49,7 +49,7 @@ fn floor_with(formats: &[(vk::Format, vk::FormatFeatureFlags)]) -> DeviceDescrip } fn device(desc: DeviceDescription) -> Device { - Device::from_queries(desc, DevicePolicy::default()).expect("device derives") + Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES).expect("device derives") } fn usages(list: &[FormatUsage]) -> BTreeSet { diff --git a/crates/metal2vulkan/src/metal/format/word.rs b/crates/metal2vulkan/src/metal/format/word.rs index 1dfbfe3a4..f19f80b42 100644 --- a/crates/metal2vulkan/src/metal/format/word.rs +++ b/crates/metal2vulkan/src/metal/format/word.rs @@ -378,10 +378,10 @@ mod tests { use crate::pipeline::testing::profile; let nvidia = profile( "nvidia-rtx5080-laptop", - crate::device::DevicePolicy::default(), + crate::device::DevicePolicy::RESIDENT_TABLES, ) .unwrap(); - let lavapipe = profile("lavapipe", crate::device::DevicePolicy::default()).unwrap(); + let lavapipe = profile("lavapipe", crate::device::DevicePolicy::RESIDENT_TABLES).unwrap(); for pf in [ PixelFormat::A1BGR5Unorm, PixelFormat::ABGR4Unorm, @@ -407,7 +407,11 @@ mod tests { WordAttachment::of(PixelFormat::RGB9E5Float, &nvidia), Some(WordAttachment::Rgb9e5) ); - let radv = profile("amd-rdna3-radv", crate::device::DevicePolicy::default()).unwrap(); + let radv = profile( + "amd-rdna3-radv", + crate::device::DevicePolicy::RESIDENT_TABLES, + ) + .unwrap(); assert_eq!(WordAttachment::of(PixelFormat::RGB9E5Float, &radv), None); // Vulkan makes `R5G6B5` and `A1R5G5B5` attachments mandatory. for pf in [PixelFormat::B5G6R5Unorm, PixelFormat::BGR5A1Unorm] { diff --git a/crates/metal2vulkan/src/metal/sampler.rs b/crates/metal2vulkan/src/metal/sampler.rs index 85ca62e46..7c26eb71d 100644 --- a/crates/metal2vulkan/src/metal/sampler.rs +++ b/crates/metal2vulkan/src/metal/sampler.rs @@ -1345,7 +1345,7 @@ mod tests { desc.features.remove(f); } desc.limits.max_sampler_anisotropy_bits = 16f32.to_bits(); - Device::from_queries(desc, DevicePolicy::default()).unwrap() + Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES).unwrap() } /// What a plan reads of a bound sampler's shape to check its separate textures' views @@ -1439,7 +1439,7 @@ mod tests { ]; let (mut checked, mut past_limit, mut withheld) = (0, 0, 0); for (stem, description) in committed_descriptions() { - let dev = Device::from_queries(description, DevicePolicy::default()).unwrap(); + let dev = Device::from_queries(description, DevicePolicy::RESIDENT_TABLES).unwrap(); let p = dev.profile(); let limit = f32::from_bits(p.fields().limits.max_sampler_lod_bias_bits); if p.fields() @@ -1519,7 +1519,7 @@ mod tests { .unwrap() .1; floor.limits.max_sampler_lod_bias_bits = 15.5f32.to_bits(); - let floor = Device::from_queries(floor, DevicePolicy::default()).unwrap(); + let floor = Device::from_queries(floor, DevicePolicy::RESIDENT_TABLES).unwrap(); let p = floor.profile(); assert!(!(p.fields().enabled).portability_withholds(VkFeature::SamplerMipLodBias)); let exact = |b: f32| match device_lod_bias(b, p) { @@ -1547,7 +1547,7 @@ mod tests { .map(|(stem, d)| { ( stem, - Device::from_queries(d, DevicePolicy::default()).unwrap(), + Device::from_queries(d, DevicePolicy::RESIDENT_TABLES).unwrap(), ) }) .find(|(_, dev)| { @@ -1575,7 +1575,7 @@ mod tests { fn the_device_lod_bias_carries_its_note_where_it_is_not_the_bias() { let note = Some(PrecisionNote::CappedLodBias); for (stem, d) in committed_descriptions() { - let dev = Device::from_queries(d, DevicePolicy::default()).unwrap(); + let dev = Device::from_queries(d, DevicePolicy::RESIDENT_TABLES).unwrap(); let p = dev.profile(); let withheld = (p.fields().enabled).portability_withholds(VkFeature::SamplerMipLodBias); let limit = f32::from_bits(p.fields().limits.max_sampler_lod_bias_bits).max(0.0); @@ -1714,11 +1714,11 @@ mod tests { let mvk = committed("moltenvk-m3"); assert!(mvk.extensions.contains(&VkExtension::KhrPortabilitySubset)); assert!(mvk.features.contains(&mutable)); - let dev = Device::from_queries(mvk.clone(), DevicePolicy::default()).unwrap(); + let dev = Device::from_queries(mvk.clone(), DevicePolicy::RESIDENT_TABLES).unwrap(); assert!(vk_sampler(&d, compare, dev.profile()).is_ok()); let mut withheld = mvk; withheld.features.remove(&mutable); - let dev = Device::from_queries(withheld, DevicePolicy::default()).unwrap(); + let dev = Device::from_queries(withheld, DevicePolicy::RESIDENT_TABLES).unwrap(); assert_eq!( vk_sampler(&d, compare, dev.profile()), Err(Unsupported::needs(Feature::SamplerCompare, Capability::Feature(mutable)).into()) @@ -1726,7 +1726,7 @@ mod tests { assert!(vk_sampler(&d, SamplerUse::default(), dev.profile()).is_ok()); let lavapipe = committed("lavapipe"); assert!(!lavapipe.features.contains(&mutable)); - let dev = Device::from_queries(lavapipe, DevicePolicy::default()).unwrap(); + let dev = Device::from_queries(lavapipe, DevicePolicy::RESIDENT_TABLES).unwrap(); assert!(vk_sampler(&d, compare, dev.profile()).is_ok()); } @@ -1768,7 +1768,7 @@ mod tests { .unwrap(); desc.features.insert(VkFeature::SamplerAnisotropy); desc.limits.max_sampler_anisotropy_bits = 16f32.to_bits(); - let dev = Device::from_queries(desc, DevicePolicy::default()).unwrap(); + let dev = Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES).unwrap(); { for (min, mag) in [ (Linear, Linear), @@ -1974,7 +1974,7 @@ mod tests { VkFeature::BorderColorSwizzle, VkFeature::BorderColorSwizzleFromImage, ]); - Device::from_queries(desc, DevicePolicy::default()).unwrap() + Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES).unwrap() }; let mapping = |format, components, emulation| FormatMapping { format, @@ -2144,7 +2144,7 @@ mod tests { ]); } desc.rgba4_opaque_black_swizzled = rgba4; - Device::from_queries(desc, DevicePolicy::default()).unwrap() + Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES).unwrap() }; let direct = FormatMapping { format: vk::Format::R4G4B4A4_UNORM_PACK16, @@ -2232,7 +2232,7 @@ mod tests { ]); desc.features.extend(features.iter().copied()); } - Device::from_queries(desc, DevicePolicy::default()).unwrap() + Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES).unwrap() }; let plain = with(&[]); let swizzle_only = with(&[VkFeature::BorderColorSwizzle]); @@ -2654,7 +2654,7 @@ mod tests { let mut desc = desc; desc.features.insert(VkFeature::SamplerAnisotropy); desc.limits.max_sampler_anisotropy_bits = 16f32.to_bits(); - let dev = Device::from_queries(desc, DevicePolicy::default()).unwrap(); + let dev = Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES).unwrap(); { let use_ = SamplerUse::new(false, false); let (linear, nearest) = device_anisotropy_by_filters(use_, dev.profile()); diff --git a/crates/metal2vulkan/src/metal/state.rs b/crates/metal2vulkan/src/metal/state.rs index 4d72d7cf7..511219484 100644 --- a/crates/metal2vulkan/src/metal/state.rs +++ b/crates/metal2vulkan/src/metal/state.rs @@ -507,7 +507,7 @@ mod tests { } else { desc.features.remove(&VkFeature::DualSrcBlend); } - Device::from_queries(desc, DevicePolicy::default()).unwrap() + Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES).unwrap() } /// Every concrete factor maps, the names agree, and only `Source1*` needs `dualSrcBlend`. @@ -635,7 +635,7 @@ mod tests { for f in withheld { assert!(desc.features.remove(f), "{name} has {f:?}"); } - Device::from_queries(desc, DevicePolicy::default()).unwrap() + Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES).unwrap() } /// The encoder's fill mode, depth clip mode, and depth bias clamp map where the device has diff --git a/crates/metal2vulkan/src/metal/vertex.rs b/crates/metal2vulkan/src/metal/vertex.rs index 0683a077a..f0ca36939 100644 --- a/crates/metal2vulkan/src/metal/vertex.rs +++ b/crates/metal2vulkan/src/metal/vertex.rs @@ -530,7 +530,7 @@ mod tests { ); desc.features .remove(&VkFeature::VertexAttributeInstanceRateDivisor); - let plain = Device::from_queries(desc.clone(), DevicePolicy::default()).unwrap(); + let plain = Device::from_queries(desc.clone(), DevicePolicy::RESIDENT_TABLES).unwrap(); desc.features .insert(VkFeature::VertexAttributeInstanceRateDivisor); // Listed with the extension that exposes it below Vulkan 1.4. @@ -539,9 +539,9 @@ mod tests { desc.limits.max_vertex_attrib_divisor = 4; // No nonzero first instance with a divisor (VUID-vkCmdDraw-pNext-09461): pulled. desc.limits.supports_non_zero_first_instance = false; - let zero_first = Device::from_queries(desc.clone(), DevicePolicy::default()).unwrap(); + let zero_first = Device::from_queries(desc.clone(), DevicePolicy::RESIDENT_TABLES).unwrap(); desc.limits.supports_non_zero_first_instance = true; - let divisor = Device::from_queries(desc, DevicePolicy::default()).unwrap(); + let divisor = Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES).unwrap(); use VertexStepFunction as S; let fetch = |dev: &Device, f, s, r| attribute_fetch(f, s, r, dev.profile()); let fixed = |rate, divisor| { @@ -619,7 +619,7 @@ mod tests { }, ); } - let dev = Device::from_queries(desc, DevicePolicy::default()).unwrap(); + let dev = Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES).unwrap(); assert!(dev.profile().supports_format( vk::Format::E5B9G9R9_UFLOAT_PACK32, FormatUsage::VertexBuffer @@ -654,8 +654,8 @@ mod tests { let mut bare = robust.clone(); bare.features.remove(&VkFeature::RobustBufferAccess); bare.features.remove(&VkFeature::RobustBufferAccess2); - let checked = Device::from_queries(bare, DevicePolicy::default()).unwrap(); - let robust = Device::from_queries(robust, DevicePolicy::default()).unwrap(); + let checked = Device::from_queries(bare, DevicePolicy::RESIDENT_TABLES).unwrap(); + let robust = Device::from_queries(robust, DevicePolicy::RESIDENT_TABLES).unwrap(); assert_eq!(contain::encoding(checked.profile()), Check::InShader); assert_eq!(contain::encoding(robust.profile()), Check::None); let float4 = VertexFormat::Float4; @@ -692,7 +692,7 @@ mod tests { { continue; } - let dev = Device::from_queries(desc, DevicePolicy::default()).unwrap(); + let dev = Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES).unwrap(); for v in [ VertexFormat::Float, VertexFormat::Float2, diff --git a/crates/metal2vulkan/src/pipeline/compile/numbered.rs b/crates/metal2vulkan/src/pipeline/compile/numbered.rs index e5971dee4..af6cd3c92 100644 --- a/crates/metal2vulkan/src/pipeline/compile/numbered.rs +++ b/crates/metal2vulkan/src/pipeline/compile/numbered.rs @@ -306,7 +306,7 @@ declare i32 @air.get_width_texture_2d(ptr addrspace(1), i32) 0, FunctionConstantValue::new(DataType::Bool, [u8::from(on)]), ); - let p = profile("lavapipe", DevicePolicy::default()).expect("profile"); + let p = profile("lavapipe", DevicePolicy::RESIDENT_TABLES).expect("profile"); let a = compile_bitcode( &bc, EntryRef::Name("k"), diff --git a/crates/metal2vulkan/src/pipeline/compile/partition.rs b/crates/metal2vulkan/src/pipeline/compile/partition.rs index af6426120..a49e594b4 100644 --- a/crates/metal2vulkan/src/pipeline/compile/partition.rs +++ b/crates/metal2vulkan/src/pipeline/compile/partition.rs @@ -302,7 +302,7 @@ entry: } fn lavapipe() -> crate::device::DeviceProfile { - profile("lavapipe", DevicePolicy::default()).expect("profile") + profile("lavapipe", DevicePolicy::RESIDENT_TABLES).expect("profile") } /// **Making a kernel's bitcode leaves nothing under the OS temp directory.** The helper used diff --git a/crates/metal2vulkan/src/pipeline/compile/tests.rs b/crates/metal2vulkan/src/pipeline/compile/tests.rs index b6e49c949..7d2b924d1 100644 --- a/crates/metal2vulkan/src/pipeline/compile/tests.rs +++ b/crates/metal2vulkan/src/pipeline/compile/tests.rs @@ -61,9 +61,9 @@ fn fixture(stem: &str) -> Option> { } } -/// Committed profile `stem` as a device with the default policy. +/// Committed profile `stem` as a device with the resident-table domains. fn device(stem: &str) -> Device { - Device::from_queries(description(stem), DevicePolicy::default()).expect("device") + Device::from_queries(description(stem), DevicePolicy::RESIDENT_TABLES).expect("device") } /// Committed profile `stem` as the Khronos reader describes it. @@ -1616,7 +1616,8 @@ fn a_render_pipeline_requires_extended_dynamic_state_exactly_when_it_makes_one_d ))); d.rasterization_enabled = false; let compile = |desc: &DeviceDescription| { - let dev = Device::from_queries(desc.clone(), DevicePolicy::default()).expect("device"); + let dev = + Device::from_queries(desc.clone(), DevicePolicy::RESIDENT_TABLES).expect("device"); let pipe = dev .compile_render_pipeline(&d, &Budget::standard()) .expect("render pipeline"); @@ -1714,7 +1715,8 @@ fn a_vertex_pipeline_makes_its_input_assembly_dynamic_exactly_with_both_extended ))); d.rasterization_enabled = false; let compile = |desc: &DeviceDescription| { - let dev = Device::from_queries(desc.clone(), DevicePolicy::default()).expect("device"); + let dev = + Device::from_queries(desc.clone(), DevicePolicy::RESIDENT_TABLES).expect("device"); dev.compile_render_pipeline(&d, &Budget::standard()) .expect("render pipeline") }; @@ -1849,7 +1851,7 @@ fn a_framebuffer_fetch_pipeline_is_ordered_exactly_where_the_device_orders_it() let lavapipe = description("lavapipe"); assert!(lavapipe.has(ORDERED)); { - let pipe = compile(&lavapipe, DevicePolicy::default(), &d).expect("lavapipe"); + let pipe = compile(&lavapipe, DevicePolicy::RESIDENT_TABLES, &d).expect("lavapipe"); assert!(!unordered(&pipe)); assert_eq!(pipe.graphics.input_attachments.len(), 1); assert!(pipe.graphics.storage_attachments.is_empty()); @@ -1868,7 +1870,7 @@ fn a_framebuffer_fetch_pipeline_is_ordered_exactly_where_the_device_orders_it() interlocked.features.remove(&ORDERED); assert!(interlocked.has(INTERLOCK)); { - let pipe = compile(&interlocked, DevicePolicy::default(), &d).expect("interlocked"); + let pipe = compile(&interlocked, DevicePolicy::RESIDENT_TABLES, &d).expect("interlocked"); assert!(!unordered(&pipe)); assert!(pipe.graphics.input_attachments.is_empty()); assert!(pipe.graphics.color_attachments.iter().all(Option::is_none)); @@ -1902,7 +1904,7 @@ fn a_framebuffer_fetch_pipeline_is_ordered_exactly_where_the_device_orders_it() } // The blend, which the shader computes: the generic one of `R32Float`, noted. { - let pipe = compile(&interlocked, DevicePolicy::default(), &blended).expect("blended"); + let pipe = compile(&interlocked, DevicePolicy::RESIDENT_TABLES, &blended).expect("blended"); let [s] = pipe.graphics.storage_attachments.as_slice() else { panic!("{:?}", pipe.graphics.storage_attachments); }; @@ -1917,7 +1919,7 @@ fn a_framebuffer_fetch_pipeline_is_ordered_exactly_where_the_device_orders_it() // Alpha to coverage, which can drop the fragment's samples, blocks the form. let mut covered = d.clone(); covered.alpha_to_coverage = true; - match compile(&interlocked, DevicePolicy::default(), &covered) { + match compile(&interlocked, DevicePolicy::RESIDENT_TABLES, &covered) { Err(Error::Unsupported(u)) => assert_eq!( (u.feature, u.needs), (Feature::FramebufferFetch, Needs::NotImplemented) @@ -1927,7 +1929,7 @@ fn a_framebuffer_fetch_pipeline_is_ordered_exactly_where_the_device_orders_it() let mut without = interlocked.clone(); without.features.remove(&INTERLOCK); - let pipe = compile(&without, DevicePolicy::default(), &d).expect("neither"); + let pipe = compile(&without, DevicePolicy::RESIDENT_TABLES, &d).expect("neither"); assert!(unordered(&pipe)); assert_eq!(pipe.graphics.input_attachments.len(), 1); assert!(pipe.graphics.storage_attachments.is_empty()); @@ -1942,10 +1944,11 @@ fn a_framebuffer_fetch_pipeline_is_ordered_exactly_where_the_device_orders_it() .function("fetch_ordered") .expect("fragment"), ))); - let pipe = compile(&interlocked, DevicePolicy::default(), &grouped).expect("grouped"); + let pipe = compile(&interlocked, DevicePolicy::RESIDENT_TABLES, &grouped).expect("grouped"); assert!(!unordered(&pipe)); assert!(pipe.requirements.features.contains(&INTERLOCK)); - let pipe = compile(&without, DevicePolicy::default(), &grouped).expect("grouped, neither"); + let pipe = + compile(&without, DevicePolicy::RESIDENT_TABLES, &grouped).expect("grouped, neither"); assert!(unordered(&pipe)); assert_eq!(pipe.graphics.input_attachments.len(), 1); for f in [ORDERED, INTERLOCK] { @@ -1994,7 +1997,7 @@ fn an_identity_fetch_reads_its_attachments_pushed_texture_in_the_attachments_cla let policy = DevicePolicy { pointer_domain: PointerDomain::Identity, handle_domain: HandleDomain::Identity, - ..DevicePolicy::default() + ..DevicePolicy::RESIDENT_TABLES }; let dev = Device::from_queries(without, policy).expect("device"); let compile = @@ -2200,7 +2203,8 @@ fn a_multisampled_framebuffer_fetch_reads_each_samples_own_color() { d }; let compile = |desc: &DeviceDescription, d: &RenderPipelineDescriptor| { - let dev = Device::from_queries(desc.clone(), DevicePolicy::default()).expect("device"); + let dev = + Device::from_queries(desc.clone(), DevicePolicy::RESIDENT_TABLES).expect("device"); let pipe = dev.compile_render_pipeline(d, &Budget::standard())?; for s in &pipe.stages { l3(&s.spirv, &pipe.requirements, &dev); @@ -2429,7 +2433,8 @@ fn a_render_pipeline_requires_the_blend_features_its_attachments_need() { d }; let compile = |desc: &DeviceDescription, d: &RenderPipelineDescriptor| { - let dev = Device::from_queries(desc.clone(), DevicePolicy::default()).expect("device"); + let dev = + Device::from_queries(desc.clone(), DevicePolicy::RESIDENT_TABLES).expect("device"); let pipe = dev.compile_render_pipeline(d, &Budget::standard())?; let enables = desc .required_enables(&pipe.requirements) @@ -2851,7 +2856,8 @@ fn a_render_pipeline_requires_the_portability_features_it_uses() { }; // Every pipeline that compiles requires only what its device enabled. let compile = |desc: &DeviceDescription, d: &RenderPipelineDescriptor| { - let dev = Device::from_queries(desc.clone(), DevicePolicy::default()).expect("device"); + let dev = + Device::from_queries(desc.clone(), DevicePolicy::RESIDENT_TABLES).expect("device"); dev.compile_render_pipeline(d, &Budget::standard()) .map(|p| { assert_eq!(dev.profile().check(&p.requirements), Ok(())); @@ -2939,8 +2945,8 @@ fn a_render_pipeline_requires_its_framebuffer_sample_counts() { ), ] { d.raster_sample_count = count; - let dev = - Device::from_queries(description("lavapipe"), DevicePolicy::default()).expect("device"); + let dev = Device::from_queries(description("lavapipe"), DevicePolicy::RESIDENT_TABLES) + .expect("device"); let pipe = dev .compile_render_pipeline(&d, &Budget::standard()) .expect("lavapipe"); @@ -2985,14 +2991,15 @@ fn the_interface_states_the_textures_read_at_the_fragments_own_pixel() { "runtime-floor", ] .map(|stem| { - let p = crate::pipeline::testing::profile(stem, DevicePolicy::default()).expect("profile"); + let p = crate::pipeline::testing::profile(stem, DevicePolicy::RESIDENT_TABLES) + .expect("profile"); (stem, p) }) .into(); let clamped = crate::pipeline::testing::profile_without( "runtime-floor", &[VkFeature::RobustImageAccess2], - DevicePolicy::default(), + DevicePolicy::RESIDENT_TABLES, ) .expect("profile"); profiles.push(("runtime-floor without robustImageAccess2", clamped)); @@ -3033,7 +3040,7 @@ fn the_interface_states_why_a_slot_takes_no_snapshot() { (d.features).remove(&VkFeature::ShaderDemoteToHelperInvocation), "the 780M's profile demotes" ); - let ends = Device::from_queries(d, DevicePolicy::default()).expect("device"); + let ends = Device::from_queries(d, DevicePolicy::RESIDENT_TABLES).expect("device"); for (name, dev, refusals) in [ ("demote", &demotes, Vec::new()), ("no demote", &ends, vec![(0, SnapshotRefusal::Branch)]), @@ -3086,7 +3093,8 @@ fn a_selection_on_the_texel_keeps_the_slot_where_a_helper_may_take_either_arm() return; }; for stem in ["amd-780m-radv", "lavapipe"] { - let p = crate::pipeline::testing::profile(stem, DevicePolicy::default()).expect("profile"); + let p = crate::pipeline::testing::profile(stem, DevicePolicy::RESIDENT_TABLES) + .expect("profile"); for (bc, entry, refusals) in [ (&selecting, "ss_read_selecting", Vec::new()), ( @@ -3146,7 +3154,8 @@ fn a_snapshot_variant_reads_its_texture_in_the_copy_alone() { "moltenvk-m3", "runtime-floor", ] { - let p = crate::pipeline::testing::profile(stem, DevicePolicy::default()).expect("profile"); + let p = crate::pipeline::testing::profile(stem, DevicePolicy::RESIDENT_TABLES) + .expect("profile"); let base = crate::pipeline::testing::compile(&bc, "tob_read", &p) .unwrap_or_else(|e| panic!("{stem}: {e}")); assert_eq!(base.interface.snapshot_textures, [0u32], "{stem}"); @@ -3233,8 +3242,8 @@ fn a_snapshot_variant_reads_its_texture_in_the_copy_alone() { /// `the_status_words_are_not_the_functions_writes`). #[test] fn the_interface_states_whether_the_function_writes_memory() { - let p = - crate::pipeline::testing::profile("lavapipe", DevicePolicy::default()).expect("profile"); + let p = crate::pipeline::testing::profile("lavapipe", DevicePolicy::RESIDENT_TABLES) + .expect("profile"); for (stem, entry, writes) in [ ("a3_rog_buffer_rmw", "a3_rog_buffer_rmw", true), ("fragment_rog", "rog_loop", true), @@ -3290,8 +3299,8 @@ fn effects_kernel(name: &str, body: &str, extra: &str) -> String { /// through the pointer it is passed, write memory. #[test] fn a_compute_pipeline_states_whether_its_kernel_writes_memory() { - let p = - crate::pipeline::testing::profile("lavapipe", DevicePolicy::default()).expect("profile"); + let p = crate::pipeline::testing::profile("lavapipe", DevicePolicy::RESIDENT_TABLES) + .expect("profile"); let callee = "define void @put(ptr addrspace(1) noundef %p, i32 noundef %v) #0 {\nentry:\n store i32 %v, ptr addrspace(1) %p, align 4\n ret void\n}\n\nattributes #0 = { noinline }\n\n"; for (name, body, extra, writes) in [ ("bare_return", " ret void\n", "", false), @@ -3344,8 +3353,8 @@ fn a_compute_pipeline_states_whether_its_kernel_writes_memory() { /// command runs) does not. A pipeline's interface states it where one of its stages does. #[test] fn the_interface_states_whether_the_function_takes_a_command_buffer() { - let p = - crate::pipeline::testing::profile("lavapipe", DevicePolicy::default()).expect("profile"); + let p = crate::pipeline::testing::profile("lavapipe", DevicePolicy::RESIDENT_TABLES) + .expect("profile"); let dirs = [crate::pipeline::testing::fixtures_dir(), engine_dir()]; for (dir, stem, entry, reaches) in [ ( @@ -3392,8 +3401,8 @@ fn the_interface_states_whether_the_function_takes_a_command_buffer() { #[test] fn the_interface_states_what_the_function_may_write_into_command_buffers() { use crate::pipeline::interface::CommandWrites as W; - let p = - crate::pipeline::testing::profile("lavapipe", DevicePolicy::default()).expect("profile"); + let p = crate::pipeline::testing::profile("lavapipe", DevicePolicy::RESIDENT_TABLES) + .expect("profile"); for (entry, operations, primitive_types, kinds) in [ ( "icb_replay_encode", @@ -3450,8 +3459,8 @@ fn the_interface_states_what_the_function_may_write_into_command_buffers() { /// stage where the function writes. #[test] fn the_interface_states_whether_the_function_writes_textures() { - let p = - crate::pipeline::testing::profile("lavapipe", DevicePolicy::default()).expect("profile"); + let p = crate::pipeline::testing::profile("lavapipe", DevicePolicy::RESIDENT_TABLES) + .expect("profile"); for (stem, entry, writes) in [ ("fragment_rog", "rog_texture", true), ("handles", "argument_buffer_array_write", true), @@ -3498,8 +3507,8 @@ fn the_interface_states_whether_the_function_writes_textures() { /// (`abt_frag_sample`). A standalone kernel's pipeline states its function's. #[test] fn the_interface_states_what_the_function_reaches_beyond_its_bound_slots() { - let p = - crate::pipeline::testing::profile("lavapipe", DevicePolicy::default()).expect("profile"); + let p = crate::pipeline::testing::profile("lavapipe", DevicePolicy::RESIDENT_TABLES) + .expect("profile"); for (stem, entry, reads, writes, storage) in [ ("handles", "select_read", false, false, false), ("handles", "select_null_write", false, false, false), @@ -3599,7 +3608,7 @@ fn a_sample_rate_point_coordinate_is_noted_under_multisampling() { /// A vertex function over a two-triangle strip with a center varying `uv`, and a fragment /// function that loads `root->next` (a `device uint *` member of its `device Node *` buffer) /// and reads through it beside `uv`, writing nothing. Every access through the loaded pointer -/// counts a resident miss in the `ExecutionStatus` buffer under the default policy. +/// counts a resident miss in the `ExecutionStatus` buffer under the resident-table domains. const WIDE_READ: &str = r#"target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v16:16:16-v24:32:32-v32:32:32-v48:64:64-v64:64:64-v96:128:128-v128:128:128-v192:256:256-v256:256:256-v512:512:512-v1024:1024:1024-n8:16:32" target triple = "air64_v28-apple-macosx26.0.0" diff --git a/crates/metal2vulkan/src/pipeline/link/tessellation/tests.rs b/crates/metal2vulkan/src/pipeline/link/tessellation/tests.rs index 605f9012e..cdef902d0 100644 --- a/crates/metal2vulkan/src/pipeline/link/tessellation/tests.rs +++ b/crates/metal2vulkan/src/pipeline/link/tessellation/tests.rs @@ -9,7 +9,7 @@ use crate::error::Needs; use crate::pipeline::interface::PatchDomain; fn profile(stem: &str) -> DeviceProfile { - crate::pipeline::testing::profile(stem, DevicePolicy::default()).expect("profile") + crate::pipeline::testing::profile(stem, DevicePolicy::RESIDENT_TABLES).expect("profile") } /// Committed profile `stem` with `maxTessellationGenerationLevel` edited to `level`. @@ -24,7 +24,7 @@ fn profile_with_level(stem: &str, level: u32) -> DeviceProfile { ); assert_ne!(edited, text, "{stem} states the level"); let desc = DeviceDescription::from_khronos_json(&edited, None).expect("description"); - Device::from_queries(desc, DevicePolicy::default()) + Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES) .expect("device") .profile() .clone() diff --git a/crates/metal2vulkan/src/pipeline/link/tests.rs b/crates/metal2vulkan/src/pipeline/link/tests.rs index ba7312923..69f15eed1 100644 --- a/crates/metal2vulkan/src/pipeline/link/tests.rs +++ b/crates/metal2vulkan/src/pipeline/link/tests.rs @@ -30,7 +30,7 @@ use crate::spirv::serialize::serialize; // ---- Fixtures ---- pub(super) fn profile(stem: &str) -> DeviceProfile { - crate::pipeline::testing::profile(stem, DevicePolicy::default()).expect("profile") + crate::pipeline::testing::profile(stem, DevicePolicy::RESIDENT_TABLES).expect("profile") } /// The key of user varying `name`. diff --git a/crates/metal2vulkan/src/pipeline/link/tests/render.rs b/crates/metal2vulkan/src/pipeline/link/tests/render.rs index dabe75723..47a829973 100644 --- a/crates/metal2vulkan/src/pipeline/link/tests/render.rs +++ b/crates/metal2vulkan/src/pipeline/link/tests/render.rs @@ -1120,7 +1120,7 @@ fn alpha_to_one_is_refused_only_without_the_feature() { let p = crate::pipeline::testing::profile_without( "runtime-floor", &[VkFeature::AlphaToOne], - DevicePolicy::default(), + DevicePolicy::RESIDENT_TABLES, ) .expect("profile"); assert!(!p.fields().enabled.features.contains(&VkFeature::AlphaToOne)); @@ -1575,7 +1575,7 @@ fn attachment_states_are_identical_or_need_independent_blend() { let floor = crate::pipeline::testing::profile_without( "runtime-floor", &[VkFeature::IndependentBlend], - DevicePolicy::default(), + DevicePolicy::RESIDENT_TABLES, ) .expect("profile"); let lavapipe = profile("lavapipe"); @@ -1809,7 +1809,7 @@ fn a_dual_source_blend_needs_dual_src_blend() { let floor = crate::pipeline::testing::profile_without( "runtime-floor", &[VkFeature::DualSrcBlend], - DevicePolicy::default(), + DevicePolicy::RESIDENT_TABLES, ) .expect("profile"); assert!(!floor.fields().fragment.dual_src_blend); @@ -1891,7 +1891,7 @@ fn color_outputs_follow_metals_measured_rules() { let floor = crate::pipeline::testing::profile_without( "runtime-floor", &[VkFeature::IndependentBlend], - DevicePolicy::default(), + DevicePolicy::RESIDENT_TABLES, ) .expect("profile"); for p in [&lavapipe, &profile("moltenvk-m3")] { @@ -2501,7 +2501,7 @@ fn multisampled_fragment_invocations_follow_metals_measured_rules() { let p = crate::pipeline::testing::profile_without( "runtime-floor", &[VkFeature::SampleRateShading], - DevicePolicy::default(), + DevicePolicy::RESIDENT_TABLES, ) .expect("profile"); assert!(!p.fields().fragment.sample_rate_shading); diff --git a/crates/metal2vulkan/src/pipeline/rotated_blend/tests.rs b/crates/metal2vulkan/src/pipeline/rotated_blend/tests.rs index 262d63eff..536b440a7 100644 --- a/crates/metal2vulkan/src/pipeline/rotated_blend/tests.rs +++ b/crates/metal2vulkan/src/pipeline/rotated_blend/tests.rs @@ -189,7 +189,7 @@ fn attachment( } fn moltenvk() -> DeviceProfile { - profile("moltenvk-m3", DevicePolicy::default()).expect("profile") + profile("moltenvk-m3", DevicePolicy::RESIDENT_TABLES).expect("profile") } /// Every pair of Metal's color factors, under alpha factors that read nothing, the source's or @@ -391,7 +391,7 @@ fn a_second_output_needs_dual_source_blending() { let text = std::fs::read_to_string(path).expect("profile"); let mut desc = DeviceDescription::from_khronos_json(&text, None).expect("description"); assert!(desc.features.remove(&VkFeature::DualSrcBlend)); - let p = Device::from_queries(desc, DevicePolicy::default()) + let p = Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES) .expect("device") .profile() .clone(); @@ -495,7 +495,7 @@ const LANE: [([BlendFactor; 4], BlendOperation); 11] = { #[test] fn the_lane_s_blends_store_metal_s_rotated() { let mvk = moltenvk(); - let lvp = profile("lavapipe", DevicePolicy::default()).expect("profile"); + let lvp = profile("lavapipe", DevicePolicy::RESIDENT_TABLES).expect("profile"); for (i, &([sr, dr, sa, da], op)) in LANE.iter().enumerate() { let a = attachment((sr, dr, op), (sa, da, op)); let on_mvk = rotated_blend(&a, &mvk).expect("admitted").expect("blended"); @@ -516,7 +516,7 @@ fn inexact_blends_are_announced() { use BlendFactor as F; use BlendOperation as O; let mvk = moltenvk(); - let lvp = profile("lavapipe", DevicePolicy::default()).expect("profile"); + let lvp = profile("lavapipe", DevicePolicy::RESIDENT_TABLES).expect("profile"); // Metal's color kept and its alpha replaced: in the 440-state sweep, 902 of 65,536 texels // apart on the M4. let kept = attachment((F::Zero, F::One, O::Add), (F::One, F::Zero, O::Add)); diff --git a/crates/metal2vulkan/src/pipeline/testing/tests.rs b/crates/metal2vulkan/src/pipeline/testing/tests.rs index 803376fbf..e9f30adfc 100644 --- a/crates/metal2vulkan/src/pipeline/testing/tests.rs +++ b/crates/metal2vulkan/src/pipeline/testing/tests.rs @@ -265,7 +265,7 @@ fn a_text_is_charged_the_same_wherever_it_is_assembled() { let (Some(a), Some(b)) = (assembled(&near), assembled(&far)) else { return; }; - let p = profile("runtime-floor", DevicePolicy::default()).expect("runtime-floor"); + let p = profile("runtime-floor", DevicePolicy::RESIDENT_TABLES).expect("runtime-floor"); let charged = |bitcode: &[u8]| { let mut m = meter(); let artifact = compile_bitcode( diff --git a/crates/metal2vulkan/src/reflection/linked_tests.rs b/crates/metal2vulkan/src/reflection/linked_tests.rs index 4bc0728da..c47968d2c 100644 --- a/crates/metal2vulkan/src/reflection/linked_tests.rs +++ b/crates/metal2vulkan/src/reflection/linked_tests.rs @@ -273,7 +273,7 @@ fn a_rasterizing_void_vertex_function_is_refused_at_its_link() { .join("../metal2vulkan-validation/profiles/lavapipe.json"); let text = std::fs::read_to_string(&path).unwrap_or_else(|e| panic!("{}: {e}", path.display())); let description = DeviceDescription::from_khronos_json(&text, None).expect("profile"); - let device = Device::from_queries(description, DevicePolicy::default()).expect("device"); + let device = Device::from_queries(description, DevicePolicy::RESIDENT_TABLES).expect("device"); let refused = Err(Error::InvalidDescriptor( DescriptorError::RasterizedVoidVertex, )); @@ -656,7 +656,7 @@ fn a_dropped_unwritten_fragment_input_is_absent_from_the_compiled_fragment() { let description = DeviceDescription::from_khronos_json(&text, None).expect(stem); ( stem, - Device::from_queries(description, DevicePolicy::default()).expect(stem), + Device::from_queries(description, DevicePolicy::RESIDENT_TABLES).expect(stem), ) }) .collect(); @@ -725,7 +725,7 @@ fn tessellated_and_mesh_pipelines_answer_an_unwritten_fragment_input_as_a_vertex .join(format!("{stem}.json")); let text = std::fs::read_to_string(&path).unwrap_or_else(|e| panic!("{}: {e}", path.display())); let description = DeviceDescription::from_khronos_json(&text, None).expect(stem); - let device = Device::from_queries(description, DevicePolicy::default()).expect(stem); + let device = Device::from_queries(description, DevicePolicy::RESIDENT_TABLES).expect(stem); let budget = Budget::standard(); for attached in [true, false] { let named = attached.then(|| (vec!["color".to_string()], None)); @@ -795,7 +795,7 @@ fn one_creation_specializes_each_stage_once() { .join(format!("{stem}.json")); let text = std::fs::read_to_string(&path).unwrap_or_else(|e| panic!("{}: {e}", path.display())); let description = DeviceDescription::from_khronos_json(&text, None).expect(stem); - let device = Device::from_queries(description, DevicePolicy::default()).expect(stem); + let device = Device::from_queries(description, DevicePolicy::RESIDENT_TABLES).expect(stem); let budget = Budget::standard(); let mut descriptor = RenderPipelineDescriptor::new(source(&library, "varying_vertex")); descriptor.fragment = Some(source(&library, "depth_writing_fragment")); diff --git a/crates/metal2vulkan/src/reflection/tests.rs b/crates/metal2vulkan/src/reflection/tests.rs index 717fd2969..31f56ef87 100644 --- a/crates/metal2vulkan/src/reflection/tests.rs +++ b/crates/metal2vulkan/src/reflection/tests.rs @@ -1030,7 +1030,7 @@ fn lavapipe() -> crate::device::Device { None, ) .expect("description"), - crate::device::DevicePolicy::default(), + crate::device::DevicePolicy::RESIDENT_TABLES, ) .expect("device") } diff --git a/crates/metal2vulkan/src/repro.rs b/crates/metal2vulkan/src/repro.rs index def93e1ed..6c35e6ff9 100644 --- a/crates/metal2vulkan/src/repro.rs +++ b/crates/metal2vulkan/src/repro.rs @@ -27,8 +27,9 @@ use crate::device::{DeviceDescription, DevicePolicy}; /// The device a command compiles for, as `device.json` holds it and the command line's `--device` /// reads it: a description and a policy, which build the same `Device` (`Device::from_queries`). /// A runtime's compile device is one: metal2vulkan-runtime's is the device's description -/// restricted to the features it enables, with the identity pointer and handle domains, which a -/// Khronos profile read by `--profile` (the default domains) does not reproduce. +/// restricted to the features it enables, under the default policy (the identity pointer and +/// handle domains), which a Khronos profile read by `--profile` takes too but whose description +/// is the profile's, not restricted to what the runtime enables. #[non_exhaustive] #[derive(Clone, Debug, PartialEq, Eq, serde::Serialize, serde::Deserialize)] pub struct ReproDevice { diff --git a/crates/metal2vulkan/src/spirv/testing.rs b/crates/metal2vulkan/src/spirv/testing.rs index 16e74c2f7..5c4e2fcc5 100644 --- a/crates/metal2vulkan/src/spirv/testing.rs +++ b/crates/metal2vulkan/src/spirv/testing.rs @@ -226,9 +226,9 @@ pub fn assert_valid(m: TypedModule, profile: &DeviceProfile) -> Vec { } /// Every committed device profile (`validation/profiles/*.json`, read-only), derived through -/// `Device::from_queries` with the default policy, sorted by file stem. +/// `Device::from_queries` with the resident-table domains, sorted by file stem. pub fn committed_profiles() -> Result, String> { - committed_profiles_under(DevicePolicy::default()) + committed_profiles_under(DevicePolicy::RESIDENT_TABLES) } /// [`committed_profiles`] that take threadgroup memory: those with diff --git a/crates/metal2vulkan/src/tests/constant_blob_footprint.rs b/crates/metal2vulkan/src/tests/constant_blob_footprint.rs index 9152a3489..2e52c8748 100644 --- a/crates/metal2vulkan/src/tests/constant_blob_footprint.rs +++ b/crates/metal2vulkan/src/tests/constant_blob_footprint.rs @@ -229,7 +229,7 @@ fn assemble(depth: u32, escaping: Escaping) -> Option> { /// Compile `bc` for `lavapipe` with the default caps: the result, the ledger peak, and the most /// bytes the compile held at once. fn compile(bc: &[u8]) -> (Result<(), Error>, Option, u64, u64) { - let p = profile("lavapipe", DevicePolicy::default()).expect("profile"); + let p = profile("lavapipe", DevicePolicy::RESIDENT_TABLES).expect("profile"); let mut m = Meter::with_caps(&Budget::default(), WORK_UNITS, LEDGER_BYTES); let (compiled, held) = held_during(|| { compile_bitcode( @@ -271,7 +271,7 @@ fn written(bc: &[u8]) -> (u64, u64, u64) { .join("../metal2vulkan-validation/profiles/lavapipe.json"); let text = std::fs::read_to_string(&path).expect("profile"); let desc = DeviceDescription::from_khronos_json(&text, None).expect("description"); - let device = Device::from_queries(desc, DevicePolicy::default()).expect("device"); + let device = Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES).expect("device"); let f = Library::from_air(bc) .expect("library") .function("blob") diff --git a/crates/metal2vulkan/src/tests/core_image_libraries.rs b/crates/metal2vulkan/src/tests/core_image_libraries.rs index 3d83bf2f7..1d7952e70 100644 --- a/crates/metal2vulkan/src/tests/core_image_libraries.rs +++ b/crates/metal2vulkan/src/tests/core_image_libraries.rs @@ -23,7 +23,7 @@ fn device() -> Device { .join("../metal2vulkan-validation/profiles/moltenvk-m3.json"); let text = std::fs::read_to_string(path).expect("profile"); let desc = DeviceDescription::from_khronos_json(&text, None).expect("description"); - Device::from_queries(desc, DevicePolicy::default()).expect("device") + Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES).expect("device") } /// A library of the extern functions `tint` and `shift`, over one module. diff --git a/crates/metal2vulkan/src/tests/engine_absent_value_arguments.rs b/crates/metal2vulkan/src/tests/engine_absent_value_arguments.rs index 5cc3c273f..41c2827c8 100644 --- a/crates/metal2vulkan/src/tests/engine_absent_value_arguments.rs +++ b/crates/metal2vulkan/src/tests/engine_absent_value_arguments.rs @@ -48,7 +48,7 @@ fn assemble(stem: &str) -> Option> { } fn prof(stem: &str) -> DeviceProfile { - profile(stem, DevicePolicy::default()).expect("committed profile") + profile(stem, DevicePolicy::RESIDENT_TABLES).expect("committed profile") } /// The boolean constants `on` true, every other constant undefined (so its gate is off). diff --git a/crates/metal2vulkan/src/tests/engine_access.rs b/crates/metal2vulkan/src/tests/engine_access.rs index 97a07b479..cdbaef835 100644 --- a/crates/metal2vulkan/src/tests/engine_access.rs +++ b/crates/metal2vulkan/src/tests/engine_access.rs @@ -62,7 +62,7 @@ use crate::spirv::verify::verify; const PROFILES: [&str; 3] = ["moltenvk-m3", "runtime-floor", "lavapipe"]; fn policy() -> DevicePolicy { - DevicePolicy::default() + DevicePolicy::RESIDENT_TABLES } /// Committed profile `stem`, optionally with buffer robustness disabled (the in-shader encoding) diff --git a/crates/metal2vulkan/src/tests/engine_aggregate_access.rs b/crates/metal2vulkan/src/tests/engine_aggregate_access.rs index 8813cf88b..f6c5081db 100644 --- a/crates/metal2vulkan/src/tests/engine_aggregate_access.rs +++ b/crates/metal2vulkan/src/tests/engine_aggregate_access.rs @@ -94,7 +94,7 @@ fn an_aggregate_buffer_access_moves_every_member() { let mut want = vec![105.0f32, 206.0, 307.0, 408.0]; want.extend(&m); for stem in ["moltenvk-m3", "lavapipe", "runtime-floor"] { - let profile = profile(stem, DevicePolicy::default()).expect("profile"); + let profile = profile(stem, DevicePolicy::RESIDENT_TABLES).expect("profile"); let (_, _, module) = compile_kept(&bitcode, "k", &profile).unwrap_or_else(|e| panic!("{stem}: {e}")); let res = Resources { diff --git a/crates/metal2vulkan/src/tests/engine_agx.rs b/crates/metal2vulkan/src/tests/engine_agx.rs index d8c7b4dc5..6c5ae6187 100644 --- a/crates/metal2vulkan/src/tests/engine_agx.rs +++ b/crates/metal2vulkan/src/tests/engine_agx.rs @@ -92,7 +92,7 @@ fn kernel(name: &str, buffers: u32, globals: &str, body: &str, decls: &str) -> S } fn moltenvk() -> DeviceProfile { - profile("moltenvk-m3", DevicePolicy::default()).expect("profile") + profile("moltenvk-m3", DevicePolicy::RESIDENT_TABLES).expect("profile") } /// A wave64-only compute device: the committed RDNA3 description with its subgroup size range @@ -104,7 +104,7 @@ fn wave64() -> DeviceProfile { let narrowed = text.replace("\"minSubgroupSize\": 32", "\"minSubgroupSize\": 64"); assert_ne!(narrowed, text, "the description names minSubgroupSize"); let desc = DeviceDescription::from_khronos_json(&narrowed, None).expect("description"); - Device::from_queries(desc, DevicePolicy::default()) + Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES) .expect("device") .profile() .clone() @@ -697,8 +697,8 @@ fn matmads_run_cluster32_at_64_lanes() { /// tile's cells are exchanged through workgroup memory. #[test] fn matmads_run_emulated_at_8_and_16_lanes() { - let p = - crate::pipeline::testing::profile("lavapipe", DevicePolicy::default()).expect("profile"); + let p = crate::pipeline::testing::profile("lavapipe", DevicePolicy::RESIDENT_TABLES) + .expect("profile"); for lanes in [SubgroupSize::W8, SubgroupSize::W16] { run_matmads(&p, Tier::Emulated, lanes, &[32, 64, 96]); } diff --git a/crates/metal2vulkan/src/tests/engine_air_2_9.rs b/crates/metal2vulkan/src/tests/engine_air_2_9.rs index 082bbe261..fdcbefaad 100644 --- a/crates/metal2vulkan/src/tests/engine_air_2_9.rs +++ b/crates/metal2vulkan/src/tests/engine_air_2_9.rs @@ -474,7 +474,7 @@ fn msl_4_1_orders_reach_spirv() { } Err(AssembleError::Rejected(why)) => panic!("llvm-as: {why}"), }; - let p = profile("nvidia-rtx50-linux", DevicePolicy::default()).expect("profile"); + let p = profile("nvidia-rtx50-linux", DevicePolicy::RESIDENT_TABLES).expect("profile"); // Scopes: Device 1, Workgroup 2, Subgroup 3. Semantics: Acquire 0x2, Release 0x4, // AcquireRelease 0x8, UniformMemory 0x40, WorkgroupMemory 0x100, ImageMemory 0x800. let every = 0x40 | 0x100 | 0x800; @@ -585,7 +585,7 @@ fn a_fragment_ordered_tile_atomic_keeps_its_order() { } Err(AssembleError::Rejected(why)) => panic!("llvm-as: {why}"), }; - let p = profile("nvidia-rtx50-linux", DevicePolicy::default()).expect("profile"); + let p = profile("nvidia-rtx50-linux", DevicePolicy::RESIDENT_TABLES).expect("profile"); let a = compile(&bc, "f", &p).unwrap_or_else(|e| panic!("f: {e}")); let (_, words) = link_and_validate(&a, &p).unwrap_or_else(|e| panic!("f: {e}")); let text = spirv_dis(&words); @@ -630,7 +630,7 @@ fn a_compare_exchange_failing_acquiring_keeps_its_acquire() { } Err(AssembleError::Rejected(why)) => panic!("llvm-as: {why}"), }; - let p = profile("nvidia-rtx50-linux", DevicePolicy::default()).expect("profile"); + let p = profile("nvidia-rtx50-linux", DevicePolicy::RESIDENT_TABLES).expect("profile"); let a = compile(&bc, "k", &p).unwrap_or_else(|e| panic!("k: {e}")); let (_, words) = link_and_validate(&a, &p).unwrap_or_else(|e| panic!("k: {e}")); let text = spirv_dis(&words); @@ -739,7 +739,7 @@ fn thread_atomics_compute_their_documented_words() { let threads = 8; let want: Vec = (0..threads).flat_map(thread_atomic_words).collect(); for stem in ["moltenvk-m3", "lavapipe", "runtime-floor"] { - let p = profile(stem, DevicePolicy::default()).expect("profile"); + let p = profile(stem, DevicePolicy::RESIDENT_TABLES).expect("profile"); let a = compile(&bc, entry, &p).unwrap_or_else(|e| panic!("{stem}: {e}")); let (_, words) = link_and_validate(&a, &p).unwrap_or_else(|e| panic!("{stem}: {e}")); let text = spirv_dis(&words); diff --git a/crates/metal2vulkan/src/tests/engine_alpha_coverage.rs b/crates/metal2vulkan/src/tests/engine_alpha_coverage.rs index 4fc28be05..7d68624ec 100644 --- a/crates/metal2vulkan/src/tests/engine_alpha_coverage.rs +++ b/crates/metal2vulkan/src/tests/engine_alpha_coverage.rs @@ -50,7 +50,7 @@ fn a_pipeline_covering_by_alpha_notes_the_device_s_coverage() { ] { let dev = Device::from_queries( description(stem).expect("committed description"), - DevicePolicy::default(), + DevicePolicy::RESIDENT_TABLES, ) .expect("device"); for samples in [1, 4] { diff --git a/crates/metal2vulkan/src/tests/engine_amplification.rs b/crates/metal2vulkan/src/tests/engine_amplification.rs index 0ae75254b..2313ebe97 100644 --- a/crates/metal2vulkan/src/tests/engine_amplification.rs +++ b/crates/metal2vulkan/src/tests/engine_amplification.rs @@ -76,7 +76,7 @@ fn fixture() -> Option> { } fn prof(stem: &str) -> DeviceProfile { - profile(stem, DevicePolicy::default()).expect("committed profile") + profile(stem, DevicePolicy::RESIDENT_TABLES).expect("committed profile") } fn description(stem: &str) -> DeviceDescription { @@ -88,7 +88,7 @@ fn description(stem: &str) -> DeviceDescription { } fn device(stem: &str) -> Device { - Device::from_queries(description(stem), DevicePolicy::default()).expect("device") + Device::from_queries(description(stem), DevicePolicy::RESIDENT_TABLES).expect("device") } /// `nvidia-rtx50-linux` with `features` removed from its description (with `Multiview`, the @@ -98,7 +98,7 @@ fn nvidia_without(features: &[F]) -> Device { for f in features { assert!(desc.features.remove(f), "nvidia-rtx50-linux has {f:?}"); } - Device::from_queries(desc, DevicePolicy::default()).expect("device") + Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES).expect("device") } /// Link `a` alone, relocate it, and run L3; the specialization constants link declared. @@ -848,7 +848,7 @@ fn below_the_floor() -> Device { let mut desc = description("runtime-floor"); assert!(desc.features.remove(&F::ShaderOutputLayer)); assert!(!desc.features.contains(&F::GeometryShader)); - Device::from_queries(desc, DevicePolicy::default()).expect("device") + Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES).expect("device") } /// What a variant that stores a layered amplification's slice needs on a device without @@ -872,7 +872,7 @@ fn a_profile_without_shader_output_layer_draws_or_refuses_every_amplification() let mut lavapipe = description("lavapipe"); assert!(lavapipe.features.remove(&F::ShaderOutputLayer)); assert!(lavapipe.features.contains(&F::GeometryShader)); - let lavapipe = Device::from_queries(lavapipe, DevicePolicy::default()).expect("device"); + let lavapipe = Device::from_queries(lavapipe, DevicePolicy::RESIDENT_TABLES).expect("device"); for (stem, dev) in [ ("runtime-floor without shaderOutputLayer", below_the_floor()), ("lavapipe without shaderOutputLayer", lavapipe), diff --git a/crates/metal2vulkan/src/tests/engine_arena.rs b/crates/metal2vulkan/src/tests/engine_arena.rs index 39a0dacb6..d9e6f0015 100644 --- a/crates/metal2vulkan/src/tests/engine_arena.rs +++ b/crates/metal2vulkan/src/tests/engine_arena.rs @@ -45,7 +45,7 @@ const PROFILES: [&str; 3] = ["moltenvk-m3", "runtime-floor", "lavapipe"]; const DATALAYOUT: &str = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v16:16:16-v24:32:32-v32:32:32-v48:64:64-v64:64:64-v96:128:128-v128:128:128-v192:256:256-v256:256:256-v512:512:512-v1024:1024:1024-n8:16:32"; fn p(stem: &str) -> DeviceProfile { - profile(stem, DevicePolicy::default()).expect("profile") + profile(stem, DevicePolicy::RESIDENT_TABLES).expect("profile") } fn assemble(name: &str, body: &str) -> Option> { diff --git a/crates/metal2vulkan/src/tests/engine_argument_tables.rs b/crates/metal2vulkan/src/tests/engine_argument_tables.rs index 143177542..a32b52a1a 100644 --- a/crates/metal2vulkan/src/tests/engine_argument_tables.rs +++ b/crates/metal2vulkan/src/tests/engine_argument_tables.rs @@ -216,8 +216,8 @@ fn an_argument_table_call_without_a_function_of_its_type_compiles() { let Some((caller, functions)) = fixtures() else { return; }; - let p = - crate::pipeline::testing::profile("moltenvk-m3", DevicePolicy::default()).expect("profile"); + let p = crate::pipeline::testing::profile("moltenvk-m3", DevicePolicy::RESIDENT_TABLES) + .expect("profile"); let none = FunctionConstantValues::defaults(); let half = [LinkedSource::new("table_half", &functions, &none)]; let empty: &[LinkedSource<'_>] = &[]; @@ -235,7 +235,7 @@ pub(super) fn device(stem: &str) -> Device { .join(format!("{stem}.json")); let text = std::fs::read_to_string(path).expect("profile"); let desc = DeviceDescription::from_khronos_json(&text, None).expect("description"); - Device::from_queries(desc, DevicePolicy::default()).expect("device") + Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES).expect("device") } /// The pipeline of kernel `entry` with the four functions linked, through the public API. @@ -718,8 +718,8 @@ fn without_listed_tables_every_id_reads_the_null_table() { assert_eq!(entries(&directory), vec![(0, 0, 0); 16]); let none = FunctionConstantValues::defaults(); let linked = sources(&functions, &none); - let p = - crate::pipeline::testing::profile("moltenvk-m3", DevicePolicy::default()).expect("profile"); + let p = crate::pipeline::testing::profile("moltenvk-m3", DevicePolicy::RESIDENT_TABLES) + .expect("profile"); let (_, one) = typed_module_linked(&caller, ONE, &p, &linked).expect("module"); for id in [T, 0] { assert_eq!( diff --git a/crates/metal2vulkan/src/tests/engine_arith.rs b/crates/metal2vulkan/src/tests/engine_arith.rs index b2cce283a..609a9fa6f 100644 --- a/crates/metal2vulkan/src/tests/engine_arith.rs +++ b/crates/metal2vulkan/src/tests/engine_arith.rs @@ -11,7 +11,7 @@ //! an integer where it needs one. `llvm-as` assembles the generated module; without it the test //! skips visibly. //! -//! Every profile here takes Metal's `half` rounding and NaN (the default policy), whose answers these +//! Every profile here takes Metal's `half` rounding and NaN, whose answers these //! tests check; the maths functions are the device's on every device but MoltenVK //! (`engine_native_maths`). @@ -1056,7 +1056,7 @@ fn fp8_widenings_are_the_devices_own_where_it_has_8_bit_floats() { let float8 = crate::device::requirements::SpirvCapability::of(crate::spv::Capability::Float8EXT); for (stem, native) in [("nvidia-rtx50-linux", true), ("lavapipe", false)] { - let p = profile(stem, DevicePolicy::default()).expect("profile"); + let p = profile(stem, DevicePolicy::RESIDENT_TABLES).expect("profile"); assert_eq!(p.fields().leaf.float8, native, "{stem}"); for kk in &ks { let what = format!("{} on {stem}", kk.name); @@ -1134,7 +1134,7 @@ fn arith_kernels_validate_and_compute_on_every_profile() { let (mut met, mut refused) = (Vec::new(), Vec::new()); let mut computed = 0; for stem in PROFILES { - let p = profile(stem, crate::device::DevicePolicy::default()).expect("profile"); + let p = profile(stem, crate::device::DevicePolicy::RESIDENT_TABLES).expect("profile"); for kk in &ks { let what = format!("{} on {stem}", kk.name); let missing = kk.needs.iter().copied().find(|n| !has(&p, *n)); @@ -1258,7 +1258,7 @@ fn wide_divisions_share_one_routine_per_form() { crate::pipeline::testing::profile_without( "runtime-floor", &[crate::device::requirements::VkFeature::ShaderInt64], - crate::device::DevicePolicy::default(), + crate::device::DevicePolicy::RESIDENT_TABLES, ) .expect("profile"), 3, @@ -1267,7 +1267,11 @@ fn wide_divisions_share_one_routine_per_form() { ), ( "amd-rdna3-radv", - profile("amd-rdna3-radv", crate::device::DevicePolicy::default()).expect("profile"), + profile( + "amd-rdna3-radv", + crate::device::DevicePolicy::RESIDENT_TABLES, + ) + .expect("profile"), 1, 0, 0, @@ -1333,7 +1337,7 @@ fn fused_multiply_adds_take_the_profiles_route() { // (profile, OpFmaKHR of the float kernel); its route is the device's `Fma` without them, the // `half` kernel's on every profile. for (stem, khr) in [("moltenvk-m3", 3), ("lavapipe", 0), ("runtime-floor", 0)] { - let p = profile(stem, crate::device::DevicePolicy::default()).expect("profile"); + let p = profile(stem, crate::device::DevicePolicy::RESIDENT_TABLES).expect("profile"); for kk in &ks { let float = kk.name == "fma_float_rounds_once"; let native = !float || khr == 0; @@ -1454,7 +1458,7 @@ fn a_half_fused_multiply_add_is_the_devices_16_bit_fma_on_from_queries() { ] { let what = format!("fma_half_rounds_once on {stem} (from_queries)"); let desc = description(stem).expect("description"); - let device = Device::from_queries(desc, crate::device::DevicePolicy::default()) + let device = Device::from_queries(desc, crate::device::DevicePolicy::RESIDENT_TABLES) .unwrap_or_else(|e| panic!("{what}: {e}")); let p = device.profile(); let controls = half_controls(p); @@ -1620,7 +1624,7 @@ fn dot_is_the_devices_op_dot_on_every_profile() { }; for stem in ["moltenvk-m3", "amd-rdna3-radv", "lavapipe", "runtime-floor"] { { - let policy = DevicePolicy::default(); + let policy = DevicePolicy::RESIDENT_TABLES; let p = profile(stem, policy).expect("profile"); for kk in &ks { let what = format!("{} on {stem}", kk.name); @@ -1681,7 +1685,7 @@ fn fast_fmod_is_metals_composition() { ("lavapipe", 0, 1), ("runtime-floor", 0, 1), ] { - let p = profile(stem, crate::device::DevicePolicy::default()).expect("profile"); + let p = profile(stem, crate::device::DevicePolicy::RESIDENT_TABLES).expect("profile"); let kk = &ks[0]; let what = format!("{} on {stem}", kk.name); let a = compile(&bitcode, kk.name, &p).unwrap_or_else(|e| panic!("{what}: {e:?}")); @@ -1735,7 +1739,7 @@ fn an_ordered_not_equal_is_the_negated_unordered_equal() { return; }; for stem in ["moltenvk-m3", "lavapipe", "runtime-floor"] { - let p = profile(stem, crate::device::DevicePolicy::default()).expect("profile"); + let p = profile(stem, crate::device::DevicePolicy::RESIDENT_TABLES).expect("profile"); let kk = &ks[0]; let what = format!("{} on {stem}", kk.name); let a = compile(&bitcode, kk.name, &p).unwrap_or_else(|e| panic!("{what}: {e:?}")); @@ -1801,7 +1805,7 @@ fn an_arcp_division_is_the_devices_quotient() { return; }; for stem in ["moltenvk-m3", "lavapipe", "runtime-floor"] { - let p = profile(stem, crate::device::DevicePolicy::default()).expect("profile"); + let p = profile(stem, crate::device::DevicePolicy::RESIDENT_TABLES).expect("profile"); for kk in &ks { let what = format!("{} on {stem}", kk.name); let a = compile(&bitcode, kk.name, &p).unwrap_or_else(|e| panic!("{what}: {e:?}")); @@ -1887,7 +1891,7 @@ fn a_fast_division_leaves_its_nans_to_the_device() { }; nans_are_the_device_s(&bitcode, &ks, false, &[], &|_| true); for stem in every_profile() { - let p = profile(&stem, crate::device::DevicePolicy::default()).expect("profile"); + let p = profile(&stem, crate::device::DevicePolicy::RESIDENT_TABLES).expect("profile"); for kk in &ks { let what = format!("{} on {stem}", kk.name); let a = compile(&bitcode, kk.name, &p).unwrap_or_else(|e| panic!("{what}: {e:?}")); @@ -1984,7 +1988,7 @@ fn a_division_without_arcp_is_the_devices_quotient() { return; }; for stem in ["moltenvk-m3", "lavapipe", "runtime-floor"] { - let p = profile(stem, crate::device::DevicePolicy::default()).expect("profile"); + let p = profile(stem, crate::device::DevicePolicy::RESIDENT_TABLES).expect("profile"); for kk in &ks { let what = format!("{} on {stem}", kk.name); let a = compile(&bitcode, kk.name, &p).unwrap_or_else(|e| panic!("{what}: {e:?}")); @@ -2062,7 +2066,7 @@ fn fast_sincos_is_the_devices_sine_and_cosine() { return; }; for stem in ["moltenvk-m3", "lavapipe", "runtime-floor"] { - let p = profile(stem, crate::device::DevicePolicy::default()).expect("profile"); + let p = profile(stem, crate::device::DevicePolicy::RESIDENT_TABLES).expect("profile"); for kk in &ks { let what = format!("{} on {stem}", kk.name); let a = compile(&bitcode, kk.name, &p).unwrap_or_else(|e| panic!("{what}: {e:?}")); @@ -2118,7 +2122,7 @@ fn device_float_environment_notes_follow_the_operations() { return; }; for stem in ["moltenvk-m3", "lavapipe"] { - let p = profile(stem, crate::device::DevicePolicy::default()).expect("profile"); + let p = profile(stem, crate::device::DevicePolicy::RESIDENT_TABLES).expect("profile"); for (kk, want) in ks.iter().zip(notes) { let what = format!("{} on {stem}", kk.name); let a = compile(&bitcode, kk.name, &p).unwrap_or_else(|e| panic!("{what}: {e:?}")); @@ -2172,7 +2176,7 @@ fn a_float_remainder_is_the_devices_without_every_flag() { return; }; for stem in PROFILES { - let p = profile(stem, crate::device::DevicePolicy::default()).expect("profile"); + let p = profile(stem, crate::device::DevicePolicy::RESIDENT_TABLES).expect("profile"); for kk in &ks { let what = format!("{} on {stem}", kk.name); let a = compile(&bitcode, kk.name, &p).unwrap_or_else(|e| panic!("{what}: {e:?}")); @@ -2225,7 +2229,7 @@ fn unlowered_arithmetic_refuses_as_not_implemented() { let Some(bitcode) = assemble("refusals", &text) else { return; }; - let p = profile("moltenvk-m3", crate::device::DevicePolicy::default()).expect("profile"); + let p = profile("moltenvk-m3", crate::device::DevicePolicy::RESIDENT_TABLES).expect("profile"); for kk in &cases { match compile(&bitcode, kk.name, &p) { Err(Error::Unsupported(u)) => { @@ -2332,7 +2336,7 @@ fn float_ops_without_contract_and_reassoc_are_no_contraction() { return; }; for stem in PROFILES { - let p = profile(stem, crate::device::DevicePolicy::default()).expect("profile"); + let p = profile(stem, crate::device::DevicePolicy::RESIDENT_TABLES).expect("profile"); for kk in &ks { let what = format!("{} on {stem}", kk.name); let a = compile(&bitcode, kk.name, &p).unwrap_or_else(|e| panic!("{what}: {e:?}")); @@ -2429,7 +2433,7 @@ fn arithmetic_the_air_lets_a_compiler_rewrite_notes_fast_math_rewrites() { return; }; for stem in PROFILES { - let p = profile(stem, crate::device::DevicePolicy::default()).expect("profile"); + let p = profile(stem, crate::device::DevicePolicy::RESIDENT_TABLES).expect("profile"); for (i, kk) in ks.iter().enumerate() { let what = format!("{} on {stem}", kk.name); let a = compile(&bitcode, kk.name, &p).unwrap_or_else(|e| panic!("{what}: {e:?}")); @@ -2495,7 +2499,7 @@ fn narrow_float_module_growth_is_bounded() { }; let words = ks .each_ref() - .map(|kk| words_on(crate::device::DevicePolicy::default(), kk)); + .map(|kk| words_on(crate::device::DevicePolicy::RESIDENT_TABLES, kk)); eprintln!( "half and bfloat growth on {stem}: float {} words, half {} ({:+}), bfloat {} ({:+})", words[0], @@ -2569,7 +2573,7 @@ fn half_rounding_follows_the_operation() { return; }; for stem in PROFILES { - let p = profile(stem, crate::device::DevicePolicy::default()).expect("profile"); + let p = profile(stem, crate::device::DevicePolicy::RESIDENT_TABLES).expect("profile"); for kk in &ks { let what = format!("{} on {stem}", kk.name); let a = compile(&bitcode, kk.name, &p).unwrap_or_else(|e| panic!("{what}: {e:?}")); @@ -2725,7 +2729,7 @@ fn a_half_rounding_without_float16_is_the_quantize_alone() { return; }; for stem in PROFILES { - let p = profile(stem, crate::device::DevicePolicy::default()).expect("profile"); + let p = profile(stem, crate::device::DevicePolicy::RESIDENT_TABLES).expect("profile"); for (kk, &(_, _, quantizes)) in ks.iter().zip(&cases) { let what = format!("{} on {stem}", kk.name); let a = compile(&bitcode, kk.name, &p).unwrap_or_else(|e| panic!("{what}: {e:?}")); @@ -2904,7 +2908,7 @@ fn float_ops_without_fast_flags_preserve_signed_zero_inf_nan() { }; let (mut declared, mut noted) = (0, 0); for stem in PROFILES { - let p = profile(stem, crate::device::DevicePolicy::default()).expect("profile"); + let p = profile(stem, crate::device::DevicePolicy::RESIDENT_TABLES).expect("profile"); let supported = p.fields().float_controls.f32.signed_zero_inf_nan_preserve; for kk in &ks { let what = format!("{} on {stem}", kk.name); @@ -2975,7 +2979,7 @@ fn fused_multiply_adds_keep_no_zero_signs() { let Some(bitcode) = assemble("fma-zero-signs", &text) else { return; }; - for (stem, p) in committed_profiles_with(DevicePolicy::default()).expect("profiles") { + for (stem, p) in committed_profiles_with(DevicePolicy::RESIDENT_TABLES).expect("profiles") { for kk in &ks { let what = format!("{} on {stem}", kk.name); let a = compile(&bitcode, kk.name, &p).unwrap_or_else(|e| panic!("{what}: {e:?}")); @@ -3017,7 +3021,7 @@ fn a_convert_tells_a_nan_by_its_bits_where_the_entry_may_assume_none() { }; let mut bits = 0; for stem in PROFILES { - let p = profile(stem, crate::device::DevicePolicy::default()).expect("profile"); + let p = profile(stem, crate::device::DevicePolicy::RESIDENT_TABLES).expect("profile"); for kk in &ks { let what = format!("{} on {stem}", kk.name); let a = compile(&bitcode, kk.name, &p).unwrap_or_else(|e| panic!("{what}: {e:?}")); @@ -3077,7 +3081,7 @@ fn a_fast_division_is_the_device_s_quotient() { let Some(bitcode) = assemble("fast-quotient", &module(&ks)) else { return; }; - let p = profile("moltenvk-m3", crate::device::DevicePolicy::default()).expect("profile"); + let p = profile("moltenvk-m3", crate::device::DevicePolicy::RESIDENT_TABLES).expect("profile"); for (kk, fast_math) in ks.iter().zip(fast_math) { { let what = kk.name.to_string(); @@ -3190,7 +3194,7 @@ fn nans_are_the_device_s( noted: &dyn Fn(&str) -> bool, ) { for stem in ["lavapipe", "moltenvk-m3"] { - let p = profile(stem, crate::device::DevicePolicy::default()).expect("profile"); + let p = profile(stem, crate::device::DevicePolicy::RESIDENT_TABLES).expect("profile"); for kk in ks { { let what = format!("{} on {stem}", kk.name); @@ -3386,7 +3390,7 @@ fn float_denormals_are_the_devices_and_noted() { return; }; for stem in ["moltenvk-m3", "lavapipe"] { - let p = profile(stem, crate::device::DevicePolicy::default()).expect("profile"); + let p = profile(stem, crate::device::DevicePolicy::RESIDENT_TABLES).expect("profile"); for (kk, device) in ks.iter().zip(&devices) { let what = format!("{} on {stem}", kk.name); let a = compile(&bitcode, kk.name, &p).unwrap_or_else(|e| panic!("{what}: {e:?}")); @@ -3496,7 +3500,7 @@ fn a_nan_test_no_float_mode_folds() { }; let (mut bits_tested, mut is_nan_tested) = (0, 0); for stem in PROFILES.into_iter().chain(["lavapipe"]) { - let p = profile(stem, crate::device::DevicePolicy::default()).expect("profile"); + let p = profile(stem, crate::device::DevicePolicy::RESIDENT_TABLES).expect("profile"); for kk in &ks { let what = format!("{} on {stem}", kk.name); let a = compile(&bitcode, kk.name, &p).unwrap_or_else(|e| panic!("{what}: {e:?}")); @@ -3547,7 +3551,7 @@ fn a_nan_test_no_float_mode_folds() { Err(AssembleError::Rejected(e)) => panic!("llvm-as rejected {entry}: {e}"), }; for stem in PROFILES.into_iter().chain(["lavapipe"]) { - let p = profile(stem, crate::device::DevicePolicy::default()).expect("profile"); + let p = profile(stem, crate::device::DevicePolicy::RESIDENT_TABLES).expect("profile"); let what = format!("{entry} on {stem}"); let a = compile(&bitcode, entry, &p).unwrap_or_else(|e| panic!("{what}: {e:?}")); let (_, words) = @@ -3798,7 +3802,7 @@ fn half_moves_are_the_devices_bits() { return; }; for stem in ["lavapipe", "moltenvk-m3"] { - let p = profile(stem, DevicePolicy::default()).expect("profile"); + let p = profile(stem, DevicePolicy::RESIDENT_TABLES).expect("profile"); for kk in &ks { let what = format!("{} on {stem}", kk.name); let a = compile(&bitcode, kk.name, &p).unwrap_or_else(|e| panic!("{what}: {e:?}")); @@ -3958,7 +3962,7 @@ fn pack_conversions_are_the_devices() { return; }; for stem in ["lavapipe", "moltenvk-m3"] { - let p = profile(stem, DevicePolicy::default()).expect("profile"); + let p = profile(stem, DevicePolicy::RESIDENT_TABLES).expect("profile"); for kk in &ks { let what = format!("{} on {stem}", kk.name); let a = compile(&bitcode, kk.name, &p).unwrap_or_else(|e| panic!("{what}: {e:?}")); @@ -4057,7 +4061,7 @@ fn float_sign_operations_are_the_devices_on_every_profile() { }) }; for stem in PROFILES.iter().copied().chain(["lavapipe"]) { - let p = profile(stem, crate::device::DevicePolicy::default()).expect("profile"); + let p = profile(stem, crate::device::DevicePolicy::RESIDENT_TABLES).expect("profile"); for kk in &ks { let what = format!("{} on {stem}", kk.name); let a = compile(&bitcode, kk.name, &p).unwrap_or_else(|e| panic!("{what}: {e:?}")); @@ -4236,7 +4240,7 @@ fn float_min_max_are_the_device_s_on_every_profile() { }) }; for stem in PROFILES.iter().copied().chain(["lavapipe"]) { - let p = profile(stem, crate::device::DevicePolicy::default()).expect("profile"); + let p = profile(stem, crate::device::DevicePolicy::RESIDENT_TABLES).expect("profile"); for kk in &ks { let what = format!("{} on {stem}", kk.name); let a = compile(&bitcode, kk.name, &p).unwrap_or_else(|e| panic!("{what}: {e:?}")); @@ -4328,7 +4332,7 @@ fn half_fmod_is_its_float_remainder_on_every_profile() { return; }; for stem in PROFILES.iter().copied().chain(["lavapipe"]) { - let p = profile(stem, crate::device::DevicePolicy::default()).expect("profile"); + let p = profile(stem, crate::device::DevicePolicy::RESIDENT_TABLES).expect("profile"); for kk in &ks { let what = format!("{} on {stem}", kk.name); let a = compile(&bitcode, kk.name, &p).unwrap_or_else(|e| panic!("{what}: {e:?}")); @@ -4423,7 +4427,7 @@ fn mix_is_the_devices_fmix_on_every_profile() { .copied() .chain(["lavapipe", "amd-rdna3-radv"]) { - let p = profile(stem, crate::device::DevicePolicy::default()).expect("profile"); + let p = profile(stem, crate::device::DevicePolicy::RESIDENT_TABLES).expect("profile"); for kk in &ks { let what = format!("{} on {stem}", kk.name); let a = compile(&bitcode, kk.name, &p).unwrap_or_else(|e| panic!("{what}: {e:?}")); diff --git a/crates/metal2vulkan/src/tests/engine_async_copy.rs b/crates/metal2vulkan/src/tests/engine_async_copy.rs index e08e29353..1f23f0b29 100644 --- a/crates/metal2vulkan/src/tests/engine_async_copy.rs +++ b/crates/metal2vulkan/src/tests/engine_async_copy.rs @@ -74,7 +74,7 @@ struct Kernel { /// Kernel `entry` of `bc` for profile `stem`, checked through L3: its plan and typed module. fn kernel(bc: &[u8], entry: &str, stem: &str) -> Kernel { - let p = profile(stem, DevicePolicy::default()).expect("profile"); + let p = profile(stem, DevicePolicy::RESIDENT_TABLES).expect("profile"); let consts = FunctionConstantValues::defaults(); let what = format!("{entry} on {stem}"); let a = compile_bitcode( diff --git a/crates/metal2vulkan/src/tests/engine_atomics.rs b/crates/metal2vulkan/src/tests/engine_atomics.rs index 0aed79ae0..a21f06ab3 100644 --- a/crates/metal2vulkan/src/tests/engine_atomics.rs +++ b/crates/metal2vulkan/src/tests/engine_atomics.rs @@ -59,7 +59,7 @@ const PROFILES: [&str; 4] = [ const DATALAYOUT: &str = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v16:16:16-v24:32:32-v32:32:32-v48:64:64-v64:64:64-v96:128:128-v128:128:128-v192:256:256-v256:256:256-v512:512:512-v1024:1024:1024-n8:16:32"; fn p(stem: &str) -> DeviceProfile { - profile(stem, DevicePolicy::default()).expect("profile") + profile(stem, DevicePolicy::RESIDENT_TABLES).expect("profile") } /// Committed profile `stem` without buffer robustness: containment is checked in the shader. @@ -83,7 +83,7 @@ fn without(stem: &str, features: &[VkFeature]) -> DeviceProfile { for f in features { desc.features.remove(f); } - Device::from_queries(desc, DevicePolicy::default()) + Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES) .expect("device") .profile() .clone() diff --git a/crates/metal2vulkan/src/tests/engine_bias_reach.rs b/crates/metal2vulkan/src/tests/engine_bias_reach.rs index e5eab5a76..850bc63d1 100644 --- a/crates/metal2vulkan/src/tests/engine_bias_reach.rs +++ b/crates/metal2vulkan/src/tests/engine_bias_reach.rs @@ -123,7 +123,7 @@ declare {{ <4 x float>, i8 }} @air.sample_texture_2d.v4f32(ptr addrspace(1), ptr } fn p(stem: &str) -> DeviceProfile { - profile(stem, DevicePolicy::default()).expect(stem) + profile(stem, DevicePolicy::RESIDENT_TABLES).expect(stem) } fn max_bias(p: &DeviceProfile) -> f32 { @@ -426,7 +426,7 @@ fn hoisted_derivatives_take_the_whole_bias() { let without = crate::pipeline::testing::profile_without( "runtime-floor", &[crate::device::requirements::VkFeature::SamplerAnisotropy], - crate::device::DevicePolicy::default(), + crate::device::DevicePolicy::RESIDENT_TABLES, ) .expect("profile"); for (stem, profile, emulations) in [ @@ -502,7 +502,7 @@ fn an_anisotropic_sampler_takes_the_axis_gradients() { .features .remove(&crate::device::requirements::VkFeature::SamplerAnisotropy)); } - crate::device::Device::from_queries(desc, DevicePolicy::default()) + crate::device::Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES) .expect(stem) .profile() .clone() diff --git a/crates/metal2vulkan/src/tests/engine_bicubic.rs b/crates/metal2vulkan/src/tests/engine_bicubic.rs index 28897577d..f8f5c0248 100644 --- a/crates/metal2vulkan/src/tests/engine_bicubic.rs +++ b/crates/metal2vulkan/src/tests/engine_bicubic.rs @@ -70,7 +70,7 @@ fn assemble_module(name: &str, text: &str) -> Option> { } fn m3() -> DeviceProfile { - profile("moltenvk-m3", DevicePolicy::default()).expect("profile") + profile("moltenvk-m3", DevicePolicy::RESIDENT_TABLES).expect("profile") } /// The words of `constexpr sampler(filter::bicubic, ...)` with every axis addressed by `address` @@ -1436,7 +1436,7 @@ fn a_bicubic_sample_is_one_call_of_the_planes_sum() { } Err(AssembleError::Rejected(e)) => panic!("llvm-as rejected bcx_rules: {e}"), }; - let p = profile("intel-irisxe-rplp-anv", DevicePolicy::default()).expect("profile"); + let p = profile("intel-irisxe-rplp-anv", DevicePolicy::RESIDENT_TABLES).expect("profile"); let (_, m) = typed_module(&bc, "bcx_rules", &p).expect("typed module"); let functions = m.functions(); let entry = functions.get(m.entry().func.index()).expect("entry"); diff --git a/crates/metal2vulkan/src/tests/engine_binder.rs b/crates/metal2vulkan/src/tests/engine_binder.rs index cd133e915..1f9774d32 100644 --- a/crates/metal2vulkan/src/tests/engine_binder.rs +++ b/crates/metal2vulkan/src/tests/engine_binder.rs @@ -100,7 +100,7 @@ pub(super) fn device(stem: &str, tweak: impl FnOnce(&mut DeviceDescription)) -> let text = std::fs::read_to_string(path).expect("profile"); let mut desc = DeviceDescription::from_khronos_json(&text, None).expect("description"); tweak(&mut desc); - Device::from_queries(desc, DevicePolicy::default()).expect("device") + Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES).expect("device") } /// Profile F: `runtime-floor` without device addresses, below the runtime's floor, whose buffers diff --git a/crates/metal2vulkan/src/tests/engine_bit_manipulation.rs b/crates/metal2vulkan/src/tests/engine_bit_manipulation.rs index 78d044f8b..e771f22a8 100644 --- a/crates/metal2vulkan/src/tests/engine_bit_manipulation.rs +++ b/crates/metal2vulkan/src/tests/engine_bit_manipulation.rs @@ -40,7 +40,7 @@ fn profiles() -> [(&'static str, DeviceProfile); 2] { if !int64 { assert!(desc.features.remove(&VkFeature::ShaderInt64)); } - let p = Device::from_queries(desc, DevicePolicy::default()) + let p = Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES) .expect("device") .profile() .clone(); diff --git a/crates/metal2vulkan/src/tests/engine_buffer_table.rs b/crates/metal2vulkan/src/tests/engine_buffer_table.rs index 38f4a768f..46136c1d0 100644 --- a/crates/metal2vulkan/src/tests/engine_buffer_table.rs +++ b/crates/metal2vulkan/src/tests/engine_buffer_table.rs @@ -46,7 +46,7 @@ fn profile_with(stem: &str, robust: bool) -> DeviceProfile { desc.features.remove(&VkFeature::RobustBufferAccess); desc.features.remove(&VkFeature::RobustBufferAccess2); } - Device::from_queries(desc, DevicePolicy::default()) + Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES) .expect("device") .profile() .clone() diff --git a/crates/metal2vulkan/src/tests/engine_chosen_pointers.rs b/crates/metal2vulkan/src/tests/engine_chosen_pointers.rs index 89a57c577..714afe8f8 100644 --- a/crates/metal2vulkan/src/tests/engine_chosen_pointers.rs +++ b/crates/metal2vulkan/src/tests/engine_chosen_pointers.rs @@ -284,7 +284,7 @@ fn pointers_chosen_at_run_time_call_the_functions_they_hold() { let Some(fx) = fixtures() else { return; }; - let p = profile("moltenvk-m3", DevicePolicy::default()).expect("profile"); + let p = profile("moltenvk-m3", DevicePolicy::RESIDENT_TABLES).expect("profile"); for (kernel, want) in SHAPES { let out = dispatch(&fx, kernel, 1, &p, &[(0, zeros()), (1, zeros())]); let all: Vec = (0..N).map(want).collect(); @@ -307,7 +307,7 @@ fn a_pointer_through_an_integer_is_its_word() { let Some(fx) = fixtures() else { return; }; - let p = profile("moltenvk-m3", DevicePolicy::default()).expect("profile"); + let p = profile("moltenvk-m3", DevicePolicy::RESIDENT_TABLES).expect("profile"); let out = dispatch(&fx, "fpc_int_back", 1, &p, &[(0, zeros()), (1, zeros())]); let all: Vec = (0..N) .map(|t| if t & 1 != 0 { dbl(t) } else { inc(t) }) @@ -331,7 +331,7 @@ fn table_entries_and_addresses_call_and_compare_alike() { let Some(fx) = fixtures() else { return; }; - let p = profile("moltenvk-m3", DevicePolicy::default()).expect("profile"); + let p = profile("moltenvk-m3", DevicePolicy::RESIDENT_TABLES).expect("profile"); let mut table = FunctionTableWords::new(3); let lib = crate::library::Library::from_air(&fx.1).expect("library"); let linked = LINKED @@ -372,7 +372,7 @@ fn recursion_through_chosen_pointers_reaches_metal_s_depth() { let Some(fx) = fixtures() else { return; }; - let p = profile("moltenvk-m3", DevicePolicy::default()).expect("profile"); + let p = profile("moltenvk-m3", DevicePolicy::RESIDENT_TABLES).expect("profile"); for k in [1, 2, 4, 8] { let (calls, reach) = (2 * k, 2 * k - 1); let depths: Vec = (0..N).flat_map(|t| (t / 2).to_le_bytes()).collect(); @@ -398,7 +398,7 @@ fn an_unlinked_function_s_address_needs_it() { let Some(fx) = fixtures() else { return; }; - let p = profile("moltenvk-m3", DevicePolicy::default()).expect("profile"); + let p = profile("moltenvk-m3", DevicePolicy::RESIDENT_TABLES).expect("profile"); let needs = |symbol: &str| { Err(Error::NeedsInput(RuntimeInput::LinkedFunction { symbol: DiagName::new(symbol), @@ -422,7 +422,7 @@ fn the_recursion_s_stack_is_refused_where_metal_s_is() { let Some(fx) = fixtures() else { return; }; - let p = profile("moltenvk-m3", DevicePolicy::default()).expect("profile"); + let p = profile("moltenvk-m3", DevicePolicy::RESIDENT_TABLES).expect("profile"); let refused = Err(Error::LimitExceeded(Limit::CallStackBytes)); let names = &LINKED[3..]; assert_eq!( diff --git a/crates/metal2vulkan/src/tests/engine_convert_rounding.rs b/crates/metal2vulkan/src/tests/engine_convert_rounding.rs index f6268611b..5b11fd079 100644 --- a/crates/metal2vulkan/src/tests/engine_convert_rounding.rs +++ b/crates/metal2vulkan/src/tests/engine_convert_rounding.rs @@ -108,7 +108,7 @@ fn profile(stem: &str, int64: bool) -> DeviceProfile { if !int64 { assert!(desc.features.remove(&VkFeature::ShaderInt64), "{stem}"); } - let p = Device::from_queries(desc, DevicePolicy::default()) + let p = Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES) .expect("device") .profile() .clone(); diff --git a/crates/metal2vulkan/src/tests/engine_copy.rs b/crates/metal2vulkan/src/tests/engine_copy.rs index 0184ecbae..cfa9c84e2 100644 --- a/crates/metal2vulkan/src/tests/engine_copy.rs +++ b/crates/metal2vulkan/src/tests/engine_copy.rs @@ -59,7 +59,7 @@ fn profiles() -> Vec<(String, DeviceProfile)> { for stem in PROFILES { out.push(( stem.to_owned(), - profile(stem, DevicePolicy::default()).expect("profile"), + profile(stem, DevicePolicy::RESIDENT_TABLES).expect("profile"), )); out.push((format!("{stem} unrobust"), variant(stem, true, false))); } @@ -80,7 +80,7 @@ fn variant(stem: &str, unrobust: bool, no_int64: bool) -> DeviceProfile { if no_int64 { desc.features.remove(&VkFeature::ShaderInt64); } - Device::from_queries(desc, DevicePolicy::default()) + Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES) .expect("device") .profile() .clone() diff --git a/crates/metal2vulkan/src/tests/engine_coverage_loop.rs b/crates/metal2vulkan/src/tests/engine_coverage_loop.rs index b9812d23b..9540d8c9c 100644 --- a/crates/metal2vulkan/src/tests/engine_coverage_loop.rs +++ b/crates/metal2vulkan/src/tests/engine_coverage_loop.rs @@ -112,7 +112,7 @@ fn description(stem: &str) -> DeviceDescription { } fn device(stem: &str) -> Device { - Device::from_queries(description(stem), DevicePolicy::default()).expect("device") + Device::from_queries(description(stem), DevicePolicy::RESIDENT_TABLES).expect("device") } /// Every committed profile's stem, sorted. diff --git a/crates/metal2vulkan/src/tests/engine_cross_class.rs b/crates/metal2vulkan/src/tests/engine_cross_class.rs index 92dee19d3..682040f6b 100644 --- a/crates/metal2vulkan/src/tests/engine_cross_class.rs +++ b/crates/metal2vulkan/src/tests/engine_cross_class.rs @@ -366,7 +366,7 @@ fn accesses_through_another_class_are_the_native_words() { .map(|stem| { ( stem, - profile(stem, DevicePolicy::default()).expect("profile"), + profile(stem, DevicePolicy::RESIDENT_TABLES).expect("profile"), ) }) .collect(); @@ -449,7 +449,7 @@ fn devices() -> Vec<(String, Device)> { let desc = DeviceDescription::from_khronos_json(&text, None).expect("description"); out.push(( stem, - Device::from_queries(desc, DevicePolicy::default()).expect("device"), + Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES).expect("device"), )); } out.sort_by(|a, b| a.0.cmp(&b.0)); @@ -1039,7 +1039,7 @@ fn integer_writes_saturate_to_the_bound_formats_channels() { .map(|stem| { ( stem, - profile(stem, DevicePolicy::default()).expect("profile"), + profile(stem, DevicePolicy::RESIDENT_TABLES).expect("profile"), ) }) .collect(); @@ -1161,7 +1161,7 @@ fn integer_writes_into_narrow_floats_take_the_devices_conversion() { ]; let mut checked = 0; for stem in ["lavapipe", "moltenvk-m3"] { - let p = profile(stem, DevicePolicy::default()).expect("profile"); + let p = profile(stem, DevicePolicy::RESIDENT_TABLES).expect("profile"); for (ty, format, narrow) in cases { let what = format!("write {ty:?} over {format:?} on {stem}"); let Some(bc) = assemble(&what, &write_kernel(ty)) else { diff --git a/crates/metal2vulkan/src/tests/engine_dead_fetch.rs b/crates/metal2vulkan/src/tests/engine_dead_fetch.rs index 6c50552d4..eb7abb652 100644 --- a/crates/metal2vulkan/src/tests/engine_dead_fetch.rs +++ b/crates/metal2vulkan/src/tests/engine_dead_fetch.rs @@ -57,7 +57,7 @@ fn device(stem: &str) -> Device { .join(format!("../metal2vulkan-validation/profiles/{stem}.json")); let text = std::fs::read_to_string(path).expect("profile"); let desc = DeviceDescription::from_khronos_json(&text, None).expect("description"); - Device::from_queries(desc, DevicePolicy::default()).expect("device") + Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES).expect("device") } /// Function `name` of `library` specialized with `dfk_reads` = `live` and `dfk_weight` one where diff --git a/crates/metal2vulkan/src/tests/engine_dead_reads.rs b/crates/metal2vulkan/src/tests/engine_dead_reads.rs index 0f5e15277..e07d018f3 100644 --- a/crates/metal2vulkan/src/tests/engine_dead_reads.rs +++ b/crates/metal2vulkan/src/tests/engine_dead_reads.rs @@ -59,7 +59,7 @@ fn device_without(stem: &str, features: &[VkFeature]) -> Device { for f in features { assert!(desc.features.remove(f), "{stem} has {f:?}"); } - Device::from_queries(desc, DevicePolicy::default()).expect("device") + Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES).expect("device") } /// The devices of the raster order tests, each with whether it has the pixel interlock. @@ -175,7 +175,7 @@ fn a_raster_order_group_on_an_input_dead_after_specialization_takes_no_interlock } let floor = Device::from_queries( description("runtime-floor").expect("profile"), - DevicePolicy::default(), + DevicePolicy::RESIDENT_TABLES, ) .expect("device"); cases.push(( diff --git a/crates/metal2vulkan/src/tests/engine_declared_varyings.rs b/crates/metal2vulkan/src/tests/engine_declared_varyings.rs index fda03b99b..76301daec 100644 --- a/crates/metal2vulkan/src/tests/engine_declared_varyings.rs +++ b/crates/metal2vulkan/src/tests/engine_declared_varyings.rs @@ -106,7 +106,7 @@ fn device(stem: &str) -> Device { .join(format!("{stem}.json")); let text = std::fs::read_to_string(&path).unwrap_or_else(|e| panic!("{}: {e}", path.display())); let description = DeviceDescription::from_khronos_json(&text, None).expect(stem); - Device::from_queries(description, DevicePolicy::default()).expect(stem) + Device::from_queries(description, DevicePolicy::RESIDENT_TABLES).expect(stem) } /// The `Location` of every user variable of storage class `class` in `words` (built-ins carry no diff --git a/crates/metal2vulkan/src/tests/engine_depth_range.rs b/crates/metal2vulkan/src/tests/engine_depth_range.rs index 508d6e0c9..f92446074 100644 --- a/crates/metal2vulkan/src/tests/engine_depth_range.rs +++ b/crates/metal2vulkan/src/tests/engine_depth_range.rs @@ -177,7 +177,7 @@ fn the_extension_is_read_from_the_device_description() { ("intel-irisxe-anv", false), ("runtime-floor", false), ] { - let p = profile(stem, DevicePolicy::default()).expect(stem); + let p = profile(stem, DevicePolicy::RESIDENT_TABLES).expect(stem); assert_eq!(unrestricted(&p), listed, "{stem}"); } } @@ -192,15 +192,15 @@ fn depth_comparisons_record_the_restricted_range_without_the_extension() { let profiles = [ ( "radv", - profile("amd-rdna3-radv", DevicePolicy::default()).expect("radv"), + profile("amd-rdna3-radv", DevicePolicy::RESIDENT_TABLES).expect("radv"), ), ( "anv", - profile("intel-irisxe-anv", DevicePolicy::default()).expect("anv"), + profile("intel-irisxe-anv", DevicePolicy::RESIDENT_TABLES).expect("anv"), ), ( "m3", - profile("moltenvk-m3", DevicePolicy::default()).expect("m3"), + profile("moltenvk-m3", DevicePolicy::RESIDENT_TABLES).expect("m3"), ), ]; let [(_, radv), (_, anv), (_, m3)] = &profiles; diff --git a/crates/metal2vulkan/src/tests/engine_device_replay.rs b/crates/metal2vulkan/src/tests/engine_device_replay.rs index 11c11bbdb..a9b62d662 100644 --- a/crates/metal2vulkan/src/tests/engine_device_replay.rs +++ b/crates/metal2vulkan/src/tests/engine_device_replay.rs @@ -145,7 +145,7 @@ fn devices_and_unaddressed() -> Vec<(String, Device)> { let text = std::fs::read_to_string(path).expect("profile"); let mut desc = DeviceDescription::from_khronos_json(&text, None).expect("description"); desc.features.remove(&VkFeature::BufferDeviceAddress); - let dev = Device::from_queries(desc, DevicePolicy::default()).expect("device"); + let dev = Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES).expect("device"); assert_ne!( dev.profile().fields().buffer_access, BufferAccess::Addressed @@ -172,7 +172,7 @@ fn devices_with(tweak: impl Fn(&mut DeviceDescription)) -> Vec<(String, Device)> tweak(&mut desc); ( stem, - Device::from_queries(desc, DevicePolicy::default()).expect("device"), + Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES).expect("device"), ) }) .collect(); @@ -1404,7 +1404,7 @@ fn gate_lavapipe(tweak: impl Fn(&mut Option)) -> De let text = std::fs::read_to_string(path).expect("profile"); let mut desc = DeviceDescription::from_khronos_json(&text, None).expect("description"); tweak(&mut desc.generated_commands); - Device::from_queries(desc, DevicePolicy::default()).expect("device") + Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES).expect("device") } /// The limit `set` changes on a description that states the facts. diff --git a/crates/metal2vulkan/src/tests/engine_dispatch.rs b/crates/metal2vulkan/src/tests/engine_dispatch.rs index a6a256867..e394c6280 100644 --- a/crates/metal2vulkan/src/tests/engine_dispatch.rs +++ b/crates/metal2vulkan/src/tests/engine_dispatch.rs @@ -150,7 +150,7 @@ fn run_word0(plan: &Plan, m: &TypedModule, d: &Dispatch) -> u32 { fn dispatch_kernels_compile_link_and_validate() { let Some(bc) = fixture() else { return }; for stem in PROFILES { - let p = profile(stem, DevicePolicy::default()).expect(stem); + let p = profile(stem, DevicePolicy::RESIDENT_TABLES).expect(stem); for entry in MARKERS .iter() .chain(&["threadgroup_barrier_store", "device_fence_store"]) @@ -256,7 +256,7 @@ fn a_simdgroup_barrier_flattens_or_is_emulated_with_the_tier() { #[test] fn single_region_builtins_run_on_the_interpreter() { let Some(bc) = fixture() else { return }; - let p = profile("moltenvk-m3", DevicePolicy::default()).expect("profile"); + let p = profile("moltenvk-m3", DevicePolicy::RESIDENT_TABLES).expect("profile"); let cases: [(&str, Dispatch, u32); 12] = [ ("thread_index_marker", single([8, 1, 1], [1, 1, 1]), 105), ("thread_index_marker", single([4, 1, 1], [2, 1, 1]), 0), @@ -287,7 +287,7 @@ fn single_region_builtins_run_on_the_interpreter() { #[test] fn edge_region_builtins_run_on_the_interpreter() { let Some(bc) = fixture() else { return }; - let p = profile("moltenvk-m3", DevicePolicy::default()).expect("profile"); + let p = profile("moltenvk-m3", DevicePolicy::RESIDENT_TABLES).expect("profile"); let (t, l) = ([40, 1, 1], [16, 1, 1]); let interior = || Dispatch { local: [16, 1, 1], @@ -320,7 +320,7 @@ fn edge_region_builtins_run_on_the_interpreter() { #[test] fn barrier_kernels_run_on_the_interpreter() { let Some(bc) = fixture() else { return }; - let p = profile("moltenvk-m3", DevicePolicy::default()).expect("profile"); + let p = profile("moltenvk-m3", DevicePolicy::RESIDENT_TABLES).expect("profile"); for (entry, local, want, form) in [ ( "threadgroup_barrier_store", @@ -358,7 +358,7 @@ fn barrier_kernels_run_on_the_interpreter() { } // The `seq_cst` fence orders through the kernel's binding of the status word where the device // does not address buffers (below the runtime's floor). - let floor = device_f(DevicePolicy::default()).expect(PROFILE_F); + let floor = device_f(DevicePolicy::RESIDENT_TABLES).expect(PROFILE_F); let (plan, m) = typed_module(&bc, "device_fence_store", floor.profile()).expect("device_fence_store"); assert_eq!( @@ -746,7 +746,7 @@ fn a_position_first_used_in_sibling_arms_is_derived_once() { assert!(loads.values().all(|&n| n == 1), "{stem} {what}: {loads:?}"); } } - let p = profile("moltenvk-m3", DevicePolicy::default()).expect("profile"); + let p = profile("moltenvk-m3", DevicePolicy::RESIDENT_TABLES).expect("profile"); let (plan, m) = typed_module(&arms, "k", &p).expect("compile"); let mut spec = BTreeMap::new(); for a in [Axis::X, Axis::Y, Axis::Z] { @@ -850,7 +850,7 @@ done: assert!(loads.values().all(|&n| n == 1), "{stem}: {loads:?}"); } assert!(read > 0, "no profile reads a push field"); - let p = profile("moltenvk-m3", DevicePolicy::default()).expect("profile"); + let p = profile("moltenvk-m3", DevicePolicy::RESIDENT_TABLES).expect("profile"); let (plan, m) = typed_module(&bc, "k", &p).expect("compile"); let mut spec = BTreeMap::new(); for a in [Axis::X, Axis::Y, Axis::Z] { diff --git a/crates/metal2vulkan/src/tests/engine_divergent_barriers.rs b/crates/metal2vulkan/src/tests/engine_divergent_barriers.rs index a4e123279..86afe9a86 100644 --- a/crates/metal2vulkan/src/tests/engine_divergent_barriers.rs +++ b/crates/metal2vulkan/src/tests/engine_divergent_barriers.rs @@ -429,7 +429,7 @@ fn run_case(plan: &Plan, m: &TypedModule, c: Case, lanes: SubgroupSize) -> Vec Device { .join(format!("{stem}.json")); let text = std::fs::read_to_string(path).expect("profile"); let desc = DeviceDescription::from_khronos_json(&text, None).expect("description"); - Device::from_queries(desc, DevicePolicy::default()).expect("device") + Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES).expect("device") } /// A draw of patches from base instance 7 writes `[patch_start, 7]` into the evaluation stage's diff --git a/crates/metal2vulkan/src/tests/engine_dynamic_libraries.rs b/crates/metal2vulkan/src/tests/engine_dynamic_libraries.rs index 98d68efb3..34c5c8e04 100644 --- a/crates/metal2vulkan/src/tests/engine_dynamic_libraries.rs +++ b/crates/metal2vulkan/src/tests/engine_dynamic_libraries.rs @@ -218,7 +218,7 @@ fn device() -> Device { .join("../metal2vulkan-validation/profiles/moltenvk-m3.json"); let text = std::fs::read_to_string(path).expect("profile"); let desc = DeviceDescription::from_khronos_json(&text, None).expect("description"); - Device::from_queries(desc, DevicePolicy::default()).expect("device") + Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES).expect("device") } fn stage(lib: &Library, libraries: DynamicLibraries) -> FunctionDescriptor { @@ -234,7 +234,7 @@ fn compile(fd: FunctionDescriptor) -> Result<(), Error> { /// `out` after the stage `fd` runs over 16 threads on the CPU interpreter. fn computed(fd: &FunctionDescriptor) -> Vec { - let p = profile("moltenvk-m3", DevicePolicy::default()).expect("profile"); + let p = profile("moltenvk-m3", DevicePolicy::RESIDENT_TABLES).expect("profile"); let m = compile_stage_kept(fd, &p, &mut meter()).unwrap_or_else(|e| panic!("{e}")); const N: u32 = 16; let res = Resources { diff --git a/crates/metal2vulkan/src/tests/engine_dynamic_roots.rs b/crates/metal2vulkan/src/tests/engine_dynamic_roots.rs index 6dd9784ae..40bea0cbc 100644 --- a/crates/metal2vulkan/src/tests/engine_dynamic_roots.rs +++ b/crates/metal2vulkan/src/tests/engine_dynamic_roots.rs @@ -83,7 +83,7 @@ fn profiles() -> Vec<(String, DeviceProfile)> { for robust in [true, false] { out.push(( format!("{stem} robust={robust}"), - profile(stem, robust, DevicePolicy::default()), + profile(stem, robust, DevicePolicy::RESIDENT_TABLES), )); } } @@ -440,7 +440,7 @@ fn inttoptr_resolves_every_resident_address() { let Some(bc) = assemble_text("from_int", &kernel("from_int", body)) else { return; }; - let p = profile("moltenvk-m3", true, DevicePolicy::default()); + let p = profile("moltenvk-m3", true, DevicePolicy::RESIDENT_TABLES); let a = compile(&bc, "from_int", &p).expect("compile"); link_and_validate(&a, &p).expect("L3"); let (plan, m) = typed_module(&bc, "from_int", &p).expect("module"); @@ -501,7 +501,7 @@ fn inttoptr_resolves_addresses_of_large_sets() { let Some(bc) = assemble_text("from_int", &kernel("from_int", body)) else { return; }; - let p = profile("moltenvk-m3", true, DevicePolicy::default()); + let p = profile("moltenvk-m3", true, DevicePolicy::RESIDENT_TABLES); let a = compile(&bc, "from_int", &p).expect("compile"); link_and_validate(&a, &p).expect("L3"); let (plan, m) = typed_module(&bc, "from_int", &p).expect("module"); @@ -679,7 +679,7 @@ fn profile_f_refuses_a_loaded_pointer_dereference() { ) else { return; }; - let f = device_f(DevicePolicy::default()).expect(PROFILE_F); + let f = device_f(DevicePolicy::RESIDENT_TABLES).expect(PROFILE_F); match compile(&bc, leaf.name, f.profile()) { Err(Error::Unsupported(u)) => { assert_eq!(u.feature, Feature::DereferenceLoadedPointer); diff --git a/crates/metal2vulkan/src/tests/engine_extended_range.rs b/crates/metal2vulkan/src/tests/engine_extended_range.rs index 094d0ea5f..07cc525a8 100644 --- a/crates/metal2vulkan/src/tests/engine_extended_range.rs +++ b/crates/metal2vulkan/src/tests/engine_extended_range.rs @@ -184,7 +184,7 @@ fn profiles() -> Vec<(&'static str, crate::device::profile::DeviceProfile)> { .map(|stem| { ( stem, - profile(stem, DevicePolicy::default()).expect("profile"), + profile(stem, DevicePolicy::RESIDENT_TABLES).expect("profile"), ) }) .collect() @@ -692,7 +692,10 @@ fn half_float_storage_slots_leave_their_writes_to_the_device() { let mut i = LowerInputs::new(); i.storage_images.insert(TARGET, choice); let anv = "intel-irisxe-rplp-anv"; - let anv = (anv, profile(anv, DevicePolicy::default()).expect("profile")); + let anv = ( + anv, + profile(anv, DevicePolicy::RESIDENT_TABLES).expect("profile"), + ); for (stem, p) in profiles().into_iter().chain([anv]) { // The kernel reads both textures: without formatless reads, the target's choice // declares its format and the source's `RGBA32Float`'s. @@ -769,7 +772,7 @@ fn devices() -> Vec<(String, Device)> { let desc = DeviceDescription::from_khronos_json(&text, None).expect("description"); out.push(( stem, - Device::from_queries(desc, DevicePolicy::default()).expect("device"), + Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES).expect("device"), )); } out.sort_by(|a, b| a.0.cmp(&b.0)); @@ -1028,7 +1031,7 @@ fn decoded_half_texels_round_by_the_device_s_conversion() { .join("../metal2vulkan-validation/profiles/moltenvk-m3.json"); let text = std::fs::read_to_string(&path).expect("profile"); let desc = DeviceDescription::from_khronos_json(&text, None).expect("description"); - let p = Device::from_queries(desc, DevicePolicy::default()) + let p = Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES) .expect("device") .profile() .clone(); diff --git a/crates/metal2vulkan/src/tests/engine_extended_range/blended_pipelines.rs b/crates/metal2vulkan/src/tests/engine_extended_range/blended_pipelines.rs index 66bff58b9..312e4ad46 100644 --- a/crates/metal2vulkan/src/tests/engine_extended_range/blended_pipelines.rs +++ b/crates/metal2vulkan/src/tests/engine_extended_range/blended_pipelines.rs @@ -46,7 +46,7 @@ fn device(stem: &str) -> Device { .join(format!("{stem}.json")); let text = std::fs::read_to_string(path).expect("profile"); let desc = DeviceDescription::from_khronos_json(&text, None).expect("description"); - Device::from_queries(desc, DevicePolicy::default()).expect("device") + Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES).expect("device") } /// The fixture's library; `None` (skipped) without `llvm-as`. diff --git a/crates/metal2vulkan/src/tests/engine_extended_range/heap.rs b/crates/metal2vulkan/src/tests/engine_extended_range/heap.rs index 1e6e81bfa..114e2b349 100644 --- a/crates/metal2vulkan/src/tests/engine_extended_range/heap.rs +++ b/crates/metal2vulkan/src/tests/engine_extended_range/heap.rs @@ -902,7 +902,7 @@ fn heap_half_texels_round_by_the_device_s_conversion() { .join("../metal2vulkan-validation/profiles/moltenvk-m3.json"); let text = std::fs::read_to_string(&path).expect("profile"); let desc = DeviceDescription::from_khronos_json(&text, None).expect("description"); - let p = Device::from_queries(desc, DevicePolicy::default()) + let p = Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES) .expect("device") .profile() .clone(); diff --git a/crates/metal2vulkan/src/tests/engine_extended_range/targets.rs b/crates/metal2vulkan/src/tests/engine_extended_range/targets.rs index c41ec11a0..77d6fed16 100644 --- a/crates/metal2vulkan/src/tests/engine_extended_range/targets.rs +++ b/crates/metal2vulkan/src/tests/engine_extended_range/targets.rs @@ -80,7 +80,7 @@ fn fixture() -> Option> { } fn venue(stem: &str) -> crate::device::profile::DeviceProfile { - profile(stem, DevicePolicy::default()).expect("committed profile") + profile(stem, DevicePolicy::RESIDENT_TABLES).expect("committed profile") } /// A render pipeline of one color attachment, `pf`, written under `mask` and blended where diff --git a/crates/metal2vulkan/src/tests/engine_fetch_blend16.rs b/crates/metal2vulkan/src/tests/engine_fetch_blend16.rs index 4152ca24f..64b441396 100644 --- a/crates/metal2vulkan/src/tests/engine_fetch_blend16.rs +++ b/crates/metal2vulkan/src/tests/engine_fetch_blend16.rs @@ -119,7 +119,7 @@ fn device(stem: &str) -> Device { .join(format!("{stem}.json")); let text = std::fs::read_to_string(path).expect("profile"); let desc = DeviceDescription::from_khronos_json(&text, None).expect("description"); - Device::from_queries(desc, DevicePolicy::default()).expect("device") + Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES).expect("device") } #[test] diff --git a/crates/metal2vulkan/src/tests/engine_fetch_blend16_narrow.rs b/crates/metal2vulkan/src/tests/engine_fetch_blend16_narrow.rs index 6193fb818..0fa8c81ac 100644 --- a/crates/metal2vulkan/src/tests/engine_fetch_blend16_narrow.rs +++ b/crates/metal2vulkan/src/tests/engine_fetch_blend16_narrow.rs @@ -222,7 +222,7 @@ fn device(stem: &str) -> Device { .join(format!("{stem}.json")); let text = std::fs::read_to_string(path).expect("profile"); let desc = DeviceDescription::from_khronos_json(&text, None).expect("description"); - Device::from_queries(desc, DevicePolicy::default()).expect("device") + Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES).expect("device") } /// `compile_with`, `None` where the device lacks a format's storage (refused whatever the blend). diff --git a/crates/metal2vulkan/src/tests/engine_fetch_blend8.rs b/crates/metal2vulkan/src/tests/engine_fetch_blend8.rs index 28b973deb..4a1e81e07 100644 --- a/crates/metal2vulkan/src/tests/engine_fetch_blend8.rs +++ b/crates/metal2vulkan/src/tests/engine_fetch_blend8.rs @@ -146,7 +146,7 @@ fn device(stem: &str) -> Device { .join(format!("{stem}.json")); let text = std::fs::read_to_string(path).expect("profile"); let desc = DeviceDescription::from_khronos_json(&text, None).expect("description"); - Device::from_queries(desc, DevicePolicy::default()).expect("device") + Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES).expect("device") } /// Whether `e` is a refusal the device's lack of a capability makes, whatever the blend (a diff --git a/crates/metal2vulkan/src/tests/engine_fetch_generic_blend.rs b/crates/metal2vulkan/src/tests/engine_fetch_generic_blend.rs index 9b9dd3225..511acfa54 100644 --- a/crates/metal2vulkan/src/tests/engine_fetch_generic_blend.rs +++ b/crates/metal2vulkan/src/tests/engine_fetch_generic_blend.rs @@ -217,7 +217,7 @@ fn device(stem: &str) -> Device { .join(format!("{stem}.json")); let text = std::fs::read_to_string(path).expect("profile"); let desc = DeviceDescription::from_khronos_json(&text, None).expect("description"); - Device::from_queries(desc, DevicePolicy::default()).expect("device") + Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES).expect("device") } #[test] diff --git a/crates/metal2vulkan/src/tests/engine_fill_moduli.rs b/crates/metal2vulkan/src/tests/engine_fill_moduli.rs index a30622d0f..9e4c6ac8a 100644 --- a/crates/metal2vulkan/src/tests/engine_fill_moduli.rs +++ b/crates/metal2vulkan/src/tests/engine_fill_moduli.rs @@ -216,7 +216,7 @@ fn run_kernels(p: &DeviceProfile, tier: Tier, widths: &[SubgroupSize]) { #[test] fn fill_moduli_run_direct_at_32_lanes() { - let p = profile("moltenvk-m3", DevicePolicy::default()).expect("profile"); + let p = profile("moltenvk-m3", DevicePolicy::RESIDENT_TABLES).expect("profile"); run_kernels(&p, Tier::Direct, &[SubgroupSize::W32]); } @@ -231,7 +231,7 @@ fn fill_moduli_run_cluster32_at_64_lanes() { #[test] fn fill_moduli_run_emulated_at_every_width() { - let p = profile("lavapipe", DevicePolicy::default()).expect("profile"); + let p = profile("lavapipe", DevicePolicy::RESIDENT_TABLES).expect("profile"); run_kernels( &p, Tier::Emulated, diff --git a/crates/metal2vulkan/src/tests/engine_float_call_notes.rs b/crates/metal2vulkan/src/tests/engine_float_call_notes.rs index 5c1d96b82..58c90d155 100644 --- a/crates/metal2vulkan/src/tests/engine_float_call_notes.rs +++ b/crates/metal2vulkan/src/tests/engine_float_call_notes.rs @@ -294,7 +294,7 @@ fn note_class(p: &DeviceProfile) -> NoteClass { fn one_profile_per_class() -> BTreeMap { let mut out = BTreeMap::new(); for (stem, p) in - committed_profiles_with(crate::device::DevicePolicy::default()).expect("profiles") + committed_profiles_with(crate::device::DevicePolicy::RESIDENT_TABLES).expect("profiles") { out.entry(note_class(&p)).or_insert((stem, p)); } diff --git a/crates/metal2vulkan/src/tests/engine_fpc_frames.rs b/crates/metal2vulkan/src/tests/engine_fpc_frames.rs index f559ae7a3..618af2075 100644 --- a/crates/metal2vulkan/src/tests/engine_fpc_frames.rs +++ b/crates/metal2vulkan/src/tests/engine_fpc_frames.rs @@ -84,7 +84,7 @@ fn fpc_frames_compile_to_their_bounds_and_are_refused_past_them() { let Some(bitcode) = fixture() else { return; }; - let p = profile("moltenvk-m3", Default::default()).expect("profile"); + let p = profile("moltenvk-m3", crate::device::DevicePolicy::RESIDENT_TABLES).expect("profile"); let refused = Err(Error::LimitExceeded(Limit::CallStackBytes)); for (entry, linked, ours, metal) in BOUNDS { let r = compile_linked(&bitcode, entry, linked, ours, &p).map(|_| ()); @@ -103,7 +103,11 @@ fn a_pair_s_uniform_frames_pass_16_kib_at_depth_4() { let Some(bitcode) = fixture() else { return; }; - let p = profile("nvidia-rtx5080-laptop", Default::default()).expect("profile"); + let p = profile( + "nvidia-rtx5080-laptop", + crate::device::DevicePolicy::RESIDENT_TABLES, + ) + .expect("profile"); let refused = Err(Error::Unsupported(Unsupported::needs_any_of( Feature::Recursion, vec![vec![Capability::Limit { @@ -288,7 +292,8 @@ fn activations(k: u32, (l, s): (u64, u64)) -> u32 { /// 192 KiB of Function storage, as the M3 Max holds: past the 16 KiB every device holds, so the /// deep stacks compile for the interpreter. fn typed(bitcode: &[u8], entry: &str, linked: &[&str], k: u32) -> TypedModule { - let mut p = profile("moltenvk-m3", Default::default()).expect("profile"); + let mut p = + profile("moltenvk-m3", crate::device::DevicePolicy::RESIDENT_TABLES).expect("profile"); p.edit(|f| f.function_storage = crate::device::profile::FunctionStorage::Assumed(192 * 1024)); let none = FunctionConstantValues::defaults(); let sources: Vec> = linked diff --git a/crates/metal2vulkan/src/tests/engine_fragment.rs b/crates/metal2vulkan/src/tests/engine_fragment.rs index fe8b1f9ea..e88c97d9c 100644 --- a/crates/metal2vulkan/src/tests/engine_fragment.rs +++ b/crates/metal2vulkan/src/tests/engine_fragment.rs @@ -130,7 +130,7 @@ fn no_demote() -> DeviceProfile { crate::pipeline::testing::profile_without( "runtime-floor", &[VkFeature::ShaderDemoteToHelperInvocation], - DevicePolicy::default(), + DevicePolicy::RESIDENT_TABLES, ) .expect(NO_DEMOTE) } @@ -318,7 +318,7 @@ fn a_predicated_discard_guards_each_later_store_atomic_and_image_write() { ("rch_guarded_copy", 1), ("rch_guarded_simd", 1), ]; - let committed = |stem: &str| profile(stem, DevicePolicy::default()).expect("profile"); + let committed = |stem: &str| profile(stem, DevicePolicy::RESIDENT_TABLES).expect("profile"); for (stem, p) in [ ("moltenvk-m3", committed("moltenvk-m3")), (NO_DEMOTE, no_demote()), @@ -679,7 +679,7 @@ fn an_srgb_input_attachment_reads_the_devices_decode() { .join("../metal2vulkan-validation/profiles/lavapipe.json"); let text = std::fs::read_to_string(path).expect("profile"); let desc = DeviceDescription::from_khronos_json(&text, None).expect("description"); - let dev = Device::from_queries(desc, DevicePolicy::default()).expect("device"); + let dev = Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES).expect("device"); let function = |bc: &[u8], name: &str| { FunctionDescriptor::new( Library::from_air(bc) @@ -748,7 +748,7 @@ fn the_binder_writes_storage_attachments_and_refuses_layered_passes() { .join("../metal2vulkan-validation/profiles/moltenvk-m3.json"); let text = std::fs::read_to_string(path).expect("profile"); let desc = DeviceDescription::from_khronos_json(&text, None).expect("description"); - let dev = Device::from_queries(desc, DevicePolicy::default()).expect("device"); + let dev = Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES).expect("device"); let function = |bc: &[u8], name: &str| { StageSource::Function(FunctionDescriptor::new( Library::from_air(bc) @@ -842,7 +842,7 @@ fn a_draw_writes_an_interlocked_color_through_the_storage_form() { .join(format!("../metal2vulkan-validation/profiles/{stem}.json")); let text = std::fs::read_to_string(path).expect("profile"); let desc = DeviceDescription::from_khronos_json(&text, None).expect("description"); - let dev = Device::from_queries(desc, DevicePolicy::default()).expect("device"); + let dev = Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES).expect("device"); let d = descriptor(false); let base = dev .compile_render_pipeline(&d, &Budget::standard()) @@ -966,7 +966,7 @@ fn the_storage_form_declares_early_tests_only_where_they_keep_metals_writes() { let (Some(plain), Some(discarding)) = (fixture("fragment_fetch"), fetch_with_discard()) else { return; }; - let p = profile("moltenvk-m3", DevicePolicy::default()).expect("profile"); + let p = profile("moltenvk-m3", DevicePolicy::RESIDENT_TABLES).expect("profile"); let state = |depth: bool| { let mut inputs = LoweringInputs::new(); inputs.framebuffer_fetch = Some(FramebufferFetchInputs::of( @@ -1027,7 +1027,7 @@ fn the_storage_form_declares_early_tests_only_where_they_keep_metals_writes() { .join("../metal2vulkan-validation/profiles/moltenvk-m3.json"); let text = std::fs::read_to_string(path).expect("profile"); let desc = DeviceDescription::from_khronos_json(&text, None).expect("description"); - let dev = Device::from_queries(desc, DevicePolicy::default()).expect("device"); + let dev = Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES).expect("device"); let function = |bc: &[u8], name: &str| { FunctionDescriptor::new( Library::from_air(bc) @@ -1115,7 +1115,7 @@ fn a_fetch_that_writes_memory_beside_depth_runs_only_draws_whose_tests_drop_noth .join("../metal2vulkan-validation/profiles/moltenvk-m3.json"); let text = std::fs::read_to_string(path).expect("profile"); let desc = DeviceDescription::from_khronos_json(&text, None).expect("description"); - let dev = Device::from_queries(desc, DevicePolicy::default()).expect("device"); + let dev = Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES).expect("device"); let function = |bc: &[u8], name: &str| { StageSource::Function(FunctionDescriptor::new( Library::from_air(bc) @@ -1293,7 +1293,7 @@ fn a_masked_fetched_write_keeps_the_channels_its_mask_leaves_out() { .join("../metal2vulkan-validation/profiles/moltenvk-m3.json"); let text = std::fs::read_to_string(path).expect("profile"); let desc = DeviceDescription::from_khronos_json(&text, None).expect("description"); - let dev = Device::from_queries(desc, DevicePolicy::default()).expect("device"); + let dev = Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES).expect("device"); let function = |bc: &[u8], name: &str| { FunctionDescriptor::new( Library::from_air(bc) @@ -1359,7 +1359,7 @@ fn the_partial_write_masks_of_a_fetched_attachment_share_one_module() { .join(format!("{stem}.json")); let text = std::fs::read_to_string(path).expect("profile"); let desc = DeviceDescription::from_khronos_json(&text, None).expect("description"); - Device::from_queries(desc, DevicePolicy::default()).expect("device") + Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES).expect("device") }; let function = |bc: &[u8], name: &str| { FunctionDescriptor::new( @@ -1538,7 +1538,7 @@ fn a_fetched_attachment_s_module_is_the_same_for_each_format_it_reads_alike() { .join(format!("{stem}.json")); let text = std::fs::read_to_string(path).expect("profile"); let desc = DeviceDescription::from_khronos_json(&text, None).expect("description"); - let dev = Device::from_queries(desc, DevicePolicy::default()).expect("device"); + let dev = Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES).expect("device"); let mut modules = Vec::new(); for (pf, _) in formats { let mut d = RenderPipelineDescriptor::new(StageSource::Function(function( @@ -1589,7 +1589,7 @@ fn a_fetched_bgra_attachment_is_viewed_in_its_rgba_twin_where_no_declaration_rea .join(format!("{stem}.json")); let text = std::fs::read_to_string(path).expect("profile"); let desc = DeviceDescription::from_khronos_json(&text, None).expect("description"); - Device::from_queries(desc, DevicePolicy::default()).expect("device") + Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES).expect("device") }; let function = |bc: &[u8], name: &str| { StageSource::Function(FunctionDescriptor::new( @@ -1852,7 +1852,7 @@ fn a_replacing_blend_or_a_write_that_stores_nothing_takes_the_storage_form() { .join("../metal2vulkan-validation/profiles/moltenvk-m3.json"); let text = std::fs::read_to_string(path).expect("profile"); let desc = DeviceDescription::from_khronos_json(&text, None).expect("description"); - let dev = Device::from_queries(desc, DevicePolicy::default()).expect("device"); + let dev = Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES).expect("device"); let function = |bc: &[u8], name: &str| { FunctionDescriptor::new( Library::from_air(bc) @@ -2098,7 +2098,7 @@ fn a_premultiplied_blend_into_a_padded_attachment_is_computed_in_the_shader() { .join(format!("{stem}.json")); let text = std::fs::read_to_string(path).expect("profile"); let desc = DeviceDescription::from_khronos_json(&text, None).expect("description"); - let dev = Device::from_queries(desc, DevicePolicy::default()).expect("device"); + let dev = Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES).expect("device"); let pipeline = |fragment: StageSource, colors: Vec>| { let mut d = RenderPipelineDescriptor::new(StageSource::Function(function( &io, @@ -2228,7 +2228,7 @@ fn a_second_source_blend_without_fast_math_reads_the_second_output() { .join(format!("{stem}.json")); let text = std::fs::read_to_string(path).expect("profile"); let desc = DeviceDescription::from_khronos_json(&text, None).expect("description"); - let dev = Device::from_queries(desc, DevicePolicy::default()).expect("device"); + let dev = Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES).expect("device"); let pipeline = |bc: &[u8], fragment: &str| { let mut d = RenderPipelineDescriptor::new(StageSource::Function(function( bc, @@ -2455,7 +2455,7 @@ fn a_fetched_extended_range_attachment_is_refused() { .join(format!("{stem}.json")); let text = std::fs::read_to_string(path).expect("profile"); let desc = DeviceDescription::from_khronos_json(&text, None).expect("description"); - let dev = Device::from_queries(desc, DevicePolicy::default()).expect("device"); + let dev = Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES).expect("device"); let mut d = RenderPipelineDescriptor::new(StageSource::Function(function( &io, "stage_io_vertex_position", @@ -2596,7 +2596,7 @@ fn a_discarding_fetch_beside_depth_stores_before_the_tests_its_draws_check() { .join("../metal2vulkan-validation/profiles/moltenvk-m3.json"); let text = std::fs::read_to_string(path).expect("profile"); let desc = DeviceDescription::from_khronos_json(&text, None).expect("description"); - let dev = Device::from_queries(desc, DevicePolicy::default()).expect("device"); + let dev = Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES).expect("device"); let function = |bc: &[u8], name: &str| { StageSource::Function(FunctionDescriptor::new( Library::from_air(bc) @@ -2732,7 +2732,7 @@ fn a_per_sample_depth_test_is_refused_at_the_depth_attachment() { .join(format!("../metal2vulkan-validation/profiles/{stem}.json")); let text = std::fs::read_to_string(path).expect("profile"); let desc = DeviceDescription::from_khronos_json(&text, None).expect("description"); - Device::from_queries(desc, DevicePolicy::default()).expect("device") + Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES).expect("device") }; let mut d = RenderPipelineDescriptor::new(function(&io, "stage_io_vertex_position")); d.fragment = Some(function(&tested, "tsw_fetch_discard")); @@ -2793,7 +2793,7 @@ fn a_fetch_that_returns_its_depth_refuses_a_draw_whose_depth_test_writes() { .join(format!("../metal2vulkan-validation/profiles/{stem}.json")); let text = std::fs::read_to_string(path).expect("profile"); let desc = DeviceDescription::from_khronos_json(&text, None).expect("description"); - Device::from_queries(desc, DevicePolicy::default()).expect("device") + Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES).expect("device") }; let shape = |fragment_tests: FragmentTests| { BindState { @@ -2868,7 +2868,7 @@ fn a_returned_stencil_or_sample_mask_refuses_a_draw_whose_tests_act() { .join(format!("../metal2vulkan-validation/profiles/{stem}.json")); let text = std::fs::read_to_string(path).expect("profile"); let desc = DeviceDescription::from_khronos_json(&text, None).expect("description"); - Device::from_queries(desc, DevicePolicy::default()).expect("device") + Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES).expect("device") }; let shape = |fragment_tests: FragmentTests| { BindState { @@ -2990,7 +2990,7 @@ pub(super) fn moltenvk_without(features: &[VkFeature]) -> DeviceProfile { for f in features { assert!(desc.features.remove(f), "moltenvk-m3 has {f:?}"); } - Device::from_queries(desc, DevicePolicy::default()) + Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES) .expect("device") .profile() .clone() @@ -3172,7 +3172,7 @@ fn a_sum_before_a_discard_takes_metals_placement() { ) else { return; }; - let p = profile("amd-780m-radv", DevicePolicy::default()).expect("profile"); + let p = profile("amd-780m-radv", DevicePolicy::RESIDENT_TABLES).expect("profile"); let noted = |bc: &[u8], entry: &str| { compile(bc, entry, &p) .unwrap_or_else(|e| panic!("{entry}: {e}")) @@ -4121,7 +4121,7 @@ fn a_snapshot_read_plans_its_variant_where_the_pipeline_can() { "runtime-floor", ] { let desc = crate::pipeline::testing::description(stem).expect("description"); - let dev = Device::from_queries(desc, DevicePolicy::default()).expect("device"); + let dev = Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES).expect("device"); let base = dev .compile_render_pipeline(&descriptor(false, 1), &Budget::standard()) .unwrap_or_else(|e| panic!("{stem}: {e}")); diff --git a/crates/metal2vulkan/src/tests/engine_fragment_depth_clamp.rs b/crates/metal2vulkan/src/tests/engine_fragment_depth_clamp.rs index a51126146..e24192a0c 100644 --- a/crates/metal2vulkan/src/tests/engine_fragment_depth_clamp.rs +++ b/crates/metal2vulkan/src/tests/engine_fragment_depth_clamp.rs @@ -56,7 +56,7 @@ fn profile(stem: &str, unrestricted: bool) -> DeviceProfile { desc.extensions .remove(&VkExtension::ExtDepthRangeUnrestricted); } - let p = Device::from_queries(desc, DevicePolicy::default()) + let p = Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES) .expect("device") .profile() .clone(); @@ -169,7 +169,7 @@ fn a_positive_nan_depth_kills_on_every_profile() { "moltenvk-m3", "intel-irisxe-rplp-anv", ] { - let p = crate::pipeline::testing::profile(stem, DevicePolicy::default()).expect(stem); + let p = crate::pipeline::testing::profile(stem, DevicePolicy::RESIDENT_TABLES).expect(stem); for (entry, expected) in [("rfb_depth", 1), ("rfb_full", 0), ("rfb_position", 0)] { let a = compile_with(&bc, entry, &p, &inputs) .unwrap_or_else(|e| panic!("{stem} {entry}: {e}")); @@ -206,7 +206,7 @@ fn a_depth_clamp_range_variant_clamps_the_depth_to_the_draws_range() { "moltenvk-m3", "intel-irisxe-rplp-anv", ] { - let p = crate::pipeline::testing::profile(stem, DevicePolicy::default()).expect(stem); + let p = crate::pipeline::testing::profile(stem, DevicePolicy::RESIDENT_TABLES).expect(stem); for entry in ["rfb_full", "rfb_position"] { let with = compile_with(&bc, entry, &p, &ranged) .unwrap_or_else(|e| panic!("{stem} {entry}: {e}")); @@ -294,7 +294,7 @@ fn a_depth_clamp_range_draw_runs_the_variant_with_the_states_range() { .join(format!("{stem}.json")); let text = std::fs::read_to_string(path).expect("profile"); let desc = DeviceDescription::from_khronos_json(&text, None).expect("description"); - let dev = Device::from_queries(desc, DevicePolicy::default()).expect("device"); + let dev = Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES).expect("device"); for (fragment, writes) in [("rfb_depth", true), ("rfb_position", false)] { let what = format!("{stem} {fragment}"); let mut d = RenderPipelineDescriptor::new(function("rfb_full")); diff --git a/crates/metal2vulkan/src/tests/engine_fragment_imageblock.rs b/crates/metal2vulkan/src/tests/engine_fragment_imageblock.rs index 3c5e4e379..d99bcccfa 100644 --- a/crates/metal2vulkan/src/tests/engine_fragment_imageblock.rs +++ b/crates/metal2vulkan/src/tests/engine_fragment_imageblock.rs @@ -181,7 +181,7 @@ fn description(stem: &str) -> DeviceDescription { } fn device(stem: &str) -> Device { - Device::from_queries(description(stem), DevicePolicy::default()).expect("device") + Device::from_queries(description(stem), DevicePolicy::RESIDENT_TABLES).expect("device") } /// `moltenvk-m3` without `features`. @@ -190,7 +190,7 @@ fn moltenvk_without(features: &[VkFeature]) -> DeviceProfile { for f in features { assert!(desc.features.remove(f), "moltenvk-m3 has {f:?}"); } - Device::from_queries(desc, DevicePolicy::default()) + Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES) .expect("device") .profile() .clone() diff --git a/crates/metal2vulkan/src/tests/engine_function_constant_interface.rs b/crates/metal2vulkan/src/tests/engine_function_constant_interface.rs index d11d95102..734462289 100644 --- a/crates/metal2vulkan/src/tests/engine_function_constant_interface.rs +++ b/crates/metal2vulkan/src/tests/engine_function_constant_interface.rs @@ -79,7 +79,7 @@ fn fixture() -> Option> { } fn prof(stem: &str) -> DeviceProfile { - profile(stem, DevicePolicy::default()).expect("committed profile") + profile(stem, DevicePolicy::RESIDENT_TABLES).expect("committed profile") } /// `entry` compiled with the boolean constants `on` true and every other constant undefined. diff --git a/crates/metal2vulkan/src/tests/engine_function_constant_pointers.rs b/crates/metal2vulkan/src/tests/engine_function_constant_pointers.rs index aa71153fa..0d1693957 100644 --- a/crates/metal2vulkan/src/tests/engine_function_constant_pointers.rs +++ b/crates/metal2vulkan/src/tests/engine_function_constant_pointers.rs @@ -138,7 +138,7 @@ fn device() -> Device { let text = std::fs::read_to_string(&path).unwrap_or_else(|e| panic!("{}: {e}", path.display())); let description = DeviceDescription::from_khronos_json(&text, None).expect("nvidia-rtx5080-laptop"); - Device::from_queries(description, DevicePolicy::default()).expect("nvidia-rtx5080-laptop") + Device::from_queries(description, DevicePolicy::RESIDENT_TABLES).expect("nvidia-rtx5080-laptop") } /// The `uintN` type of `lanes` lanes. diff --git a/crates/metal2vulkan/src/tests/engine_gated_texture_slots.rs b/crates/metal2vulkan/src/tests/engine_gated_texture_slots.rs index 40597460f..391328151 100644 --- a/crates/metal2vulkan/src/tests/engine_gated_texture_slots.rs +++ b/crates/metal2vulkan/src/tests/engine_gated_texture_slots.rs @@ -156,7 +156,7 @@ fn device(stem: &str) -> Device { .join(format!("{stem}.json")); let text = std::fs::read_to_string(&path).unwrap_or_else(|e| panic!("{}: {e}", path.display())); let description = DeviceDescription::from_khronos_json(&text, None).expect(stem); - Device::from_queries(description, DevicePolicy::default()).expect(stem) + Device::from_queries(description, DevicePolicy::RESIDENT_TABLES).expect(stem) } /// Profiles that bind textures by descriptor and by heap index. diff --git a/crates/metal2vulkan/src/tests/engine_generic_pointers.rs b/crates/metal2vulkan/src/tests/engine_generic_pointers.rs index b324d40b7..120223bfa 100644 --- a/crates/metal2vulkan/src/tests/engine_generic_pointers.rs +++ b/crates/metal2vulkan/src/tests/engine_generic_pointers.rs @@ -37,7 +37,7 @@ const PROFILES: [&str; 3] = ["lavapipe", "amd-rdna3-radv", "moltenvk-m3"]; fn compiled(library: &Library, stem: &str, entry: &str) -> Result<(), Error> { let dev = Device::from_queries( description(stem).expect("committed description"), - DevicePolicy::default(), + DevicePolicy::RESIDENT_TABLES, ) .expect("device"); let d = ComputePipelineDescriptor::new(StageSource::Function(FunctionDescriptor::new( @@ -50,7 +50,7 @@ fn compiled(library: &Library, stem: &str, entry: &str) -> Result<(), Error> { /// Kernel `entry` of `bc` as the compile specializes it for profile `stem`, printed: the module a /// refusal's location names an instruction of. fn specialized(bc: &[u8], stem: &str, entry: &str) -> String { - let p = profile(stem, DevicePolicy::default()).expect("profile"); + let p = profile(stem, DevicePolicy::RESIDENT_TABLES).expect("profile"); let none = FunctionConstantValues::defaults(); match specialized_entry(bc, entry, &p, &none, &[], &mut meter()) { Ok(e) => print(&e.module), diff --git a/crates/metal2vulkan/src/tests/engine_gep_index.rs b/crates/metal2vulkan/src/tests/engine_gep_index.rs index 0eb3c5c21..ff2d2681d 100644 --- a/crates/metal2vulkan/src/tests/engine_gep_index.rs +++ b/crates/metal2vulkan/src/tests/engine_gep_index.rs @@ -60,7 +60,7 @@ fn profile_with(stem: &str, robust: bool) -> DeviceProfile { desc.features.remove(&VkFeature::RobustBufferAccess); desc.features.remove(&VkFeature::RobustBufferAccess2); } - Device::from_queries(desc, DevicePolicy::default()) + Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES) .expect("device") .profile() .clone() diff --git a/crates/metal2vulkan/src/tests/engine_global_builtins.rs b/crates/metal2vulkan/src/tests/engine_global_builtins.rs index 6c28980a4..5deef27f3 100644 --- a/crates/metal2vulkan/src/tests/engine_global_builtins.rs +++ b/crates/metal2vulkan/src/tests/engine_global_builtins.rs @@ -278,7 +278,11 @@ fn global_builtins_compile_to_their_parameter_forms_words() { /// Every word of buffer 0 (`words` of them) after one workgroup of local size `local` ran the /// kernel `bc` on `moltenvk-m3` with 32-wide subgroups, identical in both scheduling orders. fn run_kernel(bc: &[u8], local: [u32; 3], words: usize) -> Vec { - let p = crate::pipeline::testing::profile("moltenvk-m3", Default::default()).expect("profile"); + let p = crate::pipeline::testing::profile( + "moltenvk-m3", + crate::device::DevicePolicy::RESIDENT_TABLES, + ) + .expect("profile"); let (plan, m) = typed_module(bc, "k", &p).expect("plan"); let mut spec = BTreeMap::new(); for (a, v) in [Axis::X, Axis::Y, Axis::Z].into_iter().zip(local) { @@ -389,7 +393,11 @@ fn a_global_builtin_read_at_an_unknown_lane_is_refused() { let Some(bc) = assemble("dynamic", &text) else { return; }; - let p = crate::pipeline::testing::profile("moltenvk-m3", Default::default()).expect("profile"); + let p = crate::pipeline::testing::profile( + "moltenvk-m3", + crate::device::DevicePolicy::RESIDENT_TABLES, + ) + .expect("profile"); match compile(&bc, "k", &p) { Err(Error::Unsupported(u)) => { assert_eq!(u.feature, Feature::Lowering(LowerFamily::Dispatch), "{u:?}") diff --git a/crates/metal2vulkan/src/tests/engine_graphics_binder.rs b/crates/metal2vulkan/src/tests/engine_graphics_binder.rs index 99ac87701..742418f3a 100644 --- a/crates/metal2vulkan/src/tests/engine_graphics_binder.rs +++ b/crates/metal2vulkan/src/tests/engine_graphics_binder.rs @@ -85,7 +85,7 @@ fn devices() -> Vec<(String, Device)> { let desc = DeviceDescription::from_khronos_json(&text, None).expect("description"); out.push(( stem, - Device::from_queries(desc, DevicePolicy::default()).expect("device"), + Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES).expect("device"), )); } out.sort_by(|a, b| a.0.cmp(&b.0)); @@ -449,7 +449,7 @@ fn an_indirect_draw_without_draw_indirect_first_instance_reads_its_arguments() { ); assert_ne!(edited, text, "lavapipe states the feature"); let without = DeviceDescription::from_khronos_json(&edited, None).expect("description"); - let without = Device::from_queries(without, DevicePolicy::default()).expect("device"); + let without = Device::from_queries(without, DevicePolicy::RESIDENT_TABLES).expect("device"); for (dev, missing) in [(without, true), (device("lavapipe"), false)] { let stem = if missing { "without" } else { "lavapipe" }; let p = render_pipeline(&dev, &bc).unwrap_or_else(|e| panic!("{stem}: {e}")); @@ -511,7 +511,7 @@ fn an_indexed_draw_past_its_index_buffer_is_bounded() { ); assert_ne!(edited, text, "lavapipe states the feature"); let without = DeviceDescription::from_khronos_json(&edited, None).expect("description"); - let without = Device::from_queries(without, DevicePolicy::default()).expect("device"); + let without = Device::from_queries(without, DevicePolicy::RESIDENT_TABLES).expect("device"); let mut devices = devices_by_robustness(); devices.push(( "lavapipe without robustBufferAccess2".into(), @@ -622,7 +622,7 @@ fn an_indexed_indirect_draw_reads_its_arguments_where_nothing_bounds_its_indices ); assert_ne!(edited, text, "lavapipe states the feature"); let without = DeviceDescription::from_khronos_json(&edited, None).expect("description"); - let without = Device::from_queries(without, DevicePolicy::default()).expect("device"); + let without = Device::from_queries(without, DevicePolicy::RESIDENT_TABLES).expect("device"); let mut devices = devices_by_robustness(); devices.push(( "lavapipe without robustBufferAccess2".into(), @@ -815,7 +815,7 @@ fn a_render_plan_reads_pulled_source_buffers_by_device_address() { let mut desc = DeviceDescription::from_khronos_json(&text, None).expect("description"); desc.features .remove(&crate::device::requirements::VkFeature::BufferDeviceAddress); - Device::from_queries(desc, DevicePolicy::default()).expect("device") + Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES).expect("device") }; let devices = [ ("moltenvk-m3", device("moltenvk-m3")), @@ -2239,7 +2239,7 @@ fn out_of_bounds_alpha_follows_the_bound_format() { let mut desc = DeviceDescription::from_khronos_json(&text, None).expect("description"); desc.features .remove(&crate::device::requirements::VkFeature::RobustImageAccess2); - Device::from_queries(desc, DevicePolicy::default()).expect("device") + Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES).expect("device") }; let mut all = devices(); all.push(("runtime-floor without robustImageAccess2".into(), without)); diff --git a/crates/metal2vulkan/src/tests/engine_half_hold.rs b/crates/metal2vulkan/src/tests/engine_half_hold.rs index d637604c2..35c6c6f28 100644 --- a/crates/metal2vulkan/src/tests/engine_half_hold.rs +++ b/crates/metal2vulkan/src/tests/engine_half_hold.rs @@ -392,7 +392,7 @@ fn half_values_are_held_at_16_bits_under_the_float_controls() { return; }; for stem in ["intel-irisxe-rplp-anv", "amd-780m-radv"] { - let p = profile(stem, DevicePolicy::default()).expect("profile"); + let p = profile(stem, DevicePolicy::RESIDENT_TABLES).expect("profile"); assert_eq!(quantize_form(&p), QuantizeForm::Controlled, "{stem}"); let (m, push) = emitted(&bc, &p); let s = shape(&m); @@ -413,7 +413,7 @@ fn half_values_are_held_at_16_bits_under_the_float_controls() { a.precision ); } - let p = profile("lavapipe", DevicePolicy::default()).expect("profile"); + let p = profile("lavapipe", DevicePolicy::RESIDENT_TABLES).expect("profile"); assert_eq!(quantize_form(&p), QuantizeForm::Converted); let (m, push) = emitted(&bc, &p); let s = shape(&m); @@ -437,7 +437,7 @@ fn half_division_and_sqrt_are_16_bit_under_the_float_controls() { return; }; for stem in ["intel-irisxe-rplp-anv", "amd-780m-radv"] { - let p = profile(stem, DevicePolicy::default()).expect("profile"); + let p = profile(stem, DevicePolicy::RESIDENT_TABLES).expect("profile"); assert_eq!(quantize_form(&p), QuantizeForm::Controlled, "{stem}"); let (m, push) = emitted_entry(&bc, "half_divide", &p); let s = shape(&m); @@ -462,7 +462,7 @@ fn half_division_and_sqrt_are_16_bit_under_the_float_controls() { a.precision ); } - let p = profile("lavapipe", DevicePolicy::default()).expect("profile"); + let p = profile("lavapipe", DevicePolicy::RESIDENT_TABLES).expect("profile"); assert_eq!(quantize_form(&p), QuantizeForm::Converted); let (m, push) = emitted_entry(&bc, "half_divide", &p); let s = shape(&m); diff --git a/crates/metal2vulkan/src/tests/engine_half_moves.rs b/crates/metal2vulkan/src/tests/engine_half_moves.rs index 9e520c5c1..72dd93b9d 100644 --- a/crates/metal2vulkan/src/tests/engine_half_moves.rs +++ b/crates/metal2vulkan/src/tests/engine_half_moves.rs @@ -15,10 +15,10 @@ //! recorded as `PrecisionNote::DeviceNanEncoding`), so the texel must be the exact widening of //! each value that is not a NaN, and a NaN for each NaN. //! -//! Each runs on every committed profile under the default policy. A module may leave a NaN's bits -//! to the device, and then says so: a `half` read from its bits by the device's widening (every -//! profile with `shaderFloat16`) or a NaN's bits left to the device's arithmetic and conversions, -//! each `PrecisionNote::NativeNanEncoding`, or the native conversion's +//! Each runs on every committed profile under the resident-table domains. A module may leave a +//! NaN's bits to the device, and then says so: a `half` read from its bits by the device's widening +//! (every profile with `shaderFloat16`) or a NaN's bits left to the device's arithmetic and +//! conversions, each `PrecisionNote::NativeNanEncoding`, or the native conversion's //! `PrecisionNote::NativeHalfConversion`. There //! a NaN pattern need only come back a NaN (a move through the select or the threadgroup array; a //! move straight to a buffer reuses the loaded bits). No other pattern may change, nor any where @@ -297,7 +297,7 @@ fn every_half_pattern_moves_as_its_bits() { let mut runs: Vec<(&str, String, Arc<[u32]>)> = Vec::new(); let mut modules: BTreeMap, Compiled> = BTreeMap::new(); { - let (policy_name, policy) = ("default", DevicePolicy::default()); + let (policy_name, policy) = ("default", DevicePolicy::RESIDENT_TABLES); for (stem, p) in committed_profiles_with(policy).expect("profiles") { let Some((words, compiled)) = compile_once(&stem, &p, &bc, policy_name) else { continue; diff --git a/crates/metal2vulkan/src/tests/engine_handles.rs b/crates/metal2vulkan/src/tests/engine_handles.rs index 531724ef2..07bc24f84 100644 --- a/crates/metal2vulkan/src/tests/engine_handles.rs +++ b/crates/metal2vulkan/src/tests/engine_handles.rs @@ -112,7 +112,7 @@ fn assemble(name: &str, body: &str) -> Option> { } fn m3() -> DeviceProfile { - profile("moltenvk-m3", DevicePolicy::default()).expect("profile") + profile("moltenvk-m3", DevicePolicy::RESIDENT_TABLES).expect("profile") } fn ok(bc: &[u8], entry: &str, p: &DeviceProfile) -> std::sync::Arc { @@ -681,7 +681,7 @@ fn without_robust_images(stem: &str) -> DeviceProfile { let mut desc = DeviceDescription::from_khronos_json(&text, None).expect("description"); desc.features.remove(&VkFeature::RobustImageAccess); desc.features.remove(&VkFeature::RobustImageAccess2); - Device::from_queries(desc, DevicePolicy::default()) + Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES) .expect("device") .profile() .clone() @@ -850,7 +850,7 @@ fn a_heap_storage_access_converts_the_members_its_heap_views_through_an_alias() return; }; for (stem, red_blue) in [("lavapipe", true), ("moltenvk-m3", false)] { - let p = profile(stem, DevicePolicy::default()).expect("profile"); + let p = profile(stem, DevicePolicy::RESIDENT_TABLES).expect("profile"); let (plan, _) = typed_module(&bc, "heap_rw", &p).expect("heap_rw"); assert_eq!(plan.families.access.heap_red_blue, red_blue, "{stem}"); let a = ok(&bc, "heap_rw", &p); @@ -1504,7 +1504,7 @@ fn m3_device() -> Device { .join("../metal2vulkan-validation/profiles/moltenvk-m3.json"); let text = std::fs::read_to_string(path).expect("profile"); let desc = DeviceDescription::from_khronos_json(&text, None).expect("description"); - Device::from_queries(desc, DevicePolicy::default()).expect("device") + Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES).expect("device") } /// A render pipeline whose vertex and fragment functions both read a texture from an argument @@ -4533,7 +4533,7 @@ fn an_argument_sampler_array_has_the_heap_sampler_capacity() { // The answer on `desc`, and the element count of the kernel's set-1 sampler array or the // kernel's refusal. let array = |desc: DeviceDescription| -> (u32, Result) { - let dev = Device::from_queries(desc, DevicePolicy::default()).expect("device"); + let dev = Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES).expect("device"); let f = library.function("argument_sampler_sample").expect("entry"); let d = ComputePipelineDescriptor::new(StageSource::Function(FunctionDescriptor::new(f))); let count = dev @@ -4606,7 +4606,7 @@ fn only_non_fragment_stages_test_argument_samplers_for_a_cubic_filter() { }; let (mut compiled, mut bound) = (0, 0); let mut profiles = committed_profiles().expect("profiles"); - let f = crate::pipeline::testing::device_f(DevicePolicy::default()).expect("Profile F"); + let f = crate::pipeline::testing::device_f(DevicePolicy::RESIDENT_TABLES).expect("Profile F"); profiles.push((PROFILE_F.to_string(), f.profile().clone())); for (stem, p) in profiles { let (Ok(kernel), Ok(fragment)) = ( @@ -4653,7 +4653,7 @@ fn the_cubic_tests_binding_gives_way_to_the_storage_buffer_limit() { if limit < u32::MAX { desc.limits.max_per_stage_descriptor_storage_buffers = limit; } - let dev = Device::from_queries(desc, DevicePolicy::default()).expect("profile"); + let dev = Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES).expect("profile"); dev.profile().clone() }; let full = with_storage(u32::MAX); diff --git a/crates/metal2vulkan/src/tests/engine_heap_binder.rs b/crates/metal2vulkan/src/tests/engine_heap_binder.rs index 8f789d35a..68f5fad8e 100644 --- a/crates/metal2vulkan/src/tests/engine_heap_binder.rs +++ b/crates/metal2vulkan/src/tests/engine_heap_binder.rs @@ -117,7 +117,7 @@ fn m3() -> Device { .join("../metal2vulkan-validation/profiles/moltenvk-m3.json"); let text = std::fs::read_to_string(path).expect("profile"); let desc = DeviceDescription::from_khronos_json(&text, None).expect("description"); - Device::from_queries(desc, DevicePolicy::default()).expect("device") + Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES).expect("device") } fn compute(dev: &Device, bc: &[u8], entry: &str) -> ComputePipeline { @@ -630,7 +630,7 @@ fn heap_plans_are_total_on_the_committed_profiles() { .join(format!("{stem}.json")); let text = std::fs::read_to_string(path).expect("profile"); let desc = DeviceDescription::from_khronos_json(&text, None).expect("description"); - let dev = Device::from_queries(desc, DevicePolicy::default()).expect("device"); + let dev = Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES).expect("device"); let lib = Library::from_air(&bc).expect("library"); let f = lib.function("argument_buffer_read").expect("entry"); let d = ComputePipelineDescriptor::new(StageSource::Function(FunctionDescriptor::new(f))); @@ -1464,7 +1464,7 @@ fn heap_samplers_need_the_filter_features_of_every_held_member() { .join(format!("{stem}.json")); let text = std::fs::read_to_string(path).expect("profile"); let desc = DeviceDescription::from_khronos_json(&text, None).expect("description"); - let dev = Device::from_queries(desc, DevicePolicy::default()).expect("device"); + let dev = Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES).expect("device"); let lib = Library::from_air(&bc).expect("library"); let filters = p.supports_format( vk::Format::R32_SFLOAT, @@ -1968,7 +1968,7 @@ fn a_member_read_anywhere_types_its_queries() { let Some(bc) = assemble("heap_query", QUERY_KERNELS) else { return; }; - let p = profile("moltenvk-m3", DevicePolicy::default()).expect("profile"); + let p = profile("moltenvk-m3", DevicePolicy::RESIDENT_TABLES).expect("profile"); let a = compile(&bc, "heap_query", &p).expect("heap_query"); link_and_validate(&a, &p).expect("L3"); let classes = heap_classes_of(&a); @@ -2303,8 +2303,8 @@ fn a_cube_gradient_use_takes_an_anisotropic_argument_sampler_by_its_word() { .expect("profiles") .into_iter() .map(|(stem, _)| { - let dev = - Device::from_queries(description(&stem), DevicePolicy::default()).expect("device"); + let dev = Device::from_queries(description(&stem), DevicePolicy::RESIDENT_TABLES) + .expect("device"); (stem, dev) }) .collect(); diff --git a/crates/metal2vulkan/src/tests/engine_heap_residency.rs b/crates/metal2vulkan/src/tests/engine_heap_residency.rs index fc7803619..735d25198 100644 --- a/crates/metal2vulkan/src/tests/engine_heap_residency.rs +++ b/crates/metal2vulkan/src/tests/engine_heap_residency.rs @@ -61,7 +61,7 @@ fn device(stem: &str) -> Device { .join(format!("../metal2vulkan-validation/profiles/{stem}.json")); let text = std::fs::read_to_string(path).expect("profile"); let desc = DeviceDescription::from_khronos_json(&text, None).expect("description"); - Device::from_queries(desc, DevicePolicy::default()).expect("device") + Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES).expect("device") } /// The pipeline of fragment `entry` behind `argument_sparse_vertex`, color 0 `RGBA16Float`. diff --git a/crates/metal2vulkan/src/tests/engine_heap_storage_reads.rs b/crates/metal2vulkan/src/tests/engine_heap_storage_reads.rs index 0036f79f8..22d557bf4 100644 --- a/crates/metal2vulkan/src/tests/engine_heap_storage_reads.rs +++ b/crates/metal2vulkan/src/tests/engine_heap_storage_reads.rs @@ -94,7 +94,7 @@ fn description(stem: &str) -> DeviceDescription { /// The device of committed profile `stem`. fn device(stem: &str) -> Device { - Device::from_queries(description(stem), DevicePolicy::default()).expect("device") + Device::from_queries(description(stem), DevicePolicy::RESIDENT_TABLES).expect("device") } /// [`KERNEL`], assembled; `None` where `llvm-as` is missing (the test then skips visibly). @@ -192,7 +192,7 @@ fn a_heap_storage_read_compiles_where_the_formats_bits_grant_it() { assert!(!plan.families.access.heap_unreadable); let old = crate::pipeline::testing::description_at_1_2(IRIS, false).expect("description"); - let old = Device::from_queries(old, DevicePolicy::default()).expect("device"); + let old = Device::from_queries(old, DevicePolicy::RESIDENT_TABLES).expect("device"); assert!(!old.profile().storage_reads_by_format_bits()); match pipeline(&old, &bc) { Err(Error::Unsupported(u)) => { @@ -460,7 +460,7 @@ fn a_tier_format_without_its_read_bit_is_refused() { props.optimal_tiling = props .optimal_tiling .difference(vk::FormatFeatureFlags2::STORAGE_READ_WITHOUT_FORMAT); - let cleared = Device::from_queries(desc, DevicePolicy::default()).expect("device"); + let cleared = Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES).expect("device"); assert!(cleared.profile().storage_reads_by_format_bits()); let bit = Capability::Format { format, diff --git a/crates/metal2vulkan/src/tests/engine_heap_texel_buffers.rs b/crates/metal2vulkan/src/tests/engine_heap_texel_buffers.rs index 16dd7ef3d..805bf4289 100644 --- a/crates/metal2vulkan/src/tests/engine_heap_texel_buffers.rs +++ b/crates/metal2vulkan/src/tests/engine_heap_texel_buffers.rs @@ -86,7 +86,7 @@ fn a_texture_buffer_argument_is_a_texel_buffer_heap_class() { let mut desc = description("nvidia-rtx50-linux").expect("description"); desc.features .remove(&VkFeature::DescriptorBindingUniformTexelBufferUpdateAfterBind); - let device = Device::from_queries(desc, DevicePolicy::default()).expect("device"); + let device = Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES).expect("device"); match compile(&bc, entry, device.profile()) { Err(Error::Unsupported(u)) => { assert_eq!(u.feature, Feature::ArgumentBufferTextures); diff --git a/crates/metal2vulkan/src/tests/engine_helper_threads.rs b/crates/metal2vulkan/src/tests/engine_helper_threads.rs index 08606ecc4..67f2e6c73 100644 --- a/crates/metal2vulkan/src/tests/engine_helper_threads.rs +++ b/crates/metal2vulkan/src/tests/engine_helper_threads.rs @@ -107,12 +107,12 @@ fn fragment_helper_queries_take_the_form_of_their_discards() { return; }; let stem = "intel-arl-anv"; - let with = profile(stem, DevicePolicy::default()).expect("profile"); + let with = profile(stem, DevicePolicy::RESIDENT_TABLES).expect("profile"); let without = { let mut desc = crate::pipeline::testing::description(stem).expect("description"); let demote = VkFeature::ShaderDemoteToHelperInvocation; assert!(desc.features.remove(&demote), "{stem} has {demote:?}"); - crate::device::Device::from_queries(desc, DevicePolicy::default()) + crate::device::Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES) .expect("device") .profile() .clone() @@ -234,7 +234,7 @@ fn a_vertex_function_s_helper_query_is_false() { }; let entry = "helper_threads_in_a_vertex_function"; for stem in ["moltenvk-m3", "lavapipe"] { - let p = profile(stem, DevicePolicy::default()).expect("profile"); + let p = profile(stem, DevicePolicy::RESIDENT_TABLES).expect("profile"); let a = compile(&bc, entry, &p).unwrap_or_else(|e| panic!("{entry} on {stem}: {e}")); let (_, words) = link_and_validate(&a, &p).unwrap_or_else(|e| panic!("{entry} on {stem}: L3: {e}")); @@ -303,7 +303,7 @@ fn kernel_threads_are_no_helpers(p: &DeviceProfile, tier: Tier, widths: &[Subgro #[test] fn kernel_threads_are_no_helpers_direct() { - let p = profile("moltenvk-m3", DevicePolicy::default()).expect("profile"); + let p = profile("moltenvk-m3", DevicePolicy::RESIDENT_TABLES).expect("profile"); kernel_threads_are_no_helpers(&p, Tier::Direct, &[SubgroupSize::W32]); } @@ -318,7 +318,7 @@ fn kernel_threads_are_no_helpers_cluster32() { #[test] fn kernel_threads_are_no_helpers_emulated() { - let p = profile("lavapipe", DevicePolicy::default()).expect("profile"); + let p = profile("lavapipe", DevicePolicy::RESIDENT_TABLES).expect("profile"); kernel_threads_are_no_helpers( &p, Tier::Emulated, diff --git a/crates/metal2vulkan/src/tests/engine_identity.rs b/crates/metal2vulkan/src/tests/engine_identity.rs index 9951a9e27..5801ebe24 100644 --- a/crates/metal2vulkan/src/tests/engine_identity.rs +++ b/crates/metal2vulkan/src/tests/engine_identity.rs @@ -68,11 +68,11 @@ //! - A storage slot read without a format (`engine/rrp_swizzled_storage`'s `rrp_sw_rwread_f`) on //! the Iris Xe, which reads storage so by the formats' own bits alone, is declared without a //! format where every read-write tier format has the read bit, and refused where one lacks it; -//! the default domains' answer there is unchanged. +//! the resident-table domains' answer there is unchanged. //! - A kernel that samples 2D textures through a bicubic constexpr sampler at normalized //! coordinates (`engine/bcu_formats`, `float` and `half` results) reads how the filter treats //! each slot's bound format from the slot's pushed field (`PushField::BicubicTexels`): no -//! specialization constant and no fact, where the default domains specialize +//! specialization constant and no fact, where the resident-table domains specialize //! `SpecKey::BicubicTexels` and state `RuntimeFact::BicubicTexels` as before. It passes L3. A //! bicubic sample of a 1D texture (`engine/bcu_forms`) or at pixel coordinates //! (`engine/bcu_address`) is still refused as `Unsupported{IdentityDomains}`, not implemented. @@ -101,15 +101,15 @@ //! reads it from its pushed field (`PushField::StageInRegion`), with no descriptor; it passes //! L3 and, on the CPU interpreter, every thread stores the region's origin and size. //! - A kernel's emulated-simdgroup variant (`engine/gsm2_simd_products`'s `simd_float_products`) -//! opens every barrier of its exchanges under a branch on `1 < N`, which the default domains do -//! not; on the CPU interpreter a threadgroup of one thread passes no barrier, and threadgroups of -//! one and of 80 threads (a partial simdgroup of 16) answer Metal's products. +//! opens every barrier of its exchanges under a branch on `1 < N`, which the resident-table +//! domains do not; on the CPU interpreter a threadgroup of one thread passes no barrier, and +//! threadgroups of one and of 80 threads (a partial simdgroup of 16) answer Metal's products. //! - A kernel that reads program-scope constants through memory (`blob_words`, generated: a //! `ushort3` constant read as `half3`, as `as_type` folds into the load, and a word table read //! as 2-byte units at offsets only the run knows) holds the constant blob as the module's own //! `Private` words: no descriptor, no blob in the artifact, the words counted in its private //! bytes, and on the CPU interpreter each value read, and zero for a read past the words. The -//! default domains bind the same blob as before. A blob past `memory::blob::MODULE_BYTES` +//! resident-table domains bind the same blob as before. A blob past `memory::blob::MODULE_BYTES` //! (`blob_past`, generated) is refused as `Unsupported{IdentityDomains}` naming its size. //! //! `llvm-as` assembles the kernels; without it the tests skip visibly. @@ -158,7 +158,7 @@ fn identity() -> DevicePolicy { DevicePolicy { pointer_domain: PointerDomain::Identity, handle_domain: HandleDomain::Identity, - ..DevicePolicy::default() + ..DevicePolicy::RESIDENT_TABLES } } @@ -522,15 +522,15 @@ fn a_runtime_sampler_is_the_set_1_element_its_resource_id_names() { const SAMPLE_UP_WORDS: [u64; 2] = [34_901_797_601_020_489, 0]; /// A kernel sampling a texture slot through a constexpr sampler (`sample_up`, a 2D `float` sample -/// of normalized coordinates, and the same kernel through a pixel sampler that the default domains -/// hand the device's unnormalized sampler) takes the texture from set 1's sampled-image array at -/// the index its pushed resource ID holds and the sampler from the plain sampler array at the -/// index the consumer pushes for it (`PushField::ConstexprSampler`, a `u32`), with no descriptor -/// and no specialization constant but the dispatch's ([`dispatch_key`]). The field's sampler is the constexpr one in normalized -/// coordinates, whose device sampler (`CombinedSampler::constexpr_sampler`) is normalized: the -/// shader scales the linear pixel sampler's coordinate and records -/// `PrecisionNote::PixelSamplerScaling`, which the default domains do not. It passes L3 on each -/// profile. +/// of normalized coordinates, and the same kernel through a pixel sampler that the resident-table +/// domains hand the device's unnormalized sampler) takes the texture from set 1's sampled-image +/// array at the index its pushed resource ID holds and the sampler from the plain sampler array at +/// the index the consumer pushes for it (`PushField::ConstexprSampler`, a `u32`), with no +/// descriptor and no specialization constant but the dispatch's ([`dispatch_key`]). The field's +/// sampler is the constexpr one in normalized coordinates, whose device sampler +/// (`CombinedSampler::constexpr_sampler`) is normalized: the shader scales the linear pixel +/// sampler's coordinate and records `PrecisionNote::PixelSamplerScaling`, which the resident-table +/// domains do not. It passes L3 on each profile. #[test] fn a_constexpr_sampler_is_the_set_1_element_its_pushed_index_names() { use crate::air::abi::{AddressMode, Coordinates, Filter, MipFilter, SamplerState}; @@ -572,19 +572,24 @@ fn a_constexpr_sampler_is_the_set_1_element_its_pushed_index_names() { )); for (bc, words) in [(&normalized, SAMPLE_UP_WORDS), (&pixel_bc, pixel)] { for stem in PROFILES { - // The default domains read the linear pixel sampler's coordinate through the + // The resident-table domains read the linear pixel sampler's coordinate through the // device's unnormalized sampler, with no note, so the identity form below scales it // in its place. - let default = profile(stem, DevicePolicy::default()).unwrap_or_else(|e| panic!("{e}")); + let default = + profile(stem, DevicePolicy::RESIDENT_TABLES).unwrap_or_else(|e| panic!("{e}")); let (a, plan, _) = compile_kept(bc, "sample_up", &default) - .unwrap_or_else(|e| panic!("{stem}: default domains: {e}")); + .unwrap_or_else(|e| panic!("{stem}: resident-table domains: {e}")); let unnormalized: Vec = (plan.families.sampler.decls.values()) .map(|d| d.sampler.unnormalized) .collect(); - assert_eq!(unnormalized, [words == pixel], "{stem}: default domains"); + assert_eq!( + unnormalized, + [words == pixel], + "{stem}: resident-table domains" + ); assert!( !a.precision.contains(&PrecisionNote::PixelSamplerScaling), - "{stem}: default domains" + "{stem}: resident-table domains" ); } for (stem, p) in &profiles { @@ -759,7 +764,7 @@ fn bicubic_slots() -> BTreeSet { /// A kernel that samples 2D textures through a bicubic constexpr sampler at normalized /// coordinates reads how the filter treats each slot's bound format from the slot's push field -/// under the identity domains, where the default domains specialize it and state its fact; a +/// under the identity domains, where the resident-table domains specialize it and state its fact; a /// bicubic sample of a 1D texture ([`BICUBIC_LINE_FORM`]) and one at pixel coordinates /// ([`BICUBIC_PIXEL_FORM`]) are still refused there, each naming its own form. #[test] @@ -774,9 +779,10 @@ fn a_bicubic_kernel_reads_each_slots_format_treatment_from_its_pushed_field() { }; let slots = bicubic_slots(); for stem in PROFILES { - let default = profile(stem, DevicePolicy::default()).unwrap_or_else(|e| panic!("{e}")); + let default = + profile(stem, DevicePolicy::RESIDENT_TABLES).unwrap_or_else(|e| panic!("{e}")); let (a, plan, _) = compile_kept(&formats, "bcu_formats", &default) - .unwrap_or_else(|e| panic!("{stem}: default domains: {e}")); + .unwrap_or_else(|e| panic!("{stem}: resident-table domains: {e}")); let facts: BTreeSet = (plan.facts.iter()) .filter_map(|f| match f { RuntimeFact::BicubicTexels { slot } => Some(*slot), @@ -792,11 +798,11 @@ fn a_bicubic_kernel_reads_each_slots_format_treatment_from_its_pushed_field() { assert_eq!( (&facts, &specialized), (&slots, &slots), - "{stem}: default domains" + "{stem}: resident-table domains" ); assert!( !(plan.push.fields.iter()).any(|f| matches!(f.field, PushField::BicubicTexels(_))), - "{stem}: default domains" + "{stem}: resident-table domains" ); let p = profile(stem, identity()).unwrap_or_else(|e| panic!("{e}")); let (a, plan, _) = @@ -831,7 +837,7 @@ fn a_bicubic_kernel_reads_each_slots_format_treatment_from_its_pushed_field() { (&address, "bcu_address", BICUBIC_PIXEL_FORM), ] { compile(bc, entry, &default) - .unwrap_or_else(|e| panic!("{stem}: {entry}: default domains: {e}")); + .unwrap_or_else(|e| panic!("{stem}: {entry}: resident-table domains: {e}")); match compile(bc, entry, &p) { Err(Error::Unsupported(u)) => { assert_eq!( @@ -917,7 +923,7 @@ declare {{ float, i8 }} @air.sample_compare_depth_2d.f32(ptr addrspace(1), ptr a /// array that the member's resource ID names and the sampler as the element of the set-1 sampler /// array of its use that the slot's pushed resource ID or the constexpr sampler's pushed index /// (`PushField::ConstexprSampler`) names: no heap sampler binding and nothing in set 0. Each passes -/// L3 on every profile; the default domains compile each as before. +/// L3 on every profile; the resident-table domains compile each as before. /// /// The depth texture's sample without comparison reads the same element of its depth-comparison /// class (`Depth` 1) as its comparison, through the plain sampler array (binding 2). SPIR-V 1.6 @@ -980,11 +986,13 @@ fn an_argument_buffer_textures_sample_takes_its_sampler_from_the_identity_arrays (&both, "k", &[0, 2, 3], 0, &[(false, false), (true, false)]), ]; for stem in PROFILES { - let default = profile(stem, DevicePolicy::default()).unwrap_or_else(|e| panic!("{e}")); + let default = + profile(stem, DevicePolicy::RESIDENT_TABLES).unwrap_or_else(|e| panic!("{e}")); let p = profile(stem, identity()).unwrap_or_else(|e| panic!("{e}")); for (bc, entry, bindings, slots, constexpr) in cases { let what = format!("{stem}: {entry}"); - compile(bc, entry, &default).unwrap_or_else(|e| panic!("{what}: default domains: {e}")); + compile(bc, entry, &default) + .unwrap_or_else(|e| panic!("{what}: resident-table domains: {e}")); let (a, plan, _) = compile_kept(bc, entry, &p).unwrap_or_else(|e| panic!("{what}: {e}")); link_and_validate(&a, &p).unwrap_or_else(|e| panic!("{what}: L3: {e}")); @@ -1027,7 +1035,7 @@ fn an_argument_buffer_textures_sample_takes_its_sampler_from_the_identity_arrays /// texture (`engine_handles::chosen_sampler_kernel`) are a switch over the candidates on every /// profile, each arm sampling as through that sampler alone at its pushed index /// (`PushField::ConstexprSampler`, one for each candidate), never an array of their samplers: each -/// compiles and passes L3, and the default domains compile them as before. +/// compiles and passes L3, and the resident-table domains compile them as before. #[test] fn an_argument_buffer_texture_through_chosen_constexpr_samplers_is_a_switch_over_them() { use super::engine_handles::{chosen_sampler_kernel, CHOSEN_SAMPLERS}; @@ -1040,11 +1048,12 @@ target triple = \"air64_v28-apple-macosx26.0.0\"\n\n{}", return; }; for stem in PROFILES { - let default = profile(stem, DevicePolicy::default()).unwrap_or_else(|e| panic!("{e}")); + let default = + profile(stem, DevicePolicy::RESIDENT_TABLES).unwrap_or_else(|e| panic!("{e}")); let p = profile(stem, identity()).unwrap_or_else(|e| panic!("{e}")); let what = format!("{stem}: chosen"); compile(&chosen, "chosen", &default) - .unwrap_or_else(|e| panic!("{what}: default domains: {e}")); + .unwrap_or_else(|e| panic!("{what}: resident-table domains: {e}")); let (a, plan, _) = compile_kept(&chosen, "chosen", &p).unwrap_or_else(|e| panic!("{what}: {e}")); link_and_validate(&a, &p).unwrap_or_else(|e| panic!("{what}: L3: {e}")); @@ -1063,7 +1072,7 @@ target triple = \"air64_v28-apple-macosx26.0.0\"\n\n{}", /// fields are the ID's high word. No sampler table, nothing in set 0, no sampler slot's ID, constexpr /// sampler index or execution status address pushed, and no cubic test /// (`RuntimeFact::CubicArgumentSampler`). Each passes L3 on every -/// profile; the default domains compile each as before. +/// profile; the resident-table domains compile each as before. #[test] fn an_argument_buffers_sampler_samples_through_the_identity_arrays_by_its_resource_id() { let (Some(samplers), Some(cube)) = ( @@ -1081,11 +1090,13 @@ fn an_argument_buffers_sampler_samples_through_the_identity_arrays_by_its_resour (&cube, "argument_sampler_cube_gradient", &[0, 2]), ]; for stem in PROFILES { - let default = profile(stem, DevicePolicy::default()).unwrap_or_else(|e| panic!("{e}")); + let default = + profile(stem, DevicePolicy::RESIDENT_TABLES).unwrap_or_else(|e| panic!("{e}")); let p = profile(stem, identity()).unwrap_or_else(|e| panic!("{e}")); for (bc, entry, bindings) in cases { let what = format!("{stem}: {entry}"); - compile(bc, entry, &default).unwrap_or_else(|e| panic!("{what}: default domains: {e}")); + compile(bc, entry, &default) + .unwrap_or_else(|e| panic!("{what}: resident-table domains: {e}")); let (a, plan, _) = compile_kept(bc, entry, &p).unwrap_or_else(|e| panic!("{what}: {e}")); link_and_validate(&a, &p).unwrap_or_else(|e| panic!("{what}: L3: {e}")); @@ -3153,7 +3164,7 @@ fn simd_input(t: u32) -> f32 { /// Under the identity domains the emulated tier's barriers run only in a threadgroup of more /// than one thread: each opens a block a branch on `1 < N` enters, a threadgroup of one passes /// none, and threadgroups of one and of 80 threads answer Metal's products, the last simdgroup of -/// 80 holding 16 threads. The default domains keep every barrier unconditional. +/// 80 holding 16 threads. The resident-table domains keep every barrier unconditional. #[test] fn the_emulated_tiers_barriers_run_only_in_a_threadgroup_of_several_threads() { let Some(bc) = assemble("gsm2_simd_products") else { @@ -3164,13 +3175,13 @@ fn the_emulated_tiers_barriers_run_only_in_a_threadgroup_of_several_threads() { let mut inputs = LowerInputs::new(); inputs.emulated_simdgroups = true; for stem in PROFILES { - let plain = profile(stem, DevicePolicy::default()).unwrap_or_else(|e| panic!("{e}")); + let plain = profile(stem, DevicePolicy::RESIDENT_TABLES).unwrap_or_else(|e| panic!("{e}")); let a = compile_with(&bc, ENTRY, &plain, &inputs).unwrap_or_else(|e| panic!("{stem}: {e}")); let (_, words) = link_and_validate(&a, &plain).unwrap_or_else(|e| panic!("{stem}: {e}")); let (inside, outside) = barrier_guards(&spirv_dis(&words)); assert!( inside == 0 && outside > 0, - "{stem}: the default domains guard {inside} barriers and leave {outside}" + "{stem}: the resident-table domains guard {inside} barriers and leave {outside}" ); let p = profile(stem, identity()).unwrap_or_else(|e| panic!("{e}")); let a = compile_with(&bc, ENTRY, &p, &inputs).unwrap_or_else(|e| panic!("{stem}: {e}")); @@ -3448,8 +3459,8 @@ fn unwritten_slots_are_loaded_through_non_writable_places() { /// `shaderStorageImageReadWithoutFormat` and sets the read bit on every read-write tier format), is /// declared without a format, as a heap storage class's read is: the pipeline requires the SPIR-V /// capability and not the feature. With one tier format's bit cleared (`RGBA16Float`) the read is -/// still refused as `Unsupported{IdentityDomains}`. The default domains' answer on the Iris Xe, -/// the format as the binder's input (`NeedsInput{StorageTextureFormat}`), does not change. +/// still refused as `Unsupported{IdentityDomains}`. The resident-table domains' answer on the Iris +/// Xe, the format as the binder's input (`NeedsInput{StorageTextureFormat}`), does not change. #[test] fn a_storage_read_the_formats_bits_grant_is_formatless_under_the_identity_domains() { use crate::device::requirements::SpirvCapability; @@ -3494,12 +3505,12 @@ fn a_storage_read_the_formats_bits_grant_is_formatless_under_the_identity_domain } let default = - Device::from_queries(desc, DevicePolicy::default()).unwrap_or_else(|e| panic!("{e}")); + Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES).unwrap_or_else(|e| panic!("{e}")); match compiled(&default) { Err(Error::NeedsInput(RuntimeInput::StorageTextureFormat { slot })) => { assert_eq!((slot.class, slot.index), (SlotClass::Texture, 0)); } - other => panic!("the default domains: {:?}", other.map(|_| ())), + other => panic!("the resident-table domains: {:?}", other.map(|_| ())), } } @@ -3511,8 +3522,8 @@ const BLOB_LANES: [f32; 3] = [1.0, 2.5, -0.75]; /// table as 2-byte units at offsets only the run knows, one past the table's words: it binds no /// descriptor and its artifact carries no blob, its private bytes count the blob's 32 padded bytes, /// and on the CPU interpreter each thread stores its lane's float and its unit, and zero for the -/// read past the words. The default domains compile the same kernel with the blob bound, its 24 -/// bytes in the artifact. +/// read past the words. The resident-table domains compile the same kernel with the blob bound, its +/// 24 bytes in the artifact. #[test] fn the_constant_blob_is_the_modules_words_under_the_identity_domains() { use super::engine_pointer_memory::{assemble, kernel}; @@ -3552,7 +3563,8 @@ fn the_constant_blob_is_the_modules_words_under_the_identity_domains() { want.extend_from_slice(&unit.to_le_bytes()); } for stem in PROFILES { - let default = profile(stem, DevicePolicy::default()).unwrap_or_else(|e| panic!("{e}")); + let default = + profile(stem, DevicePolicy::RESIDENT_TABLES).unwrap_or_else(|e| panic!("{e}")); let (bound, bound_plan, _) = compile_kept(&bc, name, &default).unwrap_or_else(|e| panic!("{stem}: default: {e}")); assert_eq!(bound.blob.as_deref().map(<[u8]>::len), Some(24), "{stem}"); @@ -3600,7 +3612,7 @@ fn the_constant_blob_is_the_modules_words_under_the_identity_domains() { /// Under the identity domains a constant blob past `memory::blob::MODULE_BYTES` is refused as /// `Unsupported{IdentityDomains}`, not implemented, naming the constant data's size, where the -/// default domains bind it. +/// resident-table domains bind it. #[test] fn a_constant_blob_past_the_modules_bound_is_refused_naming_its_size() { use super::engine_pointer_memory::{assemble, kernel}; @@ -3617,7 +3629,8 @@ fn a_constant_blob_past_the_modules_bound_is_refused_naming_its_size() { let bytes = 16400 * 4; assert!(bytes > crate::memory::blob::MODULE_BYTES); for stem in PROFILES { - let default = profile(stem, DevicePolicy::default()).unwrap_or_else(|e| panic!("{e}")); + let default = + profile(stem, DevicePolicy::RESIDENT_TABLES).unwrap_or_else(|e| panic!("{e}")); let (bound, _, _) = compile_kept(&bc, name, &default).unwrap_or_else(|e| panic!("{stem}: default: {e}")); assert_eq!( @@ -3645,18 +3658,19 @@ fn a_constant_blob_past_the_modules_bound_is_refused_naming_its_size() { } /// A kernel whose device-scope `seq_cst` fence orders its two stores (`a4_device_fence`) compiles -/// under the default domains, its fence ordered through the command buffer's `ExecutionStatus` -/// word, and is refused under the identity domains, which reach no such word, naming the fence -/// ([`SEQ_CST_FORM`](crate::lower::sync::barrier::SEQ_CST_FORM)). +/// under the resident-table domains, its fence ordered through the command buffer's +/// `ExecutionStatus` word, and is refused under the identity domains, which reach no such word, +/// naming the fence ([`SEQ_CST_FORM`](crate::lower::sync::barrier::SEQ_CST_FORM)). #[test] fn a_seq_cst_fence_is_refused_naming_its_form_under_the_identity_domains() { let Some(bc) = assemble("a4_device_fence") else { return; }; for stem in PROFILES { - let default = profile(stem, DevicePolicy::default()).unwrap_or_else(|e| panic!("{e}")); + let default = + profile(stem, DevicePolicy::RESIDENT_TABLES).unwrap_or_else(|e| panic!("{e}")); let a = compile(&bc, "a4_device_fence", &default) - .unwrap_or_else(|e| panic!("{stem}: default domains: {e}")); + .unwrap_or_else(|e| panic!("{stem}: resident-table domains: {e}")); assert!(a.facts.contains(&RuntimeFact::ExecutionStatus), "{stem}"); let p = profile(stem, identity()).unwrap_or_else(|e| panic!("{e}")); match compile(&bc, "a4_device_fence", &p) { diff --git a/crates/metal2vulkan/src/tests/engine_identity_domain.rs b/crates/metal2vulkan/src/tests/engine_identity_domain.rs index 1d195c265..2312293f4 100644 --- a/crates/metal2vulkan/src/tests/engine_identity_domain.rs +++ b/crates/metal2vulkan/src/tests/engine_identity_domain.rs @@ -11,7 +11,7 @@ //! - under the identity domains, in both forms, a run-time -4 at bind offset 16 reads word 3 (byte //! 12), and at bind offset 0, before the buffer's start, reads zero; a constant -4 at bind //! offset 16 reads word 3; -//! - on the default domains the same kernels at bind offset 16 read word 3, as `docs/API.md` +//! - on the resident-table domains the same kernels at bind offset 16 read word 3, as `docs/API.md` //! says a storage view of a whole window does (from the buffer's start). //! //! `llvm-as` assembles the kernels; without it the tests skip visibly. @@ -148,10 +148,10 @@ fn identity_run(bc: &[u8], entry: &str, bind: u64, k: i32) -> u32 { u32::from_le_bytes(got.buffers[1][..4].try_into().expect("a word")) } -/// What kernel `entry` stores on the default domains on lavapipe, `data` bound at `bind` through a -/// descriptor of the whole buffer, `k` the `int` it reads. +/// What kernel `entry` stores on the resident-table domains on lavapipe, `data` bound at `bind` +/// through a descriptor of the whole buffer, `k` the `int` it reads. fn default_run(bc: &[u8], entry: &str, bind: u64, k: i32) -> u32 { - let p = profile("lavapipe", DevicePolicy::default()).unwrap_or_else(|e| panic!("{e}")); + let p = profile("lavapipe", DevicePolicy::RESIDENT_TABLES).unwrap_or_else(|e| panic!("{e}")); let (_, plan, module) = compile_kept(bc, entry, &p).unwrap_or_else(|e| panic!("{entry}: {e}")); let mut push = vec![0u8; plan.push.push_range.map_or(0, |(_, end)| end as usize)]; for f in &plan.push.fields { diff --git a/crates/metal2vulkan/src/tests/engine_identity_interlock.rs b/crates/metal2vulkan/src/tests/engine_identity_interlock.rs index d134ed3aa..8915204d7 100644 --- a/crates/metal2vulkan/src/tests/engine_identity_interlock.rs +++ b/crates/metal2vulkan/src/tests/engine_identity_interlock.rs @@ -35,7 +35,7 @@ fn identity() -> DevicePolicy { DevicePolicy { pointer_domain: PointerDomain::Identity, handle_domain: HandleDomain::Identity, - ..DevicePolicy::default() + ..DevicePolicy::RESIDENT_TABLES } } diff --git a/crates/metal2vulkan/src/tests/engine_identity_render.rs b/crates/metal2vulkan/src/tests/engine_identity_render.rs index cd7dd72c1..0c21493e8 100644 --- a/crates/metal2vulkan/src/tests/engine_identity_render.rs +++ b/crates/metal2vulkan/src/tests/engine_identity_render.rs @@ -64,7 +64,7 @@ fn identity() -> DevicePolicy { DevicePolicy { pointer_domain: PointerDomain::Identity, handle_domain: HandleDomain::Identity, - ..DevicePolicy::default() + ..DevicePolicy::RESIDENT_TABLES } } diff --git a/crates/metal2vulkan/src/tests/engine_identity_spill.rs b/crates/metal2vulkan/src/tests/engine_identity_spill.rs index 6976d2d26..bd2101b5e 100644 --- a/crates/metal2vulkan/src/tests/engine_identity_spill.rs +++ b/crates/metal2vulkan/src/tests/engine_identity_spill.rs @@ -162,7 +162,7 @@ fn identity() -> DevicePolicy { DevicePolicy { pointer_domain: PointerDomain::Identity, handle_domain: HandleDomain::Identity, - ..DevicePolicy::default() + ..DevicePolicy::RESIDENT_TABLES } } diff --git a/crates/metal2vulkan/src/tests/engine_image_shapes.rs b/crates/metal2vulkan/src/tests/engine_image_shapes.rs index 18721589e..eb0e52495 100644 --- a/crates/metal2vulkan/src/tests/engine_image_shapes.rs +++ b/crates/metal2vulkan/src/tests/engine_image_shapes.rs @@ -165,7 +165,7 @@ fn device(stem: &str) -> Device { let text = std::fs::read_to_string(&path).unwrap_or_else(|e| panic!("{}: {e}", path.display())); let description = DeviceDescription::from_khronos_json(&text, None).unwrap_or_else(|e| panic!("{stem}: {e}")); - Device::from_queries(description, DevicePolicy::default()) + Device::from_queries(description, DevicePolicy::RESIDENT_TABLES) .unwrap_or_else(|e| panic!("{stem}: {e}")) } diff --git a/crates/metal2vulkan/src/tests/engine_imageblock.rs b/crates/metal2vulkan/src/tests/engine_imageblock.rs index 6f6ee3534..61e7a840c 100644 --- a/crates/metal2vulkan/src/tests/engine_imageblock.rs +++ b/crates/metal2vulkan/src/tests/engine_imageblock.rs @@ -692,7 +692,7 @@ fn device(stem: &str) -> Device { .join(format!("{stem}.json")); let text = std::fs::read_to_string(path).expect("profile"); let desc = DeviceDescription::from_khronos_json(&text, None).expect("description"); - Device::from_queries(desc, DevicePolicy::default()).expect("device") + Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES).expect("device") } fn pipeline(dev: &Device, bc: &[u8], entry: &str) -> ComputePipeline { diff --git a/crates/metal2vulkan/src/tests/engine_index_words.rs b/crates/metal2vulkan/src/tests/engine_index_words.rs index 20f8897c1..cfeea4dde 100644 --- a/crates/metal2vulkan/src/tests/engine_index_words.rs +++ b/crates/metal2vulkan/src/tests/engine_index_words.rs @@ -61,7 +61,7 @@ fn profile_with(stem: &str, robust: bool) -> DeviceProfile { desc.features.remove(&VkFeature::RobustBufferAccess); desc.features.remove(&VkFeature::RobustBufferAccess2); } - Device::from_queries(desc, DevicePolicy::default()) + Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES) .expect("device") .profile() .clone() diff --git a/crates/metal2vulkan/src/tests/engine_indirect_commands.rs b/crates/metal2vulkan/src/tests/engine_indirect_commands.rs index 07c9a08a4..9a4eb2029 100644 --- a/crates/metal2vulkan/src/tests/engine_indirect_commands.rs +++ b/crates/metal2vulkan/src/tests/engine_indirect_commands.rs @@ -80,7 +80,7 @@ type Spoil = (&'static str, fn(&mut Params)); /// The committed profiles with device addresses, and those without. fn profiles() -> (Profiles, Profiles) { let mut all = committed_profiles().expect("profiles"); - let f = device_f(crate::device::DevicePolicy::default()).expect(PROFILE_F); + let f = device_f(crate::device::DevicePolicy::RESIDENT_TABLES).expect(PROFILE_F); all.push((PROFILE_F.into(), f.profile().clone())); all.into_iter() .partition(|(_, p)| p.fields().buffer_access == BufferAccess::Addressed) diff --git a/crates/metal2vulkan/src/tests/engine_inert.rs b/crates/metal2vulkan/src/tests/engine_inert.rs index 1cadb441d..1b45eadf9 100644 --- a/crates/metal2vulkan/src/tests/engine_inert.rs +++ b/crates/metal2vulkan/src/tests/engine_inert.rs @@ -143,7 +143,7 @@ fn a_kernel_is_inert_where_it_loops_nowhere_and_writes_only_its_threadgroups_mem for stem in PROFILES { let device = Device::from_queries( description(stem).expect("description"), - DevicePolicy::default(), + DevicePolicy::RESIDENT_TABLES, ) .expect("device"); let p = device.profile(); diff --git a/crates/metal2vulkan/src/tests/engine_inline_asm.rs b/crates/metal2vulkan/src/tests/engine_inline_asm.rs index f6d6b4aa0..15266b9e5 100644 --- a/crates/metal2vulkan/src/tests/engine_inline_asm.rs +++ b/crates/metal2vulkan/src/tests/engine_inline_asm.rs @@ -81,7 +81,7 @@ fn the_loop_that_held_the_empty_asm_runs_every_iteration() { want[(2 * t) as usize] = acc; want[(2 * t + 1) as usize] = N; } - let p = profile("moltenvk-m3", DevicePolicy::default()).expect("profile"); + let p = profile("moltenvk-m3", DevicePolicy::RESIDENT_TABLES).expect("profile"); for (what, bc) in spellings() { let (plan, m) = typed_module(&bc, "asm_in_loop", &p).unwrap_or_else(|e| panic!("{e:?}")); let mut spec = BTreeMap::new(); @@ -167,7 +167,7 @@ entry: /// The empty one translates. #[test] fn any_other_inline_asm_is_refused_by_name() { - let p = profile("moltenvk-m3", DevicePolicy::default()).expect("profile"); + let p = profile("moltenvk-m3", DevicePolicy::RESIDENT_TABLES).expect("profile"); for (ret, asm) in [ ("void", r#"asm sideeffect "nop", """#), ("void", r#"asm sideeffect "", "~{memory}""#), diff --git a/crates/metal2vulkan/src/tests/engine_integer_median3.rs b/crates/metal2vulkan/src/tests/engine_integer_median3.rs index d19bf973c..df353de99 100644 --- a/crates/metal2vulkan/src/tests/engine_integer_median3.rs +++ b/crates/metal2vulkan/src/tests/engine_integer_median3.rs @@ -41,7 +41,7 @@ fn profiles() -> [(&'static str, DeviceProfile); 2] { if !int64 { assert!(desc.features.remove(&VkFeature::ShaderInt64)); } - let p = Device::from_queries(desc, DevicePolicy::default()) + let p = Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES) .expect("device") .profile() .clone(); diff --git a/crates/metal2vulkan/src/tests/engine_kernel_lod.rs b/crates/metal2vulkan/src/tests/engine_kernel_lod.rs index cacb04d65..763b9b2a9 100644 --- a/crates/metal2vulkan/src/tests/engine_kernel_lod.rs +++ b/crates/metal2vulkan/src/tests/engine_kernel_lod.rs @@ -47,7 +47,7 @@ fn fixture() -> Option> { } fn m3() -> DeviceProfile { - profile("moltenvk-m3", DevicePolicy::default()).expect("profile") + profile("moltenvk-m3", DevicePolicy::RESIDENT_TABLES).expect("profile") } /// The instructions of a SPIR-V module: opcode and word offset. diff --git a/crates/metal2vulkan/src/tests/engine_kernel_stage_in.rs b/crates/metal2vulkan/src/tests/engine_kernel_stage_in.rs index 18c7de13d..11171253f 100644 --- a/crates/metal2vulkan/src/tests/engine_kernel_stage_in.rs +++ b/crates/metal2vulkan/src/tests/engine_kernel_stage_in.rs @@ -93,7 +93,7 @@ fn device_of(mut desc: DeviceDescription, bare: bool) -> Device { desc.features.remove(&VkFeature::RobustBufferAccess); desc.features.remove(&VkFeature::RobustBufferAccess2); } - Device::from_queries(desc, DevicePolicy::default()).expect("device") + Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES).expect("device") } /// Each profile of [`PROFILES`] and Profile F (`runtime-floor` without device addresses, below diff --git a/crates/metal2vulkan/src/tests/engine_lane_reads.rs b/crates/metal2vulkan/src/tests/engine_lane_reads.rs index a15112edb..5667f6554 100644 --- a/crates/metal2vulkan/src/tests/engine_lane_reads.rs +++ b/crates/metal2vulkan/src/tests/engine_lane_reads.rs @@ -98,7 +98,7 @@ fn profile(stem: &str, id: Option) -> DeviceProfile { if let Some(id) = id { desc.device_id = id; } - Device::from_queries(desc, DevicePolicy::default()) + Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES) .expect("device") .profile() .clone() diff --git a/crates/metal2vulkan/src/tests/engine_lazy_operands.rs b/crates/metal2vulkan/src/tests/engine_lazy_operands.rs index 37c6b36a5..4dd7533ca 100644 --- a/crates/metal2vulkan/src/tests/engine_lazy_operands.rs +++ b/crates/metal2vulkan/src/tests/engine_lazy_operands.rs @@ -59,7 +59,7 @@ fn moltenvk_msl_evaluates_subgroup_operations_eagerly() { ) else { return; }; - let p = profile("moltenvk-m3", DevicePolicy::default()).expect("profile"); + let p = profile("moltenvk-m3", DevicePolicy::RESIDENT_TABLES).expect("profile"); let a = compile(&bc, "kernel_simd_variant_leftovers", &p).expect("compile"); let (_, words) = link_and_validate(&a, &p).expect("L3"); let Some(msl) = skip_missing(moltenvk_msl(&words), "spirv-cross") else { diff --git a/crates/metal2vulkan/src/tests/engine_line_band.rs b/crates/metal2vulkan/src/tests/engine_line_band.rs index b0b07d7c8..b5e038dbf 100644 --- a/crates/metal2vulkan/src/tests/engine_line_band.rs +++ b/crates/metal2vulkan/src/tests/engine_line_band.rs @@ -285,7 +285,7 @@ fn a_band_needs_tessellation_and_no_barycentric_weights() { let mut desc = DeviceDescription::from_khronos_json(&text, None).expect("description"); let budget = Budget::standard(); let both = render(&bc, "pv_vertex", "pv_both", PixelFormat::RGBA8Unorm); - let dev = Device::from_queries(desc.clone(), DevicePolicy::default()).expect("device"); + let dev = Device::from_queries(desc.clone(), DevicePolicy::RESIDENT_TABLES).expect("device"); for primitive in PRIMITIVES { match dev.compile_render_variant(&both, &band_key(primitive), &budget) { Err(Error::Unsupported(u)) => { @@ -296,7 +296,7 @@ fn a_band_needs_tessellation_and_no_barycentric_weights() { } } desc.features.remove(&F::TessellationShader); - let dev = Device::from_queries(desc, DevicePolicy::default()).expect("device"); + let dev = Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES).expect("device"); let flat = render(&bc, "pv_vertex", "pv_flat", PixelFormat::RGBA8Unorm); for primitive in PRIMITIVES { match dev.compile_render_variant(&flat, &band_key(primitive), &budget) { diff --git a/crates/metal2vulkan/src/tests/engine_link.rs b/crates/metal2vulkan/src/tests/engine_link.rs index c63f829a8..fe3288535 100644 --- a/crates/metal2vulkan/src/tests/engine_link.rs +++ b/crates/metal2vulkan/src/tests/engine_link.rs @@ -54,7 +54,7 @@ fn assemble(name: &str) -> Option> { } fn prof(stem: &str) -> DeviceProfile { - profile(stem, DevicePolicy::default()).expect("committed profile") + profile(stem, DevicePolicy::RESIDENT_TABLES).expect("committed profile") } /// Committed profile `stem` without buffer robustness: its containment is checked in the shader. @@ -66,7 +66,7 @@ fn without_robustness(stem: &str) -> DeviceProfile { let mut desc = DeviceDescription::from_khronos_json(&text, None).expect("description"); desc.features.remove(&VkFeature::RobustBufferAccess); desc.features.remove(&VkFeature::RobustBufferAccess2); - Device::from_queries(desc, DevicePolicy::default()) + Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES) .expect("device") .profile() .clone() diff --git a/crates/metal2vulkan/src/tests/engine_linked_signatures.rs b/crates/metal2vulkan/src/tests/engine_linked_signatures.rs index ef3f4385d..766864250 100644 --- a/crates/metal2vulkan/src/tests/engine_linked_signatures.rs +++ b/crates/metal2vulkan/src/tests/engine_linked_signatures.rs @@ -74,7 +74,7 @@ fn words( case: &metal2vulkan_devtools::linked_signatures::Case, ) -> Result<[u32; 2], Error> { let none = FunctionConstantValues::defaults(); - let p = profile("moltenvk-m3", DevicePolicy::default()).expect("profile"); + let p = profile("moltenvk-m3", DevicePolicy::RESIDENT_TABLES).expect("profile"); let kernel = format!("k_{}", case.name); let (_, m) = typed_module_linked(&modules[0], &kernel, &p, &[linked(modules, case, &none)])?; let slot = |index| { diff --git a/crates/metal2vulkan/src/tests/engine_linking.rs b/crates/metal2vulkan/src/tests/engine_linking.rs index 0880b9631..0ce4aaf16 100644 --- a/crates/metal2vulkan/src/tests/engine_linking.rs +++ b/crates/metal2vulkan/src/tests/engine_linking.rs @@ -87,7 +87,7 @@ fn device(stem: &str) -> Device { .join(format!("{stem}.json")); let text = std::fs::read_to_string(path).expect("profile"); let desc = DeviceDescription::from_khronos_json(&text, None).expect("description"); - Device::from_queries(desc, DevicePolicy::default()).expect("device") + Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES).expect("device") } fn needs(symbol: &str) -> Error { @@ -115,7 +115,7 @@ fn compile_linked( linked: &[LinkedSource<'_>], stem: &str, ) -> Result, Error> { - let p = profile(stem, DevicePolicy::default()).expect("profile"); + let p = profile(stem, DevicePolicy::RESIDENT_TABLES).expect("profile"); compile_bitcode_linked( caller, EntryRef::Name(CALLER), @@ -218,7 +218,7 @@ fn a_linked_kernel_computes_its_linked_functions() { }; let none = FunctionConstantValues::defaults(); let linked = complete(&caller, &functions, &none); - let p = profile("moltenvk-m3", DevicePolicy::default()).expect("profile"); + let p = profile("moltenvk-m3", DevicePolicy::RESIDENT_TABLES).expect("profile"); let (_, m) = typed_module_linked(&caller, CALLER, &p, &linked).expect("module"); const N: u32 = 32; let buffer = |index| Buffer { @@ -257,7 +257,7 @@ fn a_linked_kernel_computes_its_linked_functions() { /// The words `words[i]` the caller computes over 32 threads with `linked`. fn caller_words(caller: &[u8], linked: &[LinkedSource<'_>]) -> Vec { - let p = profile("moltenvk-m3", DevicePolicy::default()).expect("profile"); + let p = profile("moltenvk-m3", DevicePolicy::RESIDENT_TABLES).expect("profile"); let (_, m) = typed_module_linked(caller, CALLER, &p, linked).expect("module"); const N: u32 = 32; let buffer = |index| Buffer { @@ -549,7 +549,7 @@ fn a_linked_module_that_does_not_decode_is_refused_only_at_its_calls() { LinkedSource::new("linked_scale", &garbage, &none), LinkedSource::new("linked_sample", &functions, &none), ]; - let p = profile("moltenvk-m3", DevicePolicy::default()).expect("profile"); + let p = profile("moltenvk-m3", DevicePolicy::RESIDENT_TABLES).expect("profile"); let compile = |entry| { compile_bitcode_linked( &caller, @@ -593,7 +593,7 @@ fn a_linked_refusal_locates_an_instruction_of_the_specialized_entry() { }; let none = FunctionConstantValues::defaults(); let linked = complete(&caller, &functions, &none); - let p = profile("moltenvk-m3", DevicePolicy::default()).expect("profile"); + let p = profile("moltenvk-m3", DevicePolicy::RESIDENT_TABLES).expect("profile"); let refusal = match compile_linked(&caller, &linked, "moltenvk-m3") { Err(Error::Unsupported(u)) => u, other => panic!("not refused: {:?}", other.map(|_| ())), @@ -639,7 +639,7 @@ fn a_linked_function_s_constexpr_sampler_is_numbered() { return; }; let none = FunctionConstantValues::defaults(); - let p = profile("lavapipe", DevicePolicy::default()).expect("profile"); + let p = profile("lavapipe", DevicePolicy::RESIDENT_TABLES).expect("profile"); let compile = |entry: &str, linked: &[LinkedSource<'_>]| { compile_bitcode_linked( &caller, diff --git a/crates/metal2vulkan/src/tests/engine_loop_unrolling.rs b/crates/metal2vulkan/src/tests/engine_loop_unrolling.rs index 2dd0b5cd2..40970520a 100644 --- a/crates/metal2vulkan/src/tests/engine_loop_unrolling.rs +++ b/crates/metal2vulkan/src/tests/engine_loop_unrolling.rs @@ -158,7 +158,7 @@ fn asks(entry: &str, control: &[u32]) { return; }; for stem in PROFILES { - let p = profile(stem, DevicePolicy::default()).expect("profile"); + let p = profile(stem, DevicePolicy::RESIDENT_TABLES).expect("profile"); let what = format!("{entry} on {stem}"); let a = compile(&bitcode, entry, &p).unwrap_or_else(|e| panic!("{what}: {e:?}")); link_and_validate(&a, &p).unwrap_or_else(|e| panic!("{what}: L3: {e}")); diff --git a/crates/metal2vulkan/src/tests/engine_matmul2d.rs b/crates/metal2vulkan/src/tests/engine_matmul2d.rs index 2570f5ffe..f1db3fb54 100644 --- a/crates/metal2vulkan/src/tests/engine_matmul2d.rs +++ b/crates/metal2vulkan/src/tests/engine_matmul2d.rs @@ -228,7 +228,7 @@ impl Rng { /// Kernel `entry` of `bc` specialized to variant `v` for profile `stem`, checked through L3: its /// plan and typed module. fn kernel(bc: &[u8], entry: &str, v: u32, stem: &str) -> Kernel { - let p = profile(stem, DevicePolicy::default()).expect("profile"); + let p = profile(stem, DevicePolicy::RESIDENT_TABLES).expect("profile"); let consts = variant(v); let what = format!("{entry} variant {v} on {stem}"); let a = compile_bitcode( @@ -792,7 +792,7 @@ fn fp8_fused_sums((stem, widths): (&str, &[SubgroupSize])) { let Some(bc) = bitcode("tns_mm_fp8") else { return; }; - let native = profile(stem, DevicePolicy::default()) + let native = profile(stem, DevicePolicy::RESIDENT_TABLES) .expect("profile") .fields() .leaf @@ -912,7 +912,7 @@ fn unmeasured_forms_are_refused_naming_them() { "i32 16, i32 64, i32 32", "16x64x32", )]; - let p = profile("moltenvk-m3", DevicePolicy::default()).expect("profile"); + let p = profile("moltenvk-m3", DevicePolicy::RESIDENT_TABLES).expect("profile"); for (from, to, why) in cases { let Some(bc) = respelled("tns_mm_float", &[(from, to)]) else { return; diff --git a/crates/metal2vulkan/src/tests/engine_mesh.rs b/crates/metal2vulkan/src/tests/engine_mesh.rs index 6e4d3be9c..2d9cef906 100644 --- a/crates/metal2vulkan/src/tests/engine_mesh.rs +++ b/crates/metal2vulkan/src/tests/engine_mesh.rs @@ -353,7 +353,7 @@ fn an_object_function_passes_its_payload_to_its_mesh_functions() { let mut desc = DeviceDescription::from_khronos_json(&text, None).expect("description"); desc.limits.mesh.max_task_payload_size = payload_size; desc.limits.mesh.max_task_payload_and_shared_memory_size = together; - let dev = Device::from_queries(desc, DevicePolicy::default()).expect("device"); + let dev = Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES).expect("device"); let got = compile(&draws, "mesh_draws_object", dev.profile()) .map(|_| ()) .map_err(|e| match e { @@ -405,7 +405,7 @@ fn a_mesh_functions_threadgroup_memory_is_its_workgroups() { for (available, fits) in [(260, true), (259, false)] { let mut desc = DeviceDescription::from_khronos_json(&text, None).expect("description"); desc.limits.mesh.max_mesh_shared_memory_size = available; - let dev = Device::from_queries(desc, DevicePolicy::default()).expect("device"); + let dev = Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES).expect("device"); match compile(&outputs, "mesh_outputs_points", dev.profile()) { Ok(_) => assert!(fits, "{stem} at {available}"), Err(Error::Unsupported(u)) => { @@ -490,7 +490,7 @@ fn a_mesh_point_size_is_noted_only_where_the_mesh_outputs_points() { let text = std::fs::read_to_string(path).expect("profile"); let mut desc = DeviceDescription::from_khronos_json(&text, None).expect("description"); desc.limits.max_point_size = 64; - let dev = Device::from_queries(desc, DevicePolicy::default()).expect("device"); + let dev = Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES).expect("device"); for (topology, bitcode) in &modules { let a = compile(bitcode, "mesh_outputs_points", dev.profile()) .unwrap_or_else(|e| panic!("{stem} {topology}: {e}")); @@ -515,7 +515,7 @@ pub(super) fn device(stem: &str) -> crate::device::Device { .join(format!("../metal2vulkan-validation/profiles/{stem}.json")); let text = std::fs::read_to_string(path).expect("profile"); let desc = DeviceDescription::from_khronos_json(&text, None).expect("description"); - Device::from_queries(desc, DevicePolicy::default()).expect("device") + Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES).expect("device") } /// The `OpDecorate ... PerPrimitiveEXT` instructions of a module. @@ -1323,7 +1323,7 @@ fn a_mesh_functions_buffer_writes_need_no_stage_store_feature() { ] { desc.features.remove(&f); } - let dev = Device::from_queries(desc, DevicePolicy::default()).expect("device"); + let dev = Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES).expect("device"); let p = dev.profile(); let a = compile(&barrier, "mesh_barrier_writer", p).unwrap_or_else(|e| panic!("{stem}: {e}")); @@ -1831,7 +1831,7 @@ fn an_object_functions_threadgroup_memory_is_the_encoders_lengths() { let text = std::fs::read_to_string(path).expect("profile"); let mut desc = DeviceDescription::from_khronos_json(&text, None).expect("description"); desc.limits.mesh.max_task_shared_memory_size = 76; - let dev = Device::from_queries(desc, DevicePolicy::default()).expect("device"); + let dev = Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES).expect("device"); let made = pipeline(&dev).unwrap_or_else(|e| panic!("{stem} at 76: {e}")); made.plan(&dev, &with_length(Some(64)).shape()) .unwrap_or_else(|e| panic!("{stem} at 76: 64 bytes: {e}")); diff --git a/crates/metal2vulkan/src/tests/engine_metal_denormals.rs b/crates/metal2vulkan/src/tests/engine_metal_denormals.rs index b9f98b22d..c172876fb 100644 --- a/crates/metal2vulkan/src/tests/engine_metal_denormals.rs +++ b/crates/metal2vulkan/src/tests/engine_metal_denormals.rs @@ -342,7 +342,7 @@ fn the_default_forms_note_what_they_leave_to_the_device() { let Some(bc) = assemble() else { return; }; - let wrong = run_policy(&bc, DevicePolicy::default(), "default", &FUNS); + let wrong = run_policy(&bc, DevicePolicy::RESIDENT_TABLES, "default", &FUNS); assert!( wrong.is_empty(), "{} answers off Metal's, the first: {:#?}", diff --git a/crates/metal2vulkan/src/tests/engine_metal_math.rs b/crates/metal2vulkan/src/tests/engine_metal_math.rs index 3ae39a6ce..af014cb49 100644 --- a/crates/metal2vulkan/src/tests/engine_metal_math.rs +++ b/crates/metal2vulkan/src/tests/engine_metal_math.rs @@ -184,7 +184,7 @@ fn ext_insts(words: &[u32]) -> (Vec, bool) { /// The stored word of `entry` on the interpreter. fn interpret(bitcode: &[u8], entry: &str, stem: &str) -> u32 { - let p = profile(stem, crate::device::DevicePolicy::default()).expect("profile"); + let p = profile(stem, crate::device::DevicePolicy::RESIDENT_TABLES).expect("profile"); let mut m = meter(); let decoded = air::decode(bitcode, &mut m).expect("decode"); let req = SpecRequest { @@ -228,7 +228,7 @@ fn metal_math_variants_select_their_forms() { return; }; for stem in PROFILES { - let p = profile(stem, crate::device::DevicePolicy::default()).expect("profile"); + let p = profile(stem, crate::device::DevicePolicy::RESIDENT_TABLES).expect("profile"); for k in &KERNELS { let what = format!("{} on {stem}", k.name); let a = compile(&bitcode, k.name, &p).unwrap_or_else(|e| panic!("{what}: {e:?}")); @@ -291,7 +291,7 @@ fn srgb_fixtures_take_the_transfer_by_the_devices_pow() { return; }; for stem in PROFILES { - let p = profile(stem, crate::device::DevicePolicy::default()).expect("profile"); + let p = profile(stem, crate::device::DevicePolicy::RESIDENT_TABLES).expect("profile"); for (bc, entry, instruction) in [ (&decode_bc, "a1_srgb_decode_all_bytes", UNPACK_UNORM_4X8), (&encode_bc, "a1_srgb_encode_sweep", PACK_UNORM_4X8), diff --git a/crates/metal2vulkan/src/tests/engine_metal_readings.rs b/crates/metal2vulkan/src/tests/engine_metal_readings.rs index ab250a3b9..3efc29791 100644 --- a/crates/metal2vulkan/src/tests/engine_metal_readings.rs +++ b/crates/metal2vulkan/src/tests/engine_metal_readings.rs @@ -65,7 +65,7 @@ fn assemble(name: &str, body: &str) -> Option> { } fn m3() -> DeviceProfile { - profile("moltenvk-m3", DevicePolicy::default()).expect("profile") + profile("moltenvk-m3", DevicePolicy::RESIDENT_TABLES).expect("profile") } /// The offset Metal applies for component `x`: its low four bits as a two's-complement value. diff --git a/crates/metal2vulkan/src/tests/engine_metal_routines.rs b/crates/metal2vulkan/src/tests/engine_metal_routines.rs index c5247a58d..41ca69ead 100644 --- a/crates/metal2vulkan/src/tests/engine_metal_routines.rs +++ b/crates/metal2vulkan/src/tests/engine_metal_routines.rs @@ -427,7 +427,7 @@ fn frexp_and_ilogb_answer_as_metals_routines() { return; }; for stem in PROFILES { - let p = profile(stem, DevicePolicy::default()).expect("profile"); + let p = profile(stem, DevicePolicy::RESIDENT_TABLES).expect("profile"); for k in &KERNELS { let what = format!("{} on {stem}", k.name); let a = compile(&bc, k.name, &p).unwrap_or_else(|e| panic!("{what}: {e:?}")); diff --git a/crates/metal2vulkan/src/tests/engine_metered_walks.rs b/crates/metal2vulkan/src/tests/engine_metered_walks.rs index 5793d29be..95572fd32 100644 --- a/crates/metal2vulkan/src/tests/engine_metered_walks.rs +++ b/crates/metal2vulkan/src/tests/engine_metered_walks.rs @@ -21,7 +21,7 @@ use crate::pipeline::testing::{link_and_validate, llvm_assemble, profile, Assemb const DATALAYOUT: &str = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v16:16:16-v24:32:32-v32:32:32-v48:64:64-v64:64:64-v96:128:128-v128:128:128-v192:256:256-v256:256:256-v512:512:512-v1024:1024:1024-n8:16:32"; fn p(stem: &str) -> DeviceProfile { - profile(stem, DevicePolicy::default()).expect("profile") + profile(stem, DevicePolicy::RESIDENT_TABLES).expect("profile") } fn assemble(name: &str, body: &str) -> Option> { @@ -235,7 +235,7 @@ fn reads_body(accesses: u32) -> String { fn slots_past_the_storage_limit_move_in_one_pass() { let prof = crate::pipeline::testing::profile_with_storage_buffers( "lavapipe", - DevicePolicy::default(), + DevicePolicy::RESIDENT_TABLES, 30, ) .expect("profile"); diff --git a/crates/metal2vulkan/src/tests/engine_metering.rs b/crates/metal2vulkan/src/tests/engine_metering.rs index 8f8a8ee50..b13493a6b 100644 --- a/crates/metal2vulkan/src/tests/engine_metering.rs +++ b/crates/metal2vulkan/src/tests/engine_metering.rs @@ -38,8 +38,12 @@ fn ll_files(dir: &Path) -> Vec { #[test] fn a_second_compile_of_every_public_fixture_is_charged_the_same() { - let profiles = ["runtime-floor", "moltenvk-m3"] - .map(|stem| (stem, profile(stem, DevicePolicy::default()).expect(stem))); + let profiles = ["runtime-floor", "moltenvk-m3"].map(|stem| { + ( + stem, + profile(stem, DevicePolicy::RESIDENT_TABLES).expect(stem), + ) + }); let (mut compared, mut skipped) = (0usize, 0usize); for path in ll_files(&fixtures_dir()) .into_iter() diff --git a/crates/metal2vulkan/src/tests/engine_moved_writers.rs b/crates/metal2vulkan/src/tests/engine_moved_writers.rs index a153a0ca0..282404b24 100644 --- a/crates/metal2vulkan/src/tests/engine_moved_writers.rs +++ b/crates/metal2vulkan/src/tests/engine_moved_writers.rs @@ -135,7 +135,7 @@ fn device(stem: &str) -> Device { .join(format!("../metal2vulkan-validation/profiles/{stem}.json")); let text = std::fs::read_to_string(path).expect("profile"); let desc = DeviceDescription::from_khronos_json(&text, None).expect("description"); - Device::from_queries(desc, DevicePolicy::default()).expect("device") + Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES).expect("device") } /// Whether a writer of `class` needs the early-tests variant (`read_only_tests`) under `tests`; diff --git a/crates/metal2vulkan/src/tests/engine_multisample.rs b/crates/metal2vulkan/src/tests/engine_multisample.rs index 0d0c229de..d0a19e05a 100644 --- a/crates/metal2vulkan/src/tests/engine_multisample.rs +++ b/crates/metal2vulkan/src/tests/engine_multisample.rs @@ -257,8 +257,8 @@ fn multisampled_fragments_read_the_pixel_center_or_are_refused() { let mut unformed = 0usize; let mut writers = 0usize; for stem in stems() { - let dev = - Device::from_queries(description(&stem), DevicePolicy::default()).expect("device"); + let dev = Device::from_queries(description(&stem), DevicePolicy::RESIDENT_TABLES) + .expect("device"); let fields = dev.profile().fields(); let rate = fields.fragment.sample_rate_shading; let stores = fields.leaf.fragment_stores_and_atomics; @@ -403,8 +403,8 @@ fn a_pixel_rate_center_varying_reads_the_pixel_center_where_the_device_has_the_f let mut with_form = 0usize; let mut without_form = Vec::new(); for stem in stems() { - let dev = - Device::from_queries(description(&stem), DevicePolicy::default()).expect("device"); + let dev = Device::from_queries(description(&stem), DevicePolicy::RESIDENT_TABLES) + .expect("device"); for samples in [1, 4] { let what = format!("{stem} at {samples}"); let p = match dev @@ -461,7 +461,8 @@ fn a_pixel_rate_read_at_an_unstated_position_is_noted() { return; }; for stem in ["moltenvk-m3", "amd-780m-radv"] { - let dev = Device::from_queries(description(stem), DevicePolicy::default()).expect("device"); + let dev = + Device::from_queries(description(stem), DevicePolicy::RESIDENT_TABLES).expect("device"); for samples in [1, 4] { let p = dev .compile_render_pipeline(&stage_io_render(&stage_io, samples), &Budget::standard()) @@ -498,8 +499,8 @@ fn programmable_blending_beside_position_w_compiles_noted() { }; let mut compiled = Vec::new(); for stem in stems() { - let dev = - Device::from_queries(description(&stem), DevicePolicy::default()).expect("device"); + let dev = Device::from_queries(description(&stem), DevicePolicy::RESIDENT_TABLES) + .expect("device"); let what = format!("{stem} {FETCH_DEPTH}"); let d = render_after(&lib, FETCH_VERTEX, FETCH_DEPTH, 4); match dev.compile_render_pipeline(&d, &Budget::standard()) { @@ -537,7 +538,8 @@ fn the_interface_states_the_pixel_reads() { let mut multisampled = LoweringInputs::new(); multisampled.multisampled = true; for stem in ["lavapipe", "moltenvk-m3"] { - let dev = Device::from_queries(description(stem), DevicePolicy::default()).expect("device"); + let dev = + Device::from_queries(description(stem), DevicePolicy::RESIDENT_TABLES).expect("device"); // (function, reads z or w, reads a center varying) for (fragment, depth, center) in [ (CENTER, false, true), @@ -581,7 +583,7 @@ fn a_center_varying_at_sample_rate_needs_the_interpolation_functions() { if withheld { assert!(desc.features.remove(&feature)); } - let dev = Device::from_queries(desc, DevicePolicy::default()).expect("device"); + let dev = Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES).expect("device"); for fragment in [CENTER, SAMPLED, COUNTER] { let what = format!("{fragment} withheld={withheld}"); let four = dev.compile_render_pipeline(&render(&lib, fragment, 4), &Budget::standard()); @@ -671,7 +673,8 @@ fn get_num_samples_reads_the_pipeline_sample_count() { let lib = Library::from_air(&bc).expect("library"); let mut checked = 0; for stem in ["moltenvk-m3", "lavapipe"] { - let dev = Device::from_queries(description(stem), DevicePolicy::default()).expect("device"); + let dev = + Device::from_queries(description(stem), DevicePolicy::RESIDENT_TABLES).expect("device"); let a = compile(&bc, "spc_num_samples", dev.profile()).expect("spc_num_samples"); assert!(a.facts.contains(&RuntimeFact::SampleCount), "{stem}"); for samples in [1, 4] { @@ -714,7 +717,8 @@ fn get_num_samples_reads_the_pipeline_sample_count() { std::fs::write(&ll, other).expect("write"); let bc = llvm_assemble(&ll); let bc = bc.expect("assembled"); - let p = Device::from_queries(description("lavapipe"), DevicePolicy::default()).expect("device"); + let p = Device::from_queries(description("lavapipe"), DevicePolicy::RESIDENT_TABLES) + .expect("device"); match compile(&bc, "spc_num_samples", p.profile()) { Err(Error::Unsupported(u)) => { assert_eq!(u.feature, Feature::Lowering(LowerFamily::Fragment)); diff --git a/crates/metal2vulkan/src/tests/engine_must_fallback.rs b/crates/metal2vulkan/src/tests/engine_must_fallback.rs index 30cdeb305..f6704abab 100644 --- a/crates/metal2vulkan/src/tests/engine_must_fallback.rs +++ b/crates/metal2vulkan/src/tests/engine_must_fallback.rs @@ -82,7 +82,7 @@ fn device(stem: &str) -> Device { .join(format!("{stem}.json")); let text = std::fs::read_to_string(&path).unwrap_or_else(|e| panic!("{}: {e}", path.display())); let description = DeviceDescription::from_khronos_json(&text, None).expect(stem); - Device::from_queries(description, DevicePolicy::default()).expect(stem) + Device::from_queries(description, DevicePolicy::RESIDENT_TABLES).expect(stem) } /// A module that defines no function is a library of none, and asking it for one is refused as diff --git a/crates/metal2vulkan/src/tests/engine_name_independence.rs b/crates/metal2vulkan/src/tests/engine_name_independence.rs index 2795b4b45..8b4a5e7d5 100644 --- a/crates/metal2vulkan/src/tests/engine_name_independence.rs +++ b/crates/metal2vulkan/src/tests/engine_name_independence.rs @@ -216,7 +216,7 @@ fn devices() -> Vec<(&'static str, Device)> { .unwrap_or_else(|e| panic!("{}: {e}", path.display())); let description = DeviceDescription::from_khronos_json(&text, None) .unwrap_or_else(|e| panic!("{stem}: {e}")); - let device = Device::from_queries(description, DevicePolicy::default()) + let device = Device::from_queries(description, DevicePolicy::RESIDENT_TABLES) .unwrap_or_else(|e| panic!("{stem}: {e}")); (stem, device) }) diff --git a/crates/metal2vulkan/src/tests/engine_narrow_wrap.rs b/crates/metal2vulkan/src/tests/engine_narrow_wrap.rs index acfe03e7f..112f8d88b 100644 --- a/crates/metal2vulkan/src/tests/engine_narrow_wrap.rs +++ b/crates/metal2vulkan/src/tests/engine_narrow_wrap.rs @@ -226,7 +226,7 @@ fn bitcode() -> Option> { /// `Device::from_queries`' profile of committed description `stem`. fn queried(stem: &str) -> DeviceProfile { let desc = description(stem).expect("description"); - let device = Device::from_queries(desc, DevicePolicy::default()).expect("device"); + let device = Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES).expect("device"); device.profile().clone() } diff --git a/crates/metal2vulkan/src/tests/engine_native_half.rs b/crates/metal2vulkan/src/tests/engine_native_half.rs index 3fa591c8e..76756aff5 100644 --- a/crates/metal2vulkan/src/tests/engine_native_half.rs +++ b/crates/metal2vulkan/src/tests/engine_native_half.rs @@ -217,7 +217,7 @@ fn native_half_rounding_records_its_kind() { ("amd-780m-radv", [None, Some(natives[0])]), ]; for (stem, notes) in cases { - let p = profile(stem, DevicePolicy::default()).expect("profile"); + let p = profile(stem, DevicePolicy::RESIDENT_TABLES).expect("profile"); for ((name, _), note) in KERNELS.iter().zip(notes) { let what = format!("{name} on {stem}"); let a = compile(&bc, name, &p).unwrap_or_else(|e| panic!("{what}: {e:?}")); @@ -230,7 +230,7 @@ fn native_half_rounding_records_its_kind() { // even, the largest half below 65520 and infinity from it; a half denormal the conversion's, // and the quantize's zero (the device's, `NativeHalfQuantize`). for (stem, keeps) in [("lavapipe", true), ("runtime-floor", false)] { - let p = profile(stem, DevicePolicy::default()).expect("profile"); + let p = profile(stem, DevicePolicy::RESIDENT_TABLES).expect("profile"); let run = |name: &str, x: [f32; 2]| interpret(&bc, name, &p, x); let tie = 1.0 + 2f32.powi(-11); assert_eq!(run("half_narrow", [tie, 0.0]), 1.0, "{stem}: a tie to even"); @@ -415,7 +415,7 @@ fn a_half_decode_is_the_devices_widening_inside_loops_and_out() { ("runtime-floor", true, true), ]; for (stem, native, unpacks) in cases { - let p = profile(stem, DevicePolicy::default()).expect("profile"); + let p = profile(stem, DevicePolicy::RESIDENT_TABLES).expect("profile"); for (entry, both) in [("both", true), ("inside", false)] { let what = format!("{entry} on {stem}"); let (a, plan, kept) = @@ -536,7 +536,7 @@ fn a_native_conversion_converts_the_value_itself() { return; }; for stem in ["lavapipe", "moltenvk-m3"] { - let p = profile(stem, DevicePolicy::default()).expect("profile"); + let p = profile(stem, DevicePolicy::RESIDENT_TABLES).expect("profile"); for (name, _) in &KERNELS { let what = format!("{name} on {stem}"); let (a, _, kept) = @@ -877,7 +877,7 @@ fn nvidia_computes_half_on_16_bit_floats_under_the_float_controls() { return; }; let of = |desc: DeviceDescription| { - Device::from_queries(desc, DevicePolicy::default()) + Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES) .expect("device") .profile() .clone() @@ -886,7 +886,7 @@ fn nvidia_computes_half_on_16_bit_floats_under_the_float_controls() { let nvidia = [ ( "nvidia-rtx50-linux", - profile("nvidia-rtx50-linux", DevicePolicy::default()).expect("profile"), + profile("nvidia-rtx50-linux", DevicePolicy::RESIDENT_TABLES).expect("profile"), ), ("nvidia-rtx5080-laptop", of(laptop.clone())), ]; @@ -946,7 +946,7 @@ fn nvidia_computes_half_on_16_bit_floats_under_the_float_controls() { // The negative control. let mut uncontrolled = laptop; uncontrolled.float_controls.f16.rounding_rte = false; - let pascal = profile("nvidia-pascal-linux", DevicePolicy::default()).expect("profile"); + let pascal = profile("nvidia-pascal-linux", DevicePolicy::RESIDENT_TABLES).expect("profile"); for (stem, p) in [ ( "RTX 5080 Laptop GPU without RTE for 16 bits", diff --git a/crates/metal2vulkan/src/tests/engine_native_maths.rs b/crates/metal2vulkan/src/tests/engine_native_maths.rs index b7cbd4c85..348210fe6 100644 --- a/crates/metal2vulkan/src/tests/engine_native_maths.rs +++ b/crates/metal2vulkan/src/tests/engine_native_maths.rs @@ -216,7 +216,7 @@ fn each_kernel_records_its_kind() { let Some(bc) = bitcode() else { return; }; - let p = profile("lavapipe", DevicePolicy::default()).expect("profile"); + let p = profile("lavapipe", DevicePolicy::RESIDENT_TABLES).expect("profile"); for k in &KERNELS { let a = compile(&bc, k.name, &p).unwrap_or_else(|e| panic!("{}: {e:?}", k.name)); link_and_validate(&a, &p).unwrap_or_else(|e| panic!("{}: L3: {e}", k.name)); @@ -238,7 +238,7 @@ fn the_maths_functions_are_within_their_bounds() { let Some(bc) = bitcode() else { return; }; - let p = profile("lavapipe", DevicePolicy::default()).expect("lavapipe"); + let p = profile("lavapipe", DevicePolicy::RESIDENT_TABLES).expect("lavapipe"); for (a, b) in [(1.0f32, 3.0f32), (-3.0, 0.7), (0.75, -4.1), (1e-30, 3e7)] { for div in ["native_fdiv", "native_fdiv_arcp"] { let q = interpret(&bc, div, &p, [a, b, 0.0]); @@ -266,7 +266,7 @@ fn the_nan_and_min_max_are_the_device_s() { let Some(bc) = bitcode() else { return; }; - let p = profile("lavapipe", DevicePolicy::default()).expect("lavapipe"); + let p = profile("lavapipe", DevicePolicy::RESIDENT_TABLES).expect("lavapipe"); let nan = f32::from_bits(0x7fc0_1234); for name in ["native_fadd", "native_fdiv", "native_fdiv_arcp"] { assert!(interpret(&bc, name, &p, [nan, 1.0, 0.0]).is_nan(), "{name}"); @@ -317,8 +317,8 @@ fn dot_mix_and_fast_sqrt_are_the_device_s_on_every_profile() { let Some(bc) = bitcode() else { return; }; - let on = profile("lavapipe", DevicePolicy::default()).expect("lavapipe"); - let metal = profile("moltenvk-m3", DevicePolicy::default()).expect("moltenvk-m3"); + let on = profile("lavapipe", DevicePolicy::RESIDENT_TABLES).expect("lavapipe"); + let metal = profile("moltenvk-m3", DevicePolicy::RESIDENT_TABLES).expect("moltenvk-m3"); let (fma, fmix, sqrt) = ( crate::spv::GlslStd450Op::Fma as u32, crate::spv::GlslStd450Op::FMix as u32, diff --git a/crates/metal2vulkan/src/tests/engine_nonwritable.rs b/crates/metal2vulkan/src/tests/engine_nonwritable.rs index 29c18297e..7e9329cd3 100644 --- a/crates/metal2vulkan/src/tests/engine_nonwritable.rs +++ b/crates/metal2vulkan/src/tests/engine_nonwritable.rs @@ -519,7 +519,7 @@ fn description(stem: &str) -> DeviceDescription { } fn device(stem: &str) -> Device { - Device::from_queries(description(stem), DevicePolicy::default()) + Device::from_queries(description(stem), DevicePolicy::RESIDENT_TABLES) .unwrap_or_else(|e| panic!("{stem}: {e}")) } @@ -532,7 +532,7 @@ fn floor_with_16_bit() -> Device { let mut desc = description(BARE); desc.features .extend([VkFeature::ShaderInt16, VkFeature::StorageBuffer16BitAccess]); - Device::from_queries(desc, DevicePolicy::default()) + Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES) .unwrap_or_else(|e| panic!("{FLOOR_WITH_16_BIT}: {e}")) } diff --git a/crates/metal2vulkan/src/tests/engine_nuw.rs b/crates/metal2vulkan/src/tests/engine_nuw.rs index 2b945925f..4d8bb4d3e 100644 --- a/crates/metal2vulkan/src/tests/engine_nuw.rs +++ b/crates/metal2vulkan/src/tests/engine_nuw.rs @@ -264,7 +264,7 @@ fn a_nuw_loop_counter_is_not_masked() { return; }; for stem in PROFILES { - let p = profile(stem, DevicePolicy::default()).expect("profile"); + let p = profile(stem, DevicePolicy::RESIDENT_TABLES).expect("profile"); for (entry, width, masked) in [ ("nuw_i16_loops", 16, false), ("plain_i16_loops", 16, true), @@ -291,7 +291,7 @@ fn a_poison_nuw_result_reaches_no_neighbour() { return; }; for stem in PROFILES { - let p = profile(stem, DevicePolicy::default()).expect("profile"); + let p = profile(stem, DevicePolicy::RESIDENT_TABLES).expect("profile"); for entry in [ "frozen_wrap", "frozen_wrap_chunked", diff --git a/crates/metal2vulkan/src/tests/engine_offset_arms.rs b/crates/metal2vulkan/src/tests/engine_offset_arms.rs index e677c5e5c..bf40edf20 100644 --- a/crates/metal2vulkan/src/tests/engine_offset_arms.rs +++ b/crates/metal2vulkan/src/tests/engine_offset_arms.rs @@ -83,7 +83,7 @@ fn without_offset_operand(stem: &str) -> DeviceProfile { let mut desc = description(stem).expect("description"); desc.features.remove(&VkFeature::Maintenance8); desc.features.remove(&VkFeature::ShaderImageGatherExtended); - Device::from_queries(desc, DevicePolicy::default()) + Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES) .expect("device") .profile() .clone() @@ -170,7 +170,7 @@ fn the_fixture_takes_arms_without_the_offset_operand() { ); } // With the features, the `Offset` operand as before. - let p = profile("amd-780m-radv", DevicePolicy::default()).expect("profile"); + let p = profile("amd-780m-radv", DevicePolicy::RESIDENT_TABLES).expect("profile"); let a = compile(&bc, "a2_dynamic_texel_offset", &p).expect("compile"); let (_, words) = link_and_validate(&a, &p).expect("L3"); assert!(has_offset_operand(&words)); @@ -286,7 +286,8 @@ fn a_constant_lane_is_not_switched_on() { let Some(bc) = assemble("constant", &samples_kernel(1, OffsetShape::Constant)) else { return; }; - let with_operand_features = profile("amd-780m-radv", DevicePolicy::default()).expect("radv"); + let with_operand_features = + profile("amd-780m-radv", DevicePolicy::RESIDENT_TABLES).expect("radv"); let profiles = armed_profiles() .into_iter() .chain([("amd-780m-radv", with_operand_features)]); @@ -369,7 +370,8 @@ declare {{ <4 x float>, i8 }} @air.sample_texture_2d.v4f32(ptr addrspace(1), ptr /// is missing. #[test] fn a_filter_nest_of_decided_counters_has_constant_offsets() { - let with_operand_features = profile("amd-780m-radv", DevicePolicy::default()).expect("radv"); + let with_operand_features = + profile("amd-780m-radv", DevicePolicy::RESIDENT_TABLES).expect("radv"); let profiles = || { armed_profiles() .into_iter() @@ -508,7 +510,7 @@ fn a_fragment_takes_its_derivatives_before_the_arms() { ("runtime_sampler", "0.000000e+00", true), ("runtime_dynamic_bias", "%bias", true), ]; - let full = profile("amd-780m-radv", DevicePolicy::default()).expect("profile"); + let full = profile("amd-780m-radv", DevicePolicy::RESIDENT_TABLES).expect("profile"); for (shape, bias, runtime) in shapes { let Some(bc) = assemble(shape, &offset_fragment(bias, runtime)) else { return; diff --git a/crates/metal2vulkan/src/tests/engine_padded_blends.rs b/crates/metal2vulkan/src/tests/engine_padded_blends.rs index 63a21f1e8..d1492fb41 100644 --- a/crates/metal2vulkan/src/tests/engine_padded_blends.rs +++ b/crates/metal2vulkan/src/tests/engine_padded_blends.rs @@ -158,7 +158,7 @@ fn device(stem: &str) -> Device { .join(format!("{stem}.json")); let text = std::fs::read_to_string(path).expect("profile"); let desc = DeviceDescription::from_khronos_json(&text, None).expect("description"); - Device::from_queries(desc, DevicePolicy::default()).expect("device") + Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES).expect("device") } /// Whether `e` is a refusal the device's lack of a capability makes, whatever the blend (a diff --git a/crates/metal2vulkan/src/tests/engine_places.rs b/crates/metal2vulkan/src/tests/engine_places.rs index 54adc6742..d6bc1130a 100644 --- a/crates/metal2vulkan/src/tests/engine_places.rs +++ b/crates/metal2vulkan/src/tests/engine_places.rs @@ -149,7 +149,7 @@ fn the_atomic_fixture_compiles_as_moltenvk_msl() { let Some(bc) = fixture() else { return; }; - let p = profile("moltenvk-m3", DevicePolicy::default()).expect("profile"); + let p = profile("moltenvk-m3", DevicePolicy::RESIDENT_TABLES).expect("profile"); let words = final_words( &bc, "kernel_atomic_xor_and_subtract", @@ -190,7 +190,7 @@ fn a_psb_leaf_compiles_as_moltenvk_msl() { let Some(bc) = assemble("psb_leaf", &format!("{HEADER}{PSB_LEAF}")) else { return; }; - let p = profile("moltenvk-m3", DevicePolicy::default()).expect("profile"); + let p = profile("moltenvk-m3", DevicePolicy::RESIDENT_TABLES).expect("profile"); let mut inputs = LowerInputs::new(); inputs.psb_slots.insert(SlotRef { stage: Stage::Kernel, @@ -230,7 +230,7 @@ fn a_dynamic_root_compiles_as_moltenvk_msl() { let Some(bc) = assemble("dynamic_store", &format!("{HEADER}{DYNAMIC_STORE}")) else { return; }; - let p = profile("moltenvk-m3", DevicePolicy::default()).expect("profile"); + let p = profile("moltenvk-m3", DevicePolicy::RESIDENT_TABLES).expect("profile"); let words = final_words(&bc, "dynamic_store", &p, &LowerInputs::new()); // The miss count and bit, and the halfword store's clear and set (of one or two words). compiles_as_moltenvk_msl(&words, "dynamic_store", 4); diff --git a/crates/metal2vulkan/src/tests/engine_pointer_cells.rs b/crates/metal2vulkan/src/tests/engine_pointer_cells.rs index 9006bbbee..4e4b7b9b3 100644 --- a/crates/metal2vulkan/src/tests/engine_pointer_cells.rs +++ b/crates/metal2vulkan/src/tests/engine_pointer_cells.rs @@ -46,7 +46,7 @@ const PROFILES: [&str; 3] = ["moltenvk-m3", "lavapipe", "runtime-floor"]; const THREADS: u32 = 32; fn p(stem: &str) -> DeviceProfile { - profile(stem, DevicePolicy::default()).expect("profile") + profile(stem, DevicePolicy::RESIDENT_TABLES).expect("profile") } fn assemble(name: &str, text: &str) -> Option> { diff --git a/crates/metal2vulkan/src/tests/engine_pointer_memory.rs b/crates/metal2vulkan/src/tests/engine_pointer_memory.rs index e87457463..73e252ca8 100644 --- a/crates/metal2vulkan/src/tests/engine_pointer_memory.rs +++ b/crates/metal2vulkan/src/tests/engine_pointer_memory.rs @@ -84,7 +84,7 @@ fn profile_without(stem: &str, robust: bool, features: &[VkFeature]) -> DevicePr desc.features.remove(&VkFeature::RobustBufferAccess); desc.features.remove(&VkFeature::RobustBufferAccess2); } - Device::from_queries(desc, DevicePolicy::default()) + Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES) .expect("device") .profile() .clone() @@ -862,7 +862,7 @@ fn narrow_stores_through_a_loaded_pointer_are_native_where_the_profile_has_the_a for f in removed { desc.features.remove(f); } - let p = Device::from_queries(desc, DevicePolicy::default()) + let p = Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES) .expect("device") .profile() .clone(); diff --git a/crates/metal2vulkan/src/tests/engine_pointer_values.rs b/crates/metal2vulkan/src/tests/engine_pointer_values.rs index 9159dfc28..7c6edc3c3 100644 --- a/crates/metal2vulkan/src/tests/engine_pointer_values.rs +++ b/crates/metal2vulkan/src/tests/engine_pointer_values.rs @@ -56,7 +56,7 @@ const fn slot_guest(i: u64) -> u64 { /// Committed profile `stem`, or [`PROFILE_F`]'s (`runtime-floor` without `bufferDeviceAddress`). fn profile(stem: &str) -> DeviceProfile { if stem == PROFILE_F { - return device_f(DevicePolicy::default()) + return device_f(DevicePolicy::RESIDENT_TABLES) .expect(PROFILE_F) .profile() .clone(); @@ -66,7 +66,7 @@ fn profile(stem: &str) -> DeviceProfile { .join(format!("{stem}.json")); let text = std::fs::read_to_string(path).expect("profile"); let desc = DeviceDescription::from_khronos_json(&text, None).expect("description"); - Device::from_queries(desc, DevicePolicy::default()) + Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES) .expect("device") .profile() .clone() @@ -85,7 +85,7 @@ fn profiles() -> Vec<(String, DeviceProfile)> { let mut desc = DeviceDescription::from_khronos_json(&text, None).expect("description"); desc.features.remove(&VkFeature::RobustBufferAccess); desc.features.remove(&VkFeature::RobustBufferAccess2); - let p = Device::from_queries(desc, DevicePolicy::default()) + let p = Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES) .expect("device") .profile() .clone(); diff --git a/crates/metal2vulkan/src/tests/engine_pooled_cells.rs b/crates/metal2vulkan/src/tests/engine_pooled_cells.rs index a2e8989d6..4853993fc 100644 --- a/crates/metal2vulkan/src/tests/engine_pooled_cells.rs +++ b/crates/metal2vulkan/src/tests/engine_pooled_cells.rs @@ -182,7 +182,7 @@ fn a_pointer_copied_into_a_pool_as_data_answers_as_metal_or_is_refused() { fn a_context_s_argument_buffer_beside_a_pool_compiles() { let Some(bc) = fixture() else { return }; for stem in ["lavapipe", "amd-rdna3-radv", "moltenvk-m3"] { - let p = profile(stem, DevicePolicy::default()).expect("profile"); + let p = profile(stem, DevicePolicy::RESIDENT_TABLES).expect("profile"); let a = compile(&bc, "pooled_context", &p).unwrap_or_else(|e| panic!("{stem}: {e}")); link_and_validate(&a, &p).unwrap_or_else(|e| panic!("{stem}: L3: {e}")); } diff --git a/crates/metal2vulkan/src/tests/engine_primitive_ids.rs b/crates/metal2vulkan/src/tests/engine_primitive_ids.rs index 97cf0a2e1..365e70762 100644 --- a/crates/metal2vulkan/src/tests/engine_primitive_ids.rs +++ b/crates/metal2vulkan/src/tests/engine_primitive_ids.rs @@ -58,12 +58,15 @@ fn withholding(colors: u32, more: &[VkFeature]) -> Device { } desc.limits.max_color_attachments = colors; desc.limits.max_fragment_output_attachments = colors; - Device::from_queries(desc, DevicePolicy::default()).expect("device") + Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES).expect("device") } fn device(stem: &str) -> Device { - Device::from_queries(description(stem).expect("profile"), DevicePolicy::default()) - .expect("device") + Device::from_queries( + description(stem).expect("profile"), + DevicePolicy::RESIDENT_TABLES, + ) + .expect("device") } fn function(bc: &[u8], name: &str) -> FunctionDescriptor { @@ -152,7 +155,7 @@ fn without_either_feature_the_id_is_a_flat_varying() { ] { floor.features.remove(&f); } - let floor = Device::from_queries(floor, DevicePolicy::default()).expect("device"); + let floor = Device::from_queries(floor, DevicePolicy::RESIDENT_TABLES).expect("device"); for dev in [withheld(8), floor] { let f = standalone(&dev, &bc, "pi_ids"); let io = &f.artifact().interface.io; diff --git a/crates/metal2vulkan/src/tests/engine_private_memory.rs b/crates/metal2vulkan/src/tests/engine_private_memory.rs index 5ce4ddb3f..f977a0b41 100644 --- a/crates/metal2vulkan/src/tests/engine_private_memory.rs +++ b/crates/metal2vulkan/src/tests/engine_private_memory.rs @@ -181,7 +181,7 @@ fn needs(required: u64, available: u64) -> Result<(), Error> { /// Function `entry` of [`module`]`(n)` on `stem`: its precision notes, or what refused it. fn notes(stem: &str, n: u32, entry: &str) -> Option, Error>> { notes_on( - &profile(stem, Default::default()).expect("profile"), + &profile(stem, crate::device::DevicePolicy::RESIDENT_TABLES).expect("profile"), stem, n, entry, @@ -253,14 +253,14 @@ fn render_stages_past_the_floor_of_a_device_not_measured_run_noted_up_to_metal_s /// `words` kernel of 7176 words (28,704 bytes), 9216 (36 KiB) and 51,200 (200 KiB) compiles on the /// 780M's, the Iris Xe's and an RTX 50's profiles with no note, pushes /// `PushField::PrivateArenaAddress`, states `RuntimeFact::PrivateArena` of its arena's bytes, a -/// multiple of 16, holds no private bytes, and passes L3. Under the default domains, whose binder supplies no such memory, it is -/// refused as before, needing its bytes of the floor. +/// multiple of 16, holds no private bytes, and passes L3. Under the resident-table domains, whose +/// binder supplies no such memory, it is refused as before, needing its bytes of the floor. #[test] fn a_kernel_past_the_floor_keeps_its_private_memory_in_the_runtimes_memory_under_identity() { let identity = DevicePolicy { pointer_domain: PointerDomain::Identity, handle_domain: HandleDomain::Identity, - ..DevicePolicy::default() + ..DevicePolicy::RESIDENT_TABLES }; for stem in ["amd-780m-radv", "intel-irisxe-anv", "nvidia-rtx50-linux"] { let p = profile(stem, identity).expect("profile"); @@ -392,7 +392,7 @@ fn an_array_its_bounded_indices_reach_in_part_keeps_only_that_part() { }; let unbounded = reached("add i32 %gid, 0").expect("assembled"); for stem in ["nvidia-rtx5080-laptop", "amd-rdna3-radv"] { - let p = profile(stem, Default::default()).expect("profile"); + let p = profile(stem, crate::device::DevicePolicy::RESIDENT_TABLES).expect("profile"); let a = compile(&bounded, "reached", &p).unwrap_or_else(|e| panic!("{stem}: {e}")); link_and_validate(&a, &p).unwrap_or_else(|e| panic!("{stem}: L3: {e}")); assert_eq!(a.interface.private_bytes, 2 * 4 * 4 * 4, "{stem}"); @@ -435,7 +435,11 @@ fn a_tile_kernel_holds_only_the_corner_its_tile_sizes_reach() { .with_index(1, uint(4)); let none = FunctionConstantValues::defaults(); let linked = [LinkedSource::new("postfix", &functions, &none)]; - let p = profile("amd-rdna3-radv", Default::default()).expect("profile"); + let p = profile( + "amd-rdna3-radv", + crate::device::DevicePolicy::RESIDENT_TABLES, + ) + .expect("profile"); let kernel = |name| { compile_bitcode_linked( &tiles, diff --git a/crates/metal2vulkan/src/tests/engine_private_render_state.rs b/crates/metal2vulkan/src/tests/engine_private_render_state.rs index 535bb9ea4..0fb192a12 100644 --- a/crates/metal2vulkan/src/tests/engine_private_render_state.rs +++ b/crates/metal2vulkan/src/tests/engine_private_render_state.rs @@ -58,7 +58,7 @@ fn fixture(stem: &str) -> Option { } fn device(stem: &str) -> Device { - device_with(stem, DevicePolicy::default()) + device_with(stem, DevicePolicy::RESIDENT_TABLES) } fn device_with(stem: &str, policy: DevicePolicy) -> Device { @@ -872,7 +872,7 @@ fn device_without(stem: &str, features: &[&str]) -> Device { text = text.replace(&on, &format!("\"{f}\": false")); } let description = DeviceDescription::from_khronos_json(&text, None).expect("description"); - Device::from_queries(description, DevicePolicy::default()).expect("device") + Device::from_queries(description, DevicePolicy::RESIDENT_TABLES).expect("device") } /// Assert that pipeline `p` draws its logic operation in its fragment function: no Vulkan diff --git a/crates/metal2vulkan/src/tests/engine_profile_f.rs b/crates/metal2vulkan/src/tests/engine_profile_f.rs index 3328f5154..33d8e9292 100644 --- a/crates/metal2vulkan/src/tests/engine_profile_f.rs +++ b/crates/metal2vulkan/src/tests/engine_profile_f.rs @@ -368,7 +368,7 @@ fn kernel(name: &str, n: u32, body: &str) -> String { fn no_int64_with(storage: u32) -> DeviceProfile { let mut desc = no_int64(); desc.limits.max_per_stage_descriptor_storage_buffers = storage; - Device::from_queries(desc, DevicePolicy::default()) + Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES) .expect("device") .profile() .clone() @@ -411,7 +411,7 @@ fn a_profile_f_device_with_device_addresses_still_uses_descriptors_only() { let Some(bc) = assemble_text(name, &kernel(name, 1, body)) else { return; }; - let p = Device::from_queries(no_int64(), DevicePolicy::default()) + let p = Device::from_queries(no_int64(), DevicePolicy::RESIDENT_TABLES) .expect("profile") .profile() .clone(); diff --git a/crates/metal2vulkan/src/tests/engine_pull_model.rs b/crates/metal2vulkan/src/tests/engine_pull_model.rs index 3e6f077ca..e618bd6ef 100644 --- a/crates/metal2vulkan/src/tests/engine_pull_model.rs +++ b/crates/metal2vulkan/src/tests/engine_pull_model.rs @@ -183,7 +183,7 @@ fn interpolants_read_where_their_functions_say_or_are_refused() { without.features.remove(&VkFeature::SampleRateShading); descriptions.push((NO_SAMPLE_RATE.into(), without)); for (stem, desc) in descriptions { - let dev = Device::from_queries(desc, DevicePolicy::default()).expect("device"); + let dev = Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES).expect("device"); let functions = interpolation_functions(&dev); let fields = dev.profile().fields(); let origin = VkProperty::InterpolateAtOffsetCentered; @@ -292,8 +292,8 @@ fn an_interpolant_chosen_at_run_time_is_not_lowered() { }; let mut checked = 0; for stem in stems() { - let dev = - Device::from_queries(description(&stem), DevicePolicy::default()).expect("device"); + let dev = Device::from_queries(description(&stem), DevicePolicy::RESIDENT_TABLES) + .expect("device"); for samples in [1, 4] { let what = format!("{stem} pm_selected at {samples}"); let d = render(&lib, "pm_selected", (PixelFormat::RGBA32Float, 1), samples); @@ -327,8 +327,8 @@ fn an_offset_read_where_the_quad_may_have_left_is_not_lowered() { }; let mut checked = 0; for stem in stems() { - let dev = - Device::from_queries(description(&stem), DevicePolicy::default()).expect("device"); + let dev = Device::from_queries(description(&stem), DevicePolicy::RESIDENT_TABLES) + .expect("device"); for samples in [1, 4] { let what = format!("{stem} pm_offset_after_discard at {samples}"); let d = render( diff --git a/crates/metal2vulkan/src/tests/engine_quad_ops.rs b/crates/metal2vulkan/src/tests/engine_quad_ops.rs index 64145fddc..0580917cc 100644 --- a/crates/metal2vulkan/src/tests/engine_quad_ops.rs +++ b/crates/metal2vulkan/src/tests/engine_quad_ops.rs @@ -426,7 +426,7 @@ fn reductions_in_metal_s_order(bc: &[u8], p: &DeviceProfile, tier: Tier, widths: #[test] fn quad_operations_run_direct_at_32_lanes() { - let p = profile("moltenvk-m3", DevicePolicy::default()).expect("profile"); + let p = profile("moltenvk-m3", DevicePolicy::RESIDENT_TABLES).expect("profile"); run_kernels(&p, Tier::Direct, &[SubgroupSize::W32]); } @@ -443,7 +443,7 @@ fn quad_operations_run_cluster32_at_64_lanes() { /// `lavapipe` cannot pin 32 lanes: the quads are emulated through workgroup memory. #[test] fn quad_operations_run_emulated_at_every_width() { - let p = profile("lavapipe", DevicePolicy::default()).expect("profile"); + let p = profile("lavapipe", DevicePolicy::RESIDENT_TABLES).expect("profile"); run_kernels( &p, Tier::Emulated, diff --git a/crates/metal2vulkan/src/tests/engine_qualified_signature.rs b/crates/metal2vulkan/src/tests/engine_qualified_signature.rs index c1fa93903..5d52f0699 100644 --- a/crates/metal2vulkan/src/tests/engine_qualified_signature.rs +++ b/crates/metal2vulkan/src/tests/engine_qualified_signature.rs @@ -94,7 +94,7 @@ fn declares(text: &str, list: &str) -> bool { #[test] fn a_renamed_function_compiles_as_its_signature_s_module() { - let p = profile("moltenvk-m3", DevicePolicy::default()).expect("profile"); + let p = profile("moltenvk-m3", DevicePolicy::RESIDENT_TABLES).expect("profile"); let (mut signed_fixtures, mut compared, mut compiled, mut refused_alike) = (0, 0, 0, 0); let mut plain = 0usize; for path in fixtures() { diff --git a/crates/metal2vulkan/src/tests/engine_rate_map.rs b/crates/metal2vulkan/src/tests/engine_rate_map.rs index 1430e486b..b2d1ab71d 100644 --- a/crates/metal2vulkan/src/tests/engine_rate_map.rs +++ b/crates/metal2vulkan/src/tests/engine_rate_map.rs @@ -115,7 +115,7 @@ fn profile_with(stem: &str, robust: bool) -> DeviceProfile { desc.features.remove(&VkFeature::RobustBufferAccess); desc.features.remove(&VkFeature::RobustBufferAccess2); } - Device::from_queries(desc, DevicePolicy::default()) + Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES) .expect("device") .profile() .clone() diff --git a/crates/metal2vulkan/src/tests/engine_ray_tracing.rs b/crates/metal2vulkan/src/tests/engine_ray_tracing.rs index 3093ecc66..3305a9a99 100644 --- a/crates/metal2vulkan/src/tests/engine_ray_tracing.rs +++ b/crates/metal2vulkan/src/tests/engine_ray_tracing.rs @@ -440,7 +440,7 @@ fn the_binder_writes_the_structure_and_the_table_the_consumer_binds() { .join("../metal2vulkan-validation/profiles"); let text = std::fs::read_to_string(path.join("lavapipe.json")).expect("profile"); let desc = DeviceDescription::from_khronos_json(&text, None).expect("description"); - let dev = Device::from_queries(desc, DevicePolicy::default()).expect("device"); + let dev = Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES).expect("device"); let lib = Library::from_air(&bc).expect("library"); let f = lib.function("k").expect("entry"); let d = ComputePipelineDescriptor::new(StageSource::Function(FunctionDescriptor::new(f))); @@ -1996,8 +1996,8 @@ fn an_intersected_structure_keeps_its_descriptor_beside_its_count() { }; let translated = per_profile(&bc, "k", 1); assert!(translated.iter().any(|s| s == "lavapipe"), "{translated:?}"); - let p = - crate::pipeline::testing::profile("lavapipe", DevicePolicy::default()).expect("lavapipe"); + let p = crate::pipeline::testing::profile("lavapipe", DevicePolicy::RESIDENT_TABLES) + .expect("lavapipe"); let a = compile(&bc, "k", &p).expect("lavapipe"); assert!(a .facts @@ -2077,14 +2077,15 @@ fn run_counts( .join("../metal2vulkan-validation/profiles"); let text = std::fs::read_to_string(path.join(format!("{stem}.json"))).expect("profile"); let desc = DeviceDescription::from_khronos_json(&text, None).expect("description"); - let dev = Device::from_queries(desc, DevicePolicy::default()).expect("device"); + let dev = Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES).expect("device"); let lib = Library::from_air(bc).expect("library"); let f = lib.function(entry).expect("entry"); let d = ComputePipelineDescriptor::new(StageSource::Function(FunctionDescriptor::new(f))); let pipe = dev .compile_compute_pipeline(&d, &Budget::standard()) .unwrap_or_else(|e| panic!("{what}: {e}")); - let p = crate::pipeline::testing::profile(stem, DevicePolicy::default()).expect("profile"); + let p = + crate::pipeline::testing::profile(stem, DevicePolicy::RESIDENT_TABLES).expect("profile"); let (_, m) = crate::pipeline::testing::typed_module(bc, entry, &p) .unwrap_or_else(|e| panic!("{what}: {e}")); let mut table = StageTable::default(); diff --git a/crates/metal2vulkan/src/tests/engine_read_through_constant.rs b/crates/metal2vulkan/src/tests/engine_read_through_constant.rs index 49216a7c0..e6ab86f87 100644 --- a/crates/metal2vulkan/src/tests/engine_read_through_constant.rs +++ b/crates/metal2vulkan/src/tests/engine_read_through_constant.rs @@ -90,7 +90,7 @@ fn a_read_only_device_buffer_read_through_a_constant_pointer_compiles() { }; let mut compiled = 0; for stem in ["lavapipe", "moltenvk-m3", "amd-780m-radv", "runtime-floor"] { - let p = profile(stem, DevicePolicy::default()).expect("profile"); + let p = profile(stem, DevicePolicy::RESIDENT_TABLES).expect("profile"); for (form, bc) in [("constant", &constant), ("device char", &device)] { let what = format!("{form} on {stem}"); let a = compile(bc, "k", &p).unwrap_or_else(|e| panic!("{what}: {e}")); @@ -125,7 +125,7 @@ fn the_typed_fixture_compiles_as_its_opaque_form_does() { let opaque = llvm_assemble(&dir.join("kernel_read_through_constant.ll")) .unwrap_or_else(|e| panic!("llvm-as: {e:?}")); for stem in ["lavapipe", "moltenvk-m3", "amd-780m-radv", "runtime-floor"] { - let p = profile(stem, DevicePolicy::default()).expect("profile"); + let p = profile(stem, DevicePolicy::RESIDENT_TABLES).expect("profile"); let [typed, opaque] = [&typed, &opaque].map(|bc| { compile(bc, "read_through_constant", &p).unwrap_or_else(|e| panic!("{stem}: {e}")) }); diff --git a/crates/metal2vulkan/src/tests/engine_recursion.rs b/crates/metal2vulkan/src/tests/engine_recursion.rs index dc1f25d05..c002d26f2 100644 --- a/crates/metal2vulkan/src/tests/engine_recursion.rs +++ b/crates/metal2vulkan/src/tests/engine_recursion.rs @@ -733,7 +733,7 @@ fn direct_recursion_makes_one_call_fewer_than_its_depth() { let Some(bitcode) = module() else { return; }; - let p = profile("moltenvk-m3", Default::default()).expect("profile"); + let p = profile("moltenvk-m3", crate::device::DevicePolicy::RESIDENT_TABLES).expect("profile"); for k in [1, 2, 8, 256] { let m = typed(&bitcode, DIRECT, k, &p); let ds = depths(k); @@ -749,7 +749,7 @@ fn table_recursion_reaches_the_frames_metal_reaches() { let Some(bitcode) = module() else { return; }; - let p = profile("moltenvk-m3", Default::default()).expect("profile"); + let p = profile("moltenvk-m3", crate::device::DevicePolicy::RESIDENT_TABLES).expect("profile"); for (k, frames) in TABLE_FRAMES { let (pipe, handles) = pipeline(&bitcode, TABLE, k); let tables = table_inputs(&pipe, &handles); @@ -775,7 +775,7 @@ fn a_recursive_frame_keeps_its_private_array() { let Some(bitcode) = module() else { return; }; - let p = profile("moltenvk-m3", Default::default()).expect("profile"); + let p = profile("moltenvk-m3", crate::device::DevicePolicy::RESIDENT_TABLES).expect("profile"); let (pipe, handles) = pipeline(&bitcode, BIG, 8); let tables = table_inputs(&pipe, &handles); let m = typed(&bitcode, BIG, 8, &p); @@ -841,7 +841,7 @@ fn a_stack_past_metals_is_refused() { let Some(bitcode) = module() else { return; }; - let p = profile("moltenvk-m3", Default::default()).expect("profile"); + let p = profile("moltenvk-m3", crate::device::DevicePolicy::RESIDENT_TABLES).expect("profile"); let refused = Err(Error::LimitExceeded(Limit::CallStackBytes)); let cases: [(&str, &[&str], u32); 7] = [ (DIRECT, &["drec"], 16359), @@ -881,7 +881,7 @@ fn stacks_past_the_device_s_function_storage_are_refused() { ]; let mut wrong = Vec::new(); for (stem, entry, fits, required, available) in cases { - let p = profile(stem, Default::default()).expect("profile"); + let p = profile(stem, crate::device::DevicePolicy::RESIDENT_TABLES).expect("profile"); if let Err(e) = compile(&bitcode, entry, fits, &p) { wrong.push(format!("{stem} {entry} at {fits}: {e}")); } @@ -900,7 +900,7 @@ fn depth_zero_is_depth_one() { let Some(bitcode) = module() else { return; }; - let p = profile("moltenvk-m3", Default::default()).expect("profile"); + let p = profile("moltenvk-m3", crate::device::DevicePolicy::RESIDENT_TABLES).expect("profile"); let ds = depths(3); let one = typed(&bitcode, DIRECT, 1, &p); let zero = typed(&bitcode, DIRECT, 0, &p); @@ -1087,7 +1087,7 @@ fn recursion_through_a_pointer_passed_as_a_value_makes_one_call_fewer_than_its_d let Some(bitcode) = module() else { return; }; - let p = profile("moltenvk-m3", Default::default()).expect("profile"); + let p = profile("moltenvk-m3", crate::device::DevicePolicy::RESIDENT_TABLES).expect("profile"); let none = FunctionConstantValues::defaults(); for list in [LinkedList::Functions, LinkedList::PrivateFunctions] { let mut linked = LinkedSource::new("prec", &bitcode, &none); diff --git a/crates/metal2vulkan/src/tests/engine_refused_families.rs b/crates/metal2vulkan/src/tests/engine_refused_families.rs index a5ce6fb64..fb338da0b 100644 --- a/crates/metal2vulkan/src/tests/engine_refused_families.rs +++ b/crates/metal2vulkan/src/tests/engine_refused_families.rs @@ -473,7 +473,7 @@ fn an_assumed_uniformity_result_is_true() { call i1 @air.is_uniform.i32(i32 0)\n br label %j\nj:\n %u = phi i1 [ \ %ua, %a ], [ %ub, %b ]\n br label %k\nk:\n %w = phi i1 [ %u, %j ]\n \ tail call void @llvm.assume(i1 %w)\n %s = add i32 %1, 7\n"; - let p = profile("moltenvk-m3", DevicePolicy::default()).expect("profile"); + let p = profile("moltenvk-m3", DevicePolicy::RESIDENT_TABLES).expect("profile"); for (tag, body, calls) in [("assumed", direct, 1u32), ("assumed-phi", through_phis, 2)] { let Some(bc) = assemble(tag, &uniform_kernel(body)) else { return; diff --git a/crates/metal2vulkan/src/tests/engine_region_viewports.rs b/crates/metal2vulkan/src/tests/engine_region_viewports.rs index 7ddfccc8d..cb79a4426 100644 --- a/crates/metal2vulkan/src/tests/engine_region_viewports.rs +++ b/crates/metal2vulkan/src/tests/engine_region_viewports.rs @@ -64,7 +64,7 @@ fn description(stem: &str) -> DeviceDescription { } fn profile_of(desc: DeviceDescription) -> DeviceProfile { - Device::from_queries(desc, DevicePolicy::default()) + Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES) .expect("device") .profile() .clone() @@ -238,7 +238,8 @@ fn a_region_draw_runs_its_variant() { base_instance: 0, }; for stem in ["lavapipe", "intel-irisxe-rplp-anv"] { - let dev = Device::from_queries(description(stem), DevicePolicy::default()).expect("device"); + let dev = + Device::from_queries(description(stem), DevicePolicy::RESIDENT_TABLES).expect("device"); let base = dev .compile_render_pipeline(&d, &budget) .unwrap_or_else(|e| panic!("{stem}: {e}")); diff --git a/crates/metal2vulkan/src/tests/engine_render_target_slice.rs b/crates/metal2vulkan/src/tests/engine_render_target_slice.rs index 878d82870..88d47b7d3 100644 --- a/crates/metal2vulkan/src/tests/engine_render_target_slice.rs +++ b/crates/metal2vulkan/src/tests/engine_render_target_slice.rs @@ -54,7 +54,7 @@ fn description(stem: &str) -> DeviceDescription { } fn device(stem: &str) -> Device { - Device::from_queries(description(stem), DevicePolicy::default()).expect("device") + Device::from_queries(description(stem), DevicePolicy::RESIDENT_TABLES).expect("device") } /// A render pipeline of `vertex` and `fragment` from `bc` with `maxVertexAmplificationCount` diff --git a/crates/metal2vulkan/src/tests/engine_roll.rs b/crates/metal2vulkan/src/tests/engine_roll.rs index 7782b0a3b..c8f680983 100644 --- a/crates/metal2vulkan/src/tests/engine_roll.rs +++ b/crates/metal2vulkan/src/tests/engine_roll.rs @@ -181,8 +181,8 @@ fn a_function_applied_twice_is_compiled_once_on_every_profile() { let Some(bitcode) = assembled() else { return; }; - let floor = profile("runtime-floor", DevicePolicy::default()).expect("profile"); - let mvk = profile("moltenvk-m3", DevicePolicy::default()).expect("profile"); + let floor = profile("runtime-floor", DevicePolicy::RESIDENT_TABLES).expect("profile"); + let mvk = profile("moltenvk-m3", DevicePolicy::RESIDENT_TABLES).expect("profile"); // Both compile the AIR inliner's two copies, and both roll them. let want = [body(1.0).to_bits(), body(2.0).to_bits()]; for (p, stem) in [(&floor, "runtime-floor"), (&mvk, "moltenvk-m3")] { @@ -225,8 +225,8 @@ fn a_chain_of_applications_and_one_by_lane_are_compiled_once_on_every_profile() let Some(bitcode) = assembled() else { return; }; - let floor = profile("runtime-floor", DevicePolicy::default()).expect("profile"); - let mvk = profile("moltenvk-m3", DevicePolicy::default()).expect("profile"); + let floor = profile("runtime-floor", DevicePolicy::RESIDENT_TABLES).expect("profile"); + let mvk = profile("moltenvk-m3", DevicePolicy::RESIDENT_TABLES).expect("profile"); let chained = (1..=CHAIN).fold(X, |v, j| apply(v, j as f32)); let lanes = [0.25f32, 1.0, 2.75, 3.5]; let cases: [(&str, Vec, Vec); 2] = [ diff --git a/crates/metal2vulkan/src/tests/engine_rotated_colors.rs b/crates/metal2vulkan/src/tests/engine_rotated_colors.rs index 8939f9a22..6bf0fcc63 100644 --- a/crates/metal2vulkan/src/tests/engine_rotated_colors.rs +++ b/crates/metal2vulkan/src/tests/engine_rotated_colors.rs @@ -36,7 +36,7 @@ use crate::pipeline::{ }; use crate::vk; -/// Every committed profile as a device under the default policy, by stem. +/// Every committed profile as a device under the resident-table domains, by stem. fn devices() -> Vec<(String, Device)> { let dir = std::path::Path::new(env!("CARGO_MANIFEST_DIR")) .join("../metal2vulkan-validation/profiles"); @@ -52,7 +52,8 @@ fn devices() -> Vec<(String, Device)> { .unwrap_or_default(); let text = std::fs::read_to_string(&path).expect("read profile"); let desc = DeviceDescription::from_khronos_json(&text, None).expect("profile parses"); - let dev = Device::from_queries(desc, DevicePolicy::default()).expect("device derives"); + let dev = + Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES).expect("device derives"); out.push((stem, dev)); } out.sort_by(|a, b| a.0.cmp(&b.0)); diff --git a/crates/metal2vulkan/src/tests/engine_rotated_weights.rs b/crates/metal2vulkan/src/tests/engine_rotated_weights.rs index 458281c47..60018e36e 100644 --- a/crates/metal2vulkan/src/tests/engine_rotated_weights.rs +++ b/crates/metal2vulkan/src/tests/engine_rotated_weights.rs @@ -116,7 +116,7 @@ fn rotated_weights_take_metal_s_weights_from_the_drawn_triangle_s() { let mut rotated = LoweringInputs::new(); rotated.rotated_weights = true; for stem in PROFILES { - let p = crate::pipeline::testing::profile(stem, DevicePolicy::default()).expect(stem); + let p = crate::pipeline::testing::profile(stem, DevicePolicy::RESIDENT_TABLES).expect(stem); let compile = |bc: &[u8], entry: &str, inputs: &LoweringInputs| { compile_with(bc, entry, &p, inputs).unwrap_or_else(|e| panic!("{stem} {entry}: {e}")) }; @@ -207,7 +207,7 @@ fn a_rotated_draw_runs_the_rotated_weights_variant() { .join(format!("{stem}.json")); let text = std::fs::read_to_string(path).expect("profile"); let desc = DeviceDescription::from_khronos_json(&text, None).expect("description"); - let dev = Device::from_queries(desc, DevicePolicy::default()).expect("device"); + let dev = Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES).expect("device"); for (fragment, reads) in [("pv_both", true), ("pv_flat", false)] { let what = format!("{stem} {fragment}"); let mut d = RenderPipelineDescriptor::new(function("pv_vertex")); diff --git a/crates/metal2vulkan/src/tests/engine_sampler.rs b/crates/metal2vulkan/src/tests/engine_sampler.rs index f23950257..ff2f778de 100644 --- a/crates/metal2vulkan/src/tests/engine_sampler.rs +++ b/crates/metal2vulkan/src/tests/engine_sampler.rs @@ -91,7 +91,7 @@ fn assemble(name: &str, body: &str) -> Option> { } fn m3() -> DeviceProfile { - profile("moltenvk-m3", DevicePolicy::default()).expect("profile") + profile("moltenvk-m3", DevicePolicy::RESIDENT_TABLES).expect("profile") } fn ok(bc: &[u8], entry: &str, p: &DeviceProfile) -> std::sync::Arc { @@ -496,7 +496,7 @@ fn normalized_and_cubic_stages_record_no_note_their_states_cannot_run() { use crate::pipeline::testing::compile_with; use std::collections::BTreeSet; use PrecisionNote as N; - let p = profile("moltenvk-m3", DevicePolicy::default()).expect("profile"); + let p = profile("moltenvk-m3", DevicePolicy::RESIDENT_TABLES).expect("profile"); let assembled = |name: &str| match llvm_assemble(&engine_dir().join(format!("{name}.ll"))) { Ok(b) => Some(b), Err(AssembleError::Missing(why)) => { @@ -1278,7 +1278,7 @@ fn dynamic_offsets_are_offset_operands_of_their_low_four_bits() { let Some(bc) = assemble("gather_dynamic_offset", &dynamic_offset_kernel(true)) else { return; }; - let lavapipe = profile("lavapipe", DevicePolicy::default()).expect("profile"); + let lavapipe = profile("lavapipe", DevicePolicy::RESIDENT_TABLES).expect("profile"); let a = ok(&bc, "k", &lavapipe); assert_eq!(operand_masks(&a, OP_IMAGE_GATHER, 6), [MASK_OFFSET]); assert_eq!(sign_extracts(&a), 1); @@ -1295,7 +1295,7 @@ fn dynamic_offsets_are_offset_operands_of_their_low_four_bits() { let floor = profile_without( "runtime-floor", &[VkFeature::ShaderImageGatherExtended], - DevicePolicy::default(), + DevicePolicy::RESIDENT_TABLES, ) .expect("below the runtime's floor"); let a = ok(&bc, "k", &floor); @@ -1331,7 +1331,7 @@ fn m3_with(edit: impl FnOnce(&mut crate::device::profile::Limits)) -> DeviceProf let text = std::fs::read_to_string(path).expect("profile"); let mut desc = DeviceDescription::from_khronos_json(&text, None).expect("description"); edit(&mut desc.limits); - Device::from_queries(desc, DevicePolicy::default()) + Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES) .expect("device") .profile() .clone() diff --git a/crates/metal2vulkan/src/tests/engine_sampler_completion.rs b/crates/metal2vulkan/src/tests/engine_sampler_completion.rs index 2a9935320..70784dbc9 100644 --- a/crates/metal2vulkan/src/tests/engine_sampler_completion.rs +++ b/crates/metal2vulkan/src/tests/engine_sampler_completion.rs @@ -62,7 +62,7 @@ fn fixture() -> Option> { } fn m3() -> DeviceProfile { - profile("moltenvk-m3", DevicePolicy::default()).expect("profile") + profile("moltenvk-m3", DevicePolicy::RESIDENT_TABLES).expect("profile") } fn ok(bc: &[u8], entry: &str, p: &DeviceProfile) -> std::sync::Arc { diff --git a/crates/metal2vulkan/src/tests/engine_sampler_tail.rs b/crates/metal2vulkan/src/tests/engine_sampler_tail.rs index 2680662fb..02c781a13 100644 --- a/crates/metal2vulkan/src/tests/engine_sampler_tail.rs +++ b/crates/metal2vulkan/src/tests/engine_sampler_tail.rs @@ -77,7 +77,7 @@ fn assemble(name: &str, body: &str) -> Option> { } fn m3() -> DeviceProfile { - profile("moltenvk-m3", DevicePolicy::default()).expect("profile") + profile("moltenvk-m3", DevicePolicy::RESIDENT_TABLES).expect("profile") } fn uses(a: &FunctionArtifact, name: &str) -> u32 { diff --git a/crates/metal2vulkan/src/tests/engine_sampler_unk.rs b/crates/metal2vulkan/src/tests/engine_sampler_unk.rs index 343330cf0..a24eb31ef 100644 --- a/crates/metal2vulkan/src/tests/engine_sampler_unk.rs +++ b/crates/metal2vulkan/src/tests/engine_sampler_unk.rs @@ -106,7 +106,7 @@ fn unrobust(stem: &str) -> DeviceProfile { ] { desc.features.remove(&f); } - Device::from_queries(desc, DevicePolicy::default()) + Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES) .expect("device") .profile() .clone() @@ -426,7 +426,7 @@ fn a_cube_gradient_route_takes_the_devices_reading() { ) .expect("profile"); let desc = DeviceDescription::from_khronos_json(&profile_text, None).expect("description"); - let unmeasured = Device::from_queries(desc, DevicePolicy::default()) + let unmeasured = Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES) .expect("device") .profile() .clone(); diff --git a/crates/metal2vulkan/src/tests/engine_separate_samplers.rs b/crates/metal2vulkan/src/tests/engine_separate_samplers.rs index a46f0cc84..7fb666142 100644 --- a/crates/metal2vulkan/src/tests/engine_separate_samplers.rs +++ b/crates/metal2vulkan/src/tests/engine_separate_samplers.rs @@ -69,7 +69,7 @@ fn m3_with(edit: impl FnOnce(&mut crate::device::profile::Limits)) -> Device { let text = std::fs::read_to_string(path).expect("profile"); let mut desc = DeviceDescription::from_khronos_json(&text, None).expect("description"); edit(&mut desc.limits); - Device::from_queries(desc, DevicePolicy::default()).expect("device") + Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES).expect("device") } fn opcodes(words: &[u32]) -> Vec { diff --git a/crates/metal2vulkan/src/tests/engine_seq_cst.rs b/crates/metal2vulkan/src/tests/engine_seq_cst.rs index 3b6122c63..6fc20b2b7 100644 --- a/crates/metal2vulkan/src/tests/engine_seq_cst.rs +++ b/crates/metal2vulkan/src/tests/engine_seq_cst.rs @@ -91,7 +91,7 @@ fn a_seq_cst_fence_is_ordered_with_the_command_buffers_others() { } let (mut addressed, mut floor) = (0, 0); let mut profiles = committed_profiles().expect("committed profiles"); - let f = device_f(crate::device::DevicePolicy::default()).expect(PROFILE_F); + let f = device_f(crate::device::DevicePolicy::RESIDENT_TABLES).expect(PROFILE_F); profiles.push((PROFILE_F.into(), f.profile().clone())); for (stem, p) in profiles { for (fence, scope, bc) in &kernels { diff --git a/crates/metal2vulkan/src/tests/engine_shared_switch.rs b/crates/metal2vulkan/src/tests/engine_shared_switch.rs index 74e6d0198..2745228f7 100644 --- a/crates/metal2vulkan/src/tests/engine_shared_switch.rs +++ b/crates/metal2vulkan/src/tests/engine_shared_switch.rs @@ -58,7 +58,7 @@ fn assemble(name: &str, body: &str) -> Option> { } fn lavapipe() -> DeviceProfile { - profile("lavapipe", DevicePolicy::default()).expect("profile") + profile("lavapipe", DevicePolicy::RESIDENT_TABLES).expect("profile") } const EDGE: u64 = 1; diff --git a/crates/metal2vulkan/src/tests/engine_simd.rs b/crates/metal2vulkan/src/tests/engine_simd.rs index 140a62d37..34ef029c0 100644 --- a/crates/metal2vulkan/src/tests/engine_simd.rs +++ b/crates/metal2vulkan/src/tests/engine_simd.rs @@ -53,7 +53,7 @@ pub(super) fn wave64() -> DeviceProfile { let narrowed = text.replace("\"minSubgroupSize\": 32", "\"minSubgroupSize\": 64"); assert_ne!(narrowed, text, "the description names minSubgroupSize"); let desc = DeviceDescription::from_khronos_json(&narrowed, None).expect("description"); - Device::from_queries(desc, DevicePolicy::default()) + Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES) .expect("device") .profile() .clone() @@ -68,7 +68,7 @@ fn moltenvk_without_int64() -> DeviceProfile { let cleared = text.replace("\"shaderInt64\": true", "\"shaderInt64\": false"); assert_ne!(cleared, text, "the description names shaderInt64"); let desc = DeviceDescription::from_khronos_json(&cleared, None).expect("description"); - let p = Device::from_queries(desc, DevicePolicy::default()) + let p = Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES) .expect("device") .profile() .clone(); @@ -77,7 +77,7 @@ fn moltenvk_without_int64() -> DeviceProfile { } fn moltenvk() -> DeviceProfile { - profile("moltenvk-m3", DevicePolicy::default()).expect("profile") + profile("moltenvk-m3", DevicePolicy::RESIDENT_TABLES).expect("profile") } /// Every word of buffer 0 after one workgroup of local size `local` ran `m` (planned as `plan`) @@ -356,7 +356,7 @@ fn moltenvk_without_quads() -> DeviceProfile { let cleared = text.replace("\"VK_SUBGROUP_FEATURE_QUAD_BIT\",", ""); assert_ne!(cleared, text, "the description lists the quad class"); let desc = DeviceDescription::from_khronos_json(&cleared, None).expect("description"); - let p = Device::from_queries(desc, DevicePolicy::default()) + let p = Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES) .expect("device") .profile() .clone(); @@ -580,7 +580,7 @@ fn a_device_that_cannot_pin_the_stage_refuses_a_pinned_kernel() { ); let nvk = |text: &str| { let desc = DeviceDescription::from_khronos_json(text, None).expect("description"); - Device::from_queries(desc, DevicePolicy::default()) + Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES) .expect("device") .profile() .clone() @@ -638,7 +638,7 @@ fn reconvergence_follows_the_profile() { assert_eq!(a.reconvergence, Reconvergence::Guaranteed); assert!(!a.precision.contains(&PrecisionNote::DeviceReconvergence)); - let pascal = profile("nvidia-pascal-linux", DevicePolicy::default()).expect("profile"); + let pascal = profile("nvidia-pascal-linux", DevicePolicy::RESIDENT_TABLES).expect("profile"); let sg = pascal.fields().subgroup; assert!(!sg.maximal_reconvergence && !sg.uniform_control_flow); let a = compile(&bc, "simd_vote_k", &pascal).expect("compile"); @@ -906,7 +906,7 @@ fn uniform_control_flow_mode_without_maximal_reconvergence() { "the description names shaderMaximalReconvergence" ); let desc = DeviceDescription::from_khronos_json(&cleared, None).expect("description"); - let p = Device::from_queries(desc, DevicePolicy::default()) + let p = Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES) .expect("device") .profile() .clone(); @@ -1321,12 +1321,12 @@ fn float_group_arithmetic_without_fast_flags_keeps_signed_zeros() { ("wave64", wave64(), Tier::Cluster32), ( "lavapipe", - profile("lavapipe", DevicePolicy::default()).expect("profile"), + profile("lavapipe", DevicePolicy::RESIDENT_TABLES).expect("profile"), Tier::Emulated, ), ( "runtime-floor", - profile("runtime-floor", DevicePolicy::default()).expect("profile"), + profile("runtime-floor", DevicePolicy::RESIDENT_TABLES).expect("profile"), Tier::Emulated, ), ]; @@ -1406,7 +1406,7 @@ fn vertex_lane_reads_take_lanes_past_the_draw_as_zero() { ("amd-780m-radv", Tier::Cluster32, SubgroupSize::W64), ("nvidia-rtx5080-laptop", Tier::Direct, SubgroupSize::W32), ] { - let p = profile(stem, DevicePolicy::default()).expect("profile"); + let p = profile(stem, DevicePolicy::RESIDENT_TABLES).expect("profile"); let (a, plan, m) = compile_kept(&bc, entry, &p).unwrap_or_else(|e| panic!("{stem}: {e}")); link_and_validate(&a, &p).unwrap_or_else(|e| panic!("{stem}: {e}")); assert_eq!(plan.simd.1, tier, "{stem}"); @@ -1552,7 +1552,7 @@ fn a_device_without_quad_control_refuses_full_quads() { let desc = DeviceDescription::from_khronos_json(&text, None).expect("description"); assert!(!desc.features.contains(&VkFeature::ShaderQuadControl)); assert!(!desc.extensions.contains(&VkExtension::KhrShaderQuadControl)); - let without = Device::from_queries(desc, DevicePolicy::default()) + let without = Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES) .expect("device") .profile() .clone(); diff --git a/crates/metal2vulkan/src/tests/engine_simd_emulated.rs b/crates/metal2vulkan/src/tests/engine_simd_emulated.rs index 3e73ee68b..bd59fd719 100644 --- a/crates/metal2vulkan/src/tests/engine_simd_emulated.rs +++ b/crates/metal2vulkan/src/tests/engine_simd_emulated.rs @@ -24,7 +24,7 @@ //! the same reading at 1 to 32 threads. Every run takes Vulkan's barrier rule //! (`BarrierRule::Vulkan`): an invocation that returned while others wait at a workgroup barrier //! traps. Under the identity domains every one of those kernels gives the same readings, with one -//! scratch region and as many barriers as under the default domains. No GPU is used. +//! scratch region and as many barriers as under the resident-table domains. No GPU is used. //! //! `llvm-as` assembles the fixtures; a missing tool skips visibly. @@ -108,7 +108,7 @@ fn identity() -> DevicePolicy { DevicePolicy { pointer_domain: PointerDomain::Identity, handle_domain: HandleDomain::Identity, - ..DevicePolicy::default() + ..DevicePolicy::RESIDENT_TABLES } } @@ -696,7 +696,7 @@ const SIMD_UNIFORM: [(&str, u32); 9] = [ /// Plan `kernel` of `bc` on profile `stem`, check its emulated tier, and check the expectation /// at every width and local size. fn run_kernel(stem: &str, bc: &[u8], kernel: &str, words: Option) { - run_kernel_under(stem, DevicePolicy::default(), bc, kernel, words); + run_kernel_under(stem, DevicePolicy::RESIDENT_TABLES, bc, kernel, words); } /// [`run_kernel`] on profile `stem` under `policy`. @@ -765,7 +765,7 @@ fn run_expected(stem: &str, kernel: &str, plan: &Plan, m: &TypedModule, locals: /// L3: the kernel links, relocates, and passes `spirv-val` under the profile, and uses no /// subgroup instruction or capability. The plan's size estimate bounds the emitted words. fn validate(stem: &str, bc: &[u8], kernel: &str) { - let p = profile(stem, DevicePolicy::default()).expect("profile"); + let p = profile(stem, DevicePolicy::RESIDENT_TABLES).expect("profile"); let a = compile(bc, kernel, &p).unwrap_or_else(|e| panic!("{stem} {kernel}: {e}")); let (plan, _) = typed_module(bc, kernel, &p).expect("plan"); let emitted = a.module.words.len() as u64; @@ -876,7 +876,7 @@ fn emulated_reductions_scans_and_votes_stay_compact() { ]; let mut over = Vec::new(); for stem in PROFILES { - let p = profile(stem, DevicePolicy::default()).expect("profile"); + let p = profile(stem, DevicePolicy::RESIDENT_TABLES).expect("profile"); for (bc, kernel) in kernels { let emulated = compile(bc, kernel, &p).expect("compile").module.words.len(); let whole = compile(bc, kernel, &direct) @@ -911,7 +911,7 @@ fn whole_subgroups_without_the_nan_fact() -> DeviceProfile { .join("../metal2vulkan-validation/profiles/moltenvk-m3.json"); let text = std::fs::read_to_string(&path).expect("profile"); let desc = DeviceDescription::from_khronos_json(&text, None).expect("description"); - Device::from_queries(desc, DevicePolicy::default()) + Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES) .expect("device") .profile() .clone() @@ -1103,7 +1103,7 @@ fn no_nan_reaches_an_emulated_float_min_or_max() { return; }; for stem in PROFILES { - let p = profile(stem, DevicePolicy::default()).expect("profile"); + let p = profile(stem, DevicePolicy::RESIDENT_TABLES).expect("profile"); for kernel in ["simd_minmax_k", "simd_float_prefix_k"] { validate(stem, &bc, kernel); let a = compile(&bc, kernel, &p).unwrap_or_else(|e| panic!("{stem} {kernel}: {e}")); @@ -1142,7 +1142,7 @@ fn emulated_float_reductions_and_scans_take_exactly_the_active_lanes() { return; }; for stem in PROFILES { - let p = profile(stem, DevicePolicy::default()).expect("profile"); + let p = profile(stem, DevicePolicy::RESIDENT_TABLES).expect("profile"); for kernel in ["simd_minmax_k", "simd_float_prefix_k"] { let divergent = kernel == "simd_float_prefix_k"; let (plan, m) = typed_module(&bc, kernel, &p) @@ -1222,7 +1222,7 @@ fn an_emulated_float_exclusive_sum_keeps_the_sign_of_zero() { }; let neg = (-0.0f32).to_bits(); for stem in PROFILES { - let p = profile(stem, DevicePolicy::default()).expect("profile"); + let p = profile(stem, DevicePolicy::RESIDENT_TABLES).expect("profile"); for (bc, kernel) in [ (&uniform, "float_prefix_k"), (&divergent, "simd_float_prefix_k"), @@ -1263,7 +1263,7 @@ fn emulated_barriers_are_workgroup_barriers() { return; }; for stem in PROFILES { - let p = profile(stem, DevicePolicy::default()).expect("profile"); + let p = profile(stem, DevicePolicy::RESIDENT_TABLES).expect("profile"); for kernel in ["barrier_k", "vote_k"] { let a = compile(&bc, kernel, &p).expect("compile"); let (_, words) = link_and_validate(&a, &p).expect("valid"); @@ -1345,12 +1345,12 @@ fn barriers(stem: &str, policy: DevicePolicy, bc: &[u8], kernel: &str) -> usize } /// Under the identity domains the emulated tier's exchanges and votes use one scratch region and -/// each closes with a barrier, as under the default domains: every kernel of `simd_ops`, +/// each closes with a barrier, as under the resident-table domains: every kernel of `simd_ops`, /// `simd_uniform` and `simd_divergent` (shuffles, reductions, prefix sums, votes, ballots, quad /// operations, vector and `half` values, exchanges in uniform and per-thread loops, after early /// returns and in branch arms) gives the same expectation at every subgroup width in both /// scheduling orders, in full and partial threadgroups, plans the scratch of one region, and has as -/// many barriers as under the default domains. +/// many barriers as under the resident-table domains. #[test] fn identity_exchanges_keep_one_scratch_region() { const STEM: &str = "lavapipe"; @@ -1372,7 +1372,7 @@ fn identity_exchanges_keep_one_scratch_region() { run_kernel_under(STEM, identity(), bc, kernel, words); assert_eq!( barriers(STEM, identity(), bc, kernel), - barriers(STEM, DevicePolicy::default(), bc, kernel), + barriers(STEM, DevicePolicy::RESIDENT_TABLES, bc, kernel), "{kernel}: barriers under the identity domains" ); } @@ -1414,7 +1414,7 @@ fn a_multi_level_break_tail_runs_once_per_outer_iteration_emulated() { let bytes = |w: &[u32]| -> Vec { w.iter().flat_map(|x| x.to_le_bytes()).collect() }; for stem in PROFILES { validate(stem, &bc, kernel); - let p = profile(stem, DevicePolicy::default()).expect("profile"); + let p = profile(stem, DevicePolicy::RESIDENT_TABLES).expect("profile"); let (plan, m) = typed_module(&bc, kernel, &p).expect("plan"); assert_eq!(plan.simd.1, Tier::Emulated, "{stem}"); let slot = |kind, index| { @@ -1472,7 +1472,7 @@ fn a_divergent_matrix_multiply_add_compiles_on_every_emulating_profile() { return; }; for stem in PROFILES { - let p = profile(stem, DevicePolicy::default()).expect("profile"); + let p = profile(stem, DevicePolicy::RESIDENT_TABLES).expect("profile"); let a = compile(&bc, "matrix_thread_elements", &p).unwrap_or_else(|e| panic!("{stem}: {e}")); link_and_validate(&a, &p).unwrap_or_else(|e| panic!("{stem}: {e}")); @@ -1529,7 +1529,7 @@ fn the_scratch_must_fit_beside_the_threadgroup_memory() { let Some(full) = arena_kernel(4096) else { return; }; - let floor = profile("runtime-floor", DevicePolicy::default()).expect("profile"); + let floor = profile("runtime-floor", DevicePolicy::RESIDENT_TABLES).expect("profile"); match compile(&full, "barrier_k", &floor) { Err(Error::Unsupported(u)) => { assert_eq!(u.feature, Feature::ThreadgroupMemorySize); @@ -1606,7 +1606,7 @@ fn emulated_operations_do_not_depend_on_reconvergence() { return; }; for stem in PROFILES { - let p = profile(stem, DevicePolicy::default()).expect("profile"); + let p = profile(stem, DevicePolicy::RESIDENT_TABLES).expect("profile"); for kernel in ["vote_k", "prefix_k", "quad_vote_k", "barrier_k"] { let a = compile(&bc, kernel, &p).unwrap_or_else(|e| panic!("{stem} {kernel}: {e}")); assert_eq!( @@ -1616,7 +1616,7 @@ fn emulated_operations_do_not_depend_on_reconvergence() { ); } } - let floor = profile("runtime-floor", DevicePolicy::default()).expect("profile"); + let floor = profile("runtime-floor", DevicePolicy::RESIDENT_TABLES).expect("profile"); assert!(!floor.fields().subgroup.maximal_reconvergence); let a = compile(&bc, "region_k", &floor).expect("region_k"); assert_eq!(a.reconvergence, Reconvergence::ImplementationDefined); @@ -1644,7 +1644,7 @@ fn emulated_shuffles_keep_metals_reconvergence_without_maximal_reconvergence() { "the description names shaderMaximalReconvergence" ); let desc = DeviceDescription::from_khronos_json(&cleared, None).expect("description"); - let dev = Device::from_queries(desc, DevicePolicy::default()).expect("device"); + let dev = Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES).expect("device"); let p = dev.profile(); assert!(!p.fields().subgroup.maximal_reconvergence); let a = compile(&bc, "dsm2_shuffle_past_n", p).expect("compile"); @@ -1665,7 +1665,7 @@ fn lavapipe() -> Device { let text = std::fs::read_to_string(path).expect("profile"); let desc = crate::device::DeviceDescription::from_khronos_json(&text, None).expect("description"); - let dev = Device::from_queries(desc, DevicePolicy::default()).expect("device"); + let dev = Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES).expect("device"); assert_eq!( dev.profile().fields().limits.max_compute_shared_memory_size, 32 * 1024 @@ -1794,7 +1794,7 @@ fn a_large_predicated_body_compiles_under_a_cap_it_fits() { let Some(bc) = large_body(256) else { return; }; - let p = profile("lavapipe", DevicePolicy::default()).expect("profile"); + let p = profile("lavapipe", DevicePolicy::RESIDENT_TABLES).expect("profile"); let inputs = emulated_inputs(); let (plan, _) = typed_module_with(&bc, "guard_k", &p, &inputs).expect("plan"); assert!( @@ -2154,7 +2154,7 @@ fn device(name: &str) -> Device { let text = std::fs::read_to_string(path).expect("profile"); let desc = crate::device::DeviceDescription::from_khronos_json(&text, None).expect("description"); - Device::from_queries(desc, DevicePolicy::default()).expect("device") + Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES).expect("device") } /// `quad_ballot` and `simd_active_threads_mask` on emulated simdgroups, uniform and divergent (run @@ -2199,7 +2199,7 @@ fn an_emulated_exchange_reaches_a_word_with_one_access_chain() { return; }; for stem in PROFILES { - let p = profile(stem, DevicePolicy::default()).expect("profile"); + let p = profile(stem, DevicePolicy::RESIDENT_TABLES).expect("profile"); let words = compile(&bc, "guard_shuffle_k", &p) .expect("compile") .module @@ -2717,7 +2717,7 @@ fn wave64() -> Device { let narrowed = text.replace("\"minSubgroupSize\": 32", "\"minSubgroupSize\": 64"); assert_ne!(narrowed, text, "the description names minSubgroupSize"); let desc = DeviceDescription::from_khronos_json(&narrowed, None).expect("description"); - Device::from_queries(desc, DevicePolicy::default()).expect("device") + Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES).expect("device") } /// `kernel void name(texture2d_ms t [[texture(0)]], device uint *out [[buffer(0)]], uint2 @@ -2990,8 +2990,8 @@ define void @{name}(ptr addrspace(1) %src, ptr addrspace(1) %dst, ptr addrspace( } /// On lavapipe's `Device::from_queries` profile the lockstep order gives the stores of every -/// [`row_store_kernel`] barriers under the default domains, and none under the identity domains -/// (the runtime's), whose kernels take no order: there each kernel's module has no lockstep +/// [`row_store_kernel`] barriers under the resident-table domains, and none under the identity +/// domains (the runtime's), whose kernels take no order: there each kernel's module has no lockstep /// barrier, states no `RowLockstep` and takes no simd class, it does not observe its threadgroup /// partition with partial threadgroups, and that variant's pipeline runs its grid in tiles /// (`GridTiles`). The identity domains' module records the pair it leaves unordered @@ -2999,7 +2999,7 @@ define void @{name}(ptr addrspace(1) %src, ptr addrspace(1) %dst, ptr addrspace( #[test] fn the_identity_domains_order_no_lockstep_pair() { let desc = crate::pipeline::testing::description("lavapipe").unwrap_or_else(|e| panic!("{e}")); - let resident = Device::from_queries(desc.clone(), DevicePolicy::default()) + let resident = Device::from_queries(desc.clone(), DevicePolicy::RESIDENT_TABLES) .unwrap_or_else(|e| panic!("{e}")); let dev = Device::from_queries(desc, identity()).unwrap_or_else(|e| panic!("{e}")); let budget = Budget::standard(); @@ -3100,12 +3100,12 @@ define void @NAME(ptr addrspace(1) %dst, i32 %tid) { } /// A kernel without a pair only lockstep orders ([`own_word_kernel`]) takes no lockstep barrier -/// under the default domains on lavapipe's profile, and records no +/// under the resident-table domains on lavapipe's profile, and records no /// `PrecisionNote::SimdgroupAccessOrder` under either domains. #[test] fn a_kernel_without_a_lockstep_pair_records_no_access_order_note() { let desc = crate::pipeline::testing::description("lavapipe").unwrap_or_else(|e| panic!("{e}")); - let resident = Device::from_queries(desc.clone(), DevicePolicy::default()) + let resident = Device::from_queries(desc.clone(), DevicePolicy::RESIDENT_TABLES) .unwrap_or_else(|e| panic!("{e}")); let dev = Device::from_queries(desc, identity()).unwrap_or_else(|e| panic!("{e}")); let name = "own_word"; diff --git a/crates/metal2vulkan/src/tests/engine_simd_lockstep.rs b/crates/metal2vulkan/src/tests/engine_simd_lockstep.rs index eee6e7f15..c6d79d71a 100644 --- a/crates/metal2vulkan/src/tests/engine_simd_lockstep.rs +++ b/crates/metal2vulkan/src/tests/engine_simd_lockstep.rs @@ -1500,7 +1500,7 @@ fn check( expect: impl Fn(u32) -> u32, ) -> Option { let bc = assemble(name, body)?; - let p = profile(profile_name, DevicePolicy::default()).expect("profile"); + let p = profile(profile_name, DevicePolicy::RESIDENT_TABLES).expect("profile"); let (plan, m) = typed_module(&bc, name, &p).unwrap_or_else(|e| panic!("{name}: {e}")); let want: Vec = (0..threads).map(&expect).collect(); for &w in lanes { @@ -2006,7 +2006,7 @@ fn the_lockstep_gate_fixture_takes_emulated_simdgroups() { ] { for profile_name in ["lavapipe", "runtime-floor"] { let lanes = &CHUNKED[..]; - let p = profile(profile_name, DevicePolicy::default()).expect("profile"); + let p = profile(profile_name, DevicePolicy::RESIDENT_TABLES).expect("profile"); let (plan, m) = typed_module(&bc, kernel, &p) .unwrap_or_else(|e| panic!("{kernel} on {profile_name}: {e}")); let at = format!("{kernel} on {profile_name}"); @@ -2131,7 +2131,7 @@ fn a_branchs_two_arms_take_no_device_barrier() { let Some(bc) = assemble("device_arms", DEVICE_ARMS) else { return; }; - let p = profile(profile_name, DevicePolicy::default()).expect("profile"); + let p = profile(profile_name, DevicePolicy::RESIDENT_TABLES).expect("profile"); let (plan, _) = typed_module(&bc, "device_arms", &p) .unwrap_or_else(|e| panic!("device_arms on {profile_name}: {e}")); for name in [ @@ -2348,7 +2348,7 @@ fn every_stage_from_queries_keeps_the_widest_pin_or_is_refused() { let weight = |module: &TypedModule| entry_weight(module, &mut meter()).expect("weight"); let want: Vec = (0..64).map(half).collect(); let desc = crate::pipeline::testing::description("intel-irisxe-rplp-anv").unwrap(); - let queries = Device::from_queries(desc, DevicePolicy::default()).unwrap(); + let queries = Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES).unwrap(); let queries = queries.profile(); let compile = |p, bounds| compile_bitcode_bounded(&bc, entry, p, &mut meter(), bounds); let compiled = |cap| StageBounds { compiled: cap }; @@ -2402,7 +2402,7 @@ fn a_kernel_past_the_stage_bound_gets_one_answer_through_either_path() { return; }; let iris_desc = crate::pipeline::testing::description("intel-irisxe-rplp-anv").unwrap(); - let iris = Device::from_queries(iris_desc, DevicePolicy::default()).unwrap(); + let iris = Device::from_queries(iris_desc, DevicePolicy::RESIDENT_TABLES).unwrap(); let iris = iris.profile(); let library = Library::from_air(&bc).expect("library"); let fd = FunctionDescriptor::new(library.function("device_half").expect("the kernel")); @@ -2518,7 +2518,7 @@ fn the_stage_bound_fixture_keeps_the_pin_or_is_refused() { .join("../metal2vulkan-validation/profiles/intel-irisxe-rplp-anv.json"); let text = std::fs::read_to_string(path).expect("profile"); let desc = DeviceDescription::from_khronos_json(&text, None).expect("description"); - let queries = Device::from_queries(desc, DevicePolicy::default()).unwrap(); + let queries = Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES).unwrap(); { let p = queries.profile(); assert!(p.fields().subgroup.maximal_reconvergence); @@ -2546,10 +2546,10 @@ fn the_stage_bound_fixture_keeps_the_pin_or_is_refused() { "the description names shaderMaximalReconvergence" ); let desc = DeviceDescription::from_khronos_json(&cleared, None).expect("description"); - let queries = Device::from_queries(desc.clone(), DevicePolicy::default()).unwrap(); + let queries = Device::from_queries(desc.clone(), DevicePolicy::RESIDENT_TABLES).unwrap(); let mut windows = desc; windows.driver_id = Some(crate::vk::DriverId::INTEL_PROPRIETARY_WINDOWS); - let windows = Device::from_queries(windows, DevicePolicy::default()).unwrap(); + let windows = Device::from_queries(windows, DevicePolicy::RESIDENT_TABLES).unwrap(); for p in [queries.profile(), windows.profile()] { assert!(!p.fields().subgroup.maximal_reconvergence); let compiled = compile_bitcode_bounded(&bc, entry, p, &mut meter(), unbounded); @@ -2576,7 +2576,7 @@ fn texture_calls_take_no_device_barrier() { return; }; for profile_name in ["lavapipe", "moltenvk-m3", "nvidia-rtx5080-laptop"] { - let p = profile(profile_name, DevicePolicy::default()).expect("profile"); + let p = profile(profile_name, DevicePolicy::RESIDENT_TABLES).expect("profile"); let (plan, _) = typed_module(&bc, "device_texture", &p) .unwrap_or_else(|e| panic!("device_texture on {profile_name}: {e}")); for name in LOCKSTEP_NAMES { @@ -2668,7 +2668,7 @@ fn the_busy_kernel_takes_no_lockstep_barrier() { Err(AssembleError::Rejected(why)) => panic!("llvm-as rejected rfs_agx_yield: {why}"), }; for profile_name in LONE_PROFILES { - let p = profile(profile_name, DevicePolicy::default()).expect("profile"); + let p = profile(profile_name, DevicePolicy::RESIDENT_TABLES).expect("profile"); let (plan, _) = typed_module(&bc, "agx_yield_lookback", &p) .unwrap_or_else(|e| panic!("agx_yield_lookback on {profile_name}: {e}")); for name in LOCKSTEP_NAMES { @@ -2715,7 +2715,7 @@ fn a_store_loop_another_thread_reads_moves_or_leaves_early_keeps_its_barrier() { return; }; for profile_name in LONE_PROFILES { - let p = profile(profile_name, DevicePolicy::default()).expect("profile"); + let p = profile(profile_name, DevicePolicy::RESIDENT_TABLES).expect("profile"); let (plan, _) = typed_module(&bc, name, &p) .unwrap_or_else(|e| panic!("{name} on {profile_name}: {e}")); let barriers: u32 = LOCKSTEP_NAMES.iter().map(|n| uses(&plan, n)).sum(); @@ -2737,7 +2737,7 @@ fn grid_barriers(name: &str, body: &str) -> Option> { let bc = assemble_text(name, &text)?; let mut out = Vec::new(); for profile_name in LONE_PROFILES { - let p = profile(profile_name, DevicePolicy::default()).expect("profile"); + let p = profile(profile_name, DevicePolicy::RESIDENT_TABLES).expect("profile"); let (plan, _) = typed_module(&bc, name, &p).unwrap_or_else(|e| panic!("{name} on {profile_name}: {e}")); out.push(( @@ -2880,7 +2880,7 @@ target triple = "air64_v28-apple-macosx26.0.0" /// beside other jobs says nothing of the first (a loaded debug run took more than 20 s). fn steps_cost(steps: usize, accs: usize, pointers: bool) -> Option<(u64, u64, Result<(), Error>)> { let bc = assemble_text("grow", &barrier_free_steps(steps, accs, pointers))?; - let p = profile("nvidia-rtx5080-laptop", DevicePolicy::default()).expect("profile"); + let p = profile("nvidia-rtx5080-laptop", DevicePolicy::RESIDENT_TABLES).expect("profile"); let mut m = Meter::new(&Budget::default()); let compiled = compile_bitcode( &bc, @@ -2997,7 +2997,7 @@ fn check_shapes( expect: impl Fn(u32, u32) -> u32, ) -> Option { let bc = assemble_text(name, &format!("{HEADER}\n{body}\n{}", footer_pos(name)))?; - let p = profile(profile_name, DevicePolicy::default()).expect("profile"); + let p = profile(profile_name, DevicePolicy::RESIDENT_TABLES).expect("profile"); let (plan, m) = typed_module(&bc, name, &p).unwrap_or_else(|e| panic!("{name}: {e}")); for &local in shapes { let threads = local.iter().product::(); @@ -3347,7 +3347,7 @@ done: /// nothing: its one-row variant keeps the barrier and the pin. #[test] fn a_guard_on_its_index_widened_once_clears_a_tree_reduction_in_one_row() { - let p = profile("amd-780m-radv", DevicePolicy::default()).expect("profile"); + let p = profile("amd-780m-radv", DevicePolicy::RESIDENT_TABLES).expect("profile"); let mut one_row = LowerInputs::new(); one_row.one_row = true; let sum: u32 = (0..16).sum(); diff --git a/crates/metal2vulkan/src/tests/engine_simd_matrix.rs b/crates/metal2vulkan/src/tests/engine_simd_matrix.rs index cf8ff0c12..ac7ed3638 100644 --- a/crates/metal2vulkan/src/tests/engine_simd_matrix.rs +++ b/crates/metal2vulkan/src/tests/engine_simd_matrix.rs @@ -74,7 +74,7 @@ fn owned() -> Option> { } fn moltenvk() -> DeviceProfile { - profile("moltenvk-m3", DevicePolicy::default()).expect("profile") + profile("moltenvk-m3", DevicePolicy::RESIDENT_TABLES).expect("profile") } /// A wave64-only compute device: the committed RDNA3 description with its subgroup size range @@ -86,7 +86,7 @@ fn wave64() -> DeviceProfile { let narrowed = text.replace("\"minSubgroupSize\": 32", "\"minSubgroupSize\": 64"); assert_ne!(narrowed, text, "the description names minSubgroupSize"); let desc = DeviceDescription::from_khronos_json(&narrowed, None).expect("description"); - Device::from_queries(desc, DevicePolicy::default()) + Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES) .expect("device") .profile() .clone() @@ -97,7 +97,7 @@ fn wave64() -> DeviceProfile { /// them), which cannot pin 32 lanes, emulate their simdgroups through workgroup memory, here on 8- /// and 16-lane subgroups. fn tiers() -> [(DeviceProfile, Tier, SubgroupSize, &'static [u32]); 4] { - let committed = |stem| profile(stem, DevicePolicy::default()).expect("profile"); + let committed = |stem| profile(stem, DevicePolicy::RESIDENT_TABLES).expect("profile"); [ (moltenvk(), Tier::Direct, SubgroupSize::W32, &[32, 64]), (wave64(), Tier::Cluster32, SubgroupSize::W64, &[64]), @@ -117,7 +117,7 @@ fn floor_words() -> DeviceProfile { crate::pipeline::testing::profile_without( "runtime-floor", &[VkFeature::ShaderInt64], - DevicePolicy::default(), + DevicePolicy::RESIDENT_TABLES, ) .expect("below the runtime's floor") } @@ -130,7 +130,7 @@ fn moltenvk_words() -> DeviceProfile { let text = std::fs::read_to_string(&path).expect("read the MoltenVK description"); let mut desc = DeviceDescription::from_khronos_json(&text, None).expect("description"); assert!(desc.features.remove(&VkFeature::ShaderInt64)); - let p = Device::from_queries(desc, DevicePolicy::default()) + let p = Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES) .expect("device") .profile() .clone(); @@ -657,7 +657,7 @@ fn fp8_factors_multiply_exactly() { let want = mad(&a, &b, &[[0.0; 8]; 8]); let mut input = ab.clone(); input.extend(&bb); - let rtx50 = profile("nvidia-rtx50-linux", DevicePolicy::default()).expect("profile"); + let rtx50 = profile("nvidia-rtx50-linux", DevicePolicy::RESIDENT_TABLES).expect("profile"); let one: &'static [u32] = &[32]; let runs = tiers() .into_iter() @@ -1426,7 +1426,7 @@ fn a_shuffle_into_a_fragment_moves_only_its_two_elements() { /// fragments (2 KiB); held whole it is 64 KiB, refused. #[test] fn matrices_held_as_fragments_count_their_two_elements() { - let p = profile("nvidia-rtx5080-laptop", DevicePolicy::default()).expect("profile"); + let p = profile("nvidia-rtx5080-laptop", DevicePolicy::RESIDENT_TABLES).expect("profile"); for spoil in [false, true] { let name = if spoil { "matrices_whole" diff --git a/crates/metal2vulkan/src/tests/engine_simd_partly_live.rs b/crates/metal2vulkan/src/tests/engine_simd_partly_live.rs index 3be2846b9..ce515e397 100644 --- a/crates/metal2vulkan/src/tests/engine_simd_partly_live.rs +++ b/crates/metal2vulkan/src/tests/engine_simd_partly_live.rs @@ -288,7 +288,7 @@ fn words(b: &[u8]) -> Vec { } fn emulating(stem: &str) -> DeviceProfile { - profile(stem, DevicePolicy::default()).expect("profile") + profile(stem, DevicePolicy::RESIDENT_TABLES).expect("profile") } /// `runtime-floor` with 4-lane subgroups in the vertex, fragment and compute stages and the basic, @@ -302,7 +302,7 @@ fn narrow_graphics() -> DeviceProfile { desc.subgroup.supported_stages = S::VERTEX | S::FRAGMENT | S::COMPUTE; desc.subgroup.supported_operations = O::BASIC | O::VOTE | O::ARITHMETIC | O::BALLOT | O::SHUFFLE | O::SHUFFLE_RELATIVE | O::QUAD; - Device::from_queries(desc, DevicePolicy::default()) + Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES) .expect("device") .profile() .clone() @@ -436,7 +436,7 @@ fn wave64() -> DeviceProfile { let narrowed = text.replace("\"minSubgroupSize\": 32", "\"minSubgroupSize\": 64"); assert_ne!(narrowed, text, "the description names minSubgroupSize"); let desc = DeviceDescription::from_khronos_json(&narrowed, None).expect("description"); - Device::from_queries(desc, DevicePolicy::default()) + Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES) .expect("device") .profile() .clone() diff --git a/crates/metal2vulkan/src/tests/engine_simd_past_n.rs b/crates/metal2vulkan/src/tests/engine_simd_past_n.rs index 0beb10a13..b1cfeb66d 100644 --- a/crates/metal2vulkan/src/tests/engine_simd_past_n.rs +++ b/crates/metal2vulkan/src/tests/engine_simd_past_n.rs @@ -311,7 +311,7 @@ const SIZES: [u32; 6] = [6, 8, 16, 32, 42, 48]; #[test] fn the_emulated_tier_reads_a_lane_past_the_thread_count_as_zero() { for stem in PROFILES { - let p: DeviceProfile = profile(stem, DevicePolicy::default()).expect("profile"); + let p: DeviceProfile = profile(stem, DevicePolicy::RESIDENT_TABLES).expect("profile"); check_on(stem, &SIZES, &WIDTHS, &|bc, entry| { let (a, plan, m) = compile_kept(bc, entry, &p).unwrap_or_else(|e| panic!("{entry}: {e}")); @@ -324,7 +324,7 @@ fn the_emulated_tier_reads_a_lane_past_the_thread_count_as_zero() { #[test] fn the_emulated_variant_reads_a_lane_past_the_thread_count_as_zero() { - let p = profile("moltenvk-m3", DevicePolicy::default()).expect("profile"); + let p = profile("moltenvk-m3", DevicePolicy::RESIDENT_TABLES).expect("profile"); let mut inputs = LoweringInputs::new(); inputs.emulated_simdgroups = true; check_on("moltenvk-m3 variant", &SIZES, &WIDTHS, &|bc, entry| { @@ -341,7 +341,7 @@ fn the_emulated_variant_reads_a_lane_past_the_thread_count_as_zero() { #[test] fn the_direct_tier_gives_the_whole_simdgroup_control() { - let p = profile("moltenvk-m3", DevicePolicy::default()).expect("profile"); + let p = profile("moltenvk-m3", DevicePolicy::RESIDENT_TABLES).expect("profile"); check_on("moltenvk-m3", &[32], &[SubgroupSize::W32], &|bc, entry| { let (a, plan, m) = compile_kept(bc, entry, &p).unwrap_or_else(|e| panic!("{entry}: {e}")); link_and_validate(&a, &p).unwrap_or_else(|e| panic!("{entry}: {e}")); diff --git a/crates/metal2vulkan/src/tests/engine_simd_products.rs b/crates/metal2vulkan/src/tests/engine_simd_products.rs index 869b508d3..567f5094b 100644 --- a/crates/metal2vulkan/src/tests/engine_simd_products.rs +++ b/crates/metal2vulkan/src/tests/engine_simd_products.rs @@ -220,7 +220,7 @@ fn run_kernels(p: &DeviceProfile, tier: Tier, widths: &[SubgroupSize]) { #[test] fn simd_products_and_rotate_up_run_direct_at_32_lanes() { - let p = profile("moltenvk-m3", DevicePolicy::default()).expect("profile"); + let p = profile("moltenvk-m3", DevicePolicy::RESIDENT_TABLES).expect("profile"); run_kernels(&p, Tier::Direct, &[SubgroupSize::W32]); } @@ -239,7 +239,7 @@ fn simd_products_and_rotate_up_run_cluster32_at_64_lanes() { /// fold and scan with 1 as the identity. #[test] fn simd_products_and_rotate_up_run_emulated_at_every_width() { - let p = profile("lavapipe", DevicePolicy::default()).expect("profile"); + let p = profile("lavapipe", DevicePolicy::RESIDENT_TABLES).expect("profile"); run_kernels( &p, Tier::Emulated, diff --git a/crates/metal2vulkan/src/tests/engine_simd_unit_axes.rs b/crates/metal2vulkan/src/tests/engine_simd_unit_axes.rs index 503415ae4..3f9ba3eeb 100644 --- a/crates/metal2vulkan/src/tests/engine_simd_unit_axes.rs +++ b/crates/metal2vulkan/src/tests/engine_simd_unit_axes.rs @@ -120,7 +120,7 @@ fn lavapipe() -> Device { let text = std::fs::read_to_string(path).expect("profile"); let desc = crate::device::DeviceDescription::from_khronos_json(&text, None).expect("description"); - Device::from_queries(desc, DevicePolicy::default()).expect("device") + Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES).expect("device") } /// The unit axes `plan` states, with their relief (`RuntimeFact::UnitAxes`). diff --git a/crates/metal2vulkan/src/tests/engine_skeleton.rs b/crates/metal2vulkan/src/tests/engine_skeleton.rs index 2cc133cf0..f648190f8 100644 --- a/crates/metal2vulkan/src/tests/engine_skeleton.rs +++ b/crates/metal2vulkan/src/tests/engine_skeleton.rs @@ -148,7 +148,7 @@ fn check_artifact(a: &FunctionArtifact, what: &str) { fn store_const_passes_the_pipeline_on_every_m1_profile() { let Some(bitcode) = store_const() else { return }; for stem in M1_PROFILES { - let p = profile(stem, DevicePolicy::default()).expect("profile"); + let p = profile(stem, DevicePolicy::RESIDENT_TABLES).expect("profile"); let a = compile(&bitcode, "store_const", &p).unwrap_or_else(|e| panic!("{stem}: compile: {e}")); check_artifact(&a, stem); @@ -177,7 +177,7 @@ fn containment_without_robustness_guards_the_store() { let mut desc = DeviceDescription::from_khronos_json(&text, None).expect("description"); desc.features.remove(&VkFeature::RobustBufferAccess); desc.features.remove(&VkFeature::RobustBufferAccess2); - let dev = Device::from_queries(desc, DevicePolicy::default()).expect("device"); + let dev = Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES).expect("device"); let p = dev.profile(); let a = compile(&bitcode, "store_const", p).expect("compile"); assert!(a.strategies.entries.contains_key("access.store.checked")); @@ -185,7 +185,7 @@ fn containment_without_robustness_guards_the_store() { let ops = opcodes(&words); assert!(ops.contains(&(crate::spv::Op::ArrayLength as u32))); assert!(ops.contains(&(crate::spv::Op::SelectionMerge as u32))); - let robust = profile("runtime-floor", DevicePolicy::default()).expect("profile"); + let robust = profile("runtime-floor", DevicePolicy::RESIDENT_TABLES).expect("profile"); let bare = compile(&bitcode, "store_const", &robust).expect("compile"); let (_, words) = link_and_validate(&bare, &robust).unwrap_or_else(|e| panic!("{e}")); assert!( @@ -200,7 +200,7 @@ fn containment_without_robustness_guards_the_store() { fn compilation_and_link_are_deterministic() { let Some(bitcode) = store_const() else { return }; for stem in M1_PROFILES { - let p = profile(stem, DevicePolicy::default()).expect("profile"); + let p = profile(stem, DevicePolicy::RESIDENT_TABLES).expect("profile"); let a = compile(&bitcode, "store_const", &p).expect("compile"); let b = compile(&bitcode, "store_const", &p).expect("compile"); assert_eq!(a, b, "{stem}"); @@ -215,7 +215,7 @@ fn compilation_and_link_are_deterministic() { #[test] fn zeroed_relocation_slots_are_link_independent() { let Some(bitcode) = store_const() else { return }; - let p = profile("moltenvk-m3", DevicePolicy::default()).expect("profile"); + let p = profile("moltenvk-m3", DevicePolicy::RESIDENT_TABLES).expect("profile"); let a = compile(&bitcode, "store_const", &p).expect("compile"); let slots: BTreeSet = a.module.relocs.iter().map(|(_, at)| *at as usize).collect(); assert!(!slots.is_empty()); @@ -268,7 +268,7 @@ fn typed_and_opaque_bitcode_give_identical_spirv() { Err(AssembleError::Rejected(why)) => panic!("metal-as rejected store_const.air.ll: {why}"), }; for stem in M1_PROFILES { - let p = profile(stem, DevicePolicy::default()).expect("profile"); + let p = profile(stem, DevicePolicy::RESIDENT_TABLES).expect("profile"); let a = compile(&opaque, "store_const", &p).expect("opaque"); let b = compile(&typed, "store_const", &p).expect("typed"); assert_eq!(a.module, b.module, "{stem}"); @@ -280,7 +280,7 @@ fn typed_and_opaque_bitcode_give_identical_spirv() { #[test] fn an_over_estimate_is_refused_before_emission() { let Some(bitcode) = store_const() else { return }; - let p = profile("moltenvk-m3", DevicePolicy::default()).expect("profile"); + let p = profile("moltenvk-m3", DevicePolicy::RESIDENT_TABLES).expect("profile"); let a = compile(&bitcode, "store_const", &p).expect("compile"); let words = a.module.words.len() as u64; let r = compile_bitcode( @@ -315,7 +315,7 @@ fn the_estimate_bounds_the_emitted_words() { let Some(bitcode) = store_const() else { return }; for stem in M1_PROFILES { let what = stem; - let p = profile(stem, DevicePolicy::default()).expect("profile"); + let p = profile(stem, DevicePolicy::RESIDENT_TABLES).expect("profile"); let plan = plan_bitcode( &bitcode, EntryRef::Name("store_const"), @@ -357,7 +357,7 @@ fn a_loop_kernel_compiles() { return; } }; - let p = profile("moltenvk-m3", DevicePolicy::default()).expect("profile"); + let p = profile("moltenvk-m3", DevicePolicy::RESIDENT_TABLES).expect("profile"); let a = compile(&bitcode, "bounded_loop_word", &p).unwrap_or_else(|e| panic!("{e}")); assert!(!a.facts.contains(&RuntimeFact::ExecutionStatus)); let (_, words) = link_and_validate(&a, &p).unwrap_or_else(|e| panic!("{e}")); @@ -414,7 +414,7 @@ fn a_switch_on_a_dispatch_builtin_is_the_dispatch_familys() { } Err(e) => panic!("llvm-as rejected the inline kernel: {e:?}"), }; - let p = profile("moltenvk-m3", DevicePolicy::default()).expect("profile"); + let p = profile("moltenvk-m3", DevicePolicy::RESIDENT_TABLES).expect("profile"); // The dispatch family lowers the builtin: the selector is the dispatch family's value (a grid // builtin, so the kernel depends on the dispatch grid), and the module passes L3. let a = compile(&bitcode, "switch_on_gid", &p).expect("the dispatch family lowers it"); @@ -426,7 +426,7 @@ fn a_switch_on_a_dispatch_builtin_is_the_dispatch_familys() { /// is refused with a typed error that is never internal (honest intermediate commits). #[test] fn every_public_fixture_compiles_or_refuses_without_an_internal_error() { - let p = profile("moltenvk-m3", DevicePolicy::default()).expect("profile"); + let p = profile("moltenvk-m3", DevicePolicy::RESIDENT_TABLES).expect("profile"); let mut files: Vec<_> = [fixtures_dir(), engine_dir()] .iter() .flat_map(|d| std::fs::read_dir(d).expect("fixtures")) diff --git a/crates/metal2vulkan/src/tests/engine_snapshot_exact.rs b/crates/metal2vulkan/src/tests/engine_snapshot_exact.rs index c7cee9bcb..fc5b94b4e 100644 --- a/crates/metal2vulkan/src/tests/engine_snapshot_exact.rs +++ b/crates/metal2vulkan/src/tests/engine_snapshot_exact.rs @@ -5,8 +5,8 @@ //! whose bound view the binder names the snapshot's form by. //! //! - Every form the binder can name for a `texture2d` slot — the bound -//! view's codes, or the fetched lanes' bits — translates and passes L3 under the default policy. -//! An 8-bit sRGB texture, whose view decodes its codes, keeps the +//! view's codes, or the fetched lanes' bits — translates and passes L3 under the resident-table +//! domains. An 8-bit sRGB texture, whose view decodes its codes, keeps the //! fetched lanes' bits. //! - The copy pairs the form with its fetch's lanes where the invariant lives: a form whose codes //! those lanes do not hold is named, not left to the builder to refuse (a float code form over @@ -172,8 +172,8 @@ fn state(pixel_format: Option) -> BindState { } /// A `texture2d` slot the draw reads through a snapshot translates under -/// every form the binder names for it under the default policy. An 8-bit sRGB texture, whose view -/// decodes its codes, keeps the fetched bits. Each variant passes +/// every form the binder names for it under the resident-table domains. An 8-bit sRGB texture, +/// whose view decodes its codes, keeps the fetched bits. Each variant passes /// L3 and binds the snapshot as a storage image. #[test] fn a_snapshot_slot_translates_under_every_form() { @@ -196,7 +196,7 @@ fn a_snapshot_slot_translates_under_every_form() { ]; for stem in PROFILES { { - let (label, policy) = ("the default", DevicePolicy::default()); + let (label, policy) = ("the default", DevicePolicy::RESIDENT_TABLES); let desc = crate::pipeline::testing::description(stem).expect("description"); let dev = Device::from_queries(desc, policy).expect("device"); let base = dev @@ -244,7 +244,7 @@ fn the_copy_of_a_snapshot_slot_refuses_a_form_its_fetch_s_lanes_do_not_hold() { }; let stem = "intel-irisxe-anv"; let desc = crate::pipeline::testing::description(stem).expect("description"); - let dev = Device::from_queries(desc, DevicePolicy::default()).expect("device"); + let dev = Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES).expect("device"); // The float slot's fragment, and the unsigned integer slot's into an integer attachment. let legs = [ ("uint", "sx_read_u", &uint, PixelFormat::RGBA8Uint, false), @@ -284,7 +284,7 @@ fn the_copy_of_a_snapshot_slot_refuses_a_form_its_fetch_s_lanes_do_not_hold() { } /// The entry's size estimate bounds the words every snapshot copy emits (`lower::fragment`'s -/// `snapshot::SLOT_WORDS`): every form under the default policy. +/// `snapshot::SLOT_WORDS`): every form under the resident-table domains. #[test] fn the_snapshot_estimate_bounds_the_copy_it_emits() { use crate::library::function::FunctionConstantValues; @@ -302,7 +302,7 @@ fn the_snapshot_estimate_bounds_the_copy_it_emits() { let mut checked = 0; for stem in PROFILES { { - let policy = DevicePolicy::default(); + let policy = DevicePolicy::RESIDENT_TABLES; let p = profile(stem, policy).expect("profile"); for form in FORMS { let inputs = inputs(form); diff --git a/crates/metal2vulkan/src/tests/engine_specialized_folds.rs b/crates/metal2vulkan/src/tests/engine_specialized_folds.rs index 268e5bff7..23a5a76c0 100644 --- a/crates/metal2vulkan/src/tests/engine_specialized_folds.rs +++ b/crates/metal2vulkan/src/tests/engine_specialized_folds.rs @@ -42,7 +42,7 @@ fn fixture(stem: &str) -> Option> { fn device() -> Device { let description = description("nvidia-rtx5080-laptop").expect("committed description"); - Device::from_queries(description, DevicePolicy::default()).expect("device") + Device::from_queries(description, DevicePolicy::RESIDENT_TABLES).expect("device") } /// A function constant's value: `ty` with `lanes` as its little-endian lanes of `width` bytes. diff --git a/crates/metal2vulkan/src/tests/engine_specialized_name.rs b/crates/metal2vulkan/src/tests/engine_specialized_name.rs index f26d6e4ae..476b53f70 100644 --- a/crates/metal2vulkan/src/tests/engine_specialized_name.rs +++ b/crates/metal2vulkan/src/tests/engine_specialized_name.rs @@ -56,7 +56,7 @@ fn device() -> Device { .join("../metal2vulkan-validation/profiles/moltenvk-m3.json"); let text = std::fs::read_to_string(path).expect("profile"); let desc = DeviceDescription::from_khronos_json(&text, None).expect("description"); - Device::from_queries(desc, DevicePolicy::default()).expect("device") + Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES).expect("device") } /// `scale` set to `v`. @@ -195,7 +195,7 @@ fn the_specialized_name_and_the_specialization_are_part_of_the_key() { /// resolved by one of them), on the CPU interpreter. fn words(caller: &[u8], linked: &[LinkedSource<'_>]) -> Vec { const N: u32 = 8; - let p = profile("moltenvk-m3", DevicePolicy::default()).expect("profile"); + let p = profile("moltenvk-m3", DevicePolicy::RESIDENT_TABLES).expect("profile"); let (_, m) = typed_module_linked(caller, CALLER, &p, linked).unwrap_or_else(|e| panic!("{e}")); let res = Resources { buffers: vec![Buffer { diff --git a/crates/metal2vulkan/src/tests/engine_spirv_cross_forms.rs b/crates/metal2vulkan/src/tests/engine_spirv_cross_forms.rs index 8cba3cae7..fd7ae0c62 100644 --- a/crates/metal2vulkan/src/tests/engine_spirv_cross_forms.rs +++ b/crates/metal2vulkan/src/tests/engine_spirv_cross_forms.rs @@ -72,7 +72,7 @@ fn devices() -> Vec<(String, Device)> { let stem = p.file_stem().expect("stem").to_string_lossy().into_owned(); let text = std::fs::read_to_string(&p).expect("profile"); let desc = DeviceDescription::from_khronos_json(&text, None).expect("description"); - let dev = Device::from_queries(desc, DevicePolicy::default()).expect("device"); + let dev = Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES).expect("device"); (stem, dev) }) .collect(); diff --git a/crates/metal2vulkan/src/tests/engine_srgb_decode.rs b/crates/metal2vulkan/src/tests/engine_srgb_decode.rs index cd7ae2b4e..66d86e177 100644 --- a/crates/metal2vulkan/src/tests/engine_srgb_decode.rs +++ b/crates/metal2vulkan/src/tests/engine_srgb_decode.rs @@ -221,11 +221,11 @@ fn inputs(variant: bool) -> LowerInputs { } fn lavapipe() -> crate::device::profile::DeviceProfile { - profile("lavapipe", DevicePolicy::default()).expect("profile") + profile("lavapipe", DevicePolicy::RESIDENT_TABLES).expect("profile") } fn m3() -> crate::device::profile::DeviceProfile { - profile("moltenvk-m3", DevicePolicy::default()).expect("profile") + profile("moltenvk-m3", DevicePolicy::RESIDENT_TABLES).expect("profile") } /// The plan of a slot bound with a swizzle in an 8-bit sRGB format the device holds as its UNORM @@ -621,7 +621,7 @@ fn devices() -> Vec<(String, Device)> { let desc = DeviceDescription::from_khronos_json(&text, None).expect("description"); out.push(( stem, - Device::from_queries(desc, DevicePolicy::default()).expect("device"), + Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES).expect("device"), )); } out.sort_by(|a, b| a.0.cmp(&b.0)); diff --git a/crates/metal2vulkan/src/tests/engine_stage_io.rs b/crates/metal2vulkan/src/tests/engine_stage_io.rs index a4eed91b9..18382420d 100644 --- a/crates/metal2vulkan/src/tests/engine_stage_io.rs +++ b/crates/metal2vulkan/src/tests/engine_stage_io.rs @@ -48,7 +48,7 @@ fn fixture() -> Option> { } fn prof(stem: &str) -> crate::device::DeviceProfile { - profile(stem, DevicePolicy::default()).expect("committed profile") + profile(stem, DevicePolicy::RESIDENT_TABLES).expect("committed profile") } /// Whether `words` hold an `OpDecorate Invariant` (opcode 71, decoration 18). @@ -262,7 +262,7 @@ fn feature_dependent_entries_name_their_capability() { let Some(bc) = fixture() else { return }; let floor = prof("runtime-floor"); let needs = |entry: &str, feature: Feature, without: F| { - let p = profile_without("runtime-floor", &[without], DevicePolicy::default()) + let p = profile_without("runtime-floor", &[without], DevicePolicy::RESIDENT_TABLES) .expect("below the runtime's floor"); match compile(&bc, entry, &p) { Err(Error::Unsupported(u)) => { @@ -303,7 +303,7 @@ fn feature_dependent_entries_name_their_capability() { F::ShaderTessellationAndGeometryPointSize, F::MultiviewTessellationShader, ], - DevicePolicy::default(), + DevicePolicy::RESIDENT_TABLES, ) .expect("below the runtime's floor"); let a = compile(&bc, "stage_io_fragment_primitive", &untessellated).expect("primitive"); diff --git a/crates/metal2vulkan/src/tests/engine_stage_io_tail.rs b/crates/metal2vulkan/src/tests/engine_stage_io_tail.rs index dfe618165..1a214369d 100644 --- a/crates/metal2vulkan/src/tests/engine_stage_io_tail.rs +++ b/crates/metal2vulkan/src/tests/engine_stage_io_tail.rs @@ -58,7 +58,7 @@ fn fixture() -> Option> { } fn prof(stem: &str) -> DeviceProfile { - profile(stem, DevicePolicy::default()).expect("committed profile") + profile(stem, DevicePolicy::RESIDENT_TABLES).expect("committed profile") } /// Link `a` alone, relocate it, and run L3; the relocated words. @@ -202,7 +202,7 @@ fn a_fragment_primitive_id_takes_the_enabled_alternative() { F::ShaderTessellationAndGeometryPointSize, F::MultiviewTessellationShader, ], - DevicePolicy::default(), + DevicePolicy::RESIDENT_TABLES, ) .expect("below the runtime's floor"); let a = compile(&bc, "tail_fragment_primitive", &floor).expect("floor"); @@ -241,7 +241,7 @@ fn fragment_layer_and_viewport_inputs_take_the_enabled_alternatives() { validate(&a, &p); } let viewport = [F::ShaderOutputViewportIndex, F::MultiViewport]; - let floor = profile_without("runtime-floor", &viewport, DevicePolicy::default()) + let floor = profile_without("runtime-floor", &viewport, DevicePolicy::RESIDENT_TABLES) .expect("below the runtime's floor"); let a = compile(&bc, "tail_fragment_layer", &floor).expect("floor"); let io = &a.interface.io; @@ -260,7 +260,7 @@ fn fragment_layer_and_viewport_inputs_take_the_enabled_alternatives() { let below = profile_without( "runtime-floor", &[viewport.as_slice(), &[F::ShaderOutputLayer]].concat(), - DevicePolicy::default(), + DevicePolicy::RESIDENT_TABLES, ) .expect("below the runtime's floor"); let a = compile(&bc, "tail_fragment_layer", &below).expect("below the floor"); diff --git a/crates/metal2vulkan/src/tests/engine_stage_root_attributes.rs b/crates/metal2vulkan/src/tests/engine_stage_root_attributes.rs index 55da6522e..460754af3 100644 --- a/crates/metal2vulkan/src/tests/engine_stage_root_attributes.rs +++ b/crates/metal2vulkan/src/tests/engine_stage_root_attributes.rs @@ -218,7 +218,7 @@ fn device() -> Device { let text = std::fs::read_to_string(&path).unwrap_or_else(|e| panic!("{}: {e}", path.display())); let description = DeviceDescription::from_khronos_json(&text, None).expect("nvidia-rtx5080-laptop"); - Device::from_queries(description, DevicePolicy::default()).expect("nvidia-rtx5080-laptop") + Device::from_queries(description, DevicePolicy::RESIDENT_TABLES).expect("nvidia-rtx5080-laptop") } /// Load `bitcode` as a library and compile its one function: the first refusal on the way, from diff --git a/crates/metal2vulkan/src/tests/engine_stencil.rs b/crates/metal2vulkan/src/tests/engine_stencil.rs index 77424a8fd..1348244dc 100644 --- a/crates/metal2vulkan/src/tests/engine_stencil.rs +++ b/crates/metal2vulkan/src/tests/engine_stencil.rs @@ -59,7 +59,7 @@ fn device_without(stem: &str, features: &[VkFeature]) -> Device { for f in features { desc.features.remove(f); } - Device::from_queries(desc, DevicePolicy::default()).expect("device") + Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES).expect("device") } /// On every committed profile the output is the direct `FragStencilRefEXT` where the device has diff --git a/crates/metal2vulkan/src/tests/engine_stitched.rs b/crates/metal2vulkan/src/tests/engine_stitched.rs index 2f2b31960..6ba888611 100644 --- a/crates/metal2vulkan/src/tests/engine_stitched.rs +++ b/crates/metal2vulkan/src/tests/engine_stitched.rs @@ -65,7 +65,7 @@ fn device() -> Device { .join("../metal2vulkan-validation/profiles/moltenvk-m3.json"); let text = std::fs::read_to_string(path).expect("profile"); let desc = DeviceDescription::from_khronos_json(&text, None).expect("description"); - Device::from_queries(desc, DevicePolicy::default()).expect("device") + Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES).expect("device") } /// The stitched library holds `fused` and `fused4` as visible functions, each in its own module, @@ -108,7 +108,7 @@ fn a_stitched_function_links_privately_or_not() { /// on the CPU interpreter. fn word(caller: &[u8], kernel: &str, (name, module): (&str, &[u8]), input: [f32; 4]) -> f32 { let none = FunctionConstantValues::defaults(); - let p = profile("moltenvk-m3", DevicePolicy::default()).expect("profile"); + let p = profile("moltenvk-m3", DevicePolicy::RESIDENT_TABLES).expect("profile"); let linked = [LinkedSource::new(name, module, &none)]; let (_, m) = typed_module_linked(caller, kernel, &p, &linked).unwrap_or_else(|e| panic!("{e}")); let slot = |index| { diff --git a/crates/metal2vulkan/src/tests/engine_storage_view_variant.rs b/crates/metal2vulkan/src/tests/engine_storage_view_variant.rs index 5be7822b4..c40db642f 100644 --- a/crates/metal2vulkan/src/tests/engine_storage_view_variant.rs +++ b/crates/metal2vulkan/src/tests/engine_storage_view_variant.rs @@ -30,7 +30,7 @@ use crate::pipeline::{ /// Profile F: `runtime-floor` without device addresses, below the runtime's floor. fn profile_f() -> Device { - crate::pipeline::testing::device_f(DevicePolicy::default()).expect("Profile F") + crate::pipeline::testing::device_f(DevicePolicy::RESIDENT_TABLES).expect("Profile F") } fn assembled(result: Result, AssembleError>, name: &str) -> Option> { diff --git a/crates/metal2vulkan/src/tests/engine_swizzled_storage.rs b/crates/metal2vulkan/src/tests/engine_swizzled_storage.rs index 70d67a490..e28846566 100644 --- a/crates/metal2vulkan/src/tests/engine_swizzled_storage.rs +++ b/crates/metal2vulkan/src/tests/engine_swizzled_storage.rs @@ -317,7 +317,7 @@ fn profiles() -> Vec<(String, DeviceProfile)> { for f in &all { desc.features.remove(f); } - let p = Device::from_queries(desc, DevicePolicy::default()) + let p = Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES) .expect("device") .profile() .clone(); @@ -699,7 +699,8 @@ fn devices() -> Vec<(String, Device)> { let desc = DeviceDescription::from_khronos_json(&text, None).expect("description"); out.push(( stem, - Device::from_queries(desc, crate::device::DevicePolicy::default()).expect("device"), + Device::from_queries(desc, crate::device::DevicePolicy::RESIDENT_TABLES) + .expect("device"), )); } out.sort_by(|a, b| a.0.cmp(&b.0)); diff --git a/crates/metal2vulkan/src/tests/engine_tables.rs b/crates/metal2vulkan/src/tests/engine_tables.rs index 69fdc08d2..c4bda8c6a 100644 --- a/crates/metal2vulkan/src/tests/engine_tables.rs +++ b/crates/metal2vulkan/src/tests/engine_tables.rs @@ -64,7 +64,7 @@ fn device(stem: &str) -> Device { .join(format!("{stem}.json")); let text = std::fs::read_to_string(path).expect("profile"); let desc = DeviceDescription::from_khronos_json(&text, None).expect("description"); - Device::from_queries(desc, DevicePolicy::default()).expect("device") + Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES).expect("device") } /// The four functions of the functions module, in `functions` in [`LINKED`] order. @@ -81,7 +81,7 @@ fn compile( linked: &[LinkedSource<'_>], stem: &str, ) -> Result, Error> { - let p = profile(stem, DevicePolicy::default()).expect("profile"); + let p = profile(stem, DevicePolicy::RESIDENT_TABLES).expect("profile"); compile_bitcode_linked( caller, EntryRef::Name(entry), @@ -148,7 +148,7 @@ fn a_table_call_without_a_function_of_its_type_reads_null_entries() { }; let none = FunctionConstantValues::defaults(); let half = [LinkedSource::new("table_half", &functions, &none)]; - let p = profile("moltenvk-m3", DevicePolicy::default()).expect("profile"); + let p = profile("moltenvk-m3", DevicePolicy::RESIDENT_TABLES).expect("profile"); let two = FunctionTableWords::new(2).to_bytes(); let empty: &[LinkedSource<'_>] = &[]; for linked in [empty, &half] { @@ -225,7 +225,7 @@ fn a_table_call_calls_the_entry_the_table_holds() { }; let none = FunctionConstantValues::defaults(); let linked = sources(&functions, &none); - let p = profile("moltenvk-m3", DevicePolicy::default()).expect("profile"); + let p = profile("moltenvk-m3", DevicePolicy::RESIDENT_TABLES).expect("profile"); let (_, m) = typed_module_linked(&caller, TABLE, &p, &linked).expect("module"); const N: u32 = 40; let mut table = FunctionTableWords::new(5); @@ -280,7 +280,7 @@ fn a_table_holds_a_binary_function_of_another_s_name() { let lib = Library::from_air(&functions).expect("library"); let other_lib = Library::from_air(&other).expect("library"); let none = FunctionConstantValues::defaults(); - let p = profile("moltenvk-m3", DevicePolicy::default()).expect("profile"); + let p = profile("moltenvk-m3", DevicePolicy::RESIDENT_TABLES).expect("profile"); let own = LinkedFunction::new(lib.function("table_add").expect("function")); let others = LinkedFunction::new(other_lib.function("table_add").expect("function")); const N: u32 = 8; @@ -332,7 +332,7 @@ fn null_and_empty_tables_are_observed() { }; let none = FunctionConstantValues::defaults(); let linked = sources(&functions, &none); - let p = profile("moltenvk-m3", DevicePolicy::default()).expect("profile"); + let p = profile("moltenvk-m3", DevicePolicy::RESIDENT_TABLES).expect("profile"); let (_, m) = typed_module_linked(&caller, TABLE, &p, &linked).expect("module"); assert_eq!(dispatch(&m, 4, None), [0xffff_ffff; 4]); let empty = FunctionTableWords::new(0).to_bytes(); @@ -348,7 +348,7 @@ fn a_function_pointer_argument_calls_its_function() { }; let none = FunctionConstantValues::defaults(); let linked = sources(&functions, &none); - let p = profile("moltenvk-m3", DevicePolicy::default()).expect("profile"); + let p = profile("moltenvk-m3", DevicePolicy::RESIDENT_TABLES).expect("profile"); let (_, m) = typed_module_linked(&caller, POINTER, &p, &linked).expect("module"); const N: u32 = 32; let res = Resources { diff --git a/crates/metal2vulkan/src/tests/engine_target_indices.rs b/crates/metal2vulkan/src/tests/engine_target_indices.rs index ac6be539d..a8c2fb521 100644 --- a/crates/metal2vulkan/src/tests/engine_target_indices.rs +++ b/crates/metal2vulkan/src/tests/engine_target_indices.rs @@ -59,7 +59,7 @@ fn device(stem: &str, withheld: &[F]) -> Device { for f in withheld { desc.features.remove(f); } - Device::from_queries(desc, DevicePolicy::default()).expect("device") + Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES).expect("device") } /// A render pipeline of `vertex` and `fragment` from `bc`, drawing into one color of `format`. diff --git a/crates/metal2vulkan/src/tests/engine_tessellation.rs b/crates/metal2vulkan/src/tests/engine_tessellation.rs index dac98518c..a71dcbc48 100644 --- a/crates/metal2vulkan/src/tests/engine_tessellation.rs +++ b/crates/metal2vulkan/src/tests/engine_tessellation.rs @@ -84,7 +84,7 @@ fn assemble_text(name: &str, text: &str) -> Option> { } fn prof(stem: &str) -> DeviceProfile { - profile(stem, DevicePolicy::default()).expect("committed profile") + profile(stem, DevicePolicy::RESIDENT_TABLES).expect("committed profile") } fn compile( @@ -753,7 +753,7 @@ fn device(stem: &str) -> Device { desc.features.remove(&f); } } - Device::from_queries(desc, DevicePolicy::default()).expect("device") + Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES).expect("device") } /// A render pipeline of post-tessellation function `vertex` of the fixture, with fragment @@ -1373,7 +1373,7 @@ fn under_the_identity_domains_the_control_stage_reads_the_factors_by_address() { let policy = DevicePolicy { pointer_domain: PointerDomain::Identity, handle_domain: HandleDomain::Identity, - ..DevicePolicy::default() + ..DevicePolicy::RESIDENT_TABLES }; let streamed = TessellationDescriptor { partition_mode: TessellationPartitionMode::FractionalOdd, diff --git a/crates/metal2vulkan/src/tests/engine_texel_rows.rs b/crates/metal2vulkan/src/tests/engine_texel_rows.rs index c70db413b..c0d0b1963 100644 --- a/crates/metal2vulkan/src/tests/engine_texel_rows.rs +++ b/crates/metal2vulkan/src/tests/engine_texel_rows.rs @@ -61,7 +61,7 @@ fn bitcode() -> Option> { } fn lavapipe() -> DeviceProfile { - profile("lavapipe", DevicePolicy::default()).expect("profile") + profile("lavapipe", DevicePolicy::RESIDENT_TABLES).expect("profile") } /// The rows variant's inputs: slot 0's rows. diff --git a/crates/metal2vulkan/src/tests/engine_texture.rs b/crates/metal2vulkan/src/tests/engine_texture.rs index a7dfb8274..7c08aa00b 100644 --- a/crates/metal2vulkan/src/tests/engine_texture.rs +++ b/crates/metal2vulkan/src/tests/engine_texture.rs @@ -292,7 +292,7 @@ fn texel_buffers_are_buffer_images() { let Some(bc) = fixture("texture_ops") else { return; }; - let p = profile("moltenvk-m3", DevicePolicy::default()).expect("profile"); + let p = profile("moltenvk-m3", DevicePolicy::RESIDENT_TABLES).expect("profile"); let a = ok(compile(&bc, "texel_buffers", &p), &p, "texel_buffers"); for i in [0, 1] { assert!(a.facts.contains(&RuntimeFact::TexelBufferRange { @@ -532,7 +532,7 @@ fn a_half_texel_write_s_nan_into_wide_and_small_float_images_is_the_device_s() { .join(format!("{stem}.json")); let text = std::fs::read_to_string(&path).expect("profile"); let desc = DeviceDescription::from_khronos_json(&text, None).expect("description"); - Device::from_queries(desc, DevicePolicy::default()) + Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES) .expect("device") .profile() .clone() @@ -719,7 +719,7 @@ fn without(stem: &str, drop: &[VkFeature]) -> DeviceProfile { for f in drop { desc.features.remove(f); } - Device::from_queries(desc, DevicePolicy::default()) + Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES) .expect("device") .profile() .clone() @@ -828,7 +828,7 @@ fn unmodelled_texture_forms_are_refused() { other => panic!("{stem}: write_lod {:?}", other.map(|_| ())), } } - let p = profile("moltenvk-m3", DevicePolicy::default()).expect("profile"); + let p = profile("moltenvk-m3", DevicePolicy::RESIDENT_TABLES).expect("profile"); // A read whose status word is read. let status = "%st = extractvalue { <4 x float>, i8 } %r, 1\n %w = zext i8 %st to i32\n store i32 %w, ptr addrspace(1) %out, align 4"; let Some(bc) = assemble("status", &read_kernel(status)) else { @@ -1232,7 +1232,7 @@ fn a_nil_textures_arm_is_counted_apart() { return; }; for (stem, p) in - committed_profiles_with(crate::device::DevicePolicy::default()).expect("profiles") + committed_profiles_with(crate::device::DevicePolicy::RESIDENT_TABLES).expect("profiles") { let census = |name: &str| nil_census(&bc, name, &p, &stem); let direct = census("direct"); diff --git a/crates/metal2vulkan/src/tests/engine_texture_atomic_unk.rs b/crates/metal2vulkan/src/tests/engine_texture_atomic_unk.rs index 6fb5ade75..1c7c4f2ee 100644 --- a/crates/metal2vulkan/src/tests/engine_texture_atomic_unk.rs +++ b/crates/metal2vulkan/src/tests/engine_texture_atomic_unk.rs @@ -112,7 +112,7 @@ fn unrobust(stem: &str) -> DeviceProfile { ] { desc.features.remove(&f); } - Device::from_queries(desc, DevicePolicy::default()) + Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES) .expect("device") .profile() .clone() diff --git a/crates/metal2vulkan/src/tests/engine_texture_interp.rs b/crates/metal2vulkan/src/tests/engine_texture_interp.rs index 5f8fbb873..0ced7f5fd 100644 --- a/crates/metal2vulkan/src/tests/engine_texture_interp.rs +++ b/crates/metal2vulkan/src/tests/engine_texture_interp.rs @@ -56,7 +56,7 @@ fn without(stem: &str, drop: &[VkFeature]) -> DeviceProfile { for f in drop { desc.features.remove(f); } - Device::from_queries(desc, crate::device::DevicePolicy::default()) + Device::from_queries(desc, crate::device::DevicePolicy::RESIDENT_TABLES) .expect("device") .profile() .clone() @@ -392,7 +392,7 @@ fn limited(stem: &str, limit: u32, drop: &[VkFeature]) -> DeviceProfile { for f in drop { desc.features.remove(f); } - Device::from_queries(desc, crate::device::DevicePolicy::default()) + Device::from_queries(desc, crate::device::DevicePolicy::RESIDENT_TABLES) .expect("device") .profile() .clone() diff --git a/crates/metal2vulkan/src/tests/engine_texture_levels.rs b/crates/metal2vulkan/src/tests/engine_texture_levels.rs index 2d3571b56..c3a95cf85 100644 --- a/crates/metal2vulkan/src/tests/engine_texture_levels.rs +++ b/crates/metal2vulkan/src/tests/engine_texture_levels.rs @@ -703,7 +703,7 @@ fn without(stem: &str, drop: &[VkFeature]) -> DeviceProfile { for f in drop { desc.features.remove(f); } - Device::from_queries(desc, DevicePolicy::default()) + Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES) .expect("device") .profile() .clone() @@ -1136,7 +1136,7 @@ fn level_views_declare_every_level_of_the_largest_texture() { let uniform_only = crate::pipeline::testing::profile_without( "runtime-floor", &[VkFeature::ShaderStorageImageArrayNonUniformIndexing], - DevicePolicy::default(), + DevicePolicy::RESIDENT_TABLES, ) .expect("profile"); profiles.push(( @@ -1300,7 +1300,7 @@ fn an_atomic_slot_with_level_views_is_refused() { let Some(bc) = assemble("atomic_and_level", ATOMIC_AND_LEVEL) else { return; }; - let p = profile("moltenvk-m3", DevicePolicy::default()).expect("profile"); + let p = profile("moltenvk-m3", DevicePolicy::RESIDENT_TABLES).expect("profile"); let want = Unsupported::not_implemented(Feature::Lowering(LowerFamily::Texture)); match compile(&bc, "k", &p) { Err(e) if is(&e, &want) => {} @@ -1341,7 +1341,7 @@ fn a_constant_level_past_every_texture_is_indexed_as_a_dynamic_one() { crate::pipeline::testing::profile_without( "runtime-floor", &[crate::device::requirements::VkFeature::ShaderStorageImageArrayNonUniformIndexing], - DevicePolicy::default(), + DevicePolicy::RESIDENT_TABLES, ) .expect("below the runtime's floor"), )); @@ -1436,7 +1436,7 @@ fn device(stem: &str) -> Device { .join(format!("{stem}.json")); let text = std::fs::read_to_string(path).expect("profile"); let desc = DeviceDescription::from_khronos_json(&text, None).expect("description"); - Device::from_queries(desc, DevicePolicy::default()).expect("device") + Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES).expect("device") } fn pipeline(dev: &Device, bc: &[u8], entry: &str) -> ComputePipeline { @@ -1487,7 +1487,7 @@ fn the_binder_binds_each_level_and_pushes_the_count() { }; for stem in ["moltenvk-m3", "lavapipe"] { let dev = device(stem); - let p = profile(stem, DevicePolicy::default()).expect("profile"); + let p = profile(stem, DevicePolicy::RESIDENT_TABLES).expect("profile"); let pipe = pipeline(&dev, &bc, "txt_level_write"); let (_, m) = typed_module(&bc, "txt_level_write", &p).expect("module"); let n = max_levels(&p, ImageDim::D2); @@ -1623,7 +1623,7 @@ fn the_binder_specializes_a_level_reads_alpha_from_the_bound_format() { let texel = [fl(1.0), fl(2.0), fl(3.0), fl(4.0)]; for stem in ["moltenvk-m3", "lavapipe"] { let dev = device(stem); - let p = profile(stem, DevicePolicy::default()).expect("profile"); + let p = profile(stem, DevicePolicy::RESIDENT_TABLES).expect("profile"); assert!(p.fields().images.robust_image_access2, "{stem}"); let pipe = pipeline(&dev, &bc, "read_level"); let (_, m) = typed_module(&bc, "read_level", &p).expect("module"); @@ -1773,7 +1773,7 @@ fn level_slots_bind_textures_of_every_usage_the_device_can_hold() { }; let stem = "moltenvk-m3"; let dev = device(stem); - let p = profile(stem, DevicePolicy::default()).expect("profile"); + let p = profile(stem, DevicePolicy::RESIDENT_TABLES).expect("profile"); let pipe = pipeline(&dev, &bc, "txt_level_write"); let n = max_levels(&p, ImageDim::D2); let with_usage = |levels: Option, usage: TextureUsage| { diff --git a/crates/metal2vulkan/src/tests/engine_texture_oob.rs b/crates/metal2vulkan/src/tests/engine_texture_oob.rs index 7a864a2a6..0658d85b9 100644 --- a/crates/metal2vulkan/src/tests/engine_texture_oob.rs +++ b/crates/metal2vulkan/src/tests/engine_texture_oob.rs @@ -1131,7 +1131,7 @@ fn device(stem: &str, drop: &[VkFeature]) -> Device { for f in drop { desc.features.remove(f); } - Device::from_queries(desc, DevicePolicy::default()).expect("device") + Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES).expect("device") } /// Every committed profile, one with `robustImageAccess` but not `robustImageAccess2`, and two diff --git a/crates/metal2vulkan/src/tests/engine_texture_tail.rs b/crates/metal2vulkan/src/tests/engine_texture_tail.rs index f53c975bd..9368de589 100644 --- a/crates/metal2vulkan/src/tests/engine_texture_tail.rs +++ b/crates/metal2vulkan/src/tests/engine_texture_tail.rs @@ -411,7 +411,7 @@ fn status_words_with_another_bit_observed_are_refused() { .chain([stored]) .collect(); for stem in ["moltenvk-m3", "lavapipe"] { - let p = profile(stem, DevicePolicy::default()).expect("profile"); + let p = profile(stem, DevicePolicy::RESIDENT_TABLES).expect("profile"); for (name, merge) in &observing { let Some(bc) = assemble(name, &merged_reads(merge, "")) else { return; @@ -691,7 +691,7 @@ fn without_robust_images(stem: &str) -> DeviceProfile { let mut desc = DeviceDescription::from_khronos_json(&text, None).expect("description"); desc.features.remove(&VkFeature::RobustImageAccess); desc.features.remove(&VkFeature::RobustImageAccess2); - Device::from_queries(desc, DevicePolicy::default()) + Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES) .expect("device") .profile() .clone() @@ -971,7 +971,7 @@ fn texture_atomic_max_is_an_image_atomic() { crate::device::requirements::VkFeature::RobustImageAccess, crate::device::requirements::VkFeature::RobustImageAccess2, ], - crate::device::DevicePolicy::default(), + crate::device::DevicePolicy::RESIDENT_TABLES, ) .expect("below the runtime's floor"), )); @@ -1059,7 +1059,7 @@ fn texture_atomic_max_is_an_image_atomic() { /// refusal; a storage choice other than the `R32` format of the texel's type is not representable. #[test] fn texture_atomic_lanes_lower_and_unestablished_operands_are_refused() { - let p = profile("moltenvk-m3", DevicePolicy::default()).expect("profile"); + let p = profile("moltenvk-m3", DevicePolicy::RESIDENT_TABLES).expect("profile"); let wide = "%o = extractelement <4 x i32> %old, i64 1\n store i32 %o, ptr addrspace(1) %out, align 4"; let whole = "%o = bitcast <4 x i32> %old to <2 x i64>\n %w = extractelement <2 x i64> %o, i64 0\n %n = trunc i64 %w to i32\n store i32 %n, ptr addrspace(1) %out, align 4"; diff --git a/crates/metal2vulkan/src/tests/engine_texture_ulong.rs b/crates/metal2vulkan/src/tests/engine_texture_ulong.rs index bb1bd97e7..f60ba0519 100644 --- a/crates/metal2vulkan/src/tests/engine_texture_ulong.rs +++ b/crates/metal2vulkan/src/tests/engine_texture_ulong.rs @@ -97,7 +97,7 @@ fn without(stem: &str, drop: &[VkFeature]) -> DeviceProfile { for f in drop { desc.features.remove(f); } - Device::from_queries(desc, DevicePolicy::default()) + Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES) .expect("device") .profile() .clone() @@ -661,7 +661,7 @@ fn a_device_lacking_only_the_r64_atomic_format_bit_refuses_typed() { vk::FormatFeatureFlags2::STORAGE_IMAGE_ATOMIC }; *flags = vk::FormatFeatureFlags2::from_raw(flags.as_raw() & !bit.as_raw()); - let p = Device::from_queries(desc, DevicePolicy::default()) + let p = Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES) .expect("device") .profile() .clone(); @@ -755,7 +755,7 @@ fn device(stem: &str) -> Device { .join(format!("{stem}.json")); let text = std::fs::read_to_string(path).expect("profile"); let desc = DeviceDescription::from_khronos_json(&text, None).expect("description"); - Device::from_queries(desc, DevicePolicy::default()).expect("device") + Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES).expect("device") } fn pipeline(dev: &Device, bc: &[u8], entry: &str) -> ComputePipeline { diff --git a/crates/metal2vulkan/src/tests/engine_texture_unit_bit_test.rs b/crates/metal2vulkan/src/tests/engine_texture_unit_bit_test.rs index ffda83fe0..45c671989 100644 --- a/crates/metal2vulkan/src/tests/engine_texture_unit_bit_test.rs +++ b/crates/metal2vulkan/src/tests/engine_texture_unit_bit_test.rs @@ -29,7 +29,7 @@ fn fixture() -> Option> { /// The fixture's kernel as the compile specializes it for profile `stem`, printed. fn specialized(bc: &[u8], stem: &str) -> String { - let p = profile(stem, DevicePolicy::default()).expect("profile"); + let p = profile(stem, DevicePolicy::RESIDENT_TABLES).expect("profile"); let none = FunctionConstantValues::defaults(); match specialized_entry(bc, ENTRY, &p, &none, &[], &mut meter()) { Ok(e) => print(&e.module), @@ -47,7 +47,7 @@ fn a_cube_sample_no_picked_unit_reaches_is_deleted() { let text = specialized(&bc, stem); let dev = Device::from_queries( description(stem).expect("committed description"), - DevicePolicy::default(), + DevicePolicy::RESIDENT_TABLES, ) .expect("device"); let d = ComputePipelineDescriptor::new(StageSource::Function(FunctionDescriptor::new( diff --git a/crates/metal2vulkan/src/tests/engine_texture_unk.rs b/crates/metal2vulkan/src/tests/engine_texture_unk.rs index 93f1bb087..2197a5a03 100644 --- a/crates/metal2vulkan/src/tests/engine_texture_unk.rs +++ b/crates/metal2vulkan/src/tests/engine_texture_unk.rs @@ -55,7 +55,7 @@ fn unrobust(stem: &str) -> DeviceProfile { ] { desc.features.remove(&f); } - Device::from_queries(desc, DevicePolicy::default()) + Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES) .expect("device") .profile() .clone() diff --git a/crates/metal2vulkan/src/tests/engine_threadgroup_floats.rs b/crates/metal2vulkan/src/tests/engine_threadgroup_floats.rs index 9c786e65e..eb1fdb962 100644 --- a/crates/metal2vulkan/src/tests/engine_threadgroup_floats.rs +++ b/crates/metal2vulkan/src/tests/engine_threadgroup_floats.rs @@ -48,7 +48,7 @@ const HEADER: &str = "target datalayout = \"e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16 /// `stem` through `Device::from_queries`. fn queried_device(stem: &str) -> Device { let desc = description(stem).expect("description"); - Device::from_queries(desc, DevicePolicy::default()).expect("device") + Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES).expect("device") } fn queried(stem: &str) -> DeviceProfile { diff --git a/crates/metal2vulkan/src/tests/engine_tile.rs b/crates/metal2vulkan/src/tests/engine_tile.rs index 8513eec50..58b71dca7 100644 --- a/crates/metal2vulkan/src/tests/engine_tile.rs +++ b/crates/metal2vulkan/src/tests/engine_tile.rs @@ -567,8 +567,8 @@ fn a_float_attachment_is_bound_through_its_bits() { #[test] fn a_tile_functions_threadgroup_memory_is_its_tiles() { use crate::pipeline::testing::fixtures_dir; - let p = - crate::pipeline::testing::profile("moltenvk-m3", DevicePolicy::default()).expect("profile"); + let p = crate::pipeline::testing::profile("moltenvk-m3", DevicePolicy::RESIDENT_TABLES) + .expect("profile"); let dev = device("moltenvk-m3"); let mut assembled = Vec::new(); for (path, entry) in [ @@ -891,7 +891,7 @@ fn a_tile_pipeline_places_its_threadgroup_arguments() { let text = std::fs::read_to_string(path).expect("profile"); let mut desc = DeviceDescription::from_khronos_json(&text, None).expect("description"); desc.limits.max_storage_buffer_range = 256; - let dev = Device::from_queries(desc, DevicePolicy::default()).expect("device"); + let dev = Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES).expect("device"); let pipe = dev .compile_tile_pipeline(&d, &Budget::standard()) .expect("a tile pipeline"); @@ -910,7 +910,7 @@ fn device(stem: &str) -> Device { .join(format!("{stem}.json")); let text = std::fs::read_to_string(path).expect("profile"); let desc = DeviceDescription::from_khronos_json(&text, None).expect("description"); - Device::from_queries(desc, DevicePolicy::default()).expect("device") + Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES).expect("device") } fn descriptor( diff --git a/crates/metal2vulkan/src/tests/engine_tiny_products.rs b/crates/metal2vulkan/src/tests/engine_tiny_products.rs index 3a68b6580..f17c786d3 100644 --- a/crates/metal2vulkan/src/tests/engine_tiny_products.rs +++ b/crates/metal2vulkan/src/tests/engine_tiny_products.rs @@ -140,7 +140,7 @@ fn interpret(bc: &[u8], entry: &str, p: &DeviceProfile, threads: &[Thread]) -> V /// the interpreter does. fn keeping() -> Vec<(String, DeviceProfile)> { let mut seen = BTreeSet::new(); - committed_profiles_with(DevicePolicy::default()) + committed_profiles_with(DevicePolicy::RESIDENT_TABLES) .expect("profiles") .into_iter() .filter(|(_, p)| seen.insert(fma::float_route(p))) @@ -164,7 +164,7 @@ fn a_tiny_product_is_the_device_s() { let Some(bc) = assemble(entry) else { return; }; - for (stem, p) in committed_profiles_with(DevicePolicy::default()).expect("profiles") { + for (stem, p) in committed_profiles_with(DevicePolicy::RESIDENT_TABLES).expect("profiles") { let what = format!("{entry} on {stem}"); let a = compile(&bc, entry, &p).unwrap_or_else(|e| panic!("{what}: {e:?}")); link_and_validate(&a, &p).unwrap_or_else(|e| panic!("{what}: L3: {e}")); @@ -213,7 +213,7 @@ fn the_fast_entry_keeps_no_zero_signs() { let Some(bc) = assemble(entry) else { return; }; - for (stem, p) in committed_profiles_with(DevicePolicy::default()).expect("profiles") { + for (stem, p) in committed_profiles_with(DevicePolicy::RESIDENT_TABLES).expect("profiles") { let what = format!("{entry} on {stem}"); let a = compile(&bc, entry, &p).unwrap_or_else(|e| panic!("{what}: {e:?}")); let (_, words) = link_and_validate(&a, &p).unwrap_or_else(|e| panic!("{what}: L3: {e}")); diff --git a/crates/metal2vulkan/src/tests/engine_typed_clamp.rs b/crates/metal2vulkan/src/tests/engine_typed_clamp.rs index 0442bb2ba..8d1429eb0 100644 --- a/crates/metal2vulkan/src/tests/engine_typed_clamp.rs +++ b/crates/metal2vulkan/src/tests/engine_typed_clamp.rs @@ -39,7 +39,7 @@ const PROFILES: [&str; 3] = ["moltenvk-m3", "runtime-floor", "lavapipe"]; const DATALAYOUT: &str = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v16:16:16-v24:32:32-v32:32:32-v48:64:64-v64:64:64-v96:128:128-v128:128:128-v192:256:256-v256:256:256-v512:512:512-v1024:1024:1024-n8:16:32"; fn p(stem: &str) -> DeviceProfile { - profile(stem, DevicePolicy::default()).expect("profile") + profile(stem, DevicePolicy::RESIDENT_TABLES).expect("profile") } fn assemble(name: &str, body: &str) -> Option> { diff --git a/crates/metal2vulkan/src/tests/engine_typed_threadgroup.rs b/crates/metal2vulkan/src/tests/engine_typed_threadgroup.rs index 3812f0287..90db5afe3 100644 --- a/crates/metal2vulkan/src/tests/engine_typed_threadgroup.rs +++ b/crates/metal2vulkan/src/tests/engine_typed_threadgroup.rs @@ -35,7 +35,7 @@ const PROFILES: [&str; 3] = ["moltenvk-m3", "runtime-floor", "lavapipe"]; const DATALAYOUT: &str = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v16:16:16-v24:32:32-v32:32:32-v48:64:64-v64:64:64-v96:128:128-v128:128:128-v192:256:256-v256:256:256-v512:512:512-v1024:1024:1024-n8:16:32"; fn p(stem: &str) -> DeviceProfile { - profile(stem, DevicePolicy::default()).expect("profile") + profile(stem, DevicePolicy::RESIDENT_TABLES).expect("profile") } fn assemble(name: &str, body: &str) -> Option> { diff --git a/crates/metal2vulkan/src/tests/engine_uniform_varyings.rs b/crates/metal2vulkan/src/tests/engine_uniform_varyings.rs index efde0f1d6..d9d51c414 100644 --- a/crates/metal2vulkan/src/tests/engine_uniform_varyings.rs +++ b/crates/metal2vulkan/src/tests/engine_uniform_varyings.rs @@ -186,7 +186,7 @@ fn device(stem: &str) -> Device { .join(format!("{stem}.json")); let text = std::fs::read_to_string(path).expect("profile"); let description = DeviceDescription::from_khronos_json(&text, None).expect("description"); - Device::from_queries(description, DevicePolicy::default()).expect("device") + Device::from_queries(description, DevicePolicy::RESIDENT_TABLES).expect("device") } fn function(bc: &[u8], name: &str) -> FunctionDescriptor { diff --git a/crates/metal2vulkan/src/tests/engine_unread_attribute.rs b/crates/metal2vulkan/src/tests/engine_unread_attribute.rs index 2348aeab1..5e08c6610 100644 --- a/crates/metal2vulkan/src/tests/engine_unread_attribute.rs +++ b/crates/metal2vulkan/src/tests/engine_unread_attribute.rs @@ -102,7 +102,7 @@ fn an_attribute_read_only_into_a_gated_off_varying_needs_no_descriptor_entry() { ] { let dev = Device::from_queries( description(stem).expect("committed description"), - DevicePolicy::default(), + DevicePolicy::RESIDENT_TABLES, ) .expect("device"); let off = compile(&dev, &library, false, 1) diff --git a/crates/metal2vulkan/src/tests/engine_vertex_fetch.rs b/crates/metal2vulkan/src/tests/engine_vertex_fetch.rs index 41d4468c9..99d45e295 100644 --- a/crates/metal2vulkan/src/tests/engine_vertex_fetch.rs +++ b/crates/metal2vulkan/src/tests/engine_vertex_fetch.rs @@ -64,7 +64,7 @@ fn fixture() -> Option> { } fn prof(stem: &str) -> DeviceProfile { - profile(stem, DevicePolicy::default()).expect("committed profile") + profile(stem, DevicePolicy::RESIDENT_TABLES).expect("committed profile") } fn inputs(proj: VertexFetchProjection) -> LoweringInputs { @@ -251,7 +251,7 @@ fn prof_with(stem: &str, change: impl FnOnce(&mut DeviceDescription)) -> DeviceP let text = std::fs::read_to_string(path).expect("profile"); let mut desc = DeviceDescription::from_khronos_json(&text, None).expect("description"); change(&mut desc); - Device::from_queries(desc, DevicePolicy::default()) + Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES) .expect("device") .profile() .clone() @@ -1219,7 +1219,7 @@ fn a_label_pipeline_reads_its_integer_attribute_as_float() { for stem in &stems { let text = std::fs::read_to_string(dir.join(format!("{stem}.json"))).expect("profile"); let desc = DeviceDescription::from_khronos_json(&text, None).expect("description"); - let dev = Device::from_queries(desc, DevicePolicy::default()).expect("device"); + let dev = Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES).expect("device"); let p = match dev.compile_render_pipeline(&d, &Budget::standard()) { Ok(p) => p, // A device without the depth and stencil format (roadmap-2022). diff --git a/crates/metal2vulkan/src/tests/engine_vertex_variants.rs b/crates/metal2vulkan/src/tests/engine_vertex_variants.rs index 287d8b07f..92365ae81 100644 --- a/crates/metal2vulkan/src/tests/engine_vertex_variants.rs +++ b/crates/metal2vulkan/src/tests/engine_vertex_variants.rs @@ -75,7 +75,7 @@ fn fixture() -> Option> { } fn prof() -> DeviceProfile { - profile(PROFILE, DevicePolicy::default()).expect("committed profile") + profile(PROFILE, DevicePolicy::RESIDENT_TABLES).expect("committed profile") } /// Every format of the SDK table a float-class attribute can read, as `cases::vertex_formats` @@ -254,7 +254,7 @@ fn a_pipeline_notes_what_the_device_converts_from_one_translation() { for stem in [PROFILE, "lavapipe", "amd-780m-radv"] { let dev = Device::from_queries( description(stem).expect("committed description"), - DevicePolicy::default(), + DevicePolicy::RESIDENT_TABLES, ) .expect("device"); for entry in [TO_FLOAT4, TO_HALF4] { @@ -471,7 +471,7 @@ fn a_pulled_normalized_decode_notes_the_device_s_product() { fn a_constant_step_binding_compiles_one_module_for_the_whole_sweep() { let Some(bc) = fixture() else { return }; for stem in NATIVE { - let p = profile(stem, DevicePolicy::default()).expect("committed profile"); + let p = profile(stem, DevicePolicy::RESIDENT_TABLES).expect("committed profile"); let got = count(&bc, &p, TO_FLOAT4, VertexStepFunction::Constant); let per_vertex = count(&bc, &p, TO_FLOAT4, VertexStepFunction::PerVertex); assert_eq!(got.creations, 45, "{stem}: the swept formats"); @@ -531,7 +531,7 @@ fn the_integer_attribute_sweep_compiles_two_modules_where_the_constant_step_is_f ]; let stride = SLOT * FORMATS.len() as u32; for stem in NATIVE { - let p = profile(stem, DevicePolicy::default()).expect("committed profile"); + let p = profile(stem, DevicePolicy::RESIDENT_TABLES).expect("committed profile"); let mut projections = BTreeSet::new(); let mut modules = BTreeSet::new(); let mut creations = 0; @@ -580,7 +580,7 @@ fn a_constant_step_is_a_zero_divisor_only_where_a_zero_stride_is_legal() { divisor: 0, }; let derive = |desc: crate::device::DeviceDescription| { - crate::device::Device::from_queries(desc, DevicePolicy::default()) + crate::device::Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES) .expect("the description derives") .profile() .clone() diff --git a/crates/metal2vulkan/src/tests/engine_volatile.rs b/crates/metal2vulkan/src/tests/engine_volatile.rs index 91906f364..2d73eed6c 100644 --- a/crates/metal2vulkan/src/tests/engine_volatile.rs +++ b/crates/metal2vulkan/src/tests/engine_volatile.rs @@ -53,11 +53,11 @@ fn p(stem: &str) -> DeviceProfile { VkFeature::VulkanMemoryModel, VkFeature::VulkanMemoryModelDeviceScope, ], - DevicePolicy::default(), + DevicePolicy::RESIDENT_TABLES, ) .expect("below the runtime's floor"); } - profile(stem, DevicePolicy::default()).expect("profile") + profile(stem, DevicePolicy::RESIDENT_TABLES).expect("profile") } fn assemble(name: &str, text: &str) -> Option> { diff --git a/crates/metal2vulkan/src/tests/engine_wide.rs b/crates/metal2vulkan/src/tests/engine_wide.rs index db66d8d58..12918bbb5 100644 --- a/crates/metal2vulkan/src/tests/engine_wide.rs +++ b/crates/metal2vulkan/src/tests/engine_wide.rs @@ -59,7 +59,7 @@ fn moltenvk(int64: bool) -> DeviceProfile { if !int64 { assert!(desc.features.remove(&VkFeature::ShaderInt64)); } - let p = Device::from_queries(desc, DevicePolicy::default()) + let p = Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES) .expect("device") .profile() .clone(); diff --git a/crates/metal2vulkan/src/tests/engine_widest_pin.rs b/crates/metal2vulkan/src/tests/engine_widest_pin.rs index d57367f77..076716239 100644 --- a/crates/metal2vulkan/src/tests/engine_widest_pin.rs +++ b/crates/metal2vulkan/src/tests/engine_widest_pin.rs @@ -66,7 +66,7 @@ fn the_widest_pin_rule_picks_each_shuffle_kernel_s_tier_per_profile() { ] { let dev = Device::from_queries( description(stem).expect("committed description"), - DevicePolicy::default(), + DevicePolicy::RESIDENT_TABLES, ) .expect("device"); for form in ["float", "uint"] { diff --git a/crates/metal2vulkan/src/tests/engine_word_attachments.rs b/crates/metal2vulkan/src/tests/engine_word_attachments.rs index f73d4203d..e460ae8a1 100644 --- a/crates/metal2vulkan/src/tests/engine_word_attachments.rs +++ b/crates/metal2vulkan/src/tests/engine_word_attachments.rs @@ -79,7 +79,7 @@ fn fixture() -> Option> { } fn venue(stem: &str) -> crate::device::profile::DeviceProfile { - profile(stem, DevicePolicy::default()).expect("committed profile") + profile(stem, DevicePolicy::RESIDENT_TABLES).expect("committed profile") } /// A render pipeline of one color attachment, `pf`, written under `mask` and blended where @@ -229,7 +229,7 @@ fn device(stem: &str) -> Device { .join(format!("{stem}.json")); let text = std::fs::read_to_string(path).expect("profile"); let desc = DeviceDescription::from_khronos_json(&text, None).expect("description"); - Device::from_queries(desc, DevicePolicy::default()).expect("device") + Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES).expect("device") } /// A word attachment written under a mask of some of its channels, or blended, takes the diff --git a/crates/metal2vulkan/src/tests/engine_word_phases.rs b/crates/metal2vulkan/src/tests/engine_word_phases.rs index 701e2d471..4517224c0 100644 --- a/crates/metal2vulkan/src/tests/engine_word_phases.rs +++ b/crates/metal2vulkan/src/tests/engine_word_phases.rs @@ -42,7 +42,7 @@ fn identity() -> DevicePolicy { DevicePolicy { pointer_domain: PointerDomain::Identity, handle_domain: HandleDomain::Identity, - ..DevicePolicy::default() + ..DevicePolicy::RESIDENT_TABLES } } diff --git a/crates/metal2vulkan/src/tests/engine_workgroup_layout.rs b/crates/metal2vulkan/src/tests/engine_workgroup_layout.rs index f23df0102..4302e9d79 100644 --- a/crates/metal2vulkan/src/tests/engine_workgroup_layout.rs +++ b/crates/metal2vulkan/src/tests/engine_workgroup_layout.rs @@ -8,7 +8,7 @@ //! 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 the default policy and under the identity domains (the +//! on every committed profile under the resident-table domains 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 diff --git a/crates/metal2vulkan/src/tests/engine_ycbcr_in_place.rs b/crates/metal2vulkan/src/tests/engine_ycbcr_in_place.rs index 4760697bc..3aed3db6a 100644 --- a/crates/metal2vulkan/src/tests/engine_ycbcr_in_place.rs +++ b/crates/metal2vulkan/src/tests/engine_ycbcr_in_place.rs @@ -61,11 +61,11 @@ fn assemble(name: &str, body: &str) -> Option> { } fn lavapipe() -> DeviceProfile { - profile("lavapipe", DevicePolicy::default()).expect("profile") + profile("lavapipe", DevicePolicy::RESIDENT_TABLES).expect("profile") } fn m3() -> DeviceProfile { - profile("moltenvk-m3", DevicePolicy::default()).expect("profile") + profile("moltenvk-m3", DevicePolicy::RESIDENT_TABLES).expect("profile") } /// The words of `constexpr sampler(filter::linear, ...)`: minification and magnification @@ -698,7 +698,7 @@ fn in_place_samples_are_metals() { return; }; for stem in ["lavapipe", "moltenvk-m3"] { - let p = profile(stem, DevicePolicy::default()).expect("profile"); + let p = profile(stem, DevicePolicy::RESIDENT_TABLES).expect("profile"); let what = format!("{name} half={half} on {stem}"); let a = compile_with(&bc, "k", &p, &inputs(true)) .unwrap_or_else(|e| panic!("{what}: {e}")); @@ -1313,7 +1313,7 @@ fn a_slot_states_the_in_place_form_where_it_reads_only_it() { return; }; for stem in ["lavapipe", "moltenvk-m3", "nvidia-rtx5080-laptop"] { - let p = profile(stem, DevicePolicy::default()).expect("profile"); + let p = profile(stem, DevicePolicy::RESIDENT_TABLES).expect("profile"); assert!(p.fields().ycbcr_in_place, "{stem}"); let what = format!("{name} on {stem}"); let (plan, _) = typed_module_with(&bc, "k", &p, &inputs(false)) @@ -1467,7 +1467,7 @@ fn an_in_place_linear_sample_is_refused_as_its_slot_s_encoder_value_under_the_id let identity = DevicePolicy { pointer_domain: PointerDomain::Identity, handle_domain: HandleDomain::Identity, - ..DevicePolicy::default() + ..DevicePolicy::RESIDENT_TABLES }; let p = profile("lavapipe", identity).expect("profile"); match compile_with(&bc, "k", &p, &inputs(true)) { diff --git a/crates/metal2vulkan/src/tests/engine_zeroed_colors.rs b/crates/metal2vulkan/src/tests/engine_zeroed_colors.rs index 77378b88e..9fb730dd6 100644 --- a/crates/metal2vulkan/src/tests/engine_zeroed_colors.rs +++ b/crates/metal2vulkan/src/tests/engine_zeroed_colors.rs @@ -93,7 +93,8 @@ fn a_draw_into_colors_the_pipeline_lacks_runs_the_variant_writing_zero() { ), ]; for stem in ["moltenvk-m3", "lavapipe"] { - let dev = Device::from_queries(description(stem), DevicePolicy::default()).expect("device"); + let dev = + Device::from_queries(description(stem), DevicePolicy::RESIDENT_TABLES).expect("device"); let base = dev .compile_render_pipeline(&d, &budget) .unwrap_or_else(|e| panic!("{stem}: {e}")); @@ -193,8 +194,8 @@ fn a_function_writing_a_color_it_would_zero_stores_the_zero_there() { let Some(bc) = fixture("stage_io") else { return; }; - let dev = - Device::from_queries(description("lavapipe"), DevicePolicy::default()).expect("device"); + let dev = Device::from_queries(description("lavapipe"), DevicePolicy::RESIDENT_TABLES) + .expect("device"); let p = dev.profile(); for (format, numeric) in [ (PixelFormat::RGBA32Uint, IoNumeric::Uint), @@ -258,7 +259,8 @@ fn a_draw_without_colors_the_pipeline_has_runs_the_variant_dropping_them() { base_instance: 0, }; for stem in ["moltenvk-m3", "lavapipe"] { - let dev = Device::from_queries(description(stem), DevicePolicy::default()).expect("device"); + let dev = + Device::from_queries(description(stem), DevicePolicy::RESIDENT_TABLES).expect("device"); let base = dev .compile_render_pipeline(&d, &budget) .unwrap_or_else(|e| panic!("{stem}: {e}")); diff --git a/crates/metal2vulkan/src/tests/engine_zeroed_threadgroup.rs b/crates/metal2vulkan/src/tests/engine_zeroed_threadgroup.rs index 1516cb73a..dec4b70fe 100644 --- a/crates/metal2vulkan/src/tests/engine_zeroed_threadgroup.rs +++ b/crates/metal2vulkan/src/tests/engine_zeroed_threadgroup.rs @@ -154,7 +154,7 @@ attributes #0 = { convergent mustprogress nounwind willreturn } /// `stem` through `Device::from_queries`. fn queried(stem: &str) -> DeviceProfile { let desc = description(stem).expect("description"); - Device::from_queries(desc, DevicePolicy::default()) + Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES) .expect("device") .profile() .clone() @@ -330,7 +330,7 @@ fn a_profile_without_zeroed_workgroup_memory_refuses_threadgroup_memory_through_ let mut desc = description("runtime-floor").expect("description"); desc.features .remove(&VkFeature::ShaderZeroInitializeWorkgroupMemory); - let prof = Device::from_queries(desc, DevicePolicy::default()) + let prof = Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES) .expect("device") .profile() .clone(); diff --git a/crates/metal2vulkan/src/tests/fuzz_interp.rs b/crates/metal2vulkan/src/tests/fuzz_interp.rs index d838cb21f..ed40b3b31 100644 --- a/crates/metal2vulkan/src/tests/fuzz_interp.rs +++ b/crates/metal2vulkan/src/tests/fuzz_interp.rs @@ -175,11 +175,11 @@ pub(super) struct CpuInterp { impl CpuInterp { /// The executor for committed profile `stem` (`validation/profiles/.json`, derived - /// under the default policy), dispatching [`THREADS`] threads. `Ok(None)` when `llvm-as` is - /// not installed: the caller skips visibly, because there is no way to turn generated text - /// into bitcode. + /// under the resident-table domains), dispatching [`THREADS`] threads. `Ok(None)` when + /// `llvm-as` is not installed: the caller skips visibly, because there is no way to turn + /// generated text into bitcode. pub(super) fn new(stem: &str) -> Result, String> { - let profile = profile(stem, DevicePolicy::default())?; + let profile = profile(stem, DevicePolicy::RESIDENT_TABLES)?; match llvm_assemble_text("define void @probe() {\n ret void\n}\n") { Ok(_) => Ok(Some(CpuInterp { profile, @@ -531,7 +531,7 @@ fn the_interpreter_runs_every_modelled_width_the_stage_may_run_with() { #[test] fn the_soak_profiles_run_at_their_devices_widths() { let lanes = |stem: &str| { - let profile = profile(stem, DevicePolicy::default()).unwrap(); + let profile = profile(stem, DevicePolicy::RESIDENT_TABLES).unwrap(); widths(profile.subgroups().kernel.sizes, None) .unwrap() .iter() diff --git a/crates/metal2vulkan/src/tests/golden_hashes.rs b/crates/metal2vulkan/src/tests/golden_hashes.rs index bc9b09a85..1959defb6 100644 --- a/crates/metal2vulkan/src/tests/golden_hashes.rs +++ b/crates/metal2vulkan/src/tests/golden_hashes.rs @@ -67,15 +67,14 @@ use crate::pipeline::{ }; use crate::Budget; -/// One golden table: where it is committed, the policy its devices compile under, and the -/// fixtures it takes. +/// One golden table: where it is committed and the fixtures it takes. Its devices compile under +/// the default policy, the runtime's. #[derive(Clone, Copy)] struct Golden { /// The committed table, relative to the crate root. table: &'static str, /// The first lines of its header, before the bless command. title: &'static str, - policy: DevicePolicy, /// Whether it takes a fixture, by its source text. takes: fn(&str) -> bool, } @@ -85,7 +84,6 @@ const DEFAULT: Golden = Golden { table: "tests/golden_hashes.tsv", title: "# Golden output hashes of the engine over the public fixtures x the committed\n\ # profiles (src/tests/golden_hashes.rs). Written by the bless; do not edit:\n", - policy: DevicePolicy::UNTRUSTED, takes: every, }; @@ -369,8 +367,8 @@ fn multisampled_descriptor( // ---- Inputs ---- -/// Every committed profile as a device under `policy`, by stem. -fn devices(policy: DevicePolicy) -> Vec<(String, Device)> { +/// Every committed profile as a device under the default policy, by stem. +fn devices() -> Vec<(String, Device)> { let dir = Path::new(env!("CARGO_MANIFEST_DIR")).join("../metal2vulkan-validation/profiles"); let mut out = Vec::new(); for entry in std::fs::read_dir(&dir).unwrap_or_else(|e| panic!("{}: {e}", dir.display())) { @@ -385,7 +383,8 @@ fn devices(policy: DevicePolicy) -> Vec<(String, Device)> { let text = std::fs::read_to_string(&path).expect("read profile"); let desc = DeviceDescription::from_khronos_json(&text, None) .unwrap_or_else(|e| panic!("{stem}: {e}")); - let dev = Device::from_queries(desc, policy).unwrap_or_else(|e| panic!("{stem}: {e}")); + let dev = Device::from_queries(desc, DevicePolicy::default()) + .unwrap_or_else(|e| panic!("{stem}: {e}")); out.push((stem, dev)); } out.sort_by(|a, b| a.0.cmp(&b.0)); @@ -995,7 +994,7 @@ fn check_storage_pair(observed: &Table, devices: &[(String, Device)]) -> usize { #[test] fn golden_hashes_match_the_table() { - let devices = devices(DEFAULT.policy); + let devices = devices(); let observed = observe(DEFAULT, &devices); if !observed.skipped.contains(STORAGE_FIXTURE) { let swizzled = check_storage_pair(&observed.table, &devices); @@ -1068,7 +1067,7 @@ fn bless_golden_hashes() { { let golden = DEFAULT; let table = golden.table; - let devices = devices(golden.policy); + let devices = devices(); let observed = observe(golden, &devices); assert!( observed.skipped.is_empty(), diff --git a/crates/metal2vulkan/src/tests/ledger_resident.rs b/crates/metal2vulkan/src/tests/ledger_resident.rs index aff5d25cc..663a7d0f2 100644 --- a/crates/metal2vulkan/src/tests/ledger_resident.rs +++ b/crates/metal2vulkan/src/tests/ledger_resident.rs @@ -135,7 +135,7 @@ fn what_a_translation_holds_stays_within_its_ledger() { let Some(bc) = assembled() else { return; }; - let p = profile("runtime-floor", DevicePolicy::default()).expect("profile"); + let p = profile("runtime-floor", DevicePolicy::RESIDENT_TABLES).expect("profile"); // The shape: the applications are rolled into a loop (the body holds none). let (_, _, kept) = compile_kept(&bc, "chain", &p).expect("chain"); assert_eq!(kept.loops().len(), 1, "the applications roll into one loop"); diff --git a/crates/metal2vulkan/src/tests/library_entries_decode_once.rs b/crates/metal2vulkan/src/tests/library_entries_decode_once.rs index eeba1e1bf..2b4ba593c 100644 --- a/crates/metal2vulkan/src/tests/library_entries_decode_once.rs +++ b/crates/metal2vulkan/src/tests/library_entries_decode_once.rs @@ -75,7 +75,7 @@ fn device() -> Device { let text = std::fs::read_to_string(path).expect("profile"); let mut desc = DeviceDescription::from_khronos_json(&text, None).expect("description"); desc.features.insert(VkFeature::RobustBufferAccess); - Device::from_queries(desc, DevicePolicy::default()).expect("device") + Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES).expect("device") } fn fixture(name: &str) -> Option> { diff --git a/crates/metal2vulkan/src/tests/owned_divisions.rs b/crates/metal2vulkan/src/tests/owned_divisions.rs index d37f1c190..727195131 100644 --- a/crates/metal2vulkan/src/tests/owned_divisions.rs +++ b/crates/metal2vulkan/src/tests/owned_divisions.rs @@ -70,7 +70,8 @@ fn no_crate_owned_compute_module_divides_the_all_ones_integer() { .expect("profiles") .iter() .map(|(stem, desc)| { - let device = Device::from_queries(desc.clone(), DevicePolicy::default()).expect(stem); + let device = + Device::from_queries(desc.clone(), DevicePolicy::RESIDENT_TABLES).expect(stem); (stem.clone(), device) }) .collect(); diff --git a/crates/metal2vulkan/src/tests/profile_fingerprint_derived.rs b/crates/metal2vulkan/src/tests/profile_fingerprint_derived.rs index 0ece6532d..6d10d13e8 100644 --- a/crates/metal2vulkan/src/tests/profile_fingerprint_derived.rs +++ b/crates/metal2vulkan/src/tests/profile_fingerprint_derived.rs @@ -81,8 +81,8 @@ fn library() -> Option { fn a_run_of_compiles_derives_no_profile_fingerprint() { let Some(library) = library() else { return }; let start = fingerprints_derived(); - let device = - Device::from_queries(description("moltenvk-m3"), DevicePolicy::default()).expect("device"); + let device = Device::from_queries(description("moltenvk-m3"), DevicePolicy::RESIDENT_TABLES) + .expect("device"); let made = fingerprints_derived() - start; // The fingerprint every compile takes, read as often as anything reads it. for _ in 0..RUN { @@ -130,10 +130,10 @@ fn a_run_of_compiles_derives_no_profile_fingerprint() { /// fingerprints, and an edited profile carries the edit's. #[test] fn profiles_that_differ_carry_their_own_fingerprints() { - let m3 = - Device::from_queries(description("moltenvk-m3"), DevicePolicy::default()).expect("device"); - let pipe = - Device::from_queries(description("lavapipe"), DevicePolicy::default()).expect("device"); + let m3 = Device::from_queries(description("moltenvk-m3"), DevicePolicy::RESIDENT_TABLES) + .expect("device"); + let pipe = Device::from_queries(description("lavapipe"), DevicePolicy::RESIDENT_TABLES) + .expect("device"); assert_ne!( m3.profile_fingerprint(), pipe.profile_fingerprint(), diff --git a/crates/metal2vulkan/src/tests/public_fixtures_engine.rs b/crates/metal2vulkan/src/tests/public_fixtures_engine.rs index 7b0a30740..4c730851b 100644 --- a/crates/metal2vulkan/src/tests/public_fixtures_engine.rs +++ b/crates/metal2vulkan/src/tests/public_fixtures_engine.rs @@ -3,8 +3,8 @@ //! Every `.ll` fixture at the top level of `validation/fixtures/public/` and in its `engine/` //! directory is assembled to bitcode (`llvm-as`; a typed-pointer `.air.ll` through `xcrun //! metal-as`), every entry point its ABI declares is compiled by the engine for every committed -//! profile under the default policy with no function constants and default lowering inputs, and -//! the outcome is recorded: +//! profile under the resident-table domains with no function constants and default lowering inputs, +//! and the outcome is recorded: //! //! - `ok`: compiled, linked, relocated, and passed L3 (requirements within the profile and //! `spirv-val` under the profile's environment; `G-val`); diff --git a/crates/metal2vulkan/src/tests/relocated_once.rs b/crates/metal2vulkan/src/tests/relocated_once.rs index 68dfe10bb..712754ecf 100644 --- a/crates/metal2vulkan/src/tests/relocated_once.rs +++ b/crates/metal2vulkan/src/tests/relocated_once.rs @@ -71,7 +71,7 @@ fn device() -> Device { .join("../metal2vulkan-validation/profiles/moltenvk-m3.json"); let text = std::fs::read_to_string(&path).expect("committed profile"); let description = DeviceDescription::from_khronos_json(&text, None).expect("description"); - Device::from_queries(description, DevicePolicy::default()).expect("device") + Device::from_queries(description, DevicePolicy::RESIDENT_TABLES).expect("device") } /// The fixture's library, or `None` where `llvm-as` is absent. diff --git a/crates/metal2vulkan/src/tests/stage_in_unread_key.rs b/crates/metal2vulkan/src/tests/stage_in_unread_key.rs index 5021c7a7a..1d241753a 100644 --- a/crates/metal2vulkan/src/tests/stage_in_unread_key.rs +++ b/crates/metal2vulkan/src/tests/stage_in_unread_key.rs @@ -87,7 +87,7 @@ fn device() -> Device { let text = std::fs::read_to_string(path).expect("profile"); let mut desc = DeviceDescription::from_khronos_json(&text, None).expect("description"); desc.features.insert(VkFeature::RobustBufferAccess); - Device::from_queries(desc, DevicePolicy::default()).expect("device") + Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES).expect("device") } fn fixture() -> Option> { diff --git a/crates/metal2vulkan/src/tests/stage_input_siblings.rs b/crates/metal2vulkan/src/tests/stage_input_siblings.rs index f78430b39..92d5bd2ba 100644 --- a/crates/metal2vulkan/src/tests/stage_input_siblings.rs +++ b/crates/metal2vulkan/src/tests/stage_input_siblings.rs @@ -96,7 +96,7 @@ fn device() -> Device { let text = std::fs::read_to_string(path).expect("profile"); let mut desc = DeviceDescription::from_khronos_json(&text, None).expect("description"); desc.features.insert(VkFeature::RobustBufferAccess); - Device::from_queries(desc, DevicePolicy::default()).expect("device") + Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES).expect("device") } fn fixture() -> Option> { diff --git a/crates/metal2vulkan/tests/api_signatures.tsv b/crates/metal2vulkan/tests/api_signatures.tsv index 420af7f90..334cc0efc 100644 --- a/crates/metal2vulkan/tests/api_signatures.tsv +++ b/crates/metal2vulkan/tests/api_signatures.tsv @@ -150,7 +150,7 @@ assoc-const metal2vulkan::bind::indirect_commands::BufferBinding::MIN_BUFFER_ADD assoc-const metal2vulkan::bind::indirect_commands::RenderDraws::PRIMITIVES pub const PRIMITIVES: RenderDraws assoc-const metal2vulkan::device::ApiVersion::V1_2 pub const V1_2: ApiVersion assoc-const metal2vulkan::device::ApiVersion::V1_3 pub const V1_3: ApiVersion -assoc-const metal2vulkan::device::DevicePolicy::UNTRUSTED pub const UNTRUSTED: DevicePolicy +assoc-const metal2vulkan::device::DevicePolicy::RESIDENT_TABLES pub const RESIDENT_TABLES: DevicePolicy assoc-const metal2vulkan::device::OpBits::ARITHMETIC pub const ARITHMETIC: OpBits assoc-const metal2vulkan::device::OpBits::BALLOT pub const BALLOT: OpBits assoc-const metal2vulkan::device::OpBits::BASIC pub const BASIC: OpBits @@ -381,7 +381,7 @@ assoc-const-value metal2vulkan::bind::indirect_commands::BufferBinding::MIN_BUFF assoc-const-value metal2vulkan::bind::indirect_commands::RenderDraws::PRIMITIVES RenderDraws assoc-const-value metal2vulkan::device::ApiVersion::V1_2 ApiVersion assoc-const-value metal2vulkan::device::ApiVersion::V1_3 ApiVersion -assoc-const-value metal2vulkan::device::DevicePolicy::UNTRUSTED DevicePolicy +assoc-const-value metal2vulkan::device::DevicePolicy::RESIDENT_TABLES DevicePolicy assoc-const-value metal2vulkan::device::OpBits::ARITHMETIC OpBits(1 <<2) assoc-const-value metal2vulkan::device::OpBits::BALLOT OpBits(1 <<3) assoc-const-value metal2vulkan::device::OpBits::BASIC OpBits(1 <<0) diff --git a/crates/metal2vulkan/tests/api_surface.rs b/crates/metal2vulkan/tests/api_surface.rs index c79439156..ba81a245c 100644 --- a/crates/metal2vulkan/tests/api_surface.rs +++ b/crates/metal2vulkan/tests/api_surface.rs @@ -948,9 +948,9 @@ fn fixture(stem: &str) -> Option> { common::llvm_as(&text, &format!("{stem}.ll")) } -/// Committed profile `stem` as a device with the default policy. +/// Committed profile `stem` as a device with the resident-table domains. fn device(stem: &str) -> Device { - device_under(stem, DevicePolicy::default()) + device_under(stem, DevicePolicy::RESIDENT_TABLES) } /// [`device`] under `policy`. @@ -1202,7 +1202,7 @@ fn the_precision_contract_names_each_float_operations_notes() { .expect("a float operator") .contains(&PrecisionNote::DeviceArithmetic) ); - let native = device_under("lavapipe", DevicePolicy::default()); + let native = device_under("lavapipe", DevicePolicy::RESIDENT_TABLES); assert_eq!( PrecisionNote::of_float_operator( BinOp::FDiv, diff --git a/crates/metal2vulkan/tests/engine_bounded_growth.rs b/crates/metal2vulkan/tests/engine_bounded_growth.rs index a803cfb60..63ed7bb84 100644 --- a/crates/metal2vulkan/tests/engine_bounded_growth.rs +++ b/crates/metal2vulkan/tests/engine_bounded_growth.rs @@ -208,7 +208,8 @@ fn compile_cost_grows_linearly_with_the_block_count() { .join("../metal2vulkan-validation/profiles/runtime-floor.json"); let text = std::fs::read_to_string(&path).unwrap_or_else(|e| panic!("{}: {e}", path.display())); let description = DeviceDescription::from_khronos_json(&text, None).expect("runtime-floor"); - let device = Device::from_queries(description, DevicePolicy::default()).expect("runtime-floor"); + let device = + Device::from_queries(description, DevicePolicy::RESIDENT_TABLES).expect("runtime-floor"); let Some(small) = assemble(&irreducible_chain(SMALL)) else { return; }; diff --git a/docs/API.md b/docs/API.md index 5aa3ac051..4c1819bc8 100644 --- a/docs/API.md +++ b/docs/API.md @@ -82,7 +82,8 @@ or policy. A ### The policy `DevicePolicy` holds your product choices; together with the description they decide everything a -compile does. `DevicePolicy::default()` is `DevicePolicy::UNTRUSTED`: +compile does. `DevicePolicy::default()` is the one constructor: the runtime compiles under it, +and so do the command line, the compile worker and every validation tool. It holds: - **Bounds on a buffer-slot access at a run-time offset.** Such an access stays inside the range the binder supplied: where the device enables `robustBufferAccess`, buffer accesses and vertex @@ -99,11 +100,11 @@ compile does. `DevicePolicy::default()` is `DevicePolicy::UNTRUSTED`: with no switch: the device's answer is the contract, recorded as `PrecisionNote::DeviceSampling` with its measured bound. The device's own `half` rounding and its blend of a `half` color have no switch either: each records its note. -- **The resident-table and handle-table domains** (`PointerDomain::ResidentTable`, - `HandleDomain::Table`, the default). The identity domains (`PointerDomain::Identity` with - `HandleDomain::Identity`, taken together) are the runtime's form: pointers are device - addresses used directly and a texture's or sampler's handle is its `gpuResourceID` - ([RESOURCE-ID.md](RESOURCE-ID.md)). They need `bufferDeviceAddress` and `shaderInt64`. Under +- **The identity domains** (`PointerDomain::Identity` with `HandleDomain::Identity`, taken + together; the default, the runtime's form): pointers are device addresses used directly and a + texture's or sampler's handle is its `gpuResourceID` ([RESOURCE-ID.md](RESOURCE-ID.md)). They + need `bufferDeviceAddress` and `shaderInt64`; `Device::from_queries` refuses a device without + them (`Unsupported{IdentityDomains}`). Under them a buffer slot is reached at its own device address (`gpuAddress` plus the bind offset), pushed less 2^31 as `PushField::SlotGuestBase` (section 5), with no root table and no descriptor. The constant blob (the program-scope constants whose address merges, escapes or is @@ -116,8 +117,8 @@ compile does. `DevicePolicy::default()` is `DevicePolicy::UNTRUSTED`: offset reads and writes the buffer's bytes there. Outside the buffer, a load reads zero and a store or atomic does nothing (section 5). An access at a constant offset is not checked. A pointer loaded from memory or made from an integer, null included, is used as given: no binding - bounds its accesses, so the bounds the default domains place on an access do not hold for - it. A slot + bounds its accesses, so the bounds the resident-table domains place on an access do not hold + for it. A slot whose argument states an alignment of at least 4 (`air.arg_type_align_size`) is reached from that address as it is: each access is at the pushed word plus its 32-bit byte offset plus 2^31, modulo 2^32, zero-extended, which is the address plus the offset read as signed, exact as the @@ -189,11 +190,11 @@ compile does. `DevicePolicy::default()` is `DevicePolicy::UNTRUSTED`: filter treats the bound texture's texels (its inner taps, its clamp and its border texels) from the word the consumer pushes for that slot (`PushField::BicubicTexels`: `metal::format::bicubic_texels_word` of the bound texture's format and swizzle, - `metal::format::BICUBIC_TEXELS_UNBOUND` for a slot bound to nothing), the bits the default + `metal::format::BICUBIC_TEXELS_UNBOUND` for a slot bound to nothing), the bits the resident-table domains specialize `SpecKey::BicubicTexels` to. `bicubic_texels_word` has no word for a compressed, YUV, stencil, integer, extended-range or 8-bit sRGB format, so such a texture has no bicubic sample there (the runtime refuses the dispatch, `Gap::BicubicTexels`). Its - arithmetic is noted `PrecisionNote::BicubicFilterArithmetic`, as on the default domains. A + arithmetic is noted `PrecisionNote::BicubicFilterArithmetic`, as on the resident-table domains. A fragment function under the pipeline's private alpha test (`PrivateRenderState::alpha_test_enabled`, a compare function other than `Never` or `Always`) compares its color 0's alpha with the code the consumer pushes @@ -254,6 +255,10 @@ compile does. `DevicePolicy::default()` is `DevicePolicy::UNTRUSTED`: and its command, `PushField::IndirectSequence` (a part's sequence index) plus `PushField::IndirectBase` (the part's first command), a command outside the range draws nothing, and the function pulls every vertex attribute it reads. +- **The resident-table domains** (`DevicePolicy::RESIDENT_TABLES`: `PointerDomain::ResidentTable` + with `HandleDomain::Table`) exist for the validation executor alone, which builds the resident + root and the handle table itself. Besides it, only the translator's own tests of that lowering + compile under them. Loops run as written: no execution bound is translated in.