Translator: the Floor buffer access deleted; every profile reaches buffers by address
What: BufferAccess and ProfileFields::buffer_access are deleted with every Floor arm:
the refusals that named addressed_needs (the Floor arms of DereferenceLoadedPointer,
Int64Atomics, GpuEncodedIndirectCommands in the indirect-command, replay and execution-range
paths, the de-indexed and private list forms, and the addressed function tables), the
memory planner's addressed flag and its loaded-pointer refusal, the plan's needs (MemNeeds:
that refusal read its dynamic_roots, and the handle classes beside it had no reader since the
handle table went), provenance's dynamic_deref field, the Floor mechanism of
RuntimeFact::FunctionTableRange, the Floor values of MetalDeviceProperties (argument buffers
tier, max buffer length), and the null pointer's static escape that only a profile without
device addresses took. Public items gone:
DeviceProfile::addressed_needs and Feature::{ArgumentBufferPointers, PointerToInteger,
BufferRange}, whose only producers were those arms.
Why: Device::from_queries refuses a device without bufferDeviceAddress and shaderInt64
(IdentityDomains), and it is the only way to make a profile, so no profile is Floor: every
arm deleted here was unreachable. This commit's parent is the last that holds the Floor form.
Consumer search: reims-vgpu development f054ad57c1 plus its steelbrain refs younger than a
day (188 refs): 0 hits each for addressed_needs, ArgumentBufferPointers, PointerToInteger
and BufferRange.
The profile's fingerprint changes on every device (the field leaves the profile's Debug
text), so every golden cell reads "profile changed" until the table is re-blessed; no key
stays unchanged, so SEMANTICS_VERSION does not move.
Devtools: the fuzz Target loses its addressed flag; the pointer-select generator draws the
loaded form on every target, the same draw a target with device addresses made.
Tests: the memory plan tests ask whether a buffer pointer is wide in place of the needs, and
drop the handle-table asserts; the profile tests drop the field's asserts (the max buffer
length test keeps its allocation-limit arm); the pointer-cell tests no longer accept
PointerToInteger; the atomic, kernel stage-in and tessellation tests no longer filter on the
field.
docs/REFUSALS.md, scripts/refusal-surface/reach.tsv and tests/api_signatures.tsv are
regenerated; runtime-sources.sha256 is re-pinned.
Verified: job m3-max-84770 (CPU only, no card): the golden and engine
inventory lists at the parent and at this commit show 0 computed cells
moved of 28,950 (every cell re-keyed by the profile fingerprint, which
this commit moves) and no inventory line. The stack's tip ran the whole
gate (see its message).
This commit is contained in:
1 parent
09b6d0fb89
commit
31d8a874f1
39 files changed
+170
-490
No files matched your search
@@ -61,19 +61,12 @@ pub const THREAD_COUNTS: [u32; 2] = [32, 64];
|
||||
pub struct Target {
|
||||
/// Threads in the dispatch's one threadgroup, one of [`THREAD_COUNTS`].
|
||||
pub threads: u32,
|
||||
/// Whether the device reaches buffers by device address (Profile A): a pointer loaded from a
|
||||
/// buffer can be dereferenced. Without it the engine refuses such a program as
|
||||
/// `Unsupported{DereferenceLoadedPointer}`, honestly, so no generator builds one.
|
||||
pub addressed: bool,
|
||||
}
|
||||
|
||||
impl Default for Target {
|
||||
/// [`THREADS`] threads on a device with device addresses.
|
||||
/// [`THREADS`] threads.
|
||||
fn default() -> Target {
|
||||
Target {
|
||||
threads: THREADS,
|
||||
addressed: true,
|
||||
}
|
||||
Target { threads: THREADS }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -20,14 +20,11 @@
|
||||
//! **parked** form, between the same roots stored into and loaded back from a private aggregate
|
||||
//! (private pointer cells); and, in the **loaded** form, between wide pointers whose roots are
|
||||
//! LOADED from a pointer table ([`Input::Addresses`]: the guest addresses of the three buffers), so
|
||||
//! every choice, GEP, and access goes through the resident-set search and the root table, and a
|
||||
//! lookup that missed would be counted and fail the run. The loaded form is built only for a
|
||||
//! [`Target`] with device addresses (Profile A): without them the engine refuses a loaded
|
||||
//! pointer's dereference, honestly. Every form may take the nullable choice.
|
||||
//! every choice, GEP, and access goes through the device address the pointer holds. Every form may
|
||||
//! take the nullable choice.
|
||||
|
||||
use super::{
|
||||
air_header, kernel_metadata_written, Execute, IndexForm, Input, Kernel, Report, Target,
|
||||
Xorshift, OPS,
|
||||
air_header, kernel_metadata_written, Execute, IndexForm, Input, Kernel, Report, Xorshift, OPS,
|
||||
};
|
||||
|
||||
/// The index mask the generated program applies. A power of two, so the mask is exact.
|
||||
@@ -99,7 +96,7 @@ struct Program {
|
||||
}
|
||||
|
||||
impl Program {
|
||||
fn generate(seed: u64, target: Target, form: IndexForm) -> Self {
|
||||
fn generate(seed: u64, form: IndexForm) -> Self {
|
||||
let mut rng = Xorshift(seed | 1);
|
||||
let steps = (0..STEPS)
|
||||
.map(|_| {
|
||||
@@ -130,7 +127,7 @@ impl Program {
|
||||
// program are the same whichever form it takes.
|
||||
let roots = match indirect {
|
||||
false => Roots::Params,
|
||||
true if target.addressed && rng.below(2) == 1 => Roots::Loaded,
|
||||
true if rng.below(2) == 1 => Roots::Loaded,
|
||||
true => Roots::Parked,
|
||||
};
|
||||
Program {
|
||||
@@ -412,7 +409,7 @@ pub fn check(executor: &mut dyn Execute, seeds: std::ops::RangeInclusive<u64>) -
|
||||
let mut report = Report::default();
|
||||
for seed in seeds {
|
||||
let form = IndexForm::of(seed);
|
||||
let program = Program::generate(seed.wrapping_mul(0x9e3779b97f4a7c15), target, form);
|
||||
let program = Program::generate(seed.wrapping_mul(0x9e3779b97f4a7c15), form);
|
||||
let mut want: Vec<u32> = fill
|
||||
.as_chunks::<4>()
|
||||
.0
|
||||
@@ -477,37 +474,23 @@ pub fn check(executor: &mut dyn Execute, seeds: std::ops::RangeInclusive<u64>) -
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
/// The engine's programs take every root form over the gate seeds, the loaded form only
|
||||
/// on a device with device addresses, and nullable choices in all of them.
|
||||
/// The engine's programs take every root form over the gate seeds, and nullable choices in
|
||||
/// all of them.
|
||||
#[test]
|
||||
fn the_engine_programs_cover_every_root_form_the_device_can_run() {
|
||||
let program = |seed: u64, target: Target| {
|
||||
Program::generate(
|
||||
seed.wrapping_mul(0x9e3779b97f4a7c15),
|
||||
target,
|
||||
IndexForm::Zext64,
|
||||
)
|
||||
};
|
||||
let count = |target: Target| {
|
||||
let mut counts = [0usize; 3];
|
||||
for seed in crate::fuzz::GATE_SEEDS {
|
||||
counts[program(seed, target).roots as usize] += 1;
|
||||
}
|
||||
counts
|
||||
};
|
||||
let addressed = count(Target::default());
|
||||
assert!(addressed.iter().all(|&n| n > 0), "{addressed:?}");
|
||||
fn the_engine_programs_cover_every_root_form() {
|
||||
let program =
|
||||
|seed: u64| Program::generate(seed.wrapping_mul(0x9e3779b97f4a7c15), IndexForm::Zext64);
|
||||
let mut counts = [0usize; 3];
|
||||
for seed in crate::fuzz::GATE_SEEDS {
|
||||
counts[program(seed).roots as usize] += 1;
|
||||
}
|
||||
assert!(counts.iter().all(|&n| n > 0), "{counts:?}");
|
||||
let nullable = crate::fuzz::GATE_SEEDS
|
||||
.filter(|&seed| {
|
||||
let p = program(seed, Target::default());
|
||||
let p = program(seed);
|
||||
p.roots != Roots::Params && p.steps.iter().any(|s| s.nullable && !s.phi)
|
||||
})
|
||||
.count();
|
||||
assert!(nullable > 0);
|
||||
let floor = count(Target {
|
||||
addressed: false,
|
||||
..Target::default()
|
||||
});
|
||||
assert!(floor[Roots::Loaded as usize] == 0 && floor[Roots::Parked as usize] > 0);
|
||||
}
|
||||
}
|
||||
@@ -1 +1 @@
|
||||
33ebe1edbb044de9d8562b94ef26a1e72899caadb81f75f81b1538d1b2650b34
|
||||
eccf4a8b077f3b9b365540dbda6a5493442fa17f1a555aa1934c69e13a5f6d93
|
||||
@@ -27,7 +27,7 @@ pub(super) fn device_wait() {
|
||||
crate::gpu::wait::set_wait_timeout(CPU_ICD_WAIT).expect("the CPU ICD's device wait");
|
||||
}
|
||||
|
||||
/// The engine on the test's device, which is opened once here for what it supports.
|
||||
/// The engine on the test's device, which is opened once here: a test without it fails here.
|
||||
pub(super) fn engine() -> device::Engine {
|
||||
device::Engine::open().expect("open the test's device")
|
||||
}
|
||||
@@ -46,27 +46,19 @@ pub(super) mod device {
|
||||
use std::collections::BTreeMap;
|
||||
|
||||
/// The engine on the test's device.
|
||||
pub(in crate::candidate::tests) struct Engine {
|
||||
/// Whether the opened device reaches buffers by address (Profile A).
|
||||
addressed: bool,
|
||||
}
|
||||
pub(in crate::candidate::tests) struct Engine;
|
||||
|
||||
impl Engine {
|
||||
/// Open the test's device once for what the generators may build for it.
|
||||
/// Open the test's device once.
|
||||
pub(in crate::candidate::tests) fn open() -> Result<Engine, ExecutorError> {
|
||||
let device = platform::opened_worker_device(crate::gpu::TEST_DEVICE)?;
|
||||
Ok(Engine {
|
||||
addressed: device.device().profile().addressed_needs().is_empty(),
|
||||
})
|
||||
platform::opened_worker_device(crate::gpu::TEST_DEVICE)?;
|
||||
Ok(Engine)
|
||||
}
|
||||
}
|
||||
|
||||
impl Execute for Engine {
|
||||
fn target(&self) -> Target {
|
||||
Target {
|
||||
addressed: self.addressed,
|
||||
..Target::default()
|
||||
}
|
||||
Target::default()
|
||||
}
|
||||
|
||||
/// Assemble `kernel`, map it onto the candidate's [`ComputeCase`], and run it through
|
||||
|
||||
@@ -14,8 +14,8 @@ use crate::device::description::{
|
||||
use crate::device::function_storage;
|
||||
use crate::device::metal::MetalDeviceProperties;
|
||||
use crate::device::profile::{
|
||||
BufferAccess, DescriptorCaps, DeviceProfile, EnabledCaps, FormatTable, FragmentCaps,
|
||||
FunctionStorage, ImageCaps, Independence, LeafCaps, ProfileFields,
|
||||
DescriptorCaps, DeviceProfile, EnabledCaps, FormatTable, FragmentCaps, FunctionStorage,
|
||||
ImageCaps, Independence, LeafCaps, ProfileFields,
|
||||
};
|
||||
use crate::device::requirements::{
|
||||
ApiVersion, FloatControl, FloatWidth, FormatUsage, ResolveMode, SubgroupOp, VkExtension,
|
||||
@@ -152,13 +152,6 @@ fn derive_fields(desc: &DeviceDescription) -> ProfileFields {
|
||||
let ext = |e: VkExtension| desc.extensions.contains(&e);
|
||||
let api = desc.api_version;
|
||||
|
||||
// Memory's A/F split: Profile A needs device addresses and 64-bit integers; scalar block layout
|
||||
// is required only where an emitted type needs it, so it does not select the profile.
|
||||
let buffer_access = if has(VkFeature::BufferDeviceAddress) && has(VkFeature::ShaderInt64) {
|
||||
BufferAccess::Addressed
|
||||
} else {
|
||||
BufferAccess::Floor
|
||||
};
|
||||
let leaf = LeafCaps {
|
||||
int8: has(VkFeature::ShaderInt8),
|
||||
int16: has(VkFeature::ShaderInt16),
|
||||
@@ -239,7 +232,6 @@ fn derive_fields(desc: &DeviceDescription) -> ProfileFields {
|
||||
|
||||
let (vertex_formats, storage_formats, image_formats) = format_tables(desc);
|
||||
ProfileFields {
|
||||
buffer_access,
|
||||
leaf,
|
||||
subgroup: subgroup_model(desc),
|
||||
images,
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
//! Total by construction: the match below names every [`RuntimeFact`] variant (no wildcard), and
|
||||
//! each arm returns exactly one [`Mechanism`] from the fact and the profile alone.
|
||||
|
||||
use crate::device::profile::{BufferAccess, DeviceProfile};
|
||||
use crate::device::profile::DeviceProfile;
|
||||
use crate::pipeline::facts::{Mechanism, RuntimeFact};
|
||||
|
||||
/// The one mechanism by which `profile` honors `fact`.
|
||||
@@ -148,12 +148,8 @@ pub fn mechanism(fact: &RuntimeFact, profile: &DeviceProfile) -> Mechanism {
|
||||
// The binder's region flags a draw whose last object threadgroup along an axis is partial.
|
||||
RuntimeFact::PartialObjectThreadgroups => Mechanism::RegionSelected,
|
||||
// A separate compile that reads the tables' words through their device addresses, which
|
||||
// a shape whose tables may pass `maxStorageBufferRange` asks for; without device
|
||||
// addresses the binder refuses such a table where it binds it.
|
||||
RuntimeFact::FunctionTableRange { .. } => match f.buffer_access {
|
||||
BufferAccess::Addressed => Mechanism::Variant,
|
||||
BufferAccess::Floor => Mechanism::PlanTimeCheck,
|
||||
},
|
||||
// a shape whose tables may pass `maxStorageBufferRange` asks for.
|
||||
RuntimeFact::FunctionTableRange { .. } => Mechanism::Variant,
|
||||
// The binder's regions carry the tile as Metal's threadgroup; the tile pipeline checks its
|
||||
// descriptor's flag.
|
||||
RuntimeFact::TileThreadgroup { .. } => Mechanism::RegionSelected,
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
//! drives translation.
|
||||
|
||||
use crate::device::description::AllocationLimits;
|
||||
use crate::device::profile::{BufferAccess, DeviceProfile};
|
||||
use crate::device::profile::DeviceProfile;
|
||||
use crate::device::requirements::{FormatUsage, VkFeature};
|
||||
use crate::device::subgroup::{tier, OpBits, SimdClass};
|
||||
use crate::error::{Capability, Feature, Unsupported};
|
||||
@@ -29,8 +29,8 @@ pub struct MetalDeviceProperties {
|
||||
/// whose simdgroups are emulated takes scratch beside them, which its pipeline's
|
||||
/// `max_total_threads_per_threadgroup` accounts for. Capped by an Apple GPU's 32 KiB.
|
||||
pub max_threadgroup_memory_length: u32,
|
||||
/// `Tier2` when buffer pointers (Profile A) and texture/sampler handles (descriptor indexing)
|
||||
/// are both available; `Tier1` (inline constants and statically rooted buffers) otherwise.
|
||||
/// `Tier2` when texture and sampler handles (descriptor indexing) are available; `Tier1`
|
||||
/// (inline constants and statically rooted buffers) otherwise.
|
||||
pub argument_buffers_tier: ArgumentBuffersTier,
|
||||
/// `Tier1` when every Metal read-write tier-1 format (`R32Float`, `R32Uint`, `R32Sint`) has a
|
||||
/// storage-image choice, `Tier2` when every tier-2 format has one as well (on Vulkan 1.2 the
|
||||
@@ -38,8 +38,8 @@ pub struct MetalDeviceProperties {
|
||||
/// that reports their storage images anyway; formatless access alone is not enough), else
|
||||
/// `None`.
|
||||
pub read_write_texture_tier: ReadWriteTextureTier,
|
||||
/// The largest buffer a shader can address: `maxStorageBufferRange` in Profile F (larger
|
||||
/// windows are refused at plan time); the allocation limit in Profile A.
|
||||
/// The largest buffer a shader can address: the device's allocation limit
|
||||
/// (`maxBufferSize` where it states one, within `maxMemoryAllocationSize`).
|
||||
pub max_buffer_length: u64,
|
||||
/// Sample counts usable for color, depth and stencil attachments alike, of the 1, 2, 4 and 8
|
||||
/// a Mac's Metal renders (8 on a Mac's AMD GPU and on Apple10, not on Apple9).
|
||||
@@ -177,8 +177,7 @@ impl MetalDeviceProperties {
|
||||
.min(apple_gpu::MAX_THREADS_PER_THREADGROUP);
|
||||
let per_axis = [threads; 3];
|
||||
let d = &f.descriptors;
|
||||
let argument_buffers_tier = if f.buffer_access == BufferAccess::Addressed
|
||||
&& d.runtime_descriptor_array
|
||||
let argument_buffers_tier = if d.runtime_descriptor_array
|
||||
&& d.partially_bound
|
||||
&& d.update_after_bind_sampled_image
|
||||
&& d.update_after_bind_storage_image
|
||||
@@ -188,12 +187,9 @@ impl MetalDeviceProperties {
|
||||
ArgumentBuffersTier::Tier1
|
||||
};
|
||||
let read_write_texture_tier = read_write_texture_tier(profile);
|
||||
let max_buffer_length = match f.buffer_access {
|
||||
BufferAccess::Floor => u64::from(l.max_storage_buffer_range),
|
||||
_ => match allocation.max_buffer_size {
|
||||
0 => allocation.max_memory_allocation_size,
|
||||
cap => cap.min(allocation.max_memory_allocation_size),
|
||||
},
|
||||
let max_buffer_length = match allocation.max_buffer_size {
|
||||
0 => allocation.max_memory_allocation_size,
|
||||
cap => cap.min(allocation.max_memory_allocation_size),
|
||||
};
|
||||
let stage = |s: Stage| {
|
||||
let mut cross_lane = OpBits::NONE;
|
||||
@@ -256,12 +252,6 @@ fn unsupported_features(profile: &DeviceProfile) -> Vec<Unsupported> {
|
||||
feature(VkFeature::ShaderFloat64),
|
||||
));
|
||||
}
|
||||
if f.buffer_access == BufferAccess::Floor {
|
||||
out.push(Unsupported::needs_any_of(
|
||||
Feature::ArgumentBufferPointers,
|
||||
vec![profile.addressed_needs()],
|
||||
));
|
||||
}
|
||||
if !f.fragment.pixel_interlock {
|
||||
out.push(Unsupported::needs_any_of(
|
||||
Feature::RasterOrderGroups,
|
||||
|
||||
@@ -267,23 +267,6 @@ impl DeviceProfile {
|
||||
needs
|
||||
}
|
||||
|
||||
/// What this profile lacks of Profile A's device-address requirements: `bufferDeviceAddress`
|
||||
/// and `shaderInt64`, whichever are missing, in that order. Empty exactly when the profile
|
||||
/// reaches buffers by device address (Profile A). A Profile F refusal that device addresses
|
||||
/// would lift needs this one conjunct, so a device that has one of the two features is never
|
||||
/// told it needs that feature.
|
||||
pub fn addressed_needs(&self) -> Vec<Capability> {
|
||||
let f = &self.fields;
|
||||
let mut needs = Vec::new();
|
||||
if !f.descriptors.buffer_device_address {
|
||||
needs.push(Capability::Feature(VkFeature::BufferDeviceAddress));
|
||||
}
|
||||
if !f.leaf.int64 {
|
||||
needs.push(Capability::Feature(VkFeature::ShaderInt64));
|
||||
}
|
||||
needs
|
||||
}
|
||||
|
||||
/// What `spirv-val` validates a module compiled for this profile under (the L3): each of the
|
||||
/// target environments with the relaxations. Every module the crate returns for the profile has
|
||||
/// requirements within it ([`DeviceProfile::check`]) and is valid under each; the crate's own
|
||||
@@ -385,8 +368,6 @@ pub const IDENTITY_BUFFER_BYTES: u64 = 1 << 31;
|
||||
/// Every field of a profile. The fingerprint hashes all of them.
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
pub struct ProfileFields {
|
||||
/// Memory's A/F split.
|
||||
pub buffer_access: BufferAccess,
|
||||
pub leaf: LeafCaps,
|
||||
pub subgroup: SubgroupModel,
|
||||
pub images: ImageCaps,
|
||||
@@ -471,15 +452,6 @@ impl EnabledCaps {
|
||||
}
|
||||
}
|
||||
|
||||
/// Memory profile: Profile A (`Addressed`, buffer device address available) or Profile F
|
||||
/// (`Floor`, descriptors only).
|
||||
#[non_exhaustive]
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
|
||||
pub enum BufferAccess {
|
||||
Addressed,
|
||||
Floor,
|
||||
}
|
||||
|
||||
/// Leaf arithmetic, storage, and atomic capabilities.
|
||||
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]
|
||||
pub struct LeafCaps {
|
||||
|
||||
@@ -274,10 +274,7 @@ fn mechanism_is_total_over_every_fact_and_profile() {
|
||||
Mechanism::PushConstant
|
||||
}
|
||||
}
|
||||
RuntimeFact::FunctionTableRange { .. } => match f.buffer_access {
|
||||
crate::device::profile::BufferAccess::Addressed => Mechanism::Variant,
|
||||
_ => Mechanism::PlanTimeCheck,
|
||||
},
|
||||
RuntimeFact::FunctionTableRange { .. } => Mechanism::Variant,
|
||||
RuntimeFact::FramebufferFetch { .. } | RuntimeFact::TileImageblock { .. } => {
|
||||
Mechanism::RenderPassContract
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//! `Device::from_queries`, profile derivation, the fingerprint, and `requirements ⊆ profile`.
|
||||
|
||||
use super::*;
|
||||
use crate::device::profile::{BufferAccess, Independence};
|
||||
use crate::device::profile::Independence;
|
||||
use crate::device::requirements::{Requirements, StageCreateFlag, VkLimit, VkProperty};
|
||||
use crate::error::{Capability, Feature, Needs};
|
||||
|
||||
@@ -137,34 +137,12 @@ fn find_structure(v: &serde_json::Value, name: &str, out: &mut Option<serde_json
|
||||
}
|
||||
}
|
||||
|
||||
/// Every committed profile at or above the runtime's floor reaches its buffers by address.
|
||||
#[test]
|
||||
fn every_committed_profile_reaches_its_buffers_by_address() {
|
||||
for stem in [
|
||||
"runtime-floor",
|
||||
"moltenvk-m3",
|
||||
"nvidia-rtx50-linux",
|
||||
"amd-780m-radv",
|
||||
"intel-arl-anv",
|
||||
"lavapipe",
|
||||
] {
|
||||
assert_eq!(
|
||||
device(stem).profile().fields().buffer_access,
|
||||
BufferAccess::Addressed,
|
||||
"{stem}"
|
||||
);
|
||||
assert_eq!(device(stem).profile().addressed_needs(), vec![], "{stem}");
|
||||
}
|
||||
}
|
||||
|
||||
/// `runtime-floor` derives the profile of a device at the runtime's floor: addressed buffers,
|
||||
/// stores and atomics in every stage, and the formats the Vulkan 1.2 Required Format Support
|
||||
/// tables require of it.
|
||||
/// `runtime-floor` derives the profile of a device at the runtime's floor: stores and atomics in
|
||||
/// every stage, and the formats the Vulkan 1.2 Required Format Support tables require of it.
|
||||
#[test]
|
||||
fn runtime_floor_derives_the_floor_profile() {
|
||||
let dev = device("runtime-floor");
|
||||
let f = dev.profile().fields();
|
||||
assert_eq!(f.buffer_access, BufferAccess::Addressed);
|
||||
assert!(f.descriptors.uniform_buffer_standard_layout);
|
||||
assert!(f.leaf.vertex_stores_and_atomics);
|
||||
assert!(f.leaf.fragment_stores_and_atomics);
|
||||
@@ -378,15 +356,11 @@ fn allocation_sizes_are_no_profile_field() {
|
||||
"{stem}"
|
||||
);
|
||||
let length = dev.metal_properties().max_buffer_length;
|
||||
if base.profile().fields().buffer_access == BufferAccess::Addressed {
|
||||
let want = match buffer {
|
||||
0 => memory,
|
||||
cap => cap.min(memory),
|
||||
};
|
||||
assert_eq!(length, want, "{stem}");
|
||||
} else {
|
||||
assert_eq!(length, base.metal_properties().max_buffer_length, "{stem}");
|
||||
}
|
||||
let want = match buffer {
|
||||
0 => memory,
|
||||
cap => cap.min(memory),
|
||||
};
|
||||
assert_eq!(length, want, "{stem}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -648,7 +648,6 @@ fn metal_properties_report_d3_d4_values() {
|
||||
let has = |f: &Feature| m.unsupported_features.iter().any(|u| u.feature == *f);
|
||||
// 64-bit integers are two words without `shaderInt64`, on every pipeline.
|
||||
assert!(!has(&Feature::Int64Arithmetic));
|
||||
assert!(!has(&Feature::ArgumentBufferPointers));
|
||||
assert!(has(&Feature::RasterOrderGroups));
|
||||
// No pixel interlock: framebuffer fetch reads input attachments ordered between draws, a
|
||||
// note, not a refusal.
|
||||
|
||||
@@ -631,8 +631,6 @@ pub enum Feature {
|
||||
SimdgroupMatrix16x16x16,
|
||||
|
||||
// ---- Memory ----
|
||||
/// Argument buffers holding buffer pointers (dynamic roots).
|
||||
ArgumentBufferPointers,
|
||||
/// Argument buffers holding textures or samplers (handle domain).
|
||||
ArgumentBufferTextures,
|
||||
/// Argument-buffer members that are pipeline states, ICBs, function tables, or acceleration
|
||||
@@ -640,8 +638,6 @@ pub enum Feature {
|
||||
ArgumentBufferObjects,
|
||||
/// Dereferencing a pointer loaded from memory or made from an integer.
|
||||
DereferenceLoadedPointer,
|
||||
/// Storing a pointer or converting it to an integer.
|
||||
PointerToInteger,
|
||||
/// Comparing pointers with different roots.
|
||||
PointerCompare,
|
||||
/// A resource handle used as a byte pointer, or conflicting handle provenance.
|
||||
@@ -662,8 +658,6 @@ pub enum Feature {
|
||||
ImageAtomics,
|
||||
/// Too many descriptors of one kind in a stage or pipeline.
|
||||
DescriptorCount,
|
||||
/// A buffer window beyond the descriptor range limits.
|
||||
BufferRange,
|
||||
|
||||
// ---- Arithmetic ----
|
||||
/// 64-bit integer arithmetic.
|
||||
|
||||
@@ -81,10 +81,9 @@
|
||||
//! address is naturally aligned (`(bind_offset + offset) & ~(n - 1)`), as Metal atomic objects are.
|
||||
//!
|
||||
//! **Refused.** 64-bit atomics need `shaderBufferInt64Atomics` / `shaderSharedInt64Atomics`
|
||||
//! (`Unsupported{Int64Atomics}`) and, on a buffer, device addresses (the profile's addressed
|
||||
//! needs); a 64-bit threadgroup atomic needs a `u64` view of the arena, which is not declared
|
||||
//! (`Unsupported{Lowering(Access), NotImplemented}`), as are atomics of other types (pointers,
|
||||
//! `half`), under-aligned LLVM atomics, and LLVM atomics through private pointers.
|
||||
//! (`Unsupported{Int64Atomics}`); a 64-bit threadgroup atomic needs a `u64` view of the arena,
|
||||
//! which is not declared (`Unsupported{Lowering(Access), NotImplemented}`), as are atomics of other
|
||||
//! types (pointers, `half`), under-aligned LLVM atomics, and LLVM atomics through private pointers.
|
||||
|
||||
use std::borrow::Cow;
|
||||
|
||||
@@ -96,7 +95,6 @@ use crate::air::ir::{
|
||||
Align, AtomicRmwOp, Callee, Inst, InstId, InstKind, Ordering, Type, TypeId, Value, ValueId,
|
||||
};
|
||||
use crate::budget::Meter;
|
||||
use crate::device::profile::BufferAccess;
|
||||
use crate::device::requirements::VkFeature;
|
||||
use crate::error::{AccessCause, Capability, Error, Feature, Unsupported};
|
||||
use crate::lower::emit::EmitCx;
|
||||
@@ -591,7 +589,6 @@ pub fn select(
|
||||
}
|
||||
_ => return Err(refuse(AccessCause::AtomicMemory)),
|
||||
};
|
||||
let addressed = cx.profile.fields().buffer_access == BufferAccess::Addressed;
|
||||
let wide = r.elem == Elem::I64;
|
||||
let narrow = match r.elem {
|
||||
Elem::I8 => Some(8),
|
||||
@@ -620,14 +617,6 @@ pub fn select(
|
||||
// The arena is a `u32` word array; a `u64` view of it is not declared.
|
||||
return Err(refuse(AccessCause::AtomicMemory));
|
||||
}
|
||||
if !addressed {
|
||||
// A buffer's `u64` word is reached through its device address only.
|
||||
return Err(Unsupported::needs_any_of(
|
||||
Feature::Int64Atomics,
|
||||
vec![cx.profile.addressed_needs()],
|
||||
)
|
||||
.into());
|
||||
}
|
||||
}
|
||||
let value = match r.value {
|
||||
Some(v) => Some(value_id(cx, v)?),
|
||||
|
||||
@@ -31,14 +31,11 @@
|
||||
//! builder loop), followed by the unrolled tail. A length that is not a constant (the dynamic size)
|
||||
//! is a counted loop over `len / unit` units, followed by the tail bytes, each under `if (b < len
|
||||
//! mod 4)`. No assumption is made about an `i64` length's high word: between wide endpoints only (a
|
||||
//! `memcpy` or `memmove` whose both endpoints are wide, or a wide `memset`), whose allocations'
|
||||
//! root entries have `u64` sizes, a `u64` length is counted exactly, with a `u64` counter and
|
||||
//! displacements. Every other endpoint is displaced in `u32` (static slots, arenas, the blob: the
|
||||
//! offset space), so a length of 2³² or more reaches past every byte it can address: the call is
|
||||
//! out of bounds, and it counts as `u32::MAX` bytes, each unit contained. That covers every `i64`
|
||||
//! held as two words without `shaderInt64`: such a profile has no device addresses
|
||||
//! (`BufferAccess::Floor`), so no wide endpoint, and every window is at most
|
||||
//! `maxStorageBufferRange` bytes.
|
||||
//! `memcpy` or `memmove` whose both endpoints are wide, or a wide `memset`), which are `u64` device
|
||||
//! addresses, a `u64` length is counted exactly, with a `u64` counter and displacements. Every
|
||||
//! other endpoint is displaced in `u32` (static slots, arenas, the blob: the offset space), so a
|
||||
//! length of 2³² or more reaches past every byte it can address: the call is out of bounds, and it
|
||||
//! counts as `u32::MAX` bytes, each unit contained.
|
||||
//!
|
||||
//! **Overlap.** `memcpy` operands may not overlap (LLVM). A `memmove` of at most
|
||||
//! [`UNROLL_UNITS`] constant units loads every unit before storing any, so overlap is exact. A
|
||||
|
||||
@@ -53,9 +53,7 @@
|
||||
//!
|
||||
//! Not lowered yet (`Unsupported{Lowering(Access), NotImplemented}`): pointers stored in a typed
|
||||
//! object or a constant global, a wide root set holding the constant blob, and aggregate
|
||||
//! accesses. Profile F refuses every wide pointer (`DereferenceLoadedPointer`, or
|
||||
//! `PointerToInteger` in a function without a loaded pointer, naming what it lacks of
|
||||
//! `bufferDeviceAddress` and `shaderInt64`).
|
||||
//! accesses.
|
||||
|
||||
use std::borrow::Cow;
|
||||
use std::collections::BTreeSet;
|
||||
@@ -67,7 +65,6 @@ use crate::air::ir::{
|
||||
ValueId,
|
||||
};
|
||||
use crate::budget::Meter;
|
||||
use crate::device::profile::BufferAccess;
|
||||
use crate::device::requirements::VkFeature;
|
||||
use crate::error::{AccessCause, Capability, Error, Feature, LowerFamily, Unsupported};
|
||||
use crate::lower::arith::{Form, Held};
|
||||
@@ -305,21 +302,6 @@ fn wide(cx: &SelectCx<'_>, v: Value) -> Option<RootSetId> {
|
||||
}
|
||||
}
|
||||
|
||||
/// Profile F has no device addresses: every wide pointer is refused there, naming what the
|
||||
/// profile lacks of Profile A: as a loaded pointer's dereference when the function has a dynamic
|
||||
/// root, else as a stored or converted pointer (whose root joined the dynamic component).
|
||||
fn require_addresses(cx: &SelectCx<'_>) -> Result<(), Error> {
|
||||
if cx.profile.fields().buffer_access != BufferAccess::Addressed {
|
||||
let feature = if cx.memory.needs.dynamic_roots {
|
||||
Feature::DereferenceLoadedPointer
|
||||
} else {
|
||||
Feature::PointerToInteger
|
||||
};
|
||||
return Err(Unsupported::needs_any_of(feature, vec![cx.profile.addressed_needs()]).into());
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// The wide operand `v`: refused unless it is a wide pointer value (a constant pointer is not
|
||||
/// materialized).
|
||||
fn wide_operand(cx: &SelectCx<'_>, v: Value) -> Result<ValueId, Error> {
|
||||
@@ -336,7 +318,6 @@ fn wide_operand(cx: &SelectCx<'_>, v: Value) -> Result<ValueId, Error> {
|
||||
/// refused. A set's slots join the plan's once, at its first such read. Under the identity domains
|
||||
/// the pointer carries its address, and no entry is read.
|
||||
pub(super) fn plan_entry(cx: &mut SelectCx<'_>, v: Value) -> Result<ValueId, Error> {
|
||||
require_addresses(cx)?;
|
||||
let roots = wide(cx, v).ok_or_else(|| refuse(AccessCause::PointerForm))?;
|
||||
let Some(set) = cx.root_sets.get_mut(roots) else {
|
||||
return Err(cx.invariant("a wide pointer's root set was not read"));
|
||||
@@ -382,7 +363,6 @@ pub fn lowered_pointer(cx: &SelectCx<'_>, v: Value) -> Result<Option<DemoteTy>,
|
||||
if wide(cx, v).is_none() {
|
||||
return Ok(None);
|
||||
}
|
||||
require_addresses(cx)?;
|
||||
if super::phis::incoming(cx, v)?.is_some_and(|i| i.not_wide) {
|
||||
return Err(refuse(AccessCause::PointerJoin));
|
||||
}
|
||||
@@ -397,7 +377,6 @@ pub fn is_wide_param(cx: &SelectCx<'_>, b: &ParamBinding) -> bool {
|
||||
/// Plan a buffer parameter whose value is a wide pointer: its slot's address is read from its
|
||||
/// `SlotGuestBase`.
|
||||
pub fn select_param(cx: &mut SelectCx<'_>, b: &ParamBinding) -> Result<(), Error> {
|
||||
require_addresses(cx)?;
|
||||
let slot = param_slot(cx.entry, b).ok_or_else(|| refuse(AccessCause::Parameter))?;
|
||||
cx.push.insert(PushField::SlotGuestBase(slot));
|
||||
cx.families.access.dynamic.params.insert(b.param);
|
||||
@@ -542,7 +521,6 @@ pub fn select(
|
||||
indices,
|
||||
..
|
||||
} if result_wide => {
|
||||
require_addresses(cx)?;
|
||||
let base = wide_operand(cx, *base)?;
|
||||
let (konst, terms) = super::gep_offset_wide(cx, *src_ty, indices)?;
|
||||
DynStrategy::Gep { base, konst, terms }
|
||||
@@ -554,13 +532,11 @@ pub fn select(
|
||||
| InstKind::Freeze(v)
|
||||
if result_wide && is_ptr_ty(cx, inst.ty) =>
|
||||
{
|
||||
require_addresses(cx)?;
|
||||
DynStrategy::Copy {
|
||||
of: wide_operand(cx, *v)?,
|
||||
}
|
||||
}
|
||||
InstKind::Select { c, t, f, .. } if result_wide && is_ptr_ty(cx, inst.ty) => {
|
||||
require_addresses(cx)?;
|
||||
let c = match c {
|
||||
Value::Const(_) => return Err(refuse(AccessCause::ConstantCondition)),
|
||||
c => operand(cx, *c)?,
|
||||
@@ -581,7 +557,6 @@ pub fn select(
|
||||
op: CastOp::IntToPtr,
|
||||
v,
|
||||
} if result_wide => {
|
||||
require_addresses(cx)?;
|
||||
if !matches!(
|
||||
cx.value_ty(*v).and_then(|t| cx.entry.module.types().get(t)),
|
||||
Some(Type::Int(64))
|
||||
@@ -599,7 +574,6 @@ pub fn select(
|
||||
atomic: None,
|
||||
..
|
||||
} if result_wide => {
|
||||
require_addresses(cx)?;
|
||||
let leaf = pointer_leaf(cx, inst.ty, *align)?;
|
||||
let source = match cx.memory.repr(*ptr) {
|
||||
Some(Repr::BufPtr { wide: false, .. }) => {
|
||||
@@ -817,7 +791,6 @@ fn is_buffer_ptr(cx: &SelectCx<'_>, v: Value) -> bool {
|
||||
/// root entry). A pointer into the constant blob has no guest address, and any other operand is
|
||||
/// refused.
|
||||
fn stored(cx: &mut SelectCx<'_>, v: Value) -> Result<Side, Error> {
|
||||
require_addresses(cx)?;
|
||||
if is_null(cx, v) {
|
||||
return Ok(Side::Null);
|
||||
}
|
||||
|
||||
@@ -40,8 +40,7 @@ use std::borrow::Cow;
|
||||
|
||||
use crate::air::intrinsics::{AirIntrinsic, FunctionTable};
|
||||
use crate::air::ir::{Callee, Inst, InstKind, ValueId};
|
||||
use crate::device::profile::BufferAccess;
|
||||
use crate::error::{Error, Feature, Unsupported};
|
||||
use crate::error::Error;
|
||||
use crate::lower::arith::legal;
|
||||
use crate::lower::emit::EmitCx;
|
||||
use crate::lower::select::{DescriptorCounts, Plan, SelectCx};
|
||||
@@ -176,13 +175,6 @@ pub fn select(cx: &mut SelectCx<'_>, inst: &Inst) -> Result<Option<TableWord>, E
|
||||
false => HandleIds::U64,
|
||||
};
|
||||
let addressed = cx.inputs.addressed_function_tables;
|
||||
if addressed && cx.profile.fields().buffer_access != BufferAccess::Addressed {
|
||||
return Err(Unsupported::needs_any_of(
|
||||
Feature::BufferRange,
|
||||
vec![cx.profile.addressed_needs()],
|
||||
)
|
||||
.into());
|
||||
}
|
||||
let (words, storage_buffers) = match addressed {
|
||||
true => (TableWords::Addressed, 1),
|
||||
false => (TableWords::Snapshot, 2),
|
||||
|
||||
@@ -46,7 +46,6 @@ use std::borrow::Cow;
|
||||
use crate::air::intrinsics::{AirIntrinsic, CommandStage, IndirectCommand};
|
||||
use crate::air::ir::{Callee, Inst, InstKind, Value, ValueId};
|
||||
use crate::budget::Meter;
|
||||
use crate::device::profile::BufferAccess;
|
||||
use crate::error::{
|
||||
AccessCause, Capability, DiagName, Error, Feature, InternalError, InternalKind, Unsupported,
|
||||
};
|
||||
@@ -214,19 +213,10 @@ fn address(cx: &mut SelectCx<'_>, v: Value, m: &mut Meter) -> Result<Address, Er
|
||||
}
|
||||
}
|
||||
|
||||
/// The refusal of every operation on a device that cannot write the records: one without device
|
||||
/// addresses and `shaderInt64`, or a vertex or fragment function's without its stage's store
|
||||
/// feature.
|
||||
/// The refusal of every operation on a device that cannot write the records: a vertex or fragment
|
||||
/// function's without its stage's store feature.
|
||||
fn needs(cx: &SelectCx<'_>) -> Result<(), Error> {
|
||||
let f = cx.profile.fields();
|
||||
if f.buffer_access != BufferAccess::Addressed || !f.leaf.int64 {
|
||||
return Err(Unsupported::needs_any_of(
|
||||
Feature::GpuEncodedIndirectCommands,
|
||||
vec![cx.profile.addressed_needs()],
|
||||
)
|
||||
.into());
|
||||
}
|
||||
let enabled = &f.enabled.features;
|
||||
let enabled = &cx.profile.fields().enabled.features;
|
||||
if let Some(feature) = dynamic::stage_stores(cx.stage).find(|f| !enabled.contains(f)) {
|
||||
return Err(Unsupported::needs(
|
||||
Feature::GpuEncodedIndirectCommands,
|
||||
|
||||
@@ -73,9 +73,9 @@
|
||||
//! **Pointer values** ([`mod@pointer`]): `null`, `undef`, and `poison` pointers are the null root
|
||||
//! (a `select` side, a phi's incoming value, a GEP base, an access's pointer); compares of device
|
||||
//! and constant pointers compare offsets within one object and Metal addresses (`SlotGuestBase`
|
||||
//! plus displacement, or a wide pointer's root entry) otherwise; on Profile F a stored or converted
|
||||
//! static pointer is its Metal address; an instruction on a handle of a family lowered elsewhere is
|
||||
//! refused as that family.
|
||||
//! plus displacement, or a wide pointer's address) otherwise; a stored or converted static pointer
|
||||
//! is its Metal address; an instruction on a handle of a family lowered elsewhere is refused as
|
||||
//! that family.
|
||||
//!
|
||||
//! **Volatile accesses**. A volatile load or store is selected as the same instruction without
|
||||
//! `volatile` and then takes its volatile form (`volatile_form`): every word load and store it
|
||||
@@ -121,7 +121,6 @@ use std::collections::{BTreeMap, BTreeSet};
|
||||
use crate::air::abi::{AbiInt, ParamBinding, ParamRole};
|
||||
use crate::air::ir::{AddrSpace, CastOp, Const, Inst, InstId, InstKind, Type, Value, ValueId};
|
||||
use crate::budget::Meter;
|
||||
use crate::device::profile::BufferAccess;
|
||||
use crate::device::DeviceProfile;
|
||||
use crate::error::{AccessCause, Error, Feature, ImageblockCause, LowerFamily, Unsupported};
|
||||
use crate::lower::emit::EmitCx;
|
||||
@@ -182,7 +181,7 @@ pub enum AccessStrategy {
|
||||
Dynamic(dynamic::DynStrategy),
|
||||
/// A texture or sampler handle value, or a handle-array offset.
|
||||
Handle(handle::HandleStrategy),
|
||||
/// A pointer compare, or a static pointer converted or stored on Profile F.
|
||||
/// A pointer compare, or a static pointer converted or stored.
|
||||
Value(pointer::PointerValue),
|
||||
/// A pointer stored into or loaded from a forwarding pointer cell.
|
||||
Cell(cell::CellStrategy),
|
||||
@@ -1381,29 +1380,20 @@ fn unwritten_slots(
|
||||
/// flat variant (`LoweringInputs::flat_grid`) or a folded variant
|
||||
/// (`LoweringInputs::folded_groups`), before its slots' forms are chosen: a kernel with neither a
|
||||
/// stage-input descriptor or fetch (`sources`) nor a tile function's attachments, or for a replay
|
||||
/// variant also a vertex function whose fetch is all pulled or a fragment function, or for a folded variant
|
||||
/// also an object function (whose draw's pieces fold its grid, `bind::mesh_arguments`), on a
|
||||
/// profile with device addresses. A replay variant reads every `SlotGuestBase` the selection asked for from its
|
||||
/// slot's root entry instead ([`replay_guest_base`]), so the push block holds the root table's
|
||||
/// address in its place; and a kernel that reads a grid builtin reads its `DispatchRegion` from the
|
||||
/// region record the replay's preprocess writes per command and region ([`replay_region`]), so the
|
||||
/// push block holds that record's address in its place. A flat variant reads the record's
|
||||
/// `threads_per_grid` whatever builtins it reads, from a replay's record or, bound as any other
|
||||
/// kernel, from the record a preprocess writes for its dispatch beside the group counts; and it
|
||||
/// runs no emulated simdgroups: its threads return early past the grid, which no workgroup
|
||||
/// barrier may follow. A folded variant reads its group counts and every grid builtin's region
|
||||
/// from the record a preprocess writes for its dispatch, whatever builtins it reads; its
|
||||
/// workgroups past Metal's last threadgroup return early as wholes, so it runs emulated
|
||||
/// simdgroups too.
|
||||
/// variant also a vertex function whose fetch is all pulled or a fragment function, or for a folded
|
||||
/// variant also an object function (whose draw's pieces fold its grid, `bind::mesh_arguments`). A
|
||||
/// replay variant reads every `SlotGuestBase` the selection asked for from its slot's root entry
|
||||
/// instead ([`replay_guest_base`]), so the push block holds the root table's address in its place;
|
||||
/// and a kernel that reads a grid builtin reads its `DispatchRegion` from the region record the
|
||||
/// replay's preprocess writes per command and region ([`replay_region`]), so the push block holds
|
||||
/// that record's address in its place. A flat variant reads the record's `threads_per_grid`
|
||||
/// whatever builtins it reads, from a replay's record or, bound as any other kernel, from the
|
||||
/// record a preprocess writes for its dispatch beside the group counts; and it runs no emulated
|
||||
/// simdgroups: its threads return early past the grid, which no workgroup barrier may follow. A
|
||||
/// folded variant reads its group counts and every grid builtin's region from the record a
|
||||
/// preprocess writes for its dispatch, whatever builtins it reads; its workgroups past Metal's last
|
||||
/// threadgroup return early as wholes, so it runs emulated simdgroups too.
|
||||
fn plan_replay(cx: &mut SelectCx<'_>, sources: &[SlotRef]) -> Result<(), Error> {
|
||||
let p = cx.profile;
|
||||
if p.fields().buffer_access != BufferAccess::Addressed {
|
||||
return Err(Unsupported::needs_any_of(
|
||||
Feature::GpuEncodedIndirectCommands,
|
||||
vec![p.addressed_needs()],
|
||||
)
|
||||
.into());
|
||||
}
|
||||
// A replayed command is a compute dispatch with no stage-in region and no tile pass, or a
|
||||
// draw whose vertex function fetches no attribute in fixed function: its buffers are the
|
||||
// record's, read through the slot table, which a pulled attribute's read reaches and
|
||||
|
||||
@@ -39,15 +39,13 @@
|
||||
//! word first, and `SlotGuestBase` is placed as a `uvec2` on every profile (the same eight
|
||||
//! bytes).
|
||||
//!
|
||||
//! **Stored and converted pointers on Profile F and under the identity domains**
|
||||
//! ([`PointerValue::ToInt`], [`PointerValue::StorePointer`]). Without root entries an escaping
|
||||
//! slot root stays static (`memory::plan`), so `ptrtoint` of a static fat pointer (or of the null
|
||||
//! constant) is its Metal address as above, truncated to the integer's width (a `bool` its low
|
||||
//! bit), and a stored one is that address as an 8-byte leaf (stored pointers are guest addresses)
|
||||
//! through its destination, as `dynamic` stores a wide pointer's: a static-root pointer, a wide
|
||||
//! pointer (a pointer loaded from memory or made from an integer, at the address it holds), or a
|
||||
//! pointer cell in an arena (an open cell, whose bytes are read at an offset only the run knows).
|
||||
//! On Profile A's resident table such a pointer is wide.
|
||||
//! **Stored and converted pointers** ([`PointerValue::ToInt`], [`PointerValue::StorePointer`]).
|
||||
//! An escaping slot root stays static (`memory::plan`), so `ptrtoint` of a static fat pointer is
|
||||
//! its Metal address as above, truncated to the integer's width (a `bool` its low bit), and a
|
||||
//! stored one is that address as an 8-byte leaf (stored pointers are guest addresses) through its
|
||||
//! destination, as `dynamic` stores a wide pointer's: a static-root pointer, a wide pointer (a
|
||||
//! pointer loaded from memory or made from an integer, at the address it holds), or a pointer cell
|
||||
//! in an arena (an open cell, whose bytes are read at an offset only the run knows).
|
||||
//!
|
||||
//! **Handles of the other families.** A command buffer, pipeline state, acceleration structure, or
|
||||
//! function table loaded from an argument buffer, or any access-family instruction on one, is
|
||||
@@ -60,7 +58,6 @@ use crate::air::ir::{
|
||||
Align, CastOp, Const, Inst, InstId, InstKind, IntPredicate, Type, TypeId, Value, ValueId,
|
||||
};
|
||||
use crate::budget::Meter;
|
||||
use crate::device::profile::BufferAccess;
|
||||
use crate::error::{AccessCause, Error, Feature, Unsupported};
|
||||
use crate::lower::arith::wide::{self, Pair};
|
||||
use crate::lower::arith::{Form, Held};
|
||||
@@ -136,11 +133,10 @@ pub enum PointerValue {
|
||||
b: Addr,
|
||||
words: bool,
|
||||
},
|
||||
/// `ptrtoint` of a static fat pointer or the null constant to `i<bits>` (Profile F).
|
||||
/// `ptrtoint` of a static fat pointer to `i<bits>`.
|
||||
ToInt { of: Addr, bits: u8, words: bool },
|
||||
/// A static fat pointer or the null constant stored as its 8-byte Metal address through a
|
||||
/// static-root pointer, a wide pointer, or an arena's pointer cell (Profile F and the identity
|
||||
/// domains).
|
||||
/// A static fat pointer stored as its 8-byte Metal address through a static-root pointer, a
|
||||
/// wide pointer, or an arena's pointer cell.
|
||||
StorePointer {
|
||||
to: Box<Source>,
|
||||
value: Addr,
|
||||
@@ -437,18 +433,15 @@ fn compare(
|
||||
}))
|
||||
}
|
||||
|
||||
/// Whether stored or converted pointer `v` takes the static form here: a static fat pointer
|
||||
/// (which escapes only without root entries: on Profile F and under the identity domains), or the
|
||||
/// null constant on a profile without device addresses.
|
||||
/// Every other pointer is `dynamic`'s (or refused there).
|
||||
/// Whether stored or converted pointer `v` takes the static form here: a static fat pointer, whose
|
||||
/// root stays static where it escapes (`memory::plan`). Every other pointer is `dynamic`'s (or
|
||||
/// refused there).
|
||||
fn static_escape(cx: &SelectCx<'_>, v: Value) -> Result<Option<Kind>, Error> {
|
||||
if !buffer_space(cx, v) {
|
||||
return Ok(None);
|
||||
}
|
||||
let addressed = cx.profile.fields().buffer_access == BufferAccess::Addressed;
|
||||
Ok(match kind(cx, v) {
|
||||
Ok(Kind::Fat) => Some(Kind::Fat),
|
||||
Ok(Kind::Null) if !addressed => Some(Kind::Null),
|
||||
_ => None,
|
||||
})
|
||||
}
|
||||
@@ -481,7 +474,7 @@ fn address_leaf(cx: &SelectCx<'_>, ty: TypeId, align: Option<Align>) -> Result<L
|
||||
/// A store of pointer `val` (taking the static form) through `ptr`: a leaf store of its
|
||||
/// address through a static-root destination, at the address a wide one holds, or into an arena's
|
||||
/// pointer cell (`dynamic::store_destination`). A destination in the blob, a typed object or a
|
||||
/// constant global is refused (on Profile A's resident table a wide one makes `val` wide too).
|
||||
/// constant global is refused.
|
||||
fn store_pointer(
|
||||
cx: &mut SelectCx<'_>,
|
||||
val: Value,
|
||||
|
||||
@@ -343,14 +343,12 @@ pub fn mesh_stages(p: &DeviceProfile) -> bool {
|
||||
|
||||
/// Whether profile `p` compiles an object function folded (`LoweringInputs::folded_groups`), so
|
||||
/// that its draws run any object grid Metal runs in pieces within the task stage's limits
|
||||
/// (`bind::mesh_arguments`): it runs mesh functions natively, and has device addresses (the
|
||||
/// region record), 64-bit integers (the threadgroup's number), `multiDrawIndirect` (a direct draw's
|
||||
/// pieces, and `maxDrawIndirectCount` at least 65,535) and `drawIndirectCount` (an indirect
|
||||
/// draw's).
|
||||
/// (`bind::mesh_arguments`): it runs mesh functions natively, and has 64-bit integers (the
|
||||
/// threadgroup's number), `multiDrawIndirect` (a direct draw's pieces, and `maxDrawIndirectCount`
|
||||
/// at least 65,535) and `drawIndirectCount` (an indirect draw's).
|
||||
pub fn folds_object_grids(p: &DeviceProfile) -> bool {
|
||||
let features = &p.enabled().features;
|
||||
mesh_stages(p)
|
||||
&& p.fields().buffer_access == crate::device::profile::BufferAccess::Addressed
|
||||
&& features.contains(&VkFeature::ShaderInt64)
|
||||
&& features.contains(&VkFeature::MultiDrawIndirect)
|
||||
&& features.contains(&VkFeature::DrawIndirectCount)
|
||||
|
||||
@@ -526,7 +526,7 @@ pub(super) fn select(
|
||||
// The de-indexed and private list forms' per-vertex element is the vertex its index names.
|
||||
let captured = super::plan::captured_index_type(cx);
|
||||
if let (VertexStepFunction::PerVertex, Some(ty)) = (step_function, captured) {
|
||||
super::plan::captured_index(cx, ty)?;
|
||||
super::plan::captured_index(cx, ty);
|
||||
}
|
||||
// A merged draw's vertex reads its corner's command's vertex and instance
|
||||
// (`super::MergedRead`).
|
||||
|
||||
@@ -2340,7 +2340,7 @@ pub fn entry(cx: &mut SelectCx<'_>) -> Result<(), Error> {
|
||||
primitive_id_output(cx)?;
|
||||
}
|
||||
if cx.inputs.indirect_range && cx.stage == Stage::Vertex {
|
||||
indirect_range(cx)?;
|
||||
indirect_range(cx);
|
||||
}
|
||||
// The pass's colors the pipeline lacks, which plain Metal zeroes where a draw covers them.
|
||||
if cx.stage == Stage::Fragment {
|
||||
@@ -2419,50 +2419,23 @@ fn indices_feature(cx: &SelectCx<'_>) -> Feature {
|
||||
/// Plan the execution range test of a vertex function compiled under
|
||||
/// `LoweringInputs::indirect_range` ([`super::StageIoPlan::indirect_range`]): its range's address
|
||||
/// and its command, pushed, and its `Position` output, where it has one. The range is read by
|
||||
/// address: a device without device addresses refuses it.
|
||||
fn indirect_range(cx: &mut SelectCx<'_>) -> Result<(), Error> {
|
||||
let f = cx.profile.fields();
|
||||
if f.buffer_access != crate::device::profile::BufferAccess::Addressed || !f.leaf.int64 {
|
||||
return Err(Unsupported::needs_any_of(
|
||||
Feature::GpuEncodedIndirectCommands,
|
||||
vec![cx.profile.addressed_needs()],
|
||||
)
|
||||
.into());
|
||||
}
|
||||
/// address.
|
||||
fn indirect_range(cx: &mut SelectCx<'_>) {
|
||||
cx.push.insert(PushField::IndirectRange);
|
||||
cx.push.insert(PushField::IndirectSequence);
|
||||
cx.push.insert(PushField::IndirectBase);
|
||||
let sp = &mut cx.families.stage_io;
|
||||
sp.indirect_range = Some(sp.invariant);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Refuse the de-indexed or private list form ([`indices_feature`]) on a device without device
|
||||
/// addresses, naming what it needs: the indices are reached by address.
|
||||
fn refuse_unaddressed(cx: &SelectCx<'_>) -> Result<(), Error> {
|
||||
if cx.profile.fields().buffer_access != crate::device::profile::BufferAccess::Addressed {
|
||||
return Err(Unsupported::needs_any_of(
|
||||
indices_feature(cx),
|
||||
vec![cx.profile.addressed_needs()],
|
||||
)
|
||||
.into());
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Plan the index read of type `ty` of the de-indexed form or the private list form once
|
||||
/// ([`super::CapturedIndex`]): its address push field, the de-indexed form's layout, the private
|
||||
/// list form's first vertex (as the primitive ID's,
|
||||
/// [`first_vertex`]) and its fact, and the vertex index builtin. Refused ([`indices_feature`]) on
|
||||
/// a device without device addresses.
|
||||
pub(super) fn captured_index(
|
||||
cx: &mut SelectCx<'_>,
|
||||
ty: crate::metal::IndexType,
|
||||
) -> Result<(), Error> {
|
||||
/// list form's first vertex (as the primitive ID's, [`first_vertex`]) and its fact, and the vertex
|
||||
/// index builtin.
|
||||
pub(super) fn captured_index(cx: &mut SelectCx<'_>, ty: crate::metal::IndexType) {
|
||||
if cx.families.stage_io.captured_index.is_some() {
|
||||
return Ok(());
|
||||
return;
|
||||
}
|
||||
refuse_unaddressed(cx)?;
|
||||
cx.push.insert(PushField::CaptureIndexAddress);
|
||||
let first = match listed(cx) {
|
||||
true => {
|
||||
@@ -2483,7 +2456,6 @@ pub(super) fn captured_index(
|
||||
StageBuiltin::VertexIndex,
|
||||
);
|
||||
sp.captured_index = Some(super::CapturedIndex { vertex, ty, first });
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Plan builtin parameter `b` of AIR type `ty`, a scalar integer, of a vertex function in the
|
||||
@@ -2502,12 +2474,12 @@ fn captured_param(
|
||||
int_scalar(f)?;
|
||||
let source = match index {
|
||||
Some(index) => {
|
||||
captured_index(cx, index)?;
|
||||
captured_index(cx, index);
|
||||
Source::CapturedVertex(f)
|
||||
}
|
||||
// The private list form's base vertex lies before its list, found from its first vertex.
|
||||
None if listed(cx) => {
|
||||
captured_index(cx, crate::metal::IndexType::UInt32)?;
|
||||
captured_index(cx, crate::metal::IndexType::UInt32);
|
||||
Source::CapturedBaseVertex(f)
|
||||
}
|
||||
None => {
|
||||
|
||||
@@ -5,12 +5,10 @@
|
||||
//!
|
||||
//! - **Representations**: the [`Repr`] of every pointer value, which `select` demotes it to. A
|
||||
//! buffer pointer is wide exactly when one of its roots is in the root component of `Dynamic`
|
||||
//! (`super::roots::wide_roots`), so a pointer and its operands share one width. On a profile with
|
||||
//! device addresses (Profile A), a buffer slot root whose pointer escapes (stored as a value, or
|
||||
//! `ptrtoint`) joins that component: its address may come back as a loaded pointer, and a wide
|
||||
//! pointer's guest address is exact. On Profile F, and under the identity domains, it stays
|
||||
//! static, and its stored or converted address is `SlotGuestBase` plus its displacement. Such a
|
||||
//! slot's window is `Whole` when its own accesses give none.
|
||||
//! (`super::roots::wide_roots`), so a pointer and its operands share one width. A buffer slot
|
||||
//! root whose pointer escapes (stored as a value, or `ptrtoint`) stays static, and its stored or
|
||||
//! converted address is `SlotGuestBase` plus its displacement. Such a slot's window is `Whole`
|
||||
//! when its own accesses give none.
|
||||
//! - **Slots**: every buffer or argument-buffer parameter an instruction reaches, and every
|
||||
//! accessed element of a buffer table (an `array_ref` of buffers), with its access set, its
|
||||
//! proven [`Window`], and whether it needs its guest base (`PushField::SlotGuestBase`:
|
||||
@@ -35,13 +33,8 @@
|
||||
//! initializer, unless its type would take the function's typed objects past
|
||||
//! `alloca::MAX_UNSHARED`; any other one is placed in the **constant blob**, the byte image the
|
||||
//! artifact carries (`WriteSource::ConstantBlob`).
|
||||
//! - **Needs**: dynamic roots, the handle classes that need the handle table, and whether a guest
|
||||
//! base is needed.
|
||||
//!
|
||||
//! Profile F (`BufferAccess::Floor`) has no device addresses, so a dereference of a pointer whose
|
||||
//! root set contains `Dynamic` is refused here, naming what the profile lacks of Profile A's
|
||||
//! `bufferDeviceAddress` and `shaderInt64`. Every other refusal of a represented construct belongs
|
||||
//! to the family that lowers it.
|
||||
//! Every refusal of a represented construct belongs to the family that lowers it.
|
||||
|
||||
use std::collections::{BTreeMap, BTreeSet};
|
||||
use std::sync::Arc;
|
||||
@@ -60,7 +53,6 @@ use crate::air::ir::{
|
||||
};
|
||||
use crate::air::Entry;
|
||||
use crate::budget::{tree_bytes, vec_bytes, Meter};
|
||||
use crate::device::profile::BufferAccess;
|
||||
use crate::device::DeviceProfile;
|
||||
use crate::error::{
|
||||
AccessCause, Error, Feature, ImageblockCause, InternalError, InternalKind, Limit, Unsupported,
|
||||
@@ -88,8 +80,8 @@ pub struct SlotPlan {
|
||||
pub argument_buffer: bool,
|
||||
/// What the function's accesses do (an atomic reads and writes).
|
||||
pub access: AccessSet,
|
||||
/// What the function's accesses through a dynamic root may do to the slot: on a profile with
|
||||
/// device addresses, a slot whose address escapes may come back as a loaded or converted
|
||||
/// What the function's accesses through a dynamic root may do to the slot: a slot whose
|
||||
/// address escapes may come back as a loaded or converted
|
||||
/// pointer, which every access of the dynamic root may be. It writes where some such access
|
||||
/// writes, and reads where some reads or writes: a store through a device address merges its
|
||||
/// partial words with two atomics, which read the word they modify, and whether one does is
|
||||
@@ -314,15 +306,6 @@ pub struct ConstantBlob {
|
||||
pub bytes: Arc<[u8]>,
|
||||
}
|
||||
|
||||
/// What the function needs from the binder and the device.
|
||||
#[derive(Clone, Debug, Default, PartialEq, Eq)]
|
||||
pub struct MemNeeds {
|
||||
/// Some buffer pointer may have a dynamic root (a resident-set lookup).
|
||||
pub dynamic_roots: bool,
|
||||
/// The classes of handles loaded from memory, which need the handle table.
|
||||
pub handle_table: Option<Vec<HandleClass>>,
|
||||
}
|
||||
|
||||
/// The memory plan of one entry.
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct MemoryPlan {
|
||||
@@ -376,7 +359,6 @@ pub struct MemoryPlan {
|
||||
/// ([`MemoryPlan::const_global`]).
|
||||
pub const_index: Vec<(GlobalId, u32)>,
|
||||
pub blob: Option<ConstantBlob>,
|
||||
pub needs: MemNeeds,
|
||||
/// Which allocas forward the pointers stored into them (pointer cells).
|
||||
pub cells: CellFacts,
|
||||
/// The GEPs into array fields, sorted, each with its extent (`provenance::array_geps`):
|
||||
@@ -706,18 +688,10 @@ pub fn analyze_memory(e: &Entry, p: &DeviceProfile, m: &mut Meter) -> Result<Mem
|
||||
fn analyze(e: &Entry, p: &DeviceProfile, m: &mut Meter) -> Result<MemoryPlan, Error> {
|
||||
let layouts = TypeLayouts::new(&e.layout, e.module.types(), m)?;
|
||||
let prov = provenance::analyze(e, &layouts, m)?;
|
||||
if let (Some((b, id)), BufferAccess::Floor) = (prov.dynamic_deref, p.fields().buffer_access) {
|
||||
let err: Error =
|
||||
Unsupported::needs_any_of(Feature::DereferenceLoadedPointer, vec![p.addressed_needs()])
|
||||
.into();
|
||||
return Err(provenance::located(err, e, b, id));
|
||||
}
|
||||
let addressed = p.fields().buffer_access == BufferAccess::Addressed;
|
||||
Planner {
|
||||
e,
|
||||
layouts,
|
||||
prov,
|
||||
addressed,
|
||||
p,
|
||||
}
|
||||
.plan(m)
|
||||
@@ -729,7 +703,6 @@ struct Reprs {
|
||||
offsets: Vec<(ValueId, OffsetRange, u8)>,
|
||||
strided: Vec<(ValueId, i64, u64)>,
|
||||
root_sets: Vec<(ValueId, RootSetId)>,
|
||||
handle_table: Option<Vec<HandleClass>>,
|
||||
}
|
||||
|
||||
/// How a typed object would hold a type ([`Planner::fit`]).
|
||||
@@ -748,8 +721,6 @@ struct Planner<'a> {
|
||||
/// Moved into the plan: the access leaves read GEP strides and store sizes from it.
|
||||
layouts: TypeLayouts,
|
||||
prov: Provenance,
|
||||
/// The profile reaches memory by device address (Profile A): escaping roots are wide.
|
||||
addressed: bool,
|
||||
/// The profile, whose held forms decide which allocas a typed object can hold.
|
||||
p: &'a DeviceProfile,
|
||||
}
|
||||
@@ -781,11 +752,11 @@ impl Planner<'_> {
|
||||
}
|
||||
|
||||
/// What the accesses through the dynamic root may do to a buffer slot whose root has uses
|
||||
/// `u` ([`SlotPlan::wide`]): on a profile with device addresses, an escaping slot is in the
|
||||
/// dynamic root's reach, so it is written where the dynamic root is written, and read where it
|
||||
/// is read or written (a store through a device address may merge).
|
||||
/// `u` ([`SlotPlan::wide`]): an escaping slot is in the dynamic root's reach, so it is written
|
||||
/// where the dynamic root is written, and read where it is read or written (a store through a
|
||||
/// device address may merge).
|
||||
fn wide_access(&self, u: &RootUse) -> AccessSet {
|
||||
if !(self.addressed && u.escapes) {
|
||||
if !u.escapes {
|
||||
return AccessSet::UNUSED;
|
||||
}
|
||||
let d = self.uses(Root::Dynamic);
|
||||
@@ -813,7 +784,6 @@ impl Planner<'_> {
|
||||
offsets,
|
||||
strided,
|
||||
root_sets,
|
||||
handle_table,
|
||||
} = self.reprs(&const_globals, &typed_allocas, &typed_shared, dynamic, m)?;
|
||||
let slot_roots = slot_roots(&slots, m)?;
|
||||
let const_index = const_index(&const_globals, m)?;
|
||||
@@ -837,10 +807,6 @@ impl Planner<'_> {
|
||||
const_globals,
|
||||
const_index,
|
||||
blob,
|
||||
needs: MemNeeds {
|
||||
dynamic_roots: dynamic,
|
||||
handle_table,
|
||||
},
|
||||
cells: prov.cells,
|
||||
abi: prov.abi,
|
||||
array_geps: prov.array_geps,
|
||||
@@ -2195,7 +2161,6 @@ impl Planner<'_> {
|
||||
&mut root_sets,
|
||||
self.prov.facts.len() + self.prov.const_facts.len(),
|
||||
)?;
|
||||
let mut handles = BTreeSet::new();
|
||||
let types = self.e.module.types();
|
||||
// The two lookup maps below (`InstId` and `GlobalId` keys are both `u32` newtypes).
|
||||
m.charge(
|
||||
@@ -2252,15 +2217,10 @@ impl Planner<'_> {
|
||||
let array = handle_array_root(&self.prov.abi, roots);
|
||||
let table = buffer_table_root(&self.prov.abi, roots);
|
||||
let r = match (class, *space) {
|
||||
(Class::Handle(class), _) => {
|
||||
if has_dynamic(roots) {
|
||||
handles.insert(class);
|
||||
}
|
||||
Repr::Handle {
|
||||
class,
|
||||
cands: f.roots,
|
||||
}
|
||||
}
|
||||
(Class::Handle(class), _) => Repr::Handle {
|
||||
class,
|
||||
cands: f.roots,
|
||||
},
|
||||
(Class::Byte | Class::Unknown, _) if array.is_some() => Repr::HandleArray {
|
||||
class: array.ok_or_else(|| invariant("a handle array without a class"))?,
|
||||
},
|
||||
@@ -2372,13 +2332,11 @@ impl Planner<'_> {
|
||||
offsets.sort_unstable_by_key(|(v, _, _)| *v);
|
||||
strided.sort_unstable_by_key(|(v, _, _)| *v);
|
||||
root_sets.sort_unstable_by_key(|(v, _)| *v);
|
||||
let handle_table = (!handles.is_empty()).then(|| handles.into_iter().collect());
|
||||
Ok(Reprs {
|
||||
repr,
|
||||
offsets,
|
||||
strided,
|
||||
root_sets,
|
||||
handle_table,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -260,7 +260,7 @@ fn a_constant_offset_store_is_a_static_slot_with_its_bytes_as_window() {
|
||||
Some(Repr::BufPtr { wide: false, .. })
|
||||
));
|
||||
assert_eq!(repr_roots(&plan, p8), vec![Root::Param(0)]);
|
||||
assert!(!plan.needs.dynamic_roots);
|
||||
assert!(!wide_pointers(&plan));
|
||||
}
|
||||
|
||||
/// GEPs through a struct and an array compose to datalayout offsets, and a negative GEP gives a
|
||||
@@ -476,13 +476,21 @@ fn loaded_pointer_kernel() -> (Entry, Value) {
|
||||
(e, q)
|
||||
}
|
||||
|
||||
/// A pointer loaded from memory has the dynamic root: a wide fat pointer, every window `Whole`
|
||||
/// (even a sized reference's), and Profile A accepts it.
|
||||
/// Whether some buffer pointer of `plan` is wide: some root set holds the dynamic root.
|
||||
fn wide_pointers(plan: &MemoryPlan) -> bool {
|
||||
plan.repr
|
||||
.iter()
|
||||
.flatten()
|
||||
.any(|r| matches!(r, Repr::BufPtr { wide: true, .. }))
|
||||
}
|
||||
|
||||
/// A pointer loaded from memory has the dynamic root: a wide fat pointer, and every window `Whole`
|
||||
/// (even a sized reference's).
|
||||
#[test]
|
||||
fn a_loaded_pointer_is_dynamic_wide_and_makes_every_window_whole() {
|
||||
let (e, q) = loaded_pointer_kernel();
|
||||
let plan = ok(&e);
|
||||
assert!(plan.needs.dynamic_roots);
|
||||
assert!(wide_pointers(&plan));
|
||||
assert!(matches!(
|
||||
plan.repr(q),
|
||||
Some(Repr::BufPtr { wide: true, .. })
|
||||
@@ -1268,7 +1276,6 @@ fn merged_textures_are_one_handle_over_both_candidates() {
|
||||
));
|
||||
assert_eq!(repr_roots(&plan, sel), vec![Root::Param(0), Root::Param(1)]);
|
||||
assert!(plan.slots.is_empty());
|
||||
assert_eq!(plan.needs.handle_table, None);
|
||||
}
|
||||
|
||||
/// A handle reaching a GEP, or merged with a buffer pointer, is `HandleAsPointer`.
|
||||
@@ -1390,9 +1397,8 @@ fn an_argument_buffer_texture_member_seeds_a_dynamic_handle() {
|
||||
..
|
||||
})
|
||||
));
|
||||
assert_eq!(plan.needs.handle_table, Some(vec![HandleClass::Texture]));
|
||||
// A dynamic handle is no dynamic buffer root.
|
||||
assert!(!plan.needs.dynamic_roots);
|
||||
assert!(!wide_pointers(&plan));
|
||||
let s = plan.slots.first().copied().expect("slot");
|
||||
assert!(s.argument_buffer);
|
||||
assert_eq!(s.access, AccessSet::READ);
|
||||
@@ -1498,7 +1504,7 @@ fn verifying_the_cells_returns_its_tables_to_the_ledger() {
|
||||
let before = m.ledger();
|
||||
let prov = provenance::analyze(&e, &layouts, &mut m).expect("provenance");
|
||||
assert!(
|
||||
prov.dynamic_deref.is_none(),
|
||||
!prov.uses.contains_key(&Root::Dynamic),
|
||||
"the cell forwards its pointer"
|
||||
);
|
||||
m.ledger() - before
|
||||
@@ -1558,9 +1564,8 @@ fn class_join_is_a_lattice() {
|
||||
|
||||
// ---- Fixtures ----
|
||||
|
||||
/// Every entry of every public fixture (top level and `engine/`) that decodes and
|
||||
/// specializes is analyzed on an Addressed profile without an internal error or a
|
||||
/// panic; refusals are typed.
|
||||
/// Every entry of every public fixture (top level and `engine/`) that decodes and specializes is
|
||||
/// analyzed without an internal error or a panic; refusals are typed.
|
||||
#[test]
|
||||
fn every_public_fixture_analyzes_without_an_internal_error() {
|
||||
use crate::pipeline::testing::{engine_dir, fixtures_dir, llvm_assemble, AssembleError};
|
||||
@@ -1623,12 +1628,7 @@ fn every_public_fixture_analyzes_without_an_internal_error() {
|
||||
panic!("{}:{name}: internal error {i}", path.display())
|
||||
}
|
||||
Ok(Err(Error::Unsupported(u))) => {
|
||||
eprintln!(
|
||||
"refused {}:{name} ({:?}): {:?}",
|
||||
path.display(),
|
||||
p.fields().buffer_access,
|
||||
u.feature
|
||||
);
|
||||
eprintln!("refused {}:{name}: {:?}", path.display(), u.feature);
|
||||
refused += 1;
|
||||
}
|
||||
Ok(Err(other)) => panic!("{}:{name}: {other:?}", path.display()),
|
||||
@@ -1753,7 +1753,6 @@ fn a_texture_array_parameter_is_a_pointer_to_its_handles() {
|
||||
));
|
||||
assert_eq!(repr_roots(&plan, t), vec![Root::Param(0)]);
|
||||
assert_eq!(plan.offset(t).and_then(|o| o.exact()), Some(8));
|
||||
assert_eq!(plan.needs.handle_table, None);
|
||||
assert!(plan.slots.is_empty());
|
||||
}
|
||||
|
||||
@@ -1828,7 +1827,6 @@ fn a_handle_array_load_laid_out_before_its_gep_is_not_dynamic() {
|
||||
));
|
||||
assert_eq!(repr_roots(&plan, t), vec![Root::Param(0)]);
|
||||
assert_eq!(plan.offset(t).and_then(|o| o.exact()), Some(8));
|
||||
assert_eq!(plan.needs.handle_table, None);
|
||||
}
|
||||
|
||||
/// A chain of `blocks` blocks, each a pointer phi and `triples` offset/load/store triples on
|
||||
|
||||
@@ -109,7 +109,7 @@ fn a_buffer_table_has_one_slot_per_accessed_element() {
|
||||
}),
|
||||
Some(1)
|
||||
);
|
||||
assert!(!plan.needs.dynamic_roots);
|
||||
assert!(!super::wide_pointers(&plan));
|
||||
}
|
||||
|
||||
/// A dynamic element index may read any element: the pointer's candidates are every element,
|
||||
@@ -150,7 +150,7 @@ fn a_dynamic_element_index_reaches_every_element_and_stays_static() {
|
||||
),
|
||||
]
|
||||
);
|
||||
assert!(!plan.needs.dynamic_roots);
|
||||
assert!(!super::wide_pointers(&plan));
|
||||
}
|
||||
|
||||
/// A constant index outside the table reads no element (undefined in Metal): the null
|
||||
@@ -322,7 +322,6 @@ fn an_argument_buffer_table_element_seeds_its_members() {
|
||||
..
|
||||
})
|
||||
));
|
||||
assert_eq!(plan.needs.handle_table, Some(vec![HandleClass::Texture]));
|
||||
assert_eq!(
|
||||
slot_view(&plan),
|
||||
vec![(
|
||||
|
||||
@@ -605,9 +605,6 @@ pub struct Provenance {
|
||||
pub classes: Vec<Class>,
|
||||
/// Every root an instruction reaches, with its uses.
|
||||
pub uses: BTreeMap<Root, RootUse>,
|
||||
/// The first dereference of a pointer whose root set contains `Dynamic`, in the device or
|
||||
/// constant space: the instruction and its block.
|
||||
pub dynamic_deref: Option<(BlockId, InstId)>,
|
||||
/// Which allocas forward the pointers stored into them.
|
||||
pub cells: CellFacts,
|
||||
/// The entry's bindings and layouts, indexed once.
|
||||
@@ -2721,7 +2718,6 @@ fn classify(
|
||||
const_facts: cx.const_facts,
|
||||
classes: resolved,
|
||||
uses,
|
||||
dynamic_deref,
|
||||
cells: cx.cells.facts,
|
||||
abi: cx.abi,
|
||||
array_geps: cx.array_geps,
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
//! Pointer cells: store-to-load forwarding through closed allocas.
|
||||
//!
|
||||
//! A pointer stored into an alloca and loaded back is, without this, a pointer loaded from
|
||||
//! memory: `Dynamic`, resolved at run time through the resident set, which Profile F lacks and
|
||||
//! which no handle, arena, or buffer-table pointer can take. When every access to the alloca is
|
||||
//! memory: `Dynamic`, the device address it holds, which no handle, arena, or buffer-table pointer
|
||||
//! can take. When every access to the alloca is
|
||||
//! visible, the loaded pointer is instead one of the pointers stored at its slot, so its fact is
|
||||
//! the join of theirs, and the cell holds each pointer in its lowered representation
|
||||
//! (`lower::access::cell`).
|
||||
|
||||
@@ -507,9 +507,8 @@ pub struct LoweringInputs {
|
||||
/// of the id holds the address of the table's words in place of an element, and a read of
|
||||
/// word `w` is checked against the table's size word, so a table whose words pass
|
||||
/// `maxStorageBufferRange` is read whole. It declares no snapshot, and states
|
||||
/// `RuntimeFact::FunctionTableRange` with `addressed`. It needs
|
||||
/// device addresses (`Unsupported{BufferRange}` without them). A function that reads no
|
||||
/// table by resource id compiles as without it.
|
||||
/// `RuntimeFact::FunctionTableRange` with `addressed`. A function that reads no table by
|
||||
/// resource id compiles as without it.
|
||||
#[cfg_attr(feature = "serde", serde(default))]
|
||||
pub addressed_function_tables: bool,
|
||||
/// Colors the fragment function's render pipeline has no attachment for, by color index:
|
||||
|
||||
@@ -529,9 +529,7 @@ fn int64_atomics_refuse_by_the_profiles_features() {
|
||||
VkFeature::ShaderBufferInt64Atomics,
|
||||
)
|
||||
};
|
||||
let addressed =
|
||||
prof.fields().buffer_access == crate::device::profile::BufferAccess::Addressed;
|
||||
if have && !shared && addressed {
|
||||
if have && !shared {
|
||||
l3(&bc, "wide", &prof, stem);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
use std::path::Path;
|
||||
|
||||
use crate::budget::{Budget, SPIRV_WORDS};
|
||||
use crate::device::profile::BufferAccess;
|
||||
use crate::device::{Device, DeviceDescription};
|
||||
use crate::error::{DescriptorError, Error, Feature, LowerFamily, Needs, RuntimeInput};
|
||||
use crate::library::{FunctionConstantValues, Library};
|
||||
@@ -471,9 +470,6 @@ fn a_kernel_the_stage_in_region_reaches_is_no_replay_variant() {
|
||||
let consts = FunctionConstantValues::defaults();
|
||||
let mut checked = 0;
|
||||
for (stem, p) in committed_profiles().expect("profiles") {
|
||||
if p.fields().buffer_access != BufferAccess::Addressed {
|
||||
continue;
|
||||
}
|
||||
for (entry, d) in [
|
||||
("stage_in_fetch", &fetch),
|
||||
("stage_in_region", ®ion),
|
||||
|
||||
@@ -11,12 +11,11 @@
|
||||
//! The check is metamorphic. Rewrite every identifier outside the contract (global symbols, named
|
||||
//! struct, class, and union types, named local values and labels) to a generated placeholder,
|
||||
//! assemble both texts (`llvm-as`), and compile every entry point of both libraries on two
|
||||
//! committed profiles: one that reaches buffers by device address and one that binds them
|
||||
//! (`vk12-floor`, Profile F). Structure and semantics are untouched, so each entry point must
|
||||
//! compile to the same final SPIR-V words or be refused with the same typed outcome. The engine
|
||||
//! writes no debug names and names every SPIR-V entry point `main`, so the words are compared
|
||||
//! whole. A kernel is compiled into a compute pipeline; any other stage is linked alone and
|
||||
//! relocated, as `src/tests/golden_hashes.rs` does.
|
||||
//! committed profiles: a discrete GPU and the runtime's floor (`runtime-floor`). Structure and
|
||||
//! semantics are untouched, so each entry point must compile to the same final SPIR-V words or be
|
||||
//! refused with the same typed outcome. The engine writes no debug names and names every SPIR-V
|
||||
//! entry point `main`, so the words are compared whole. A kernel is compiled into a compute
|
||||
//! pipeline; any other stage is linked alone and relocated, as `src/tests/golden_hashes.rs` does.
|
||||
//!
|
||||
//! The authored inputs below spell every user identifier as a near-miss of a name the engine does
|
||||
//! dispatch on, so a branch that matched loosely (`contains("texture_buffer")`,
|
||||
@@ -202,8 +201,7 @@ fn rename_names_the_contract_does_not_own(source: &str) -> (String, usize) {
|
||||
|
||||
// ---- Compiling ----
|
||||
|
||||
/// The two committed profiles every input compiles on: a device that reaches buffers by device
|
||||
/// address, and the Vulkan 1.2 floor, which binds them (Profile F).
|
||||
/// The two committed profiles every input compiles on: a discrete GPU and the runtime's floor.
|
||||
const PROFILES: [&str; 2] = ["nvidia-rtx5080-laptop", "runtime-floor"];
|
||||
|
||||
fn devices() -> Vec<(&'static str, Device)> {
|
||||
|
||||
@@ -513,9 +513,6 @@ fn a_pointer_slot_read_as_data_stays_an_open_cell() {
|
||||
let prof = p(stem);
|
||||
match typed_module(&bc, "punned", &prof) {
|
||||
Ok((plan, _)) => {
|
||||
assert!(
|
||||
prof.fields().buffer_access == crate::device::profile::BufferAccess::Addressed
|
||||
);
|
||||
assert_eq!(count(&plan, "access.cell.load"), 0, "{stem}");
|
||||
// Under the identity domains a guest address is the buffer's device address: no
|
||||
// root table.
|
||||
@@ -526,10 +523,7 @@ fn a_pointer_slot_read_as_data_stays_an_open_cell() {
|
||||
}
|
||||
Err(Error::Unsupported(u)) => {
|
||||
assert!(
|
||||
matches!(
|
||||
u.feature,
|
||||
Feature::DereferenceLoadedPointer | Feature::PointerToInteger
|
||||
),
|
||||
matches!(u.feature, Feature::DereferenceLoadedPointer),
|
||||
"{stem}: {u:?}"
|
||||
);
|
||||
}
|
||||
@@ -656,9 +650,6 @@ fn a_copy_that_splits_a_pointer_slot_opens_both_cells() {
|
||||
let prof = p(stem);
|
||||
match typed_module(&bc, "split", &prof) {
|
||||
Ok((plan, _)) => {
|
||||
assert!(
|
||||
prof.fields().buffer_access == crate::device::profile::BufferAccess::Addressed
|
||||
);
|
||||
assert_eq!(
|
||||
(
|
||||
count(&plan, "access.cell.store"),
|
||||
@@ -676,10 +667,7 @@ fn a_copy_that_splits_a_pointer_slot_opens_both_cells() {
|
||||
}
|
||||
Err(Error::Unsupported(u)) => {
|
||||
assert!(
|
||||
matches!(
|
||||
u.feature,
|
||||
Feature::DereferenceLoadedPointer | Feature::PointerToInteger
|
||||
),
|
||||
matches!(u.feature, Feature::DereferenceLoadedPointer),
|
||||
"{stem}: {u:?}"
|
||||
);
|
||||
}
|
||||
@@ -1419,10 +1407,7 @@ fn pointer_bits_observed_as_an_integer_stay_an_integer() {
|
||||
);
|
||||
}
|
||||
Err(Error::Unsupported(u)) => assert!(
|
||||
matches!(
|
||||
u.feature,
|
||||
Feature::DereferenceLoadedPointer | Feature::PointerToInteger
|
||||
),
|
||||
matches!(u.feature, Feature::DereferenceLoadedPointer),
|
||||
"{stem}: {u:?}"
|
||||
),
|
||||
Err(e) => panic!("{stem}: {e}"),
|
||||
@@ -1630,10 +1615,7 @@ fn pointer_bits_copied_out_of_the_cells_are_data() {
|
||||
);
|
||||
}
|
||||
Err(Error::Unsupported(u)) => assert!(
|
||||
matches!(
|
||||
u.feature,
|
||||
Feature::DereferenceLoadedPointer | Feature::PointerToInteger
|
||||
),
|
||||
matches!(u.feature, Feature::DereferenceLoadedPointer),
|
||||
"{stem}: {u:?}"
|
||||
),
|
||||
Err(e) => panic!("{stem}: {e}"),
|
||||
|
||||
@@ -1903,7 +1903,7 @@ fn the_buffer_address_round_trip_fixture_is_exact() {
|
||||
|
||||
/// The shapes of a pointer's bits through a private cell, over a wide pointer: odd threads take the
|
||||
/// pointer loaded from `b1` (the guest address of `b3`), even threads `b2` itself, so the pointer
|
||||
/// parked in `%s` is wide on Profile A with a dynamic and a static root. Its bits are stored
|
||||
/// parked in `%s` is wide, with a dynamic and a static root. Its bits are stored
|
||||
/// (`ptrtoint` + `store i64`) and read back as a pointer, stored as a pointer and read back through
|
||||
/// a pointer word (`load i64` + `inttoptr`), or both; each thread then writes three times the word
|
||||
/// it reads through the pointer at its index.
|
||||
|
||||
@@ -477,15 +477,10 @@ fn a_patch_attribute_s_decode_records_the_vertex_fetch_s_notes() {
|
||||
/// `tessellation.control_point.psb`, checked in the shader.
|
||||
#[test]
|
||||
fn a_control_point_read_is_named_by_the_memory_it_reaches() {
|
||||
use crate::device::profile::BufferAccess;
|
||||
|
||||
let Some(bc) = fixture() else { return };
|
||||
let (with, _) = profiles();
|
||||
let mut addressed_profiles = 0;
|
||||
for (stem, p) in with
|
||||
.iter()
|
||||
.filter(|(_, p)| p.fields().buffer_access == BufferAccess::Addressed)
|
||||
{
|
||||
let mut checked = 0;
|
||||
for (stem, p) in &with {
|
||||
let reads = || {
|
||||
let mut inputs = LoweringInputs::new();
|
||||
inputs.vertex_fetch = Some(projection());
|
||||
@@ -510,9 +505,9 @@ fn a_control_point_read_is_named_by_the_memory_it_reaches() {
|
||||
[(name, uses)] if name == "tessellation.control_point.psb" && *uses > 0 => {}
|
||||
other => panic!("{stem}: {other:?}"),
|
||||
}
|
||||
addressed_profiles += 1;
|
||||
checked += 1;
|
||||
}
|
||||
assert!(addressed_profiles > 0);
|
||||
assert!(checked > 0);
|
||||
}
|
||||
|
||||
/// Control points used whole (merged in a phi) fetch every field Metal does not mark unused.
|
||||
|
||||
@@ -30,8 +30,7 @@ use crate::spirv::testing::refuses_threadgroup_memory;
|
||||
|
||||
const HEADER: &str = "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\"\ntarget triple = \"air64_v28-apple-macosx26.0.0\"\n\n";
|
||||
|
||||
/// Profile A (device addresses) and Profile F (none), with and without robust descriptors,
|
||||
/// with and without the Vulkan memory model.
|
||||
/// Two devices, with and without robust descriptors, and one without the Vulkan memory model.
|
||||
const PROFILES: [&str; 3] = ["moltenvk-m3", "lavapipe", NO_VULKAN_MODEL];
|
||||
|
||||
/// `runtime-floor` without the Vulkan memory model (below the runtime's floor): the GLSL memory
|
||||
|
||||
@@ -165,7 +165,6 @@ impl Execute for CpuInterp {
|
||||
fn target(&self) -> Target {
|
||||
Target {
|
||||
threads: self.threads,
|
||||
addressed: self.profile.addressed_needs().is_empty(),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6386,7 +6386,6 @@ method metal2vulkan::device::DeviceDescription::query pub unsafe fn query(instan
|
||||
method metal2vulkan::device::DeviceDescription::recommended_enables pub fn recommended_enables(&self) -> EnableSet
|
||||
method metal2vulkan::device::DeviceDescription::required_enables pub fn required_enables(&self, requirements: &Requirements) -> Result<EnableSet, Capability>
|
||||
method metal2vulkan::device::DeviceDescription::with_enabled pub fn with_enabled(mut self, enabled: &EnableSet) -> Result<DeviceDescription, Error>
|
||||
method metal2vulkan::device::DeviceProfile::addressed_needs pub fn addressed_needs(&self) -> Vec<Capability>
|
||||
method metal2vulkan::device::DeviceProfile::binds_kernel_buffers pub fn binds_kernel_buffers(&self) -> bool
|
||||
method metal2vulkan::device::DeviceProfile::buffer_base_alignment pub fn buffer_base_alignment(&self) -> u64
|
||||
method metal2vulkan::device::DeviceProfile::check pub fn check(&self, req: &Requirements) -> Result<(), Capability>
|
||||
@@ -9589,12 +9588,10 @@ variant metal2vulkan::error::Feature::AddressSpace AddressSpace(u32)
|
||||
variant metal2vulkan::error::Feature::AgxUnmodeled AgxUnmodeled
|
||||
variant metal2vulkan::error::Feature::AlphaToOne AlphaToOne
|
||||
variant metal2vulkan::error::Feature::ArgumentBufferObjects ArgumentBufferObjects
|
||||
variant metal2vulkan::error::Feature::ArgumentBufferPointers ArgumentBufferPointers
|
||||
variant metal2vulkan::error::Feature::ArgumentBufferTextures ArgumentBufferTextures
|
||||
variant metal2vulkan::error::Feature::Attribute Attribute { kind: u32 }
|
||||
variant metal2vulkan::error::Feature::Barycentrics Barycentrics
|
||||
variant metal2vulkan::error::Feature::BitcodeRecord BitcodeRecord { block: u32, code: u32 }
|
||||
variant metal2vulkan::error::Feature::BufferRange BufferRange
|
||||
variant metal2vulkan::error::Feature::CallingConvention CallingConvention(u32)
|
||||
variant metal2vulkan::error::Feature::ClipDistance ClipDistance
|
||||
variant metal2vulkan::error::Feature::CoherentMemory CoherentMemory
|
||||
@@ -9648,7 +9645,6 @@ variant metal2vulkan::error::Feature::PartialThreadgroups PartialThreadgroups
|
||||
variant metal2vulkan::error::Feature::PixelCoverageAtSampleRate PixelCoverageAtSampleRate
|
||||
variant metal2vulkan::error::Feature::PixelSamplerCompare PixelSamplerCompare
|
||||
variant metal2vulkan::error::Feature::PointerCompare PointerCompare
|
||||
variant metal2vulkan::error::Feature::PointerToInteger PointerToInteger
|
||||
variant metal2vulkan::error::Feature::PostDepthCoverage PostDepthCoverage
|
||||
variant metal2vulkan::error::Feature::PrimitiveId PrimitiveId
|
||||
variant metal2vulkan::error::Feature::PrivateMemory PrivateMemory
|
||||
|
||||
|
Can't render this file because it is too large.
|
+9
-15
@@ -26,7 +26,7 @@ Columns:
|
||||
|
||||
| Kind | Variants | With a site | Reach system | Reach app | Reach rare | Reach none | Unassessed |
|
||||
|---|---|---|---|---|---|---|---|
|
||||
| Translator and front-end refusals | 120 | 116 | 6 | 27 | 66 | 21 | 0 |
|
||||
| Translator and front-end refusals | 117 | 113 | 6 | 25 | 65 | 21 | 0 |
|
||||
| Translation caps | 14 | 14 | 0 | 0 | 7 | 7 | 0 |
|
||||
| Rate maps the compile layer does not compile | 5 | 5 | 0 | 0 | 4 | 1 | 0 |
|
||||
| The translation deadline | 1 | 1 | 0 | 0 | 0 | 1 | 0 |
|
||||
@@ -39,7 +39,7 @@ Columns:
|
||||
|
||||
| Kind | `metal-measured` | `metal-documented` | `metal-takes` | `device` | `ours` | `unknown` | `delegated` | `-` |
|
||||
|---|---|---|---|---|---|---|---|---|
|
||||
| Translator and front-end refusals | 0 | 0 | 3 | 46 | 67 | 0 | 0 | 4 |
|
||||
| Translator and front-end refusals | 0 | 0 | 3 | 43 | 67 | 0 | 0 | 4 |
|
||||
| Translation caps | 0 | 0 | 0 | 0 | 14 | 0 | 0 | 0 |
|
||||
| Rate maps the compile layer does not compile | 0 | 0 | 0 | 0 | 5 | 0 | 0 | 0 |
|
||||
| The translation deadline | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 |
|
||||
@@ -75,21 +75,18 @@ Columns:
|
||||
| `QuadOperations` | Quad operations in a stage without quad support | devices without VkLimit::MinSubgroupSize | `device` | 1: `crates/metal2vulkan/src/device/subgroup.rs (subgroup_tier)` | `app`: quad shuffles in kernels on devices without quad operations there |
|
||||
| `SimdgroupMatrix` | Simdgroup matrix operations | every device (not implemented) | `ours` | 1: `crates/metal2vulkan/src/lower/simd/matrix.rs (not_implemented)` | `rare`: simdgroup matrix kernels |
|
||||
| `SimdgroupMatrix16x16x16` | A 16x16x16 simdgroup matrix product (`air.simdgroup_matrix_16x16x16_[widening_]multiply_accumulate`), in any stage | every device (not implemented) | `ours` | 1: `crates/metal2vulkan/src/lower/simd/matrix.rs (select)` | `rare`: 16x16x16 simdgroup matrix products (Metal: Apple10 GPUs and later) |
|
||||
| `ArgumentBufferPointers` | Argument buffers holding buffer pointers (dynamic roots) | devices without buffer device addresses (`addressed_needs`) | `device` | 1: `crates/metal2vulkan/src/device/metal.rs (unsupported_features)` | `app`: argument buffers holding buffer pointers |
|
||||
| `ArgumentBufferTextures` | Argument buffers holding textures or samplers (handle domain) | devices without a capability the site computes (`gaps`); devices without a capability the site computes (`missing`); every device (not implemented) | `ours` | 12: `crates/metal2vulkan/src/bind/heap.rs (member_storage_format, 4 sites)`, `crates/metal2vulkan/src/bind/heap.rs (member_texel_view, 2 sites)` (+5) | `app`: argument buffers holding textures and samplers (bindless) |
|
||||
| `ArgumentBufferObjects` | Argument-buffer members that are pipeline states, ICBs, function tables, or acceleration structures | every device (not implemented) | `ours` | 4: `crates/metal2vulkan/src/lower/access/icb.rs (select)`, `crates/metal2vulkan/src/lower/access/object.rs (select)` (+2) | `rare`: pipeline states and ICBs in argument buffers |
|
||||
| `DereferenceLoadedPointer` | Dereferencing a pointer loaded from memory or made from an integer | devices without buffer device addresses (`addressed_needs`); every device (no Vulkan mechanism) | `device` | 3: `crates/metal2vulkan/src/lower/access/local.rs (access_ptr)`, `crates/metal2vulkan/src/lower/access/local.rs (threadgroup_constant_refusal)` (+1) | `app`: pointers loaded from argument buffers |
|
||||
| `PointerToInteger` | Storing a pointer or converting it to an integer | devices without buffer device addresses (`addressed_needs`) | `device` | via a helper: 1: `crates/metal2vulkan/src/lower/access/dynamic.rs (require_addresses)` | `rare`: pointer to integer casts |
|
||||
| `DereferenceLoadedPointer` | Dereferencing a pointer loaded from memory or made from an integer | every device (no Vulkan mechanism) | `device` | 2: `crates/metal2vulkan/src/lower/access/local.rs (access_ptr)`, `crates/metal2vulkan/src/lower/access/local.rs (threadgroup_constant_refusal)` | `app`: pointers loaded from argument buffers |
|
||||
| `PointerCompare` | Comparing pointers with different roots | devices without VkFeature::ShaderInt64 | `device` | via a helper: 1: `crates/metal2vulkan/src/lower/access/copy.rs (addressed)` | `rare`: comparing pointers of different roots |
|
||||
| `HandleAsPointer` | A resource handle used as a byte pointer, or conflicting handle provenance | every device (no Vulkan mechanism); every device (not implemented) | `ours` | 6: `crates/metal2vulkan/src/lower/access/handle.rs (domain_kind)`, `crates/metal2vulkan/src/lower/access/handle.rs (element, 2 sites)` (+3) | `rare`: resource handles used as byte pointers |
|
||||
| `ConstantGlobalEscaping` | A constant global whose address escapes | every device (not implemented) | `ours` | 2: `crates/metal2vulkan/src/memory/plan.rs (blob_nodes)`, `crates/metal2vulkan/src/memory/plan.rs (serialize)` | `rare`: a constant global whose address escapes |
|
||||
| `ThreadgroupMemorySize` | Threadgroup memory above the device limit | devices short of a device limit the site names; every device (no Vulkan mechanism) | `device` | 2: `crates/metal2vulkan/src/memory/arena.rs (check)`, `crates/metal2vulkan/src/memory/plan.rs (too_large)` | `rare`: threadgroup memory past a smaller device's limit |
|
||||
| `ZeroedThreadgroupMemory` | Threadgroup memory that reads zero until the program writes it, on `Device::from_queries`' profile | devices short of a Vulkan feature the site names | `device` | 1: `crates/metal2vulkan/src/lower/access/local.rs (zero_threadgroup)` | `rare`: threadgroup memory on a device without shaderZeroInitializeWorkgroupMemory, which Vulkan 1.3 requires |
|
||||
| `CoherentMemory` | `coherent(device)` accesses (Vulkan memory model) | devices short of a Vulkan feature the site names | `device` | 1: `crates/metal2vulkan/src/lower/sync/memory_model.rs (check)` | `rare`: coherent(device) accesses |
|
||||
| `Int64Atomics` | 64-bit atomics | devices short of a Vulkan feature the site names; devices without buffer device addresses (`addressed_needs`) | `device` | 2: `crates/metal2vulkan/src/lower/access/atomic.rs (select, 2 sites)` | `rare`: 64-bit atomics |
|
||||
| `Int64Atomics` | 64-bit atomics | devices short of a Vulkan feature the site names | `device` | 1: `crates/metal2vulkan/src/lower/access/atomic.rs (select)` | `rare`: 64-bit atomics |
|
||||
| `ImageAtomics` | Image atomics beyond 32-bit integers | every device (not implemented) | `ours` | 1: `crates/metal2vulkan/src/lower/texture/atomic.rs (select)` | `rare`: texture atomics beyond 32-bit integers |
|
||||
| `DescriptorCount` | Too many descriptors of one kind in a stage or pipeline | devices short of a device limit the site names | `device` | 2: `crates/metal2vulkan/src/lower/select.rs (finish)`, `crates/metal2vulkan/src/pipeline/link.rs (limit_error)` | `app`: many textures or buffers in one stage on a smaller device |
|
||||
| `BufferRange` | A buffer window beyond the descriptor range limits | devices without buffer device addresses (`addressed_needs`) | `device` | 1: `crates/metal2vulkan/src/lower/access/function_table.rs (select)` | `app`: a buffer window past a device's descriptor range |
|
||||
| `Int64Arithmetic` | 64-bit integer arithmetic | devices without VkFeature::ShaderInt64 | `device` | 2: `crates/metal2vulkan/src/lower/arith/legal.rs (check_scalar)`, `crates/metal2vulkan/src/lower/select.rs (selector_form)` | `rare`: 64-bit integers on a device without shaderInt64 |
|
||||
| `Float64Arithmetic` | 64-bit float arithmetic | devices without VkFeature::ShaderFloat64 | `device` | 2: `crates/metal2vulkan/src/device/metal.rs (unsupported_features)`, `crates/metal2vulkan/src/lower/arith/legal.rs (check_scalar)` | `rare`: doubles (MSL has none outside Apple's own code) |
|
||||
| `Format` | A pixel or vertex format not supported for the required use | devices without VkFeature::ShaderStorageImageExtendedFormats; devices without a capability the site computes (`alternatives`); devices without a capability the site computes (`missing`); devices without a capability the site computes (`routes`); devices without a format's usage; every device (no Vulkan mechanism); every device (not implemented) | `ours` | 47: `crates/metal2vulkan/src/lower/access/tile.rs (storage_format)`, `crates/metal2vulkan/src/lower/fragment/color.rs (select_param, 5 sites)` (+25) | `system`: pixel formats a device lacks for a use (CoreVideo's 4:2:x and 10-bit formats among them) |
|
||||
@@ -110,7 +107,7 @@ Columns:
|
||||
| `RasterOrderGroups` | Raster order groups without fragment shader interlock | devices without VkFeature::FragmentShaderPixelInterlock; every device (not implemented) | `ours` | 3: `crates/metal2vulkan/src/device/metal.rs (unsupported_features)`, `crates/metal2vulkan/src/lower/fragment/rog.rs (mode, 2 sites)` | `rare`: raster order groups |
|
||||
| `FramebufferFetch` | Framebuffer fetch in a shape not implemented (a write the function would compute over its own read of the attachment), or that needs a feature the... | devices without VkFeature::SampleRateShading; every device (not implemented) | `ours` | 2: `crates/metal2vulkan/src/lower/fragment/fetch.rs (computed_write_refused)`, `crates/metal2vulkan/src/lower/fragment/fetch.rs (plan_sample)` | `system`: programmable blending (framebuffer fetch); macOS 26.6.2's login reaches it (two WindowServer and RenderBox pipelines fetch RGB10A8_2P_XR10 attachments, the consumer's boots) |
|
||||
| `PrimitiveId` | `[[primitive_id]]` in a fragment function | devices without a capability the site computes; every device (not implemented) | `ours` | 2: `crates/metal2vulkan/src/lower/stage_io/plan.rs (finish)`, `crates/metal2vulkan/src/pipeline/link/varyings.rs (check_primitive_id)` | `rare`: primitive_id on a device without geometry or tessellation shaders, in an indexed draw or behind a mesh function |
|
||||
| `PrivatePrimitives` | One of Metal's private primitive types (a line loop, a triangle fan, quads, a quad strip) drawn in the pulled list form... | devices without buffer device addresses (`addressed_needs`); every device (not implemented) | `ours` | via a helper: 1: `crates/metal2vulkan/src/lower/stage_io/plan.rs (indices_feature)` | `rare`: a private primitive type drawn in the pulled list form (a vertex function that writes memory or the primitive_id varying, a vertex start past 2^31) on a device without device addresses |
|
||||
| `PrivatePrimitives` | One of Metal's private primitive types (a line loop, a triangle fan, quads, a quad strip) drawn in the pulled list form... | every device (not implemented) | `ours` | via a helper: 1: `crates/metal2vulkan/src/lower/stage_io/plan.rs (indices_feature)` | `rare`: a private primitive type drawn in the pulled list form (a vertex function that writes memory or the primitive_id varying, a vertex start past 2^31) on a device without device addresses |
|
||||
| `VertexAmplification` | Vertex amplification | devices short of a Vulkan feature the site names; devices without VkFeature::Multiview; devices without VkFeature::MultiviewTessellationShader; every device (not implemented) | `ours` | 4: `crates/metal2vulkan/src/lower/stage_io/plan.rs (index_store)`, `crates/metal2vulkan/src/lower/tessellation/mod.rs (select_param)` (+2) | `rare`: vertex amplification |
|
||||
| `LayeredRendering` | Layered rendering (`render_target_array_index`, `viewport_array_index`) | devices short of a Vulkan feature the site names; devices without VkFeature::ShaderOutputLayer; devices without VkFeature::ShaderOutputViewportIndex | `device` | 3: `crates/metal2vulkan/src/lower/mesh/mod.rs (target_index, 2 sites)`, `crates/metal2vulkan/src/lower/stage_io/plan.rs (index_store)` | `rare`: layered rendering on a device without its features |
|
||||
| `ClipDistance` | Clip or cull distances | devices without VkFeature::ShaderClipDistance; devices without VkLimit::MaxClipDistances | `device` | 2: `crates/metal2vulkan/src/lower/mesh/mod.rs (select, 2 sites)` | `rare`: clip distances on a device without them |
|
||||
@@ -132,7 +129,7 @@ Columns:
|
||||
| `RayTracing` | | devices without a capability the site computes (`missing`); every device (no Vulkan mechanism); every device (not implemented) | `ours` | 10: `crates/metal2vulkan/src/lower/raytracing/mod.rs (instance_count)`, `crates/metal2vulkan/src/lower/raytracing/mod.rs (intersect, 5 sites)` (+4) | `rare`: ray tracing (out of scope by ruling) |
|
||||
| `Tensors` | | every device (not implemented) | `ours` | 3: `crates/metal2vulkan-air/src/canon/matmul2d/synth.rs (refuse)`, `crates/metal2vulkan-air/src/canon/mod.rs (post_check)` (+1) | `rare`: shader tensors |
|
||||
| `RasterizationRateMap` | | devices without VkFeature::MultiViewport; devices without VkFeature::ShaderDrawParameters; devices without VkFeature::ShaderOutputViewportIndex; every device (not implemented) | `ours` | 2: `crates/metal2vulkan/src/lower/stage_io/plan.rs (region_viewport, 2 sites)` | `rare`: rasterization rate maps |
|
||||
| `GpuEncodedIndirectCommands` | | devices short of a Vulkan feature the site names; devices without buffer device addresses (`addressed_needs`); every device (no Vulkan mechanism); every device (not implemented) | `ours` | 14: `crates/metal2vulkan/src/lower/access/icb.rs (needs, 2 sites)`, `crates/metal2vulkan/src/lower/access/icb.rs (select, 2 sites)` (+7) | `rare`: indirect command buffers encoded by a kernel |
|
||||
| `GpuEncodedIndirectCommands` | | devices short of a Vulkan feature the site names; every device (no Vulkan mechanism); every device (not implemented) | `ours` | 11: `crates/metal2vulkan/src/lower/access/icb.rs (needs)`, `crates/metal2vulkan/src/lower/access/icb.rs (select, 2 sites)` (+6) | `rare`: indirect command buffers encoded by a kernel |
|
||||
| `VulkanVersion` | The device's Vulkan version is below the 1.2 floor | devices without ApiVersion::V1_2 | `device` | 2: `crates/metal2vulkan/src/ash_interop/query.rs (query)`, `crates/metal2vulkan/src/device/derive.rs (from_queries)` | `none`: a device below Vulkan 1.2 |
|
||||
| `PushWindow` | The description's `maxPushConstantsSize` is below 128 bytes, Vulkan's least and the least push window a stage is lowered for | devices without VkLimit::MaxPushConstantsSize | `device` | 1: `crates/metal2vulkan/src/device/derive.rs (from_queries)` | `none`: a description whose maxPushConstantsSize is below 128 bytes, less than Vulkan lets a device report |
|
||||
| `IdentityDomains` | The identity pointer and handle domains, where a pointer is the device address it holds and a texture's or sampler's handle is its `gpuResourceID` | devices without a capability the site computes (`all`); every device (not implemented) | `ours` | 2: `crates/metal2vulkan/src/device/derive.rs (identity_domains)`, `crates/metal2vulkan/src/error/mod.rs (identity)` | `none`: the identity domains, which the runtime alone takes and which lower only kernels over buffer slots, textures in slots or argument buffers, and runtime samplers, so far |
|
||||
@@ -410,21 +407,18 @@ Each refusal's sites, with the function that builds it.
|
||||
- `feature::QuadOperations`: `crates/metal2vulkan/src/device/subgroup.rs (subgroup_tier)`
|
||||
- `feature::SimdgroupMatrix`: `crates/metal2vulkan/src/lower/simd/matrix.rs (not_implemented)`
|
||||
- `feature::SimdgroupMatrix16x16x16`: `crates/metal2vulkan/src/lower/simd/matrix.rs (select)`
|
||||
- `feature::ArgumentBufferPointers`: `crates/metal2vulkan/src/device/metal.rs (unsupported_features)`
|
||||
- `feature::ArgumentBufferTextures`: `crates/metal2vulkan/src/bind/heap.rs (member_storage_format, 4 sites)`; `crates/metal2vulkan/src/bind/heap.rs (member_texel_view, 2 sites)`; `crates/metal2vulkan/src/lower/access/handle.rs (select)`; `crates/metal2vulkan/src/lower/sampler/select.rs (select_one)`; `crates/metal2vulkan/src/lower/sampler/select.rs (select_sampling)`; `crates/metal2vulkan/src/lower/texture/atomic.rs (select)`; `crates/metal2vulkan/src/lower/texture/slot.rs (declare_heap, 2 sites)`
|
||||
- `feature::ArgumentBufferObjects`: `crates/metal2vulkan/src/lower/access/icb.rs (select)`; `crates/metal2vulkan/src/lower/access/object.rs (select)`; `crates/metal2vulkan/src/memory/provenance.rs (access)`; `crates/metal2vulkan/src/memory/provenance.rs (classify)`
|
||||
- `feature::DereferenceLoadedPointer`: `crates/metal2vulkan/src/lower/access/local.rs (access_ptr)`; `crates/metal2vulkan/src/lower/access/local.rs (threadgroup_constant_refusal)`; `crates/metal2vulkan/src/memory/plan.rs (analyze)`
|
||||
- `feature::PointerToInteger`: `crates/metal2vulkan/src/lower/access/dynamic.rs (require_addresses)`
|
||||
- `feature::DereferenceLoadedPointer`: `crates/metal2vulkan/src/lower/access/local.rs (access_ptr)`; `crates/metal2vulkan/src/lower/access/local.rs (threadgroup_constant_refusal)`
|
||||
- `feature::PointerCompare`: `crates/metal2vulkan/src/lower/access/copy.rs (addressed)`
|
||||
- `feature::HandleAsPointer`: `crates/metal2vulkan/src/lower/access/handle.rs (domain_kind)`; `crates/metal2vulkan/src/lower/access/handle.rs (element, 2 sites)`; `crates/metal2vulkan/src/memory/plan.rs (reprs)`; `crates/metal2vulkan/src/memory/provenance.rs (classify)`; `crates/metal2vulkan/src/memory/provenance.rs (seed)`
|
||||
- `feature::ConstantGlobalEscaping`: `crates/metal2vulkan/src/memory/plan.rs (blob_nodes)`; `crates/metal2vulkan/src/memory/plan.rs (serialize)`
|
||||
- `feature::ThreadgroupMemorySize`: `crates/metal2vulkan/src/memory/arena.rs (check)`; `crates/metal2vulkan/src/memory/plan.rs (too_large)`
|
||||
- `feature::ZeroedThreadgroupMemory`: `crates/metal2vulkan/src/lower/access/local.rs (zero_threadgroup)`
|
||||
- `feature::CoherentMemory`: `crates/metal2vulkan/src/lower/sync/memory_model.rs (check)`
|
||||
- `feature::Int64Atomics`: `crates/metal2vulkan/src/lower/access/atomic.rs (select, 2 sites)`
|
||||
- `feature::Int64Atomics`: `crates/metal2vulkan/src/lower/access/atomic.rs (select)`
|
||||
- `feature::ImageAtomics`: `crates/metal2vulkan/src/lower/texture/atomic.rs (select)`
|
||||
- `feature::DescriptorCount`: `crates/metal2vulkan/src/lower/select.rs (finish)`; `crates/metal2vulkan/src/pipeline/link.rs (limit_error)`
|
||||
- `feature::BufferRange`: `crates/metal2vulkan/src/lower/access/function_table.rs (select)`
|
||||
- `feature::Int64Arithmetic`: `crates/metal2vulkan/src/lower/arith/legal.rs (check_scalar)`; `crates/metal2vulkan/src/lower/select.rs (selector_form)`
|
||||
- `feature::Float64Arithmetic`: `crates/metal2vulkan/src/device/metal.rs (unsupported_features)`; `crates/metal2vulkan/src/lower/arith/legal.rs (check_scalar)`
|
||||
- `feature::Format`: `crates/metal2vulkan/src/lower/access/tile.rs (storage_format)`; `crates/metal2vulkan/src/lower/fragment/color.rs (select_param, 5 sites)`; `crates/metal2vulkan/src/lower/sampler/select.rs (select_extended)`; `crates/metal2vulkan/src/lower/stage_io/extended_color.rs (plan, 2 sites)`; `crates/metal2vulkan/src/lower/stage_io/plan.rs (entry)`; `crates/metal2vulkan/src/lower/stage_io/plan.rs (zeroed_output)`; `crates/metal2vulkan/src/lower/stage_io/word_color.rs (plan)`; `crates/metal2vulkan/src/lower/texture/mod.rs (select)`; `crates/metal2vulkan/src/lower/texture/mod.rs (select_image)`; `crates/metal2vulkan/src/lower/texture/mod.rs (select_read)`; `crates/metal2vulkan/src/lower/texture/slot.rs (atomic_format, 2 sites)`; `crates/metal2vulkan/src/lower/texture/slot.rs (declare_slot)`; `crates/metal2vulkan/src/lower/texture/slot.rs (storage_format, 6 sites)`; `crates/metal2vulkan/src/lower/texture/slot.rs (ulong_format, 3 sites)`; `crates/metal2vulkan/src/lower/texture/words.rs (not_built)`; `crates/metal2vulkan/src/metal/format/mod.rs (candidates)`; `crates/metal2vulkan/src/metal/format/mod.rs (held_storage_choice, 3 sites)`; `crates/metal2vulkan/src/metal/format/mod.rs (storage_choice)`; `crates/metal2vulkan/src/metal/format/mod.rs (vk_format, 2 sites)`; `crates/metal2vulkan/src/metal/vertex.rs (fetch_as, 2 sites)`; `crates/metal2vulkan/src/pipeline/color_writes.rs (rotated_blend_in_shader)`; `crates/metal2vulkan/src/pipeline/link/graphics.rs (extended_write_mask, 2 sites)`; `crates/metal2vulkan/src/pipeline/link/graphics.rs (graphics_state, 2 sites)`; `crates/metal2vulkan/src/pipeline/link/graphics.rs (reads_alpha_to_coverage, 2 sites)`; `crates/metal2vulkan/src/pipeline/link/graphics.rs (textured_fetches)`; `crates/metal2vulkan/src/pipeline/rotated_blend.rs (alpha_in_red_blend)`; `crates/metal2vulkan/src/pipeline/rotated_blend.rs (rotated_blend)`
|
||||
@@ -466,7 +460,7 @@ Each refusal's sites, with the function that builds it.
|
||||
- `feature::RayTracing`: `crates/metal2vulkan/src/lower/raytracing/mod.rs (instance_count)`; `crates/metal2vulkan/src/lower/raytracing/mod.rs (intersect, 5 sites)`; `crates/metal2vulkan/src/lower/raytracing/mod.rs (primitive_data_read)`; `crates/metal2vulkan/src/lower/raytracing/mod.rs (select_param)`; `crates/metal2vulkan/src/lower/raytracing/mod.rs (slot_of)`; `crates/metal2vulkan/src/lower/select.rs (route_air)`
|
||||
- `feature::Tensors`: `crates/metal2vulkan-air/src/canon/matmul2d/synth.rs (refuse)`; `crates/metal2vulkan-air/src/canon/mod.rs (post_check)`; `crates/metal2vulkan/src/lower/select.rs (route_air)`
|
||||
- `feature::RasterizationRateMap`: `crates/metal2vulkan/src/lower/stage_io/plan.rs (region_viewport, 2 sites)`
|
||||
- `feature::GpuEncodedIndirectCommands`: `crates/metal2vulkan/src/lower/access/icb.rs (needs, 2 sites)`; `crates/metal2vulkan/src/lower/access/icb.rs (select, 2 sites)`; `crates/metal2vulkan/src/lower/access/mod.rs (plan_replay, 3 sites)`; `crates/metal2vulkan/src/lower/access/object.rs (select)`; `crates/metal2vulkan/src/lower/select.rs (finish)`; `crates/metal2vulkan/src/lower/stage_io/plan.rs (indirect_range)`; `crates/metal2vulkan/src/lower/stage_io/plan.rs (merged)`; `crates/metal2vulkan/src/lower/stage_io/plan.rs (param)`; `crates/metal2vulkan/src/pipeline/compile.rs (analyze_one, 2 sites)`
|
||||
- `feature::GpuEncodedIndirectCommands`: `crates/metal2vulkan/src/lower/access/icb.rs (needs)`; `crates/metal2vulkan/src/lower/access/icb.rs (select, 2 sites)`; `crates/metal2vulkan/src/lower/access/mod.rs (plan_replay, 2 sites)`; `crates/metal2vulkan/src/lower/access/object.rs (select)`; `crates/metal2vulkan/src/lower/select.rs (finish)`; `crates/metal2vulkan/src/lower/stage_io/plan.rs (merged)`; `crates/metal2vulkan/src/lower/stage_io/plan.rs (param)`; `crates/metal2vulkan/src/pipeline/compile.rs (analyze_one, 2 sites)`
|
||||
- `feature::VulkanVersion`: `crates/metal2vulkan/src/ash_interop/query.rs (query)`; `crates/metal2vulkan/src/device/derive.rs (from_queries)`
|
||||
- `feature::PushWindow`: `crates/metal2vulkan/src/device/derive.rs (from_queries)`
|
||||
- `feature::IdentityDomains`: `crates/metal2vulkan/src/device/derive.rs (identity_domains)`; `crates/metal2vulkan/src/error/mod.rs (identity)`
|
||||
|
||||
@@ -25,11 +25,9 @@ feature ComputeDerivatives rare derivatives in a kernel
|
||||
feature QuadOperations app quad shuffles in kernels on devices without quad operations there
|
||||
feature SimdgroupMatrix rare simdgroup matrix kernels
|
||||
feature SimdgroupMatrix16x16x16 rare 16x16x16 simdgroup matrix products (Metal: Apple10 GPUs and later)
|
||||
feature ArgumentBufferPointers app argument buffers holding buffer pointers
|
||||
feature ArgumentBufferTextures app argument buffers holding textures and samplers (bindless)
|
||||
feature ArgumentBufferObjects rare pipeline states and ICBs in argument buffers
|
||||
feature DereferenceLoadedPointer app pointers loaded from argument buffers
|
||||
feature PointerToInteger rare pointer to integer casts
|
||||
feature PointerCompare rare comparing pointers of different roots
|
||||
feature HandleAsPointer rare resource handles used as byte pointers
|
||||
feature ConstantGlobalEscaping rare a constant global whose address escapes
|
||||
@@ -39,7 +37,6 @@ feature CoherentMemory rare coherent(device) accesses
|
||||
feature Int64Atomics rare 64-bit atomics
|
||||
feature ImageAtomics rare texture atomics beyond 32-bit integers
|
||||
feature DescriptorCount app many textures or buffers in one stage on a smaller device
|
||||
feature BufferRange app a buffer window past a device's descriptor range
|
||||
feature Int64Arithmetic rare 64-bit integers on a device without shaderInt64
|
||||
feature Float64Arithmetic rare doubles (MSL has none outside Apple's own code)
|
||||
feature Format system pixel formats a device lacks for a use (CoreVideo's 4:2:x and 10-bit formats among them)
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 17 and column 65.
|
Reference in new issue
Block a user