The floor: from_queries refuses a push window below 256 bytes, the runtime's floor requires 8 fragment outputs, and runtime-floor replaces the profiles below it
What: Device::from_queries refuses a description whose maxPushConstantsSize is below the 256
bytes every stage's push window is lowered for, with a typed Unsupported{PushWindow} naming the
MaxPushConstantsSize limit (crates/metal2vulkan/src/device/derive.rs, the floor checks of
from_queries). The runtime's floor (metal2vulkan-runtime's floor list) requires
maxFragmentOutputAttachments >= 8. All 15 committed device profiles report 8, and so does every
matrix card.
The committed profile set keeps only devices at or above the floor:
- roadmap-2022 and lunarg-desktop-baseline-2023 are deleted;
- vk12-floor and swiftshader move to profiles/below-floor/, inputs of the from_queries refusal
test only;
- runtime-floor, derived from the runtime's floor by scripts/regen-device-profiles and held
equal to it by a test, is the floor every test compiles on.
A test of a below-floor form now runs on runtime-floor without the feature that form stands in
for, labelled "below the runtime's floor" (pipeline::testing::profile_without, PROFILE_F,
device_f, FORMATLESS_FLOOR). The validation tests name runtime-floor, or derive the device they
need from it (no tessellation, no formatless writes, robustImageAccess alone, no device
addresses).
Why: the runtime refuses every device below its floor, so translating for those profiles tested
forms no device the runtime opens can ask for. A push window below 256 bytes cannot hold what
the lowering puts there.
Consumer check: no public item of a published crate is deleted. The one removed constant,
FORMATLESS_FLOOR's old value, is in the crate-private pipeline::testing.
Not in this change, re-blessed on development: the golden hashes table
(tests::golden_hashes) and the public fixture expectations (tests::public_fixtures_engine). The
runtime-sources pin (candidate::engine::artifact) follows from the test run at this tree.
Verified: cargo fmt. The suites, clippy and the CPU-ICD run are potluck jobs on this tree, named
when the branch is handed over.
This commit is contained in:
1 parent
3421c0f8ac
commit
b90e0565da
181 files changed
+4903
-6955
No files matched your search
@@ -35,6 +35,8 @@ windows-sys = { workspace = true, features = ["Win32_System_Performance", "Win32
|
||||
[dev-dependencies]
|
||||
# The tests' fixture assembler and fixture directories. Path-only, so publishing drops it.
|
||||
metal2vulkan-devtools = { path = "../metal2vulkan-devtools" }
|
||||
# The floor profile's reader (`tests::floor`).
|
||||
serde_json.workspace = true
|
||||
|
||||
# The device tests compile only under the validation crate's device cfgs (docs/VALIDATION.md).
|
||||
[lints.rust]
|
||||
|
||||
@@ -3501,6 +3501,8 @@ integer texture). Vulkan requires at least 500,000 of each texture limit and of
|
||||
totals on a device that supports `descriptorIndexing`, as every lab device does. 4,000 is Vulkan's minimum `maxSamplerAllocationCount`. The compute limits let a threadgroup take
|
||||
Metal's 1,024 threads in any shape up to 1,024 by 1,024 by 64. `maxColorAttachments` holds
|
||||
Metal's eight color attachments on every device; Vulkan 1.3 requires 4 of it, and Vulkan 1.4 8.
|
||||
`maxFragmentOutputAttachments` holds a fragment function's output to each of them; Vulkan 1.3 and
|
||||
1.4 require 4 of it, and Roadmap 2026 8.
|
||||
A Boolean limit's minimum is 1,
|
||||
`VK_TRUE`; `timestampValidBits` is the queue family's.
|
||||
|
||||
@@ -3524,6 +3526,7 @@ A Boolean limit's minimum is 1,
|
||||
| `standardSampleLocations` | `1` | Metal's sample positions: those of 1, 2 and 4 samples are Vulkan's standard locations |
|
||||
| `timestampValidBits` | `36` | GPU times of command buffers |
|
||||
| `maxColorAttachments` | `8` | every color attachment of a render pass descriptor |
|
||||
| `maxFragmentOutputAttachments` | `8` | a fragment function's output to every color attachment |
|
||||
|
||||
### Queue family and memory types
|
||||
|
||||
|
||||
@@ -1107,7 +1107,7 @@ fn second_elements_fit(device: &Queried) -> bool {
|
||||
|
||||
/// Each limit the floor sets: its Vulkan name, the device's value, and the least value the runtime
|
||||
/// uses.
|
||||
pub(crate) fn limits(device: &Queried) -> [(&'static str, u32, u32); 17] {
|
||||
pub(crate) fn limits(device: &Queried) -> [(&'static str, u32, u32); 18] {
|
||||
let limits = &device.limits;
|
||||
let descriptors = &device.vulkan12;
|
||||
[
|
||||
@@ -1200,6 +1200,13 @@ pub(crate) fn limits(device: &Queried) -> [(&'static str, u32, u32); 17] {
|
||||
limits.max_color_attachments,
|
||||
crate::pass::MAX_COLOR_ATTACHMENTS as u32,
|
||||
),
|
||||
// A fragment function's output to each of them (Metal's `[[color(0)]]` to `[[color(7)]]`),
|
||||
// so a pipeline drawing to every slot links.
|
||||
(
|
||||
"maxFragmentOutputAttachments",
|
||||
limits.max_fragment_output_attachments,
|
||||
crate::pass::MAX_COLOR_ATTACHMENTS as u32,
|
||||
),
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
@@ -102,6 +102,7 @@ fn at_the_floor() -> Queried {
|
||||
limits: vk::PhysicalDeviceLimits::default()
|
||||
.max_sampler_allocation_count(4000)
|
||||
.max_color_attachments(8)
|
||||
.max_fragment_output_attachments(8)
|
||||
.max_push_constants_size(256)
|
||||
.max_compute_work_group_invocations(1024)
|
||||
.max_compute_work_group_size([1024, 1024, 64])
|
||||
@@ -592,7 +593,7 @@ fn each_missing_feature_is_named() {
|
||||
#[test]
|
||||
fn each_low_limit_is_named() {
|
||||
type Lower = fn(&mut Queried);
|
||||
let cases: [(Lower, &str, u32); 18] = [
|
||||
let cases: [(Lower, &str, u32); 19] = [
|
||||
(
|
||||
|d| {
|
||||
d.vulkan12
|
||||
@@ -698,6 +699,11 @@ fn each_low_limit_is_named() {
|
||||
"maxColorAttachments",
|
||||
8,
|
||||
),
|
||||
(
|
||||
|d| d.limits.max_fragment_output_attachments = 7,
|
||||
"maxFragmentOutputAttachments",
|
||||
8,
|
||||
),
|
||||
];
|
||||
for (lower, name, needed) in cases {
|
||||
let mut device = at_the_floor();
|
||||
@@ -1502,6 +1508,88 @@ fn the_readme_states_the_floor() {
|
||||
assert_eq!(stated, code, "the README's memory types");
|
||||
}
|
||||
|
||||
/// The committed `runtime-floor` profile (`metal2vulkan-validation/profiles/runtime-floor.json`,
|
||||
/// which the translator's and validation's tests load as the floor's device) states in its
|
||||
/// `m2v_runtime_floor` block exactly what the runtime requires: the device extensions, every
|
||||
/// required feature and no other, and each limit at the value the floor needs.
|
||||
/// `scripts/regen-device-profiles` writes the block.
|
||||
#[test]
|
||||
fn the_floor_profile_states_exactly_the_floor() {
|
||||
let path = metal2vulkan_devtools::validation_dir().join("profiles/runtime-floor.json");
|
||||
let text = fs::read_to_string(&path)
|
||||
.unwrap_or_else(|error| panic!("reading {}: {error}", path.display()));
|
||||
let profile: serde_json::Value = serde_json::from_str(&text)
|
||||
.unwrap_or_else(|error| panic!("parsing {}: {error}", path.display()));
|
||||
let block = &profile["capabilities"]["m2v_runtime_floor"];
|
||||
assert!(
|
||||
block.is_object(),
|
||||
"{} has no m2v_runtime_floor block",
|
||||
path.display()
|
||||
);
|
||||
|
||||
let stated: BTreeSet<String> = block["extensions"]
|
||||
.as_object()
|
||||
.expect("the block's extensions")
|
||||
.keys()
|
||||
.cloned()
|
||||
.collect();
|
||||
let code: BTreeSet<String> = DEVICE_EXTENSIONS
|
||||
.iter()
|
||||
.map(|name| name.to_string_lossy().into_owned())
|
||||
.collect();
|
||||
assert_eq!(stated, code, "the profile's extensions");
|
||||
|
||||
let mut stated = BTreeSet::new();
|
||||
for (structure, members) in block["features"].as_object().expect("the block's features") {
|
||||
for (member, value) in members.as_object().expect("a structure's members") {
|
||||
assert_eq!(
|
||||
value,
|
||||
&serde_json::Value::Bool(true),
|
||||
"{structure}.{member}"
|
||||
);
|
||||
stated.insert((structure.clone(), member.clone()));
|
||||
}
|
||||
}
|
||||
let code: BTreeSet<(String, String)> = REQUIRED
|
||||
.iter()
|
||||
.map(|feature| (feature.structure.to_string(), vulkan_name(feature.member)))
|
||||
.collect();
|
||||
assert_eq!(stated, code, "the profile's features");
|
||||
|
||||
let properties = &block["properties"];
|
||||
let mut stated = BTreeSet::new();
|
||||
for members in [
|
||||
&properties["VkPhysicalDeviceProperties"]["limits"],
|
||||
&properties["VkPhysicalDeviceVulkan12Properties"],
|
||||
] {
|
||||
for (name, value) in members.as_object().expect("the block's limits") {
|
||||
let number = |value: &serde_json::Value| match value {
|
||||
serde_json::Value::Bool(value) => u32::from(*value),
|
||||
value => value
|
||||
.as_u64()
|
||||
.and_then(|value| u32::try_from(value).ok())
|
||||
.unwrap_or_else(|| panic!("{name}: {value}")),
|
||||
};
|
||||
match value.as_array() {
|
||||
Some(values) => stated.extend(
|
||||
values
|
||||
.iter()
|
||||
.enumerate()
|
||||
.map(|(at, value)| (format!("{name}[{at}]"), number(value))),
|
||||
),
|
||||
None => {
|
||||
stated.insert((name.clone(), number(value)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
let code: BTreeSet<(String, u32)> = limits(&at_the_floor())
|
||||
.into_iter()
|
||||
.map(|(name, _, needed)| (name.to_string(), needed))
|
||||
.collect();
|
||||
assert_eq!(stated, code, "the profile's limits");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn vulkan_names_follow_the_registry() {
|
||||
assert_eq!(vulkan_name("buffer_device_address"), "bufferDeviceAddress");
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,57 +1,5 @@
|
||||
{
|
||||
"entries": [
|
||||
{
|
||||
"profile": "lunarg-desktop-baseline-2023",
|
||||
"outcome": "device_capability_missing",
|
||||
"key": "FramebufferFetch needs Feature(RasterizationOrderColorAttachmentAccess) | Feature(FragmentShaderPixelInterlock)",
|
||||
"class": "device_lacks",
|
||||
"rows": 8,
|
||||
"rows_digest": "7010f0557b7c62397a6f66bf553930ea5dbacd8d429f9a9ea82ca51335adbb62",
|
||||
"new_census": "dae6c9c8021e6a3de6b1ebabf3bfb5e8756e9161930b55f912d7407288c442a8",
|
||||
"old_l3": "eeb826d3de808129cd3c3ef41b11a9386db2aff8b81ce72070990eaa6898fdb9",
|
||||
"review": {
|
||||
"evidence": [
|
||||
"the engine's census of lunarg-desktop-baseline-2023 refuses this entry's rows `device_capability_missing FramebufferFetch needs Feature(RasterizationOrderColorAttachmentAccess) | Feature(FragmentShaderPixelInterlock)` (rows, rows_digest, new_census)",
|
||||
"the old engine's L3 table of lunarg-desktop-baseline-2023 (old_l3): the rows' old output passes L3 there or has no verdict",
|
||||
"validation/profiles/lunarg-desktop-baseline-2023.json: none of its 41 extensions is VK_EXT_fragment_shader_interlock or a rasterization-order attachment access extension, and no capability block states fragmentShaderPixelInterlock or rasterizationOrderColorAttachmentAccess",
|
||||
"the translator orders a framebuffer fetch in one of two exact forms: an input attachment under rasterization-order attachment access, or each read attachment as a coherent storage image inside the ordered pixel interlock (crates/metal2vulkan/src/lower/fragment/color.rs and fetch.rs); with neither, it refuses the read, naming both forms",
|
||||
"corpus-ab --c1-report at commit 1758b8a9 finds this bucket's rows (new census dae6c9c8, old L3 eeb826d3)",
|
||||
"the user's sign-off of 2026-10-03"
|
||||
],
|
||||
"note": "The bucket's 8 rows are 6 private rows (0d33931d, 353da437, 92428fc0, 9efdcbd4, f420722e, fe6bea5b) and the public fragment_fetch fixture's fetch_ordered (a4d33db3) and fetch_scalar (f6350577). Each reads a color attachment through Metal's framebuffer fetch, which Metal orders after every earlier fragment of the pixel. The profile states neither rasterizationOrderColorAttachmentAccess nor fragmentShaderPixelInterlock, so neither exact form applies and no exact emulation is known: the engine refuses the rows, naming both forms. No unordered input-attachment read is offered in their place: it could return the attachment before an earlier overlapping fragment's write, a value Metal never shows. The old engine emits one input attachment per color index (src/passes/stage_input/mod.rs), read unordered and unrecorded. The user signed off the 6 private rows as a device limit on 2026-10-03, and the whole bucket the same day as a recorded near-equivalent; with the unordered read removed, the bucket is the device's lack.",
|
||||
"sign_off": {
|
||||
"state": "signed_off",
|
||||
"decision": "sign off this family's rows as a device limit, and the bucket as a recorded near-equivalent that stays open until an exact path exists and does not count against C1 (the user's answers of 2026-10-03); the near-equivalent, an unordered read, is removed, as no fast form may change what a Metal program observes (the user's rule of 2026-10-18)",
|
||||
"date": "2026-10-03"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"profile": "lunarg-desktop-baseline-2023",
|
||||
"outcome": "device_capability_missing",
|
||||
"key": "MinLodClamp needs Feature(ShaderResourceMinLod)",
|
||||
"class": "device_lacks",
|
||||
"rows": 1,
|
||||
"rows_digest": "8510c7fddd77a755b7454c1cae84d4cbfb44527a32a381e1ff47db7313260e21",
|
||||
"new_census": "dae6c9c8021e6a3de6b1ebabf3bfb5e8756e9161930b55f912d7407288c442a8",
|
||||
"old_l3": "eeb826d3de808129cd3c3ef41b11a9386db2aff8b81ce72070990eaa6898fdb9",
|
||||
"review": {
|
||||
"evidence": [
|
||||
"the engine's census of lunarg-desktop-baseline-2023 refuses this entry's rows `device_capability_missing MinLodClamp needs Feature(ShaderResourceMinLod)` (rows, rows_digest, new_census)",
|
||||
"the old engine's L3 table of lunarg-desktop-baseline-2023 (old_l3): the rows' old output passes L3 there or has no verdict",
|
||||
"validation/profiles/lunarg-desktop-baseline-2023.json: its one capability block with features (VP_LUNARG_desktop_baseline_2023_block) grants 29 VkPhysicalDeviceFeatures, and shaderResourceMinLod is not among them",
|
||||
"a nonzero min_lod_clamp on an implicit-level or gradient sample is SPIR-V's MinLod image operand, which needs shaderResourceMinLod",
|
||||
"corpus-ab --c1-report at commit 1758b8a9 finds this bucket's rows (new census dae6c9c8, old L3 eeb826d3)",
|
||||
"the user's sign-off of 2026-10-03"
|
||||
],
|
||||
"note": "The user signed it off on 2026-10-03. The one row is the public sampling fixture's sample_min_lod (f2af5b3d), a fragment function's implicit-level sample with min_lod_clamp(1.5). Vulkan clamps an implicit level from below only through the MinLod image operand, whose capability needs shaderResourceMinLod, and the profile lacks it. No exact emulation is known. Sampler state cannot carry the clamp, because the clamp is an operand of the call, not of the sampler. A rewrite to an explicit level (the queried level, raised to the clamp) or to scaled gradients replaces the implementation's own level selection, and so its filtering (anisotropy included); neither is shown to equal Metal's clamped implicit sample. The old output passes L3 on this profile: expected from its requirements, not executed.",
|
||||
"sign_off": {
|
||||
"state": "signed_off",
|
||||
"decision": "sign off as a device limit (the user's answer of 2026-10-03)",
|
||||
"date": "2026-10-03"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"profile": "moltenvk-m3",
|
||||
"outcome": "invalid_input",
|
||||
@@ -181,32 +129,6 @@
|
||||
"date": "2026-10-03"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"profile": "vk12-floor",
|
||||
"outcome": "device_capability_missing",
|
||||
"key": "FramebufferFetch needs Feature(RasterizationOrderColorAttachmentAccess) | Feature(FragmentShaderPixelInterlock)+Feature(FragmentStoresAndAtomics)",
|
||||
"class": "device_lacks",
|
||||
"rows": 6,
|
||||
"rows_digest": "9d6f4b909eda2168f0f4ed52c894e87defa44a01479140048696b79be7f46a80",
|
||||
"new_census": "fe02751bc8bf5dbf3ee1a60eff5281544a1d8396b5b53a646026224e613b529d",
|
||||
"old_l3": "657baac91087cd17b953e95d2b48b8c3ceae90a0bdd70fe59bdb9f6d67bbc637",
|
||||
"review": {
|
||||
"evidence": [
|
||||
"the engine's census of vk12-floor refuses this entry's rows `device_capability_missing FramebufferFetch needs Feature(RasterizationOrderColorAttachmentAccess) | Feature(FragmentShaderPixelInterlock)+Feature(FragmentStoresAndAtomics)` (rows, rows_digest, new_census)",
|
||||
"the old engine's L3 table of vk12-floor (old_l3): the rows' old output passes L3 there or has no verdict",
|
||||
"validation/profiles/vk12-floor.json: it states no extension, and its capability blocks state neither fragmentShaderPixelInterlock nor rasterizationOrderColorAttachmentAccess, nor fragmentStoresAndAtomics among the 4 VkPhysicalDeviceFeatures it grants",
|
||||
"the translator orders a framebuffer fetch in one of two exact forms: an input attachment under rasterization-order attachment access, or each read attachment as a coherent storage image inside the ordered pixel interlock (crates/metal2vulkan/src/lower/fragment/color.rs and fetch.rs); with neither, it refuses the read, naming both forms",
|
||||
"corpus-ab --c1-report at commit 1758b8a9 finds this bucket's rows (new census fe02751b, old L3 657baac9)",
|
||||
"the user's sign-off of 2026-10-03"
|
||||
],
|
||||
"note": "The bucket's 6 rows are 4 private rows (353da437, 92428fc0, 9efdcbd4, f420722e) and the public fragment_fetch fixture's fetch_ordered (a4d33db3) and fetch_scalar (f6350577). Each reads a color attachment through Metal's framebuffer fetch, which Metal orders after every earlier fragment of the pixel. The profile states neither rasterizationOrderColorAttachmentAccess nor fragmentShaderPixelInterlock (nor fragmentStoresAndAtomics, which the storage form's write needs), so neither exact form applies and no exact emulation is known: the engine refuses the rows, naming both forms. No unordered input-attachment read is offered in their place: it could return the attachment before an earlier overlapping fragment's write, a value Metal never shows. The old engine emits one input attachment per color index (src/passes/stage_input/mod.rs), read unordered and unrecorded. The user signed off the 4 private rows as a device limit on 2026-10-03, and the whole bucket the same day as a recorded near-equivalent; with the unordered read removed, the bucket is the device's lack.",
|
||||
"sign_off": {
|
||||
"state": "signed_off",
|
||||
"decision": "sign off this family's rows as a device limit, and the bucket as a recorded near-equivalent that stays open until an exact path exists and does not count against C1 (the user's answers of 2026-10-03); the near-equivalent, an unordered read, is removed, as no fast form may change what a Metal program observes (the user's rule of 2026-10-18)",
|
||||
"date": "2026-10-03"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -5,11 +5,15 @@ top-level `provenance` object. Generated by `scripts/regen-device-profiles/`; do
|
||||
(the lint rejects non-canonical files). The translator parses them into a `DeviceDescription`;
|
||||
validation uses them for per-profile checks.
|
||||
|
||||
`below-floor/` holds the descriptions below the translator's floor, which `Device::from_queries`
|
||||
refuses (a `maxPushConstantsSize` of 128, below the 256-byte push window): the input of the
|
||||
floor's refusal test alone, read by no other test, census or venue. The committed profiles are
|
||||
the files of this directory.
|
||||
|
||||
| File | Source | Device / definition | Driver | API |
|
||||
|---|---|---|---|---|
|
||||
| `vk12-floor` | derived from `VP_LUNARG_minimum_requirements_1_2` | the floor: Vulkan 1.2 required features, minimum limits, and the unconditional Required Format Support entries only; F-class | – | 1.2.131 |
|
||||
| `lunarg-desktop-baseline-2023` | Vulkan-Profiles `VP_LUNARG_desktop_baseline_2023` | profile, plus `m2v_layer_presentation` | – | 1.2.148 |
|
||||
| `roadmap-2022` | Vulkan-Profiles `VP_KHR_roadmap_2022` | profile, plus the Vulkan 1.2 Required Format Support entries it implies, plus `m2v_layer_presentation` | – | 1.3.204 |
|
||||
| `runtime-floor` | derived from `VP_LUNARG_minimum_requirements_1_3`, plus `m2v_runtime_floor` | the runtime's floor: Vulkan 1.3 required features and minimum limits, the unconditional Vulkan 1.2 Required Format Support entries, and what `metal2vulkan-runtime` requires of every device (`crates/metal2vulkan-runtime/src/floor.rs`) | – | 1.3.204 |
|
||||
| `below-floor/vk12-floor` | derived from `VP_LUNARG_minimum_requirements_1_2` | Vulkan 1.2 required features, minimum limits, and the unconditional Required Format Support entries only | – | 1.2.131 |
|
||||
| `nvidia-rtx50-linux` | gpuinfo report 51770 | NVIDIA GeForce RTX 5080, Linux | 615.71.09 | 1.4.351 |
|
||||
| `nvidia-pascal-linux` | gpuinfo report 52074 | NVIDIA GeForce GTX 1060 6GB, Linux | 580.178.04 | 1.4.312 |
|
||||
| `amd-rdna3-radv` | gpuinfo report 51898 | AMD Radeon RX 7800 XT (RADV NAVI32) | Mesa 26.2.3 | 1.4.354 |
|
||||
@@ -17,8 +21,8 @@ validation uses them for per-profile checks.
|
||||
| `intel-arl-anv` | gpuinfo report 52029 | Intel(R) Graphics (ARL), ANV | Mesa 26.2.3 | 1.4.354 |
|
||||
| `intel-irisxe-anv` | gpuinfo report 51836 | Intel(R) Iris(R) Xe Graphics (TGL GT2), ANV | Mesa 26.2.2 | 1.4.354 |
|
||||
| `moltenvk-m3` | local `vulkaninfo --json`, portability-subset profile, plus its `--capture-formats` supplement | Apple M3 Max, macOS 27.0.1 | MoltenVK 1.4.2 | 1.4.357 |
|
||||
| `below-floor/swiftshader` | gpuinfo report 38278 | SwiftShader Device (Subzero), Linux | 5.0.0 | 1.3.0 |
|
||||
| `lavapipe` | gpuinfo report 51983 | llvmpipe (LLVM 23.1.1, 256 bits) | Mesa 26.2.3 | 1.4.354 |
|
||||
| `swiftshader` | gpuinfo report 38278 | SwiftShader Device (Subzero), Linux | 5.0.0 | 1.3.0 |
|
||||
| `gate-lavapipe` | `vulkaninfo --json` capture in `scripts/linux-gate --icd lavapipe` (arm64 image), plus its supplement | llvmpipe (LLVM 21.1.8, 128 bits): the gate's own CPU device, so a run restricted to it under `VK_LAYER_KHRONOS_profiles` reports the device itself | Mesa 26.0.8 | 1.4.335 |
|
||||
| `gate-lavapipe-x86_64` | `vulkaninfo --json` capture in `scripts/linux-gate --icd lavapipe` (amd64 image), plus its supplement | llvmpipe (LLVM 21.1.8, 256 bits) | Mesa 26.0.8 | 1.4.335 |
|
||||
| `amd-780m-radv` | local `vulkaninfo --json`, plus its supplement | AMD Radeon 780M Graphics (RADV PHOENIX), CachyOS | Mesa 26.2.6 | 1.4.354 |
|
||||
@@ -54,13 +58,19 @@ Reading notes for consumers of these files:
|
||||
which the base states empty and the specification requires to include
|
||||
`VK_RESOLVE_MODE_SAMPLE_ZERO_BIT`, and `maxDrawIndexedIndexValue`, which the base states as
|
||||
`2^24` and the Required Limits table as `2^24 - 1`.
|
||||
- The block `m2v_runtime_floor` of `runtime-floor` is not from the base profile either: it states
|
||||
the device extensions, features and limits `metal2vulkan-runtime`'s floor requires, each limit at
|
||||
the value the floor needs, and the block `m2v_required_features` the Vulkan 1.3 core features
|
||||
the base profile omits (`provenance.added_features`). A runtime test holds the former equal to
|
||||
`floor.rs`. The floor's queue family, timestamp bits, memory types and time domains have no
|
||||
profiles-schema form.
|
||||
- The block `m2v_unrequired_properties` of the derived profiles is not from the base profile
|
||||
either: it states the weakest value the specification permits for each property the product
|
||||
reads, and `VK_LAYER_KHRONOS_profiles` sets, that the base leaves without a requirement. That
|
||||
is the value a reader takes for the absent member; stated, the layer (which keeps the device's
|
||||
own value for a member a profile omits) reports it too.
|
||||
- The block `m2v_layer_presentation` of `lunarg-desktop-baseline-2023` and `roadmap-2022` is not
|
||||
from the profile's source either: it states each feature the profile's core version requires
|
||||
- The block `m2v_layer_presentation` of a requirements document (a `khronos` source of the
|
||||
generator; no committed file is one) is not from the profile's source either: it states each feature the profile's core version requires
|
||||
that the profile omits, and each member the product reads of the core property structures of
|
||||
its version and of the property structures of the extensions it lists that it omits, at the
|
||||
value the product's reader takes for the absent member (`provenance.layer_presentation` lists
|
||||
|
||||
File renamed without changes.
File renamed without changes.
File diff suppressed because it is too large.
Load diff
+419
-756
File diff suppressed because it is too large.
Load diff
@@ -1361,7 +1361,7 @@ mod tests {
|
||||
let Some(bitcode) = fixture("store_const.ll") else {
|
||||
return;
|
||||
};
|
||||
let device = crate::engine::load_device("vk12-floor").unwrap();
|
||||
let device = crate::engine::load_device("runtime-floor").unwrap();
|
||||
let RowCompile::Compiled(pipeline) = compile_row(
|
||||
&bitcode,
|
||||
"store_const",
|
||||
@@ -1388,7 +1388,7 @@ mod tests {
|
||||
}
|
||||
// Every requirement is enabled, and every device fact met, on a device that is exactly
|
||||
// the profile's description and enabled everything it recommends.
|
||||
let description = description("vk12-floor");
|
||||
let description = description("runtime-floor");
|
||||
let enabled = description.recommended_enables();
|
||||
assert_eq!(
|
||||
unenabled(
|
||||
@@ -1680,12 +1680,35 @@ mod tests {
|
||||
/// A post-tessellation vertex row compiles to a tessellation pipeline: the synthesized vertex
|
||||
/// and control stages before the function's evaluation stage, a patch list of one control point
|
||||
/// per patch, and the row's control-point and patch attributes pulled by the evaluation stage.
|
||||
/// On a device without tessellation shaders it is refused typed, naming the feature.
|
||||
/// On a device without tessellation shaders (`runtime-floor` without them, below the runtime's
|
||||
/// floor) it is refused typed, naming the feature.
|
||||
#[test]
|
||||
fn post_tessellation_vertex_rows_compile_to_tessellation_pipelines() {
|
||||
use metal2vulkan::device::VkFeature;
|
||||
let Some(bitcode) = fixture("tessellation.ll") else {
|
||||
return;
|
||||
};
|
||||
let untessellated = {
|
||||
let mut description = description("runtime-floor");
|
||||
for feature in [
|
||||
VkFeature::TessellationShader,
|
||||
VkFeature::ShaderTessellationAndGeometryPointSize,
|
||||
VkFeature::MultiviewTessellationShader,
|
||||
] {
|
||||
description.features.remove(&feature);
|
||||
}
|
||||
Device::from_queries(description, DevicePolicy::default()).unwrap()
|
||||
};
|
||||
let compile_on = |device: &Device, entry| {
|
||||
compile_row(
|
||||
&bitcode,
|
||||
entry,
|
||||
RowStage::Vertex,
|
||||
Projection::Derived,
|
||||
device,
|
||||
None,
|
||||
)
|
||||
};
|
||||
let compile = |profile: &str, entry| {
|
||||
let device = crate::engine::load_device(profile).unwrap();
|
||||
compile_row(
|
||||
@@ -1723,15 +1746,13 @@ mod tests {
|
||||
// The fixed vertex stage reads no attribute: every one is pulled.
|
||||
assert!(render.vertex_input.attributes.is_empty(), "{entry}");
|
||||
}
|
||||
for profile in ["roadmap-2022", "vk12-floor"] {
|
||||
for entry in ["tess_quad_buffer", "tess_triangle_points"] {
|
||||
match compile(profile, entry) {
|
||||
RowCompile::NotCompiled(outcome, detail) => {
|
||||
assert_eq!(outcome.label(), "device_capability_missing", "{detail}");
|
||||
assert!(detail.contains("TessellationShader"), "{detail}");
|
||||
}
|
||||
other => panic!("{profile} {entry}: {other:?}"),
|
||||
for entry in ["tess_quad_buffer", "tess_triangle_points"] {
|
||||
match compile_on(&untessellated, entry) {
|
||||
RowCompile::NotCompiled(outcome, detail) => {
|
||||
assert_eq!(outcome.label(), "device_capability_missing", "{detail}");
|
||||
assert!(detail.contains("TessellationShader"), "{detail}");
|
||||
}
|
||||
other => panic!("{entry}: {other:?}"),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1943,7 +1964,8 @@ mod tests {
|
||||
/// stage.
|
||||
#[test]
|
||||
fn a_worker_boundary_failure_is_a_stopped_row() {
|
||||
let device = WorkerDevice::new(description("vk12-floor"), DevicePolicy::default()).unwrap();
|
||||
let device =
|
||||
WorkerDevice::new(description("runtime-floor"), DevicePolicy::default()).unwrap();
|
||||
let worker = CompileWorker::program("/nonexistent/compile-worker");
|
||||
for stage in [RowStage::Kernel, RowStage::Vertex, RowStage::Fragment] {
|
||||
let (row, measured) = compile_row_in_worker(
|
||||
@@ -1971,14 +1993,14 @@ mod tests {
|
||||
#[test]
|
||||
fn unenabled_names_every_requirement_the_opened_device_did_not_enable() {
|
||||
use metal2vulkan::device::{ApiVersion, StageCreateFlag, VkExtension, VkFeature};
|
||||
let description = description("vk12-floor");
|
||||
let description = description("runtime-floor");
|
||||
let mut enabled = EnableSet::new();
|
||||
enabled.features.insert(VkFeature::RobustBufferAccess);
|
||||
let opened = opened_description(description, &enabled);
|
||||
assert!(opened.is_ok(), "{opened:?}");
|
||||
|
||||
let mut requirements = Requirements::default();
|
||||
requirements.api_version = Some(ApiVersion { major: 1, minor: 3 });
|
||||
requirements.api_version = Some(ApiVersion { major: 1, minor: 4 });
|
||||
requirements.features.insert(VkFeature::RobustBufferAccess);
|
||||
requirements.features.insert(VkFeature::ShaderInt64);
|
||||
requirements.extensions.insert(VkExtension::ExtRobustness2);
|
||||
@@ -1988,7 +2010,7 @@ mod tests {
|
||||
assert_eq!(
|
||||
unenabled(&opened, &requirements),
|
||||
[
|
||||
"ApiVersion(ApiVersion { major: 1, minor: 3 })",
|
||||
"ApiVersion(ApiVersion { major: 1, minor: 4 })",
|
||||
"Feature(ShaderInt64)",
|
||||
"Extension(ExtRobustness2)",
|
||||
"Feature(ComputeFullSubgroups)",
|
||||
@@ -2068,7 +2090,7 @@ mod tests {
|
||||
#[test]
|
||||
fn device_facts_are_checked_against_the_opened_device_not_the_profile() {
|
||||
use metal2vulkan::device::{StageCreateFlag, VkLimit};
|
||||
let mut description = description("vk12-floor");
|
||||
let mut description = description("runtime-floor");
|
||||
let push_limit = description.limits.max_push_constants_size;
|
||||
let enabled = description.recommended_enables();
|
||||
let opened = opened_profile(description.clone(), &enabled);
|
||||
@@ -2101,10 +2123,11 @@ mod tests {
|
||||
flagged
|
||||
.stage_flags
|
||||
.insert(StageCreateFlag::RequireFullSubgroups);
|
||||
assert!(!enabled
|
||||
let mut partial = enabled.clone();
|
||||
assert!(partial
|
||||
.features
|
||||
.contains(&metal2vulkan::device::VkFeature::ComputeFullSubgroups));
|
||||
let opened = opened_profile(description.clone(), &enabled);
|
||||
.remove(&metal2vulkan::device::VkFeature::ComputeFullSubgroups));
|
||||
let opened = opened_profile(description.clone(), &partial);
|
||||
assert_eq!(
|
||||
unmet_device_facts(&opened, &flagged),
|
||||
["Feature(ComputeFullSubgroups)"]
|
||||
@@ -2126,14 +2149,14 @@ mod tests {
|
||||
#[test]
|
||||
fn the_opened_description_keeps_the_enabled_subset_and_refuses_an_unclosed_set() {
|
||||
use metal2vulkan::device::{ApiVersion, VkExtension, VkFeature};
|
||||
let description = description("vk12-floor");
|
||||
assert_eq!(description.api_version, ApiVersion::V1_2);
|
||||
let description = description("runtime-floor");
|
||||
assert_eq!(description.api_version, ApiVersion::V1_3);
|
||||
let mut enabled = EnableSet::new();
|
||||
enabled.features.insert(VkFeature::RobustBufferAccess);
|
||||
let opened = opened_description(description.clone(), &enabled).unwrap();
|
||||
assert_eq!(opened.features, enabled.features);
|
||||
assert!(opened.extensions.is_empty());
|
||||
assert_eq!(opened.api_version, ApiVersion::V1_2);
|
||||
assert_eq!(opened.api_version, ApiVersion::V1_3);
|
||||
|
||||
assert!(!description.features.contains(&VkFeature::Maintenance8));
|
||||
let mut overstated = enabled.clone();
|
||||
@@ -2145,12 +2168,10 @@ mod tests {
|
||||
// A description that lists a promoted feature and its extension, with the feature
|
||||
// enabled but not the extension: not exposed, so refused.
|
||||
let mut listing = description;
|
||||
listing.features.insert(VkFeature::SubgroupSizeControl);
|
||||
listing
|
||||
.extensions
|
||||
.insert(VkExtension::ExtSubgroupSizeControl);
|
||||
listing.features.insert(VkFeature::Maintenance5);
|
||||
listing.extensions.insert(VkExtension::KhrMaintenance5);
|
||||
let mut unexposed = enabled;
|
||||
unexposed.features.insert(VkFeature::SubgroupSizeControl);
|
||||
unexposed.features.insert(VkFeature::Maintenance5);
|
||||
let error = opened_description(listing, &unexposed).unwrap_err();
|
||||
assert!(error.contains("without exposing"), "{error}");
|
||||
}
|
||||
|
||||
@@ -1141,7 +1141,7 @@ fn an_additions_bless_refuses_a_changed_cell_and_writes_nothing() {
|
||||
corpus.store().put_case(case("delta")).unwrap();
|
||||
let fresh = corpus.root().join("fresh.sqlite");
|
||||
let report = corpus
|
||||
.additions(&compiler, &["vk12-floor"], Some(&fresh))
|
||||
.additions(&compiler, &["runtime-floor"], Some(&fresh))
|
||||
.unwrap();
|
||||
assert!(!report.passed() && !report.blessed && !report.written);
|
||||
let changed = report
|
||||
|
||||
@@ -3101,7 +3101,7 @@ mod tests {
|
||||
#[test]
|
||||
fn engine_worker_translates_retained_bitcode_and_assembles_public_text() {
|
||||
use metal2vulkan_devtools::{engine_dir, llvm_assemble, AssembleError};
|
||||
let profile = engine::load_profile("vk12-floor").unwrap();
|
||||
let profile = engine::load_profile("runtime-floor").unwrap();
|
||||
let text = fs::read_to_string(engine_dir().join("store_const.ll")).unwrap();
|
||||
let mut source = metal2vulkan_validation::source::SourceRow {
|
||||
air_sha256: "11".repeat(32),
|
||||
|
||||
@@ -1023,7 +1023,7 @@ mod tests {
|
||||
assert_eq!(input.libraries, source.lib_sha256s);
|
||||
assert_eq!(input.links, links);
|
||||
let dir = metal2vulkan_validation::ScratchDir::new("specialization-set-test").unwrap();
|
||||
let profile = engine::load_profile("vk12-floor").unwrap();
|
||||
let profile = engine::load_profile("runtime-floor").unwrap();
|
||||
let (mut result, l3) = attempt_input(
|
||||
input,
|
||||
dir.path(),
|
||||
|
||||
@@ -3079,6 +3079,7 @@ fn a_venue_profile_states_its_identity() {
|
||||
"VkPhysicalDeviceProperties": {
|
||||
"deviceName": "Toy GPU", "vendorID": 4098, "deviceID": 5567,
|
||||
"driverVersion": 109060100,
|
||||
"limits": {"maxPushConstantsSize": 256},
|
||||
},
|
||||
}},
|
||||
"driver": {"properties": {
|
||||
@@ -3572,13 +3573,13 @@ fn a_refused_restriction_is_a_device_refusal_of_its_restricted_slot_only() {
|
||||
use crate::check::admission::NotSupported;
|
||||
let refused = case(1, "restricted");
|
||||
let refusal = RefusalObservation {
|
||||
environment_id: engine_slot(RADV, Some("lunarg-desktop-baseline-2023"), Leg::Stated),
|
||||
environment_id: engine_slot(RADV, Some("runtime-floor"), Leg::Stated),
|
||||
..refusal_of(
|
||||
&refused,
|
||||
RADV,
|
||||
Leg::Stated,
|
||||
&NotSupported::Restriction {
|
||||
profile: "lunarg-desktop-baseline-2023".into(),
|
||||
profile: "runtime-floor".into(),
|
||||
gaps: vec![
|
||||
"limits.max_compute_work_group_invocations 1536 beyond the device's 1024"
|
||||
.into(),
|
||||
@@ -3621,7 +3622,7 @@ fn a_refused_restriction_is_a_device_refusal_of_its_restricted_slot_only() {
|
||||
assert!(report
|
||||
.slots
|
||||
.iter()
|
||||
.all(|slot| !slot.slot.contains("lunarg-desktop-baseline-2023")));
|
||||
.all(|slot| !slot.slot.contains("runtime-floor")));
|
||||
assert!(report.gap_proposals.is_empty() && report.device_gaps.is_empty());
|
||||
}
|
||||
|
||||
|
||||
@@ -2207,7 +2207,7 @@ fn public_framebuffer_fetch_cases_plan_input_attachments_without_an_ordered_form
|
||||
let root = metal2vulkan_devtools::validation_dir().join("corpus");
|
||||
let store = CorpusStore::new(&root);
|
||||
let sources = public_sources().unwrap();
|
||||
for stem in ["lunarg-desktop-baseline-2023", "vk12-floor"] {
|
||||
for stem in ["runtime-floor"] {
|
||||
let unordered = device(stem);
|
||||
let mut fetches = 0;
|
||||
for shard in 0..64 {
|
||||
@@ -2489,7 +2489,7 @@ fn public_fragment_imageblock_cases_plan_their_storage_image() {
|
||||
);
|
||||
planned += 1;
|
||||
}
|
||||
match plan_render(&device("swiftshader"), &render, libraries) {
|
||||
match plan_render(&device("runtime-floor"), &render, libraries) {
|
||||
Err(Error::Unsupported(refusal)) => {
|
||||
assert_eq!(refusal.feature, metal2vulkan::error::Feature::Imageblocks)
|
||||
}
|
||||
|
||||
@@ -59,19 +59,30 @@ enum Planned {
|
||||
}
|
||||
|
||||
/// Whether every alternative of `sets` needs some format's support, and `device`'s profile
|
||||
/// cannot sample one of the formats `case` binds a texture in.
|
||||
/// cannot use one of the formats `case` binds a texture in as `sets` names (or sample it).
|
||||
fn lacks_a_bound_format(device: &Device, case: &AuthoredCase, sets: &[Vec<Capability>]) -> bool {
|
||||
let sampled = BTreeSet::from([FormatUsage::SampledImage]);
|
||||
// The usages the refusal names (linear filtering, say), and sampling itself.
|
||||
let usages: BTreeSet<FormatUsage> = sets
|
||||
.iter()
|
||||
.flatten()
|
||||
.filter_map(|capability| match capability {
|
||||
Capability::Format { usage, .. } => Some(*usage),
|
||||
_ => None,
|
||||
})
|
||||
.chain([FormatUsage::SampledImage])
|
||||
.collect();
|
||||
sets.iter().all(|set| {
|
||||
set.iter()
|
||||
.any(|capability| matches!(capability, Capability::Format { .. }))
|
||||
}) && case.textures.iter().any(|texture| {
|
||||
vk_format(
|
||||
resources::pixel_format(texture.format),
|
||||
&sampled,
|
||||
device.profile(),
|
||||
)
|
||||
.is_err()
|
||||
usages.iter().any(|&usage| {
|
||||
vk_format(
|
||||
resources::pixel_format(texture.format),
|
||||
&BTreeSet::from([usage]),
|
||||
device.profile(),
|
||||
)
|
||||
.is_err()
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
@@ -163,8 +174,9 @@ fn plan_case(device: &Device, case: &AuthoredCase, row: &crate::source::SourceRo
|
||||
{
|
||||
return Planned::Refused;
|
||||
}
|
||||
// A texture of a format the profile cannot sample is refused typed as the device's gap
|
||||
// (`Feature::Format`, needing that format's support): the case's literal binds it, and no
|
||||
// A texture of a format the profile cannot sample, or filter as the case's sampler
|
||||
// does, is refused typed as the device's gap (`Feature::Format`, needing that format's
|
||||
// support): the case's literal binds it, and no
|
||||
// other mapping of the case changes it (the sRGB and packed formats).
|
||||
Err(BindError::Unsupported(Unsupported {
|
||||
feature: Feature::Format,
|
||||
@@ -232,7 +244,7 @@ fn plan_case(device: &Device, case: &AuthoredCase, row: &crate::source::SourceRo
|
||||
#[test]
|
||||
fn public_texture_cases_plan_their_compiled_variant_without_diagnostics() {
|
||||
let cases = public_cases();
|
||||
for stem in ["lavapipe", "moltenvk-m3", "swiftshader"] {
|
||||
for stem in ["lavapipe", "moltenvk-m3", "runtime-floor"] {
|
||||
let device = device(stem);
|
||||
let mut families = BTreeSet::new();
|
||||
let mut planned = 0;
|
||||
@@ -265,9 +277,9 @@ fn public_texture_cases_plan_their_compiled_variant_without_diagnostics() {
|
||||
families.contains("sampler") || families.contains("combined image sampler"),
|
||||
"{stem}: no sampler write"
|
||||
);
|
||||
// SwiftShader reads storage images only with a format: its storage cases compile with an
|
||||
// input and plan that variant.
|
||||
if stem == "swiftshader" {
|
||||
// The runtime floor reads storage images only with a format: its storage cases compile
|
||||
// with an input and plan that variant.
|
||||
if stem == "runtime-floor" {
|
||||
assert!(families.contains("pipeline variant"), "{stem}: no variant");
|
||||
}
|
||||
// A sparse case whose observed accesses each name their texels answers residency from
|
||||
@@ -361,18 +373,36 @@ fn public_texture_array_cases_plan_their_elements_at_their_slots() {
|
||||
let library = Library::from_air(&bitcode).unwrap();
|
||||
let mut function = FunctionDescriptor::new(library.function(&compute.entry).unwrap());
|
||||
function.constants = compute.constants.clone();
|
||||
for stem in ["lavapipe", "moltenvk-m3", "swiftshader"] {
|
||||
for stem in ["lavapipe", "moltenvk-m3", "runtime-floor"] {
|
||||
let device = device(stem);
|
||||
let shape = compute_shape(&compute, true, BufferRanges::default()).unwrap();
|
||||
let (pipeline, inputs) = variants::compile_compute_for_shape(
|
||||
let compiled = variants::compile_compute_for_shape(
|
||||
&device,
|
||||
&function,
|
||||
&shape,
|
||||
None,
|
||||
None,
|
||||
&Budget::standard(),
|
||||
)
|
||||
.unwrap_or_else(|error| panic!("{} {stem}: compile: {error:?}", case.name));
|
||||
);
|
||||
let sampled = device
|
||||
.profile()
|
||||
.limits()
|
||||
.max_per_stage_descriptor_sampled_images;
|
||||
let (pipeline, inputs) = match compiled {
|
||||
// More elements than the stage's sampled images (the runtime floor's 16): refused
|
||||
// typed, naming the limit.
|
||||
Err(error) if slots.len() > sampled as usize => {
|
||||
let text = format!("{error:?}");
|
||||
assert!(
|
||||
text.contains("MaxPerStageDescriptorSampledImages"),
|
||||
"{} {stem}: {text}",
|
||||
case.name
|
||||
);
|
||||
continue;
|
||||
}
|
||||
compiled => compiled
|
||||
.unwrap_or_else(|error| panic!("{} {stem}: compile: {error:?}", case.name)),
|
||||
};
|
||||
let plan = pipeline.plan(&device, &shape).unwrap();
|
||||
assert!(
|
||||
variants::compiled_for(&inputs, &plan.variant),
|
||||
@@ -558,7 +588,7 @@ fn the_public_stage_input_case_compiles_under_the_oracles_descriptor() {
|
||||
let library = Library::from_air(&bitcode).unwrap();
|
||||
let mut function = FunctionDescriptor::new(library.function(&compute.entry).unwrap());
|
||||
function.constants = compute.constants.clone();
|
||||
for stem in ["lavapipe", "moltenvk-m3", "swiftshader"] {
|
||||
for stem in ["lavapipe", "moltenvk-m3", "runtime-floor"] {
|
||||
let device = device(stem);
|
||||
let shape = compute_shape(&compute, true, BufferRanges::default()).unwrap();
|
||||
// Without the descriptor, the kernel asks for it.
|
||||
@@ -681,7 +711,7 @@ fn public_tile_cases_plan_their_attachments() {
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
assert!(!tiles.is_empty(), "no public tile case");
|
||||
for stem in ["lavapipe", "moltenvk-m3", "swiftshader"] {
|
||||
for stem in ["lavapipe", "moltenvk-m3", "runtime-floor"] {
|
||||
let device = device(stem);
|
||||
let mut planned = 0;
|
||||
for (case, row) in &tiles {
|
||||
|
||||
@@ -1611,7 +1611,7 @@ fn a_device_buffer_array_plans_as_the_functions_buffer_table() {
|
||||
for (stem, addressed) in [
|
||||
("lavapipe", true),
|
||||
("moltenvk-m3", true),
|
||||
("vk12-floor", false),
|
||||
("runtime-floor", false),
|
||||
] {
|
||||
let device = device(stem, DevicePolicy::default());
|
||||
let shape = compute_shape(&compute, addressed, BufferRanges::default()).unwrap();
|
||||
@@ -1696,7 +1696,7 @@ fn the_binder_plans_the_executors_state() {
|
||||
length: 4,
|
||||
},
|
||||
};
|
||||
for stem in ["lavapipe", "moltenvk-m3", "vk12-floor"] {
|
||||
for stem in ["lavapipe", "moltenvk-m3", "runtime-floor"] {
|
||||
let device = device(stem, DevicePolicy::default());
|
||||
let pipeline = compile(&device, &bitcode, "count");
|
||||
for address in [
|
||||
@@ -1753,24 +1753,20 @@ fn identity_is_per_profile_and_per_engine_slot() {
|
||||
fn a_restricted_row_has_its_own_engine_slot() {
|
||||
use crate::coverage::Leg;
|
||||
let native = engine_slot("ubuntu-26.04-lavapipe", None, Leg::Stated);
|
||||
let floor = engine_slot("ubuntu-26.04-lavapipe", Some("vk12-floor"), Leg::Stated);
|
||||
let baseline = engine_slot(
|
||||
"ubuntu-26.04-lavapipe",
|
||||
Some("lunarg-desktop-baseline-2023"),
|
||||
Leg::Stated,
|
||||
);
|
||||
let floor = engine_slot("ubuntu-26.04-lavapipe", Some("runtime-floor"), Leg::Stated);
|
||||
let baseline = engine_slot("ubuntu-26.04-lavapipe", Some("gate-lavapipe"), Leg::Stated);
|
||||
let off = engine_slot("ubuntu-26.04-lavapipe", None, Leg::RobustnessOff);
|
||||
let floor_off = engine_slot(
|
||||
"ubuntu-26.04-lavapipe",
|
||||
Some("vk12-floor"),
|
||||
Some("runtime-floor"),
|
||||
Leg::RobustnessOff,
|
||||
);
|
||||
assert_eq!(native, engine_environment_id("ubuntu-26.04-lavapipe"));
|
||||
assert_eq!(floor, "ubuntu-26.04-lavapipe@engine@vk12-floor");
|
||||
assert_eq!(floor, "ubuntu-26.04-lavapipe@engine@runtime-floor");
|
||||
assert_eq!(off, "ubuntu-26.04-lavapipe@engine+robustness-off");
|
||||
assert_eq!(
|
||||
floor_off,
|
||||
"ubuntu-26.04-lavapipe@engine@vk12-floor+robustness-off"
|
||||
"ubuntu-26.04-lavapipe@engine@runtime-floor+robustness-off"
|
||||
);
|
||||
let slots = [&native, &floor, &baseline, &off, &floor_off];
|
||||
for (index, slot) in slots.iter().enumerate() {
|
||||
|
||||
+1
-1
@@ -558,7 +558,7 @@ fn a_pipeline_state_whose_bytes_a_kernel_reads_never_reaches_a_comparison() {
|
||||
assert_eq!(&owner[8..], &[3, 0, 0, 0, 4, 0, 0, 0]);
|
||||
let library = Library::from_air(&bitcode).unwrap();
|
||||
let function = FunctionDescriptor::new(library.function(entry).unwrap());
|
||||
for stem in ["moltenvk-m3", "lavapipe", "vk12-floor"] {
|
||||
for stem in ["moltenvk-m3", "lavapipe", "runtime-floor"] {
|
||||
let device = device(stem, DevicePolicy::default());
|
||||
for addressed in [false, true] {
|
||||
let shape = compute_shape(&mapped, addressed, BufferRanges::default()).unwrap();
|
||||
|
||||
@@ -1165,7 +1165,7 @@ fn a_validated_instance_reports_every_repeated_message() {
|
||||
assert!(settings.is_empty());
|
||||
|
||||
// Restricted: the profiles layer below the validation layer, configured with the file.
|
||||
let restriction = ProfileRestriction::committed("vk12-floor").unwrap();
|
||||
let restriction = ProfileRestriction::committed("runtime-floor").unwrap();
|
||||
let hidden: BTreeSet<String> = ["VK_EXT_shader_viewport_index_layer".to_owned()].into();
|
||||
let restrict = ProfilesSettings::new(ProfilesLayer::Restrict(&restriction, &hidden)).unwrap();
|
||||
let (extensions, layers, settings) = with_instance_create_info(
|
||||
@@ -1212,7 +1212,7 @@ fn a_validated_instance_reports_every_repeated_message() {
|
||||
string,
|
||||
&[&restriction.file.to_string_lossy()]
|
||||
),
|
||||
profiles("profile_name", string, &["VP_M2V_vk12_floor"]),
|
||||
profiles("profile_name", string, &["VP_M2V_runtime_floor"]),
|
||||
profiles(
|
||||
"simulate_capabilities",
|
||||
string,
|
||||
|
||||
@@ -42,10 +42,6 @@ lavapipe device Stated b5ddddab0b92326e004341e0b1a7aeed2f25be4b5393307f774fa6cac
|
||||
lavapipe device RobustnessOff 471eaa27049a4cd4fe75fe4e917606a5753fe42af75a3c1a1b8825572e1bdf2b members=145 extensions=48
|
||||
lavapipe restricted Stated 168eef90c56417253a74b57842c325b9a55b68767714fe6ca254ac6af383f5ad members=147 extensions=29
|
||||
lavapipe restricted RobustnessOff 54aa0e4d607f622853b8e803795b79be0ea68702a512b7a85b73b659cdb55c7c members=143 extensions=29
|
||||
lunarg-desktop-baseline-2023 device Stated 825caf82dbbe0316e466c6cc23baffcdef5844139a8af05f5722227f4f60ac3c members=52 extensions=4
|
||||
lunarg-desktop-baseline-2023 device RobustnessOff d0ecb668ab43ce73a07b7daf16a212cd4a96a4da5b4bcbf874e2c662d0a4961f members=49 extensions=4
|
||||
lunarg-desktop-baseline-2023 restricted Stated 825caf82dbbe0316e466c6cc23baffcdef5844139a8af05f5722227f4f60ac3c members=52 extensions=4
|
||||
lunarg-desktop-baseline-2023 restricted RobustnessOff d0ecb668ab43ce73a07b7daf16a212cd4a96a4da5b4bcbf874e2c662d0a4961f members=49 extensions=4
|
||||
moltenvk-m3 device Stated fba1f14799f8de2f3fce11270bfe5acfe70a9181fba05b39b03ca584abb02353 members=110 extensions=35
|
||||
moltenvk-m3 device RobustnessOff 0c0bcc4fe361e6c079eb1f7fb909f5041de30f9487e7350be2aed9287311f5f8 members=107 extensions=35
|
||||
moltenvk-m3 restricted Stated 29f45720a234e7d9a6d6539d970e098623a37105073f268b6c3f7d4d5e654e1f members=108 extensions=15
|
||||
@@ -62,15 +58,7 @@ nvidia-rtx5080-laptop device Stated cbc227d09a278b641ac92963d31c69c73a5b377d9e64
|
||||
nvidia-rtx5080-laptop device RobustnessOff afb1da0a47e8135f64d0503e96d5b6704debc9afa2d6fcbe3a1a4ed685fb20bb members=148 extensions=50
|
||||
nvidia-rtx5080-laptop restricted Stated 0de75175778cf3738fef0e8311e2452598e707f4ca5b744b865c2ef6ed0452cd members=150 extensions=31
|
||||
nvidia-rtx5080-laptop restricted RobustnessOff 487bf984965a6572fdaa6d0de4013fdf8c5c52ba371e9d62cec9b8a0523fc5f1 members=146 extensions=31
|
||||
roadmap-2022 device Stated f48b79c1c1cad271b4d28c86ed33b4b13e27a57c82615c68cb67c414aa7ffcd7 members=36 extensions=0
|
||||
roadmap-2022 device RobustnessOff 0bc8d68f81264767ba268cf3f276d82e0e695410ddd1cc93c9ca320c46b137e7 members=35 extensions=0
|
||||
roadmap-2022 restricted Stated fb16ead2e3ac58c5cba2f78babc11edde10e14091bd31e6a1dfd04999c7ec8b0 members=44 extensions=0
|
||||
roadmap-2022 restricted RobustnessOff 74bd0f28b69a3405beb9deddc8e8dedb8c2c0b2df570c94888f23bec059b841f members=42 extensions=0
|
||||
swiftshader device Stated beed74eb5a8be047dc9e910ca670ed2772d3b882288d7d63dae319b174ab3273 members=62 extensions=19
|
||||
swiftshader device RobustnessOff cb22b9fd0a0deeaeb4eb1f1201342773542590decb948425f6986dc694176eea members=60 extensions=19
|
||||
swiftshader restricted Stated dd2c90281a877f27636bdbc64090d80837a9596d58e1b3245fe6bf61a3fe23da members=61 extensions=8
|
||||
swiftshader restricted RobustnessOff ee1126880194d879da5938731b632db0319d3fa333dd3096ea303e9458bbe9ab members=59 extensions=8
|
||||
vk12-floor device Stated 93a7b2d5387f6704d8d98ae664605e6968eefbe810ae6ce6f6c13b30813614f4 members=4 extensions=0
|
||||
vk12-floor device RobustnessOff f5b6ba47b302128b29868685308b2c311dd9a316da3abc899036c2015bf3bae0 members=3 extensions=0
|
||||
vk12-floor restricted Stated 93a7b2d5387f6704d8d98ae664605e6968eefbe810ae6ce6f6c13b30813614f4 members=4 extensions=0
|
||||
vk12-floor restricted RobustnessOff f5b6ba47b302128b29868685308b2c311dd9a316da3abc899036c2015bf3bae0 members=3 extensions=0
|
||||
runtime-floor device Stated b3a341cfb29eb34cea2557ae829a4fbcd82d6fa18621297d8b7a83318dedd131 members=40 extensions=1
|
||||
runtime-floor device RobustnessOff 1f5024dfab9259f34208600c6fa736dfee13601f5af28162922611396512b109 members=38 extensions=1
|
||||
runtime-floor restricted Stated d92953f19692e198110a9e041973e07fbb594f9c271871127544cfb934ab976b members=48 extensions=1
|
||||
runtime-floor restricted RobustnessOff 5be81e6b7a1b2ebf254781c6a179fbcb1e1b9af3412371ec515a5e5243a8cd57 members=45 extensions=1
|
||||
@@ -605,8 +605,13 @@ fn the_stated_leg_enables_what_the_description_states_or_names_it_unmet() {
|
||||
]
|
||||
.into()
|
||||
);
|
||||
let floor = leg_of("vk12-floor", None);
|
||||
assert_eq!(robustness(&floor), [F::RobustBufferAccess].into());
|
||||
// The runtime floor read at API 1.2: `robustImageAccess` is core from 1.3 and the floor lists
|
||||
// no `VK_EXT_image_robustness`, so only `robustImageAccess2` serves images.
|
||||
let floor = leg_of("runtime-floor", None);
|
||||
assert_eq!(
|
||||
robustness(&floor),
|
||||
[F::RobustBufferAccess, F::RobustImageAccess2].into()
|
||||
);
|
||||
|
||||
let unmet = leg_of("lavapipe", Some(F::RobustImageAccess));
|
||||
assert_eq!(unmet.unmet_robustness, [F::RobustImageAccess].into());
|
||||
@@ -659,7 +664,7 @@ fn the_new_list_enables_extended_dynamic_state_where_the_device_lists_it() {
|
||||
"{stem}"
|
||||
);
|
||||
}
|
||||
let (description, enables) = lists("vk12-floor");
|
||||
let (description, enables) = lists("runtime-floor");
|
||||
assert!(!description.has(F::ExtendedDynamicState));
|
||||
assert!(!enabled_set(&enables)
|
||||
.features
|
||||
@@ -719,7 +724,7 @@ fn the_new_list_enables_extended_dynamic_state2_where_the_device_lists_it() {
|
||||
"{stem}"
|
||||
);
|
||||
}
|
||||
let (description, enables) = lists("vk12-floor");
|
||||
let (description, enables) = lists("runtime-floor");
|
||||
assert!(!description.has(F::ExtendedDynamicState2));
|
||||
assert!(!enabled_set(&enables)
|
||||
.features
|
||||
@@ -729,9 +734,10 @@ fn the_new_list_enables_extended_dynamic_state2_where_the_device_lists_it() {
|
||||
/// On every committed profile (as a context's API-1.2 query reads it), the new list in the stated
|
||||
/// robustness leg (which enables the robustness features the description states) is a set the
|
||||
/// device can create: `with_enabled` accepts it, so it keeps
|
||||
/// VUID-VkDeviceCreateInfo-robustBufferAccess-10247. On SwiftShader,
|
||||
/// whose profile states `robustBufferAccessUpdateAfterBind` false, the recommendation left out
|
||||
/// the buffer update-after-bind features, so `robustBufferAccess` can be enabled.
|
||||
/// VUID-VkDeviceCreateInfo-robustBufferAccess-10247: where a profile states
|
||||
/// `robustBufferAccessUpdateAfterBind` false, the list leaves out the buffer update-after-bind
|
||||
/// features, so `robustBufferAccess` can be enabled. The runtime's floor states it false and has
|
||||
/// none of those features; the product's `a_recommendation_keeps_vuid_10247` adds them to it.
|
||||
#[test]
|
||||
fn the_new_list_with_the_stated_robustness_keeps_the_co_enable_rules() {
|
||||
// The features of VUID-VkDeviceCreateInfo-robustBufferAccess-10247 the vocabulary names (its
|
||||
@@ -741,7 +747,6 @@ fn the_new_list_with_the_stated_robustness_keeps_the_co_enable_rules() {
|
||||
F::DescriptorBindingUniformTexelBufferUpdateAfterBind,
|
||||
F::DescriptorBindingStorageTexelBufferUpdateAfterBind,
|
||||
];
|
||||
let mut held = Vec::new();
|
||||
for stem in committed_profiles().unwrap() {
|
||||
let description = at_1_2(load_description(&stem).unwrap());
|
||||
let (supported, available) = modelled(&stem, &description, ApiVersion::V1_2);
|
||||
@@ -762,26 +767,12 @@ fn the_new_list_with_the_stated_robustness_keeps_the_co_enable_rules() {
|
||||
.all(|feature| !set.features.contains(feature)),
|
||||
"{stem}"
|
||||
);
|
||||
if BUFFER_UPDATE_AFTER_BIND
|
||||
.iter()
|
||||
.any(|&feature| description.has(feature))
|
||||
{
|
||||
held.push(stem.clone());
|
||||
}
|
||||
}
|
||||
let opened = opened_description(description.clone(), &set)
|
||||
.unwrap_or_else(|error| panic!("{stem}: {error}"));
|
||||
Device::from_queries(opened, DevicePolicy::default())
|
||||
.unwrap_or_else(|error| panic!("{stem}: {error}"));
|
||||
}
|
||||
assert_eq!(
|
||||
held,
|
||||
[
|
||||
"lunarg-desktop-baseline-2023",
|
||||
"roadmap-2022",
|
||||
"swiftshader"
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
/// A description and a device's own lists that disagree open no context: a recommended feature
|
||||
@@ -1233,11 +1224,10 @@ fn a_structure_is_core_from_the_version_the_product_reads_it_core() {
|
||||
/// version its engine list is the product's recommendation less the excluded features, the
|
||||
/// one closed set `with_enabled` accepts and `Device::from_queries` derives from, as at 1.2
|
||||
/// ([`the_new_list_enables_the_recommendation_but_the_excluded`]), and no structure core at the
|
||||
/// version is chained through its extension. The profiles at Vulkan 1.2 run at 1.2.
|
||||
/// version is chained through its extension.
|
||||
#[test]
|
||||
fn a_restricted_context_enables_the_recommendation_at_its_profiles_version() {
|
||||
use super::super::profiles::ProfileRestriction;
|
||||
let mut at_1_2 = Vec::new();
|
||||
for stem in committed_profiles().unwrap() {
|
||||
let restriction = ProfileRestriction::committed(&stem).unwrap();
|
||||
let version = restriction.context_version();
|
||||
@@ -1246,9 +1236,6 @@ fn a_restricted_context_enables_the_recommendation_at_its_profiles_version() {
|
||||
restriction.description.api_version.max(ApiVersion::V1_2),
|
||||
"{stem}"
|
||||
);
|
||||
if version == ApiVersion::V1_2 {
|
||||
at_1_2.push(stem.clone());
|
||||
}
|
||||
let description = restriction.read_at(version);
|
||||
let (supported, available) = modelled(&stem, &description, version);
|
||||
for leg in [Leg::Stated, Leg::RobustnessOff] {
|
||||
@@ -1284,7 +1271,6 @@ fn a_restricted_context_enables_the_recommendation_at_its_profiles_version() {
|
||||
}
|
||||
}
|
||||
}
|
||||
assert_eq!(at_1_2, ["lunarg-desktop-baseline-2023", "vk12-floor"]);
|
||||
}
|
||||
|
||||
/// A fake Vulkan instance for the cross-check of the executor's feature structures against the
|
||||
|
||||
@@ -203,9 +203,8 @@ impl ProfileRestriction {
|
||||
/// read at it ([`check_within`], [`check_restricted`]), and the context's feature chain links
|
||||
/// what is core at it (`enables::Available::at`), so the context translates for the profile the
|
||||
/// product reads, which reads a profile at its own version: read at an earlier one, a Vulkan
|
||||
/// 1.3 document drops each feature and member only that version's core states (`roadmap-2022`
|
||||
/// moves its translation key and ten golden cells). A profile at Vulkan 1.2 runs at 1.2, as
|
||||
/// every restricted context did before.
|
||||
/// 1.3 document drops each feature and member only that version's core states. A profile at
|
||||
/// Vulkan 1.2 runs at 1.2.
|
||||
pub fn context_version(&self) -> ApiVersion {
|
||||
self.description.api_version.max(ApiVersion::V1_2)
|
||||
}
|
||||
@@ -218,11 +217,8 @@ impl ProfileRestriction {
|
||||
/// ([`ProfileRestriction::requirements_only`]) states only what its profile requires: the
|
||||
/// product reads a member it omits as its version's guarantee, or as none, and a feature its
|
||||
/// version requires as present, while the layer reports the device's own value for an omitted
|
||||
/// member (of a structure the context queries) and an omitted feature as absent. Under
|
||||
/// `lunarg-desktop-baseline-2023` as extracted, the RTX 5080's context
|
||||
/// found `shaderSubgroupExtendedTypes` absent and the five `VK_EXT_subgroup_size_control` and
|
||||
/// `VK_EXT_vertex_attribute_divisor` properties the document lists the extensions of but does
|
||||
/// not state at the device's values. Its regeneration now states every such member
|
||||
/// member (of a structure the context queries) and an omitted feature as absent. Its
|
||||
/// regeneration states every such member
|
||||
/// ([`ProfileRestriction::completed_for_layer`]), at the profile's own version, which the
|
||||
/// context runs at ([`ProfileRestriction::context_version`]); one that does not is refused.
|
||||
pub fn presentation_gap(&self) -> Option<String> {
|
||||
|
||||
@@ -5,7 +5,6 @@ use crate::engine::{committed_profiles, load_description};
|
||||
use metal2vulkan::device::{FormatProperties, FormatSupport};
|
||||
use metal2vulkan::device::{VkExtension, VkFeature};
|
||||
use metal2vulkan::vk;
|
||||
use std::collections::BTreeMap;
|
||||
|
||||
/// What a context restricted to committed profile `stem` refuses of a device described by
|
||||
/// `device` before it reads the device through the layer: the profile's presentation gap, else
|
||||
@@ -48,19 +47,19 @@ fn every_committed_profile_is_a_restriction() {
|
||||
}
|
||||
let unknown = ProfileRestriction::committed("no-such-profile").unwrap_err();
|
||||
assert!(unknown.contains("committed profiles: "), "{unknown}");
|
||||
assert!(unknown.contains("vk12-floor"), "{unknown}");
|
||||
assert!(unknown.contains("runtime-floor"), "{unknown}");
|
||||
assert!(restrict_devices_to("no-such-profile").is_err());
|
||||
}
|
||||
|
||||
/// The layer lists every extension promoted to core at or below P's version; the context hides
|
||||
/// the ones P does not list. `swiftshader` (1.3) does not list
|
||||
/// `VK_EXT_texture_compression_astc_hdr` (promoted in 1.3), which SwiftShader lacks. It lists
|
||||
/// the ones P does not list. `intel-arl-anv` (1.4) does not list
|
||||
/// `VK_EXT_texture_compression_astc_hdr` (promoted in 1.3), which the device lacks. It lists
|
||||
/// `VK_KHR_format_feature_flags2` but, a gpuinfo report without them, states no
|
||||
/// `VkFormatProperties3`, so that is hidden too. A `vulkaninfo` capture with its supplement
|
||||
/// (`gate-lavapipe`) states them, and keeps the extension.
|
||||
#[test]
|
||||
fn the_extensions_a_profile_does_not_list_or_describe_are_hidden() {
|
||||
let restriction = ProfileRestriction::committed("swiftshader").unwrap();
|
||||
let restriction = ProfileRestriction::committed("intel-arl-anv").unwrap();
|
||||
for listed in ["VK_EXT_image_robustness", FORMAT_FEATURE_FLAGS2] {
|
||||
assert!(restriction.extension_names.contains(listed), "{listed}");
|
||||
}
|
||||
@@ -121,20 +120,23 @@ fn every_committed_profile_is_within_itself() {
|
||||
}
|
||||
|
||||
/// A profile that states features a device lacks is named member by member: the floor with four
|
||||
/// optional features SwiftShader lacks (`shaderInt16`, 8- and 16-bit storage access, and formatless
|
||||
/// storage-image reads) names each of them on SwiftShader.
|
||||
/// optional features it lacks (geometry shaders, 64-bit floats, 64-bit buffer atomics, and
|
||||
/// formatless storage-image reads) names each of them on the floor.
|
||||
#[test]
|
||||
fn a_profile_beyond_the_device_is_named_member_by_member() {
|
||||
let lacked = [
|
||||
VkFeature::ShaderInt16,
|
||||
VkFeature::StorageBuffer8BitAccess,
|
||||
VkFeature::StorageBuffer16BitAccess,
|
||||
VkFeature::GeometryShader,
|
||||
VkFeature::ShaderFloat64,
|
||||
VkFeature::ShaderBufferInt64Atomics,
|
||||
VkFeature::ShaderStorageImageReadWithoutFormat,
|
||||
];
|
||||
let mut beyond = read_at(&committed("vk12-floor"), AT_1_2);
|
||||
let floor = read_at(&committed("runtime-floor"), AT_1_2);
|
||||
for feature in lacked {
|
||||
assert!(!floor.features.contains(&feature), "{feature:?}");
|
||||
}
|
||||
let mut beyond = floor.clone();
|
||||
beyond.features.extend(lacked);
|
||||
let swiftshader = read_at(&committed("swiftshader"), AT_1_2);
|
||||
let gaps = exceeds(&beyond, &swiftshader);
|
||||
let gaps = exceeds(&beyond, &floor);
|
||||
for feature in lacked {
|
||||
assert!(
|
||||
gaps.contains(&format!("feature {feature:?}")),
|
||||
@@ -142,7 +144,6 @@ fn a_profile_beyond_the_device_is_named_member_by_member() {
|
||||
);
|
||||
}
|
||||
// The committed x86 lavapipe has more than the floor; the reverse does not hold.
|
||||
let floor = read_at(&committed("vk12-floor"), AT_1_2);
|
||||
let lavapipe = read_at(&committed("lavapipe"), AT_1_2);
|
||||
assert!(exceeds(&floor, &lavapipe).is_empty());
|
||||
assert!(!exceeds(&lavapipe, &floor).is_empty());
|
||||
@@ -152,7 +153,7 @@ fn a_profile_beyond_the_device_is_named_member_by_member() {
|
||||
/// reads no storage image without its format, takes it as the other Linux venue captures do.
|
||||
#[test]
|
||||
fn every_device_capture_takes_the_floor() {
|
||||
let floor = read_at(&committed("vk12-floor"), AT_1_2);
|
||||
let floor = read_at(&committed("runtime-floor"), AT_1_2);
|
||||
for stem in [
|
||||
"intel-irisxe-rplp-anv",
|
||||
"intel-uhd770-rpls-anv",
|
||||
@@ -327,12 +328,12 @@ fn differences_name_each_member_with_both_values() {
|
||||
/// the listed extensions.
|
||||
#[test]
|
||||
fn a_later_profile_is_read_at_the_instance_version() {
|
||||
let roadmap = committed("roadmap-2022");
|
||||
assert!(roadmap.api_version > AT_1_2);
|
||||
let read = read_at(&roadmap, AT_1_2);
|
||||
let floor = committed("runtime-floor");
|
||||
assert!(floor.api_version > AT_1_2);
|
||||
let read = read_at(&floor, AT_1_2);
|
||||
assert_eq!(read.api_version, AT_1_2);
|
||||
assert!(read.features.is_subset(&roadmap.features));
|
||||
assert!(read.features.len() < roadmap.features.len());
|
||||
assert!(read.features.is_subset(&floor.features));
|
||||
assert!(read.features.len() < floor.features.len());
|
||||
for feature in &read.features {
|
||||
assert!(
|
||||
feature.exposure().exposed(AT_1_2, &read.extensions),
|
||||
@@ -343,19 +344,15 @@ fn a_later_profile_is_read_at_the_instance_version() {
|
||||
for format in read.formats.formats.keys() {
|
||||
assert!(queried.contains(format), "{format:?}");
|
||||
}
|
||||
// A 1.2 profile reads as itself, less the formats the product never asks about: the floor
|
||||
// states the scaled vertex formats, which no Metal format maps to.
|
||||
let floor = committed("vk12-floor");
|
||||
let read = read_at(&floor, AT_1_2);
|
||||
assert_eq!(read.features, floor.features);
|
||||
assert_eq!(read.limits, floor.limits);
|
||||
// Less the formats the product never asks about: the floor states the scaled vertex formats,
|
||||
// which no Metal format maps to.
|
||||
assert!(read.formats.formats.len() < floor.formats.formats.len());
|
||||
assert!(!read.formats.formats.contains_key(&vk::Format::R8_USCALED));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_restricted_context_runs_only_on_a_device_that_has_and_reports_its_profile() {
|
||||
let restriction = ProfileRestriction::committed("vk12-floor").unwrap();
|
||||
let restriction = ProfileRestriction::committed("runtime-floor").unwrap();
|
||||
let native = read_at(&committed("gate-lavapipe"), AT_1_2);
|
||||
let tools = [tool(c"VK_LAYER_KHRONOS_validation"), tool(PROFILES_LAYER)];
|
||||
// What the layer reports: the profile as read at 1.2, with the members it keeps (the
|
||||
@@ -412,7 +409,7 @@ fn a_restricted_context_runs_only_on_a_device_that_has_and_reports_its_profile()
|
||||
));
|
||||
// SwiftShader takes the floor (Vulkan 1.2's required features and minimum limits); a device
|
||||
// short of one of its limits does not.
|
||||
let swiftshader = read_at(&committed("swiftshader"), AT_1_2);
|
||||
let swiftshader = read_at(&committed("runtime-floor"), AT_1_2);
|
||||
assert_eq!(check_within(&restriction, &swiftshader, AT_1_2), Ok(()));
|
||||
let mut short = swiftshader;
|
||||
short.limits.max_bound_descriptor_sets = 3;
|
||||
@@ -718,534 +715,3 @@ fn the_intel_venue_allows_the_rplp_alone_and_stops_the_rpls() {
|
||||
// Its key is the venue's, so its host's allocation size is unread, not a stop.
|
||||
assert_eq!(check.unread, described, "{check:?}");
|
||||
}
|
||||
/// The restricted context requires the description it queries through the layer to be the profile
|
||||
/// as the product reads it, so every member the product reads must come from the file. A
|
||||
/// requirements document omits what its profile does not require; the layer then reports the
|
||||
/// device's own value for a member it omits (of a structure the context queries) and a feature it
|
||||
/// omits as absent, where the product reads the version's guarantee (or none) and a feature the
|
||||
/// version requires as present. Our probe ran the RTX 5080 restricted to
|
||||
/// `lunarg-desktop-baseline-2023` as extracted (none of its stated members beyond the device): the
|
||||
/// context refused all four runs, in exactly these six members. The document lists
|
||||
/// `VK_EXT_subgroup_size_control` and `VK_EXT_vertex_attribute_divisor` but states none of their
|
||||
/// properties, and omits `shaderSubgroupExtendedTypes`, which Vulkan 1.2 requires. Three of the six
|
||||
/// move the translation key, so no narrower comparison would let the run proceed. Its regeneration
|
||||
/// now states them ([`a_completed_requirements_document_reads_as_before`]), and the product's
|
||||
/// reading, which this reconstruction compares against, is unchanged.
|
||||
#[test]
|
||||
fn the_layer_reports_the_device_value_of_a_member_a_requirements_document_omits() {
|
||||
let restriction = ProfileRestriction::committed("lunarg-desktop-baseline-2023").unwrap();
|
||||
let native = read_at(&committed("nvidia-rtx5080-laptop"), AT_1_2);
|
||||
assert_eq!(check_within(&restriction, &native, AT_1_2), Ok(()));
|
||||
let profile = restriction.read_at(AT_1_2);
|
||||
assert!(profile.has(VkFeature::ShaderSubgroupExtendedTypes));
|
||||
// What the layer reported on the RTX 5080: the profile, but for the device's identity and
|
||||
// kept members, the omitted feature absent, and the omitted properties the device's.
|
||||
let mut queried = profile.clone();
|
||||
queried.driver_id = native.driver_id;
|
||||
queried.driver_version = native.driver_version;
|
||||
queried.vendor_id = native.vendor_id;
|
||||
queried.device_id = native.device_id;
|
||||
queried.device_name.clone_from(&native.device_name);
|
||||
queried.device_type = native.device_type;
|
||||
queried.float_controls.denorm_independence = native.float_controls.denorm_independence;
|
||||
queried.float_controls.rounding_independence = native.float_controls.rounding_independence;
|
||||
queried.rgba4_opaque_black_swizzled = native.rgba4_opaque_black_swizzled;
|
||||
queried
|
||||
.features
|
||||
.remove(&VkFeature::ShaderSubgroupExtendedTypes);
|
||||
queried.limits.max_vertex_attrib_divisor = native.limits.max_vertex_attrib_divisor;
|
||||
queried.subgroup.min_size = native.subgroup.min_size;
|
||||
queried.subgroup.max_size = native.subgroup.max_size;
|
||||
queried.subgroup.max_compute_workgroup_subgroups =
|
||||
native.subgroup.max_compute_workgroup_subgroups;
|
||||
queried.subgroup.required_size_stages = native.subgroup.required_size_stages;
|
||||
let tools = [tool(c"VK_LAYER_KHRONOS_validation"), tool(PROFILES_LAYER)];
|
||||
let Err(RestrictionError::Mismatch { fields, .. }) =
|
||||
check_restricted(&restriction, &native, &tools, &queried, AT_1_2)
|
||||
else {
|
||||
panic!("the RTX 5080 reported lunarg-desktop-baseline-2023 as the product reads it");
|
||||
};
|
||||
let reported = fields.iter().map(ToString::to_string).collect::<Vec<_>>();
|
||||
assert_eq!(
|
||||
reported,
|
||||
[
|
||||
"features.ShaderSubgroupExtendedTypes: expected listed, queried absent",
|
||||
"limits.max_vertex_attrib_divisor: expected 0, queried 4294967295",
|
||||
"subgroup.max_compute_workgroup_subgroups: expected 0, queried 32",
|
||||
"subgroup.max_size: expected 0, queried 32",
|
||||
"subgroup.min_size: expected 0, queried 32",
|
||||
"subgroup.required_size_stages: expected 0, queried 16383",
|
||||
]
|
||||
);
|
||||
// Each of the first three alone moves the translation key; the size-control range does not,
|
||||
// since the profile does not enable subgroup size control.
|
||||
let key =
|
||||
|description: &DeviceDescription| crate::c3::VenueProfile::key_of(description).unwrap();
|
||||
let moves = |edit: &dyn Fn(&mut DeviceDescription)| {
|
||||
let mut one = profile.clone();
|
||||
edit(&mut one);
|
||||
key(&one) != key(&profile)
|
||||
};
|
||||
assert!(moves(&|d| {
|
||||
d.features.remove(&VkFeature::ShaderSubgroupExtendedTypes);
|
||||
}));
|
||||
assert!(moves(&|d| d.limits.max_vertex_attrib_divisor = 4294967295));
|
||||
assert!(moves(&|d| d.subgroup.max_compute_workgroup_subgroups = 32));
|
||||
assert!(!moves(&|d| {
|
||||
d.subgroup.min_size = 32;
|
||||
d.subgroup.max_size = 32;
|
||||
d.subgroup.required_size_stages = vk::ShaderStageFlags::from_raw(16383);
|
||||
}));
|
||||
}
|
||||
|
||||
/// `scripts/regen-device-profiles` completes `lunarg-desktop-baseline-2023` for the layer
|
||||
/// (`m2v_layer_presentation`): it states the feature its version requires and the five properties
|
||||
/// the product reads of the extensions it lists, at the values the product reads, so the layer
|
||||
/// reports the profile as the product reads it on any device. The block changes nothing the product
|
||||
/// reads: without it the profile reads the same, with the same translation key, so every
|
||||
/// translation for it, golden, and census cell stays as it was.
|
||||
#[test]
|
||||
fn a_completed_requirements_document_reads_as_before() {
|
||||
let mut completed = Vec::new();
|
||||
for stem in committed_profiles().unwrap() {
|
||||
let restriction = ProfileRestriction::committed(&stem).unwrap();
|
||||
if !restriction.completed_for_layer {
|
||||
continue;
|
||||
}
|
||||
completed.push(stem.clone());
|
||||
assert!(restriction.requirements_only, "{stem}");
|
||||
// Presentable at its own version, which the context runs at (`roadmap-2022` at 1.3).
|
||||
assert_eq!(restriction.presentation_gap(), None, "{stem}");
|
||||
let text = std::fs::read_to_string(&restriction.file).unwrap();
|
||||
let mut document: Value = serde_json::from_str(&text).unwrap();
|
||||
let block = document["capabilities"][LAYER_PRESENTATION_BLOCK].clone();
|
||||
document["capabilities"]
|
||||
.as_object_mut()
|
||||
.unwrap()
|
||||
.remove(LAYER_PRESENTATION_BLOCK);
|
||||
document["profiles"][&restriction.profile_name]["capabilities"]
|
||||
.as_array_mut()
|
||||
.unwrap()
|
||||
.retain(|name| name.as_str() != Some(LAYER_PRESENTATION_BLOCK));
|
||||
let without = DeviceDescription::from_khronos_json(
|
||||
&document.to_string(),
|
||||
Some(&restriction.profile_name),
|
||||
)
|
||||
.unwrap();
|
||||
assert_eq!(without, restriction.description, "{stem}");
|
||||
assert_eq!(
|
||||
crate::c3::VenueProfile::key_of(&without).unwrap(),
|
||||
crate::c3::VenueProfile::key_of(&restriction.description).unwrap(),
|
||||
"{stem}"
|
||||
);
|
||||
if stem == "lunarg-desktop-baseline-2023" {
|
||||
assert_eq!(
|
||||
block,
|
||||
serde_json::json!({
|
||||
"features": {
|
||||
"VkPhysicalDeviceVulkan12Features": {
|
||||
"subgroupBroadcastDynamicId": true,
|
||||
"shaderSubgroupExtendedTypes": true
|
||||
}
|
||||
},
|
||||
"properties": {
|
||||
"VkPhysicalDeviceSubgroupSizeControlPropertiesEXT": {
|
||||
"minSubgroupSize": 0,
|
||||
"maxSubgroupSize": 0,
|
||||
"maxComputeWorkgroupSubgroups": 0,
|
||||
"requiredSubgroupSizeStages": []
|
||||
},
|
||||
"VkPhysicalDeviceVertexAttributeDivisorPropertiesEXT": {
|
||||
"maxVertexAttribDivisor": 0
|
||||
}
|
||||
}
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
assert_eq!(completed, ["lunarg-desktop-baseline-2023", "roadmap-2022"]);
|
||||
}
|
||||
|
||||
/// `ProfileRestriction` `stem` as its regeneration would have written it without its
|
||||
/// `m2v_layer_presentation` block (a requirements document as extracted).
|
||||
fn without_block(stem: &str) -> ProfileRestriction {
|
||||
let restriction = ProfileRestriction::committed(stem).unwrap();
|
||||
let text = std::fs::read_to_string(&restriction.file).unwrap();
|
||||
let mut document: Value = serde_json::from_str(&text).unwrap();
|
||||
document["capabilities"]
|
||||
.as_object_mut()
|
||||
.unwrap()
|
||||
.remove(LAYER_PRESENTATION_BLOCK);
|
||||
document["profiles"][&restriction.profile_name]["capabilities"]
|
||||
.as_array_mut()
|
||||
.unwrap()
|
||||
.retain(|name| name.as_str() != Some(LAYER_PRESENTATION_BLOCK));
|
||||
ProfileRestriction::of_document(
|
||||
stem,
|
||||
restriction.file.clone(),
|
||||
document.to_string().as_bytes(),
|
||||
)
|
||||
.unwrap()
|
||||
}
|
||||
|
||||
/// The core device-property structures a venue capture states, by the minor version that made
|
||||
/// each core: a context at that version or later queries it.
|
||||
fn core_minor(structure: &str) -> Option<u32> {
|
||||
match structure {
|
||||
"VkPhysicalDeviceProperties" => Some(0),
|
||||
"VkPhysicalDeviceVulkan11Properties" => Some(1),
|
||||
"VkPhysicalDeviceVulkan12Properties" => Some(2),
|
||||
"VkPhysicalDeviceVulkan13Properties" => Some(3),
|
||||
"VkPhysicalDeviceVulkan14Properties" => Some(4),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
/// The members the product reads (`src/device/khronos.rs`) of each extension's device-property
|
||||
/// structure: a context queries them where the profile lists the extension.
|
||||
const EXTENSION_MEMBERS: [(&str, &[&str]); 8] = [
|
||||
(
|
||||
"VK_EXT_subgroup_size_control",
|
||||
&[
|
||||
"minSubgroupSize",
|
||||
"maxSubgroupSize",
|
||||
"maxComputeWorkgroupSubgroups",
|
||||
"requiredSubgroupSizeStages",
|
||||
],
|
||||
),
|
||||
(
|
||||
"VK_EXT_vertex_attribute_divisor",
|
||||
&["maxVertexAttribDivisor"],
|
||||
),
|
||||
(
|
||||
"VK_KHR_vertex_attribute_divisor",
|
||||
&["maxVertexAttribDivisor", "supportsNonZeroFirstInstance"],
|
||||
),
|
||||
("VK_KHR_maintenance4", &["maxBufferSize"]),
|
||||
("VK_KHR_push_descriptor", &["maxPushDescriptors"]),
|
||||
(
|
||||
"VK_KHR_portability_subset",
|
||||
&["minVertexInputBindingStrideAlignment"],
|
||||
),
|
||||
(
|
||||
"VK_KHR_acceleration_structure",
|
||||
&[
|
||||
"maxPerStageDescriptorAccelerationStructures",
|
||||
"maxDescriptorSetAccelerationStructures",
|
||||
],
|
||||
),
|
||||
(
|
||||
"VK_EXT_device_generated_commands",
|
||||
&[
|
||||
"maxIndirectPipelineCount",
|
||||
"maxIndirectSequenceCount",
|
||||
"maxIndirectCommandsTokenCount",
|
||||
"maxIndirectCommandsTokenOffset",
|
||||
"maxIndirectCommandsIndirectStride",
|
||||
"supportedIndirectCommandsShaderStages",
|
||||
"supportedIndirectCommandsShaderStagesPipelineBinding",
|
||||
],
|
||||
),
|
||||
];
|
||||
|
||||
/// The capability blocks the one profile of `document` lists.
|
||||
fn profile_blocks(document: &Value) -> Vec<&Value> {
|
||||
let profile = document["profiles"]
|
||||
.as_object()
|
||||
.unwrap()
|
||||
.values()
|
||||
.next()
|
||||
.unwrap();
|
||||
profile["capabilities"]
|
||||
.as_array()
|
||||
.unwrap()
|
||||
.iter()
|
||||
.map(|name| &document["capabilities"][name.as_str().unwrap()])
|
||||
.collect()
|
||||
}
|
||||
|
||||
/// What `VK_LAYER_KHRONOS_profiles` reports, as a document the product reads, when it restricts
|
||||
/// the device a venue's `capture` (which states its device's every member) describes to the
|
||||
/// profile `restriction`, for a context at Vulkan 1.`minor`: the profile's version, extensions,
|
||||
/// and every member it states; each format at the last entry the profile's blocks state of it;
|
||||
/// each feature it omits as absent (the layer's
|
||||
/// `DEFAULT_FEATURE_VALUES_FALSE`); and the device's own value of each property it omits of a
|
||||
/// structure the context queries (a core one of the context's version or earlier, or the
|
||||
/// structure of an extension it lists), including the device's identity.
|
||||
fn layer_report(restriction: &ProfileRestriction, capture: &Value, minor: u32) -> String {
|
||||
let text = std::fs::read_to_string(&restriction.file).unwrap();
|
||||
let mut document: Value = serde_json::from_str(&text).unwrap();
|
||||
if !restriction.completed_for_layer {
|
||||
// `without_block`'s document: the file less the block.
|
||||
document["capabilities"]
|
||||
.as_object_mut()
|
||||
.unwrap()
|
||||
.remove(LAYER_PRESENTATION_BLOCK);
|
||||
document["profiles"][&restriction.profile_name]["capabilities"]
|
||||
.as_array_mut()
|
||||
.unwrap()
|
||||
.retain(|name| name.as_str() != Some(LAYER_PRESENTATION_BLOCK));
|
||||
}
|
||||
let mut features = BTreeSet::new();
|
||||
let mut properties = BTreeSet::new();
|
||||
for block in profile_blocks(&document) {
|
||||
for members in block["features"]
|
||||
.as_object()
|
||||
.into_iter()
|
||||
.flat_map(|s| s.values())
|
||||
{
|
||||
features.extend(members.as_object().unwrap().keys().cloned());
|
||||
}
|
||||
for members in block["properties"]
|
||||
.as_object()
|
||||
.into_iter()
|
||||
.flat_map(|s| s.values())
|
||||
{
|
||||
for (member, value) in members.as_object().unwrap() {
|
||||
match (member.as_str(), value.as_object()) {
|
||||
("limits", Some(limits)) => properties.extend(limits.keys().cloned()),
|
||||
_ => {
|
||||
properties.insert(member.clone());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
let read_by_extension: BTreeSet<&str> = EXTENSION_MEMBERS
|
||||
.iter()
|
||||
.filter(|(extension, _)| restriction.extension_names.contains(*extension))
|
||||
.flat_map(|(_, members)| members.iter().copied())
|
||||
.collect();
|
||||
let mut device = serde_json::Map::new();
|
||||
let (mut omitted_features, mut omitted_properties) =
|
||||
(serde_json::Map::new(), serde_json::Map::new());
|
||||
for block in profile_blocks(capture) {
|
||||
for (structure, members) in block["features"].as_object().into_iter().flatten() {
|
||||
for member in members.as_object().unwrap().keys() {
|
||||
if !features.contains(member) {
|
||||
omitted_features
|
||||
.entry(structure.clone())
|
||||
.or_insert_with(|| Value::Object(serde_json::Map::new()))[member] =
|
||||
Value::Bool(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (structure, members) in block["properties"].as_object().into_iter().flatten() {
|
||||
let core = core_minor(structure).is_some_and(|core| core <= minor);
|
||||
for (member, value) in members.as_object().unwrap() {
|
||||
let entry = omitted_properties
|
||||
.entry(structure.clone())
|
||||
.or_insert_with(|| Value::Object(serde_json::Map::new()));
|
||||
if let ("limits", Some(limits)) = (member.as_str(), value.as_object()) {
|
||||
for (limit, value) in limits {
|
||||
if core && !properties.contains(limit) {
|
||||
let nested = entry
|
||||
.as_object_mut()
|
||||
.unwrap()
|
||||
.entry("limits")
|
||||
.or_insert_with(|| Value::Object(serde_json::Map::new()));
|
||||
nested[limit] = value.clone();
|
||||
}
|
||||
}
|
||||
} else if (core || read_by_extension.contains(member.as_str()))
|
||||
&& !properties.contains(member)
|
||||
{
|
||||
entry[member] = value.clone();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
device.insert("features".into(), Value::Object(omitted_features));
|
||||
device.insert("properties".into(), Value::Object(omitted_properties));
|
||||
// The layer keeps one block's entry of a format, the last of the profile's blocks that states
|
||||
// it, where the product's reader takes the union of every block's flags (`roadmap-2022`'s
|
||||
// storage-only conditional entries replaced its required ones).
|
||||
let mut formats = serde_json::Map::new();
|
||||
for block in profile_blocks(&document) {
|
||||
for (format, entry) in block["formats"].as_object().into_iter().flatten() {
|
||||
formats.insert(format.clone(), entry.clone());
|
||||
}
|
||||
}
|
||||
for block in document["capabilities"]
|
||||
.as_object_mut()
|
||||
.unwrap()
|
||||
.values_mut()
|
||||
{
|
||||
block.as_object_mut().unwrap().remove("formats");
|
||||
}
|
||||
device.insert("formats".into(), Value::Object(formats));
|
||||
document["capabilities"]["m2v_test_device"] = Value::Object(device);
|
||||
document["profiles"][&restriction.profile_name]["capabilities"]
|
||||
.as_array_mut()
|
||||
.unwrap()
|
||||
.push(Value::from("m2v_test_device"));
|
||||
document.to_string()
|
||||
}
|
||||
|
||||
/// What a context at Vulkan 1.`minor` restricted to `restriction` on the venue whose capture is
|
||||
/// `venue` decides: its first check, that the device has what the profile states
|
||||
/// ([`check_within`]), then, after the layer reports [`layer_report`], its check of that report
|
||||
/// against the profile as the product reads it ([`check_restricted`]).
|
||||
fn presented(
|
||||
restriction: &ProfileRestriction,
|
||||
venue: &str,
|
||||
minor: u32,
|
||||
) -> Result<DeviceDescription, RestrictionError> {
|
||||
let at = ApiVersion { major: 1, minor };
|
||||
let file = crate::engine::profiles_dir().join(format!("{venue}.json"));
|
||||
let capture: Value = serde_json::from_str(&std::fs::read_to_string(file).unwrap()).unwrap();
|
||||
let report = layer_report(restriction, &capture, minor);
|
||||
let mut queried = read_at(
|
||||
&DeviceDescription::from_khronos_json(&report, Some(&restriction.profile_name)).unwrap(),
|
||||
at,
|
||||
);
|
||||
// The context hides what the layer adds that the profile does not describe (`hidden`).
|
||||
queried.khr_format_feature_flags2 &= restriction.states_format_flags2;
|
||||
let native = read_at(&committed(venue), at);
|
||||
check_within(restriction, &native, at)?;
|
||||
let tools = [tool(c"VK_LAYER_KHRONOS_validation"), tool(PROFILES_LAYER)];
|
||||
check_restricted(restriction, &native, &tools, &queried, at)
|
||||
}
|
||||
|
||||
/// A completed requirements document is presented as the product reads it on every venue, at its
|
||||
/// own version (the context a restricted run of it opens): modelled from each venue's capture, the
|
||||
/// layer's report of it passes the restricted context's check. The model is the evidence's: for
|
||||
/// `lunarg-desktop-baseline-2023` as extracted it gives exactly the six members the RTX 5080's
|
||||
/// context reported, and the completed one matched on RADV, ANV, and the RTX 5080. `roadmap-2022`
|
||||
/// as extracted omits the core members the product reads that the layer then reports at each
|
||||
/// device's value; completed, it omits none.
|
||||
#[test]
|
||||
fn a_completed_requirements_document_presents_as_the_product_reads_it_on_every_venue() {
|
||||
let venues = crate::c3::Venues::load(&crate::c3::Venues::committed_path()).unwrap();
|
||||
// Every device a venue allows, by its own capture.
|
||||
let venue_profiles: BTreeSet<String> = venues
|
||||
.venues
|
||||
.iter()
|
||||
.flat_map(|venue| venue.devices.iter().map(|device| device.profile.clone()))
|
||||
.collect();
|
||||
assert_eq!(venue_profiles.len(), 6, "{venue_profiles:?}");
|
||||
let Err(RestrictionError::Mismatch { fields, .. }) = presented(
|
||||
&without_block("lunarg-desktop-baseline-2023"),
|
||||
"nvidia-rtx5080-laptop",
|
||||
2,
|
||||
) else {
|
||||
panic!("the model presented lunarg-desktop-baseline-2023 as extracted");
|
||||
};
|
||||
assert_eq!(
|
||||
fields.iter().map(ToString::to_string).collect::<Vec<_>>(),
|
||||
[
|
||||
"features.ShaderSubgroupExtendedTypes: expected listed, queried absent",
|
||||
"limits.max_vertex_attrib_divisor: expected 0, queried 4294967295",
|
||||
"subgroup.max_compute_workgroup_subgroups: expected 0, queried 32",
|
||||
"subgroup.max_size: expected 0, queried 32",
|
||||
"subgroup.min_size: expected 0, queried 32",
|
||||
"subgroup.required_size_stages: expected 0, queried 16383",
|
||||
]
|
||||
);
|
||||
let Err(RestrictionError::Mismatch { fields, .. }) =
|
||||
presented(&without_block("roadmap-2022"), "nvidia-rtx5080-laptop", 3)
|
||||
else {
|
||||
panic!("the model presented roadmap-2022 as extracted");
|
||||
};
|
||||
assert!(
|
||||
fields
|
||||
.iter()
|
||||
.any(|field| field.path == "limits.max_image_dimension_3d"),
|
||||
"{fields:?}"
|
||||
);
|
||||
let mut takes = BTreeMap::new();
|
||||
for stem in ["lunarg-desktop-baseline-2023", "roadmap-2022"] {
|
||||
let restriction = ProfileRestriction::committed(stem).unwrap();
|
||||
let minor = restriction.context_version().minor;
|
||||
for venue in &venue_profiles {
|
||||
match presented(&restriction, venue, minor) {
|
||||
Ok(_) => takes
|
||||
.entry(stem)
|
||||
.or_insert_with(Vec::new)
|
||||
.push(venue.as_str()),
|
||||
// The device lacks what the profile states: a typed refusal, before the layer
|
||||
// reports anything.
|
||||
Err(RestrictionError::Exceeds { .. }) => {}
|
||||
Err(error) => panic!("{stem} on {venue}: {error}"),
|
||||
}
|
||||
}
|
||||
}
|
||||
// MoltenVK lacks two of lunarg's members and lavapipe 15; at Vulkan 1.3 every venue but
|
||||
// MoltenVK has what `roadmap-2022` states.
|
||||
assert_eq!(
|
||||
takes["lunarg-desktop-baseline-2023"],
|
||||
[
|
||||
"amd-780m-radv",
|
||||
"intel-irisxe-rplp-anv",
|
||||
"nvidia-rtx5080-laptop"
|
||||
]
|
||||
);
|
||||
assert_eq!(
|
||||
takes["roadmap-2022"],
|
||||
[
|
||||
"amd-780m-radv",
|
||||
"gate-lavapipe",
|
||||
"gate-lavapipe-x86_64",
|
||||
"intel-irisxe-rplp-anv",
|
||||
"nvidia-rtx5080-laptop"
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
/// A requirements document the layer cannot present as the product reads it, on any device, is
|
||||
/// refused by the plan and the run by the same check before any device is read: it is that one
|
||||
/// gap, a tooling gap, and
|
||||
/// `restrict_devices_to` and a batch (`check_presentable`) refuse it up front. One its regeneration
|
||||
/// did not complete for the layer is one (the safety net), named with the version the context would
|
||||
/// run at. A completed one is presentable at its own version, which the context runs at, and
|
||||
/// whether a device has what it states is the first check's, at that version:
|
||||
/// `lunarg-desktop-baseline-2023` states nothing beyond the RTX 5080 and format features beyond
|
||||
/// lavapipe's, and `roadmap-2022`, Vulkan 1.3, nothing beyond either. Every other committed
|
||||
/// profile states every member the product reads: a device report or capture its device's every
|
||||
/// member, a derived profile its base version's every member and the ones the base leaves open.
|
||||
#[test]
|
||||
fn an_unpresentable_requirements_document_is_refused_before_any_device_is_read() {
|
||||
for stem in committed_profiles().unwrap() {
|
||||
let restriction = ProfileRestriction::committed(&stem).unwrap();
|
||||
let requirements =
|
||||
["lunarg-desktop-baseline-2023", "roadmap-2022"].contains(&stem.as_str());
|
||||
assert_eq!(restriction.requirements_only, requirements, "{stem}");
|
||||
assert_eq!(restriction.completed_for_layer, requirements, "{stem}");
|
||||
assert_eq!(restriction.presentation_gap(), None, "{stem}");
|
||||
}
|
||||
let nvidia = committed("nvidia-rtx5080-laptop");
|
||||
let lavapipe = committed("gate-lavapipe-x86_64");
|
||||
for (stem, minor) in [("lunarg-desktop-baseline-2023", 2), ("roadmap-2022", 3)] {
|
||||
let uncompleted = without_block(stem);
|
||||
assert_eq!(uncompleted.context_version().minor, minor, "{stem}");
|
||||
let gap = uncompleted.presentation_gap().unwrap();
|
||||
assert!(
|
||||
gap.starts_with(&format!(
|
||||
"tooling gap: the executor's Vulkan 1.{minor} context cannot present \
|
||||
requirements document {stem} as the product reads it (provenance source \
|
||||
khronos, not completed by m2v_layer_presentation: "
|
||||
)),
|
||||
"{gap}"
|
||||
);
|
||||
}
|
||||
presentable("roadmap-2022").unwrap();
|
||||
super::super::check_presentable("roadmap-2022").unwrap();
|
||||
for device in [&nvidia, &lavapipe] {
|
||||
assert_eq!(gaps_of("roadmap-2022", device), Vec::<String>::new());
|
||||
}
|
||||
|
||||
super::super::check_presentable("lunarg-desktop-baseline-2023").unwrap();
|
||||
assert_eq!(
|
||||
gaps_of("lunarg-desktop-baseline-2023", &nvidia),
|
||||
Vec::<String>::new()
|
||||
);
|
||||
let beyond = gaps_of("lunarg-desktop-baseline-2023", &lavapipe);
|
||||
assert!(
|
||||
beyond
|
||||
.iter()
|
||||
.any(|gap| gap.starts_with("formats.VK_FORMAT_R8_SNORM.optimal_tiling 0xdd83")),
|
||||
"{beyond:?}"
|
||||
);
|
||||
assert_eq!(gaps_of("vk12-floor", &lavapipe), Vec::<String>::new());
|
||||
super::super::check_presentable("vk12-floor").unwrap();
|
||||
}
|
||||
@@ -382,7 +382,7 @@ pub enum ExecutionClass {
|
||||
|
||||
impl ExecutionClass {
|
||||
/// The class of a device, or `None` for a description that names no device (a capability
|
||||
/// profile, such as `vk12-floor`, that no host is).
|
||||
/// profile, such as `runtime-floor`, that no host is).
|
||||
pub fn of_description(description: &DeviceDescription) -> Option<ExecutionClass> {
|
||||
if description.device_type == Some(vk::PhysicalDeviceType::CPU) {
|
||||
return Some(ExecutionClass::CpuIcd);
|
||||
|
||||
@@ -317,8 +317,8 @@ fn a_render_pipeline_census_leaves_out_its_geometry_stages() {
|
||||
/// feature, in its robustness-off leg (validation runs both): the stated leg compiles the robust
|
||||
/// encodings the profile states, the off leg the in-shader ones, on the same device class and
|
||||
/// subgroup width. Every committed profile states `robustBufferAccess`, so every one has both legs;
|
||||
/// `vk12-floor` states no image robustness, and `moltenvk-m3` states
|
||||
/// `robustBufferAccess` without `robustBufferAccess2`.
|
||||
/// every one states image robustness too (the floor's Vulkan 1.3 requires `robustImageAccess`),
|
||||
/// and `moltenvk-m3` states `robustBufferAccess` without `robustBufferAccess2`.
|
||||
#[test]
|
||||
fn the_tier_table_derives_a_robustness_off_leg_from_each_profile() {
|
||||
use metal2vulkan::device::Robustness;
|
||||
@@ -359,12 +359,12 @@ fn the_tier_table_derives_a_robustness_off_leg_from_each_profile() {
|
||||
.find(|entry| entry.tier.stem == stem && entry.tier.leg == Leg::Stated)
|
||||
.unwrap()
|
||||
};
|
||||
assert!(!stated("vk12-floor").profile.images().robust_image_access);
|
||||
assert!(stated("runtime-floor").profile.images().robust_image_access);
|
||||
assert!(stated("lavapipe").profile.images().robust_image_access);
|
||||
assert_eq!(stated("moltenvk-m3").profile.robustness(), Robustness::Rba);
|
||||
assert_eq!(stated("lavapipe").profile.robustness(), Robustness::Rba2);
|
||||
// A description that states no robustness feature has no second leg.
|
||||
let mut none = crate::engine::load_description("vk12-floor").unwrap();
|
||||
let mut none = crate::engine::load_description("runtime-floor").unwrap();
|
||||
none.features
|
||||
.retain(|feature| !ROBUSTNESS_FEATURES.contains(feature));
|
||||
assert_eq!(robustness_off(&none), None);
|
||||
@@ -373,8 +373,10 @@ fn the_tier_table_derives_a_robustness_off_leg_from_each_profile() {
|
||||
/// A compile records the containment it compiled under, from its profile and its own module:
|
||||
/// the robust and the in-shader leg of one copy census the same strategy names (the name hides
|
||||
/// the encoding) under different encodings; a kernel that declares no image has none; a texture
|
||||
/// write's image encoding follows the leg's image robustness, and `vk12-floor`, which writes a
|
||||
/// storage image only through its declared format, needs the texture's format first; and a kernel that turns an integer into a pointer (a dynamic root) reaches that memory by
|
||||
/// write's image encoding follows the leg's image robustness, and a device that writes a storage
|
||||
/// image only through its declared format (`runtime-floor` without
|
||||
/// `shaderStorageImageWriteWithoutFormat`, below the runtime's floor) needs the texture's format
|
||||
/// first; and a kernel that turns an integer into a pointer (a dynamic root) reaches that memory by
|
||||
/// device address under names of its own, checked in the shader in both legs, while its descriptor
|
||||
/// accesses take each leg's encoding.
|
||||
#[test]
|
||||
@@ -425,17 +427,28 @@ fn a_compile_records_the_containment_it_compiled_under() {
|
||||
assert_eq!(write("lavapipe", Leg::RobustnessOff), I::Checked);
|
||||
let select_write = llvm_assemble(&engine_dir().join("a4_select_write.ll"))
|
||||
.unwrap_or_else(|error| panic!("{error:?}"));
|
||||
let mut formatted = crate::engine::load_description("runtime-floor").unwrap();
|
||||
assert!(formatted
|
||||
.features
|
||||
.remove(&VkFeature::ShaderStorageImageWriteWithoutFormat));
|
||||
let formatted = metal2vulkan::device::Device::from_queries(
|
||||
formatted,
|
||||
metal2vulkan::device::DevicePolicy::default(),
|
||||
)
|
||||
.unwrap()
|
||||
.profile()
|
||||
.clone();
|
||||
match compile_module(
|
||||
&select_write,
|
||||
"a4_select_write",
|
||||
&CaseInputs::defaults(),
|
||||
leg("vk12-floor", Leg::Stated),
|
||||
&formatted,
|
||||
) {
|
||||
Err(CompileError::Refused(reason)) => assert!(
|
||||
reason.starts_with("needs_input StorageTextureFormat"),
|
||||
"{reason}"
|
||||
),
|
||||
other => panic!("a4_select_write on vk12-floor: {other:?}"),
|
||||
other => panic!("a4_select_write without formatless writes: {other:?}"),
|
||||
}
|
||||
|
||||
let round_trip = |leg_of| {
|
||||
@@ -545,43 +558,54 @@ fn an_image_encoding_names_what_its_device_is_left() {
|
||||
let ll = scratch.path().join("image.ll");
|
||||
std::fs::write(&ll, switched_read_kernel(false)).unwrap();
|
||||
let bitcode = llvm_assemble(&ll).unwrap_or_else(|error| panic!("{error:?}"));
|
||||
for (stem, leg, images, read) in [
|
||||
// `robustImageAccess` alone: `runtime-floor` without `robustImageAccess2` (below the
|
||||
// runtime's floor), and its robustness-off leg.
|
||||
let mut alone = crate::engine::load_description("runtime-floor").unwrap();
|
||||
assert!(alone.features.remove(&VkFeature::RobustImageAccess2));
|
||||
let derive = |description: DeviceDescription| {
|
||||
metal2vulkan::device::Device::from_queries(
|
||||
description,
|
||||
metal2vulkan::device::DevicePolicy::default(),
|
||||
)
|
||||
.unwrap()
|
||||
.profile()
|
||||
.clone()
|
||||
};
|
||||
let floor = &table
|
||||
.iter()
|
||||
.find(|entry| entry.tier.stem == "runtime-floor" && entry.tier.leg == Leg::Stated)
|
||||
.unwrap()
|
||||
.profile;
|
||||
let alone_off = derive(robustness_off(&alone).unwrap());
|
||||
let alone = derive(alone);
|
||||
for (label, profile, images, read) in [
|
||||
(
|
||||
"lunarg-desktop-baseline-2023",
|
||||
Leg::Stated,
|
||||
"runtime-floor",
|
||||
floor,
|
||||
ImageEncoding::Robust,
|
||||
"texture.read.switch",
|
||||
),
|
||||
(
|
||||
"swiftshader",
|
||||
Leg::Stated,
|
||||
"robustImageAccess alone",
|
||||
&alone,
|
||||
ImageEncoding::RobustWrites,
|
||||
"texture.read_clamped.switch",
|
||||
),
|
||||
(
|
||||
"swiftshader",
|
||||
Leg::RobustnessOff,
|
||||
"robustImageAccess alone, robustness off",
|
||||
&alone_off,
|
||||
ImageEncoding::Checked,
|
||||
"texture.read_clamped.switch",
|
||||
),
|
||||
] {
|
||||
let entry = table
|
||||
.iter()
|
||||
.find(|entry| entry.tier.stem == stem && entry.tier.leg == leg)
|
||||
.unwrap_or_else(|| panic!("{stem} {leg:?}"));
|
||||
let census = compile_module(
|
||||
&bitcode,
|
||||
"switched",
|
||||
&CaseInputs::defaults(),
|
||||
&entry.profile,
|
||||
)
|
||||
.unwrap_or_else(|error| panic!("{stem}: {error:?}"))
|
||||
.census;
|
||||
let census = compile_module(&bitcode, "switched", &CaseInputs::defaults(), profile)
|
||||
.unwrap_or_else(|error| panic!("{label}: {error:?}"))
|
||||
.census;
|
||||
let containment = census.containment.expect("a compiled module's containment");
|
||||
assert_eq!(containment.images, images, "{stem} {leg:?}");
|
||||
assert_eq!(containment.images, images, "{label}");
|
||||
assert!(
|
||||
census.strategies.contains(read),
|
||||
"{stem} {leg:?}: {:?}",
|
||||
"{label}: {:?}",
|
||||
census.strategies
|
||||
);
|
||||
}
|
||||
@@ -642,7 +666,7 @@ fn a_vertex_case_compiles_under_its_vertex_descriptor() {
|
||||
.unwrap()
|
||||
.buffers
|
||||
};
|
||||
for stem in ["lavapipe", "moltenvk-m3", "vk12-floor"] {
|
||||
for stem in ["lavapipe", "moltenvk-m3", "runtime-floor"] {
|
||||
assert_eq!(
|
||||
buffers(&inputs, leg(stem, Leg::Stated)),
|
||||
BufferEncoding::Unused,
|
||||
@@ -749,12 +773,12 @@ fn target(resource: OutOfBoundsResource, form: ContainmentForm) -> OutOfBoundsTa
|
||||
}
|
||||
|
||||
/// The out-of-bounds fixtures (`engine/ob1_*`) compile each target they declare to the form
|
||||
/// and mechanism of the inventory on lavapipe, MoltenVK, and SwiftShader, in both legs: a
|
||||
/// and mechanism of the inventory on lavapipe, MoltenVK, and the runtime's floor, in both legs: a
|
||||
/// descriptor view left to the device's buffer robustness where the leg enables it and checked in
|
||||
/// the shader where it does not, a device address and the arena checked in the shader on every
|
||||
/// leg, and an image or texel buffer left to the device's image or buffer robustness where
|
||||
/// enabled. The form is the compiled structure's: without device addresses the escaping buffer is
|
||||
/// a storage buffer, and a robustness-off leg views the `constant` buffer as a storage buffer.
|
||||
/// enabled. The form is the compiled structure's: a robustness-off leg views the `constant`
|
||||
/// buffer as a storage buffer.
|
||||
#[test]
|
||||
fn the_out_of_bounds_fixtures_contain_each_target_as_declared() {
|
||||
use metal2vulkan_devtools::{engine_dir, llvm_assemble};
|
||||
@@ -800,15 +824,12 @@ fn the_out_of_bounds_fixtures_contain_each_target_as_declared() {
|
||||
],
|
||||
),
|
||||
];
|
||||
// The mechanism label of each fixture's targets per (stem, leg). SwiftShader states only the
|
||||
// first robustness levels and no device addresses: the buffer whose address escapes is a
|
||||
// descriptor view there.
|
||||
// The mechanism label of each fixture's targets per (stem, leg). MoltenVK and the runtime's
|
||||
// floor state `robustBufferAccess` without `robustBufferAccess2`.
|
||||
let expected = |fixture: &str, stem: &str, leg: Leg| -> &str {
|
||||
let off = leg == Leg::RobustnessOff;
|
||||
let robust1 = ["moltenvk-m3", "swiftshader"].contains(&stem);
|
||||
let robust1 = ["moltenvk-m3", "runtime-floor"].contains(&stem);
|
||||
match fixture {
|
||||
"ob1_device_address" if stem == "swiftshader" && off => "descriptor-view:shader",
|
||||
"ob1_device_address" if stem == "swiftshader" => "descriptor-view:robust",
|
||||
"ob1_device_address" => "device-address:shader",
|
||||
"ob1_threadgroup" => "arena:shader",
|
||||
_ if off => match fixture {
|
||||
@@ -816,8 +837,6 @@ fn the_out_of_bounds_fixtures_contain_each_target_as_declared() {
|
||||
"ob1_texel_buffer" => "texel-buffer:shader",
|
||||
_ => "descriptor-view:shader",
|
||||
},
|
||||
// `robustImageAccess` alone discards writes; reads are clamped in the shader.
|
||||
"ob1_texture" if stem == "swiftshader" => "image:shader-reads",
|
||||
"ob1_texture" => "image:robust2",
|
||||
// `robustBufferAccess` alone: the texel buffer is checked in the shader.
|
||||
"ob1_texel_buffer" if robust1 => "texel-buffer:shader",
|
||||
@@ -827,11 +846,10 @@ fn the_out_of_bounds_fixtures_contain_each_target_as_declared() {
|
||||
}
|
||||
};
|
||||
// The form each target is exercised as: the declared one, but a buffer as its compiled slot
|
||||
// reaches it. A device address that compiles to a descriptor view is a storage buffer, and so
|
||||
// is `ob1_uniform_buffer`'s `constant` buffer, which each thread reads at its own index: a read
|
||||
// whose address may differ between the lanes takes the slot's storage view on every device.
|
||||
let form = |fixture: &str, stem: &str, _: Leg, declared: ContainmentForm| match fixture {
|
||||
"ob1_device_address" if stem == "swiftshader" => F::StorageBuffer,
|
||||
// reaches it. `ob1_uniform_buffer`'s `constant` buffer is a storage buffer, which each thread
|
||||
// reads at its own index: a read whose address may differ between the lanes takes the slot's
|
||||
// storage view on every device.
|
||||
let form = |fixture: &str, _: &str, _: Leg, declared: ContainmentForm| match fixture {
|
||||
"ob1_uniform_buffer" => F::StorageBuffer,
|
||||
_ => declared,
|
||||
};
|
||||
@@ -843,7 +861,7 @@ fn the_out_of_bounds_fixtures_contain_each_target_as_declared() {
|
||||
..CaseInputs::defaults()
|
||||
};
|
||||
for entry in table.iter().filter(|entry| {
|
||||
["lavapipe", "moltenvk-m3", "swiftshader"].contains(&entry.tier.stem.as_str())
|
||||
["lavapipe", "moltenvk-m3", "runtime-floor"].contains(&entry.tier.stem.as_str())
|
||||
}) {
|
||||
let compiled = compile_module(&bitcode, fixture, &inputs, &entry.profile)
|
||||
.unwrap_or_else(|error| panic!("{fixture} on {}: {error:?}", entry.tier.label()));
|
||||
@@ -868,12 +886,11 @@ fn the_out_of_bounds_fixtures_contain_each_target_as_declared() {
|
||||
}
|
||||
|
||||
/// The fixtures of the authorable forms (`engine/ob2_*`) compile each target to its form and an
|
||||
/// in-shader check on every committed profile that compiles them, in both legs: the buffer a loaded
|
||||
/// pointer reaches is a device address the resident set resolves, the thread-local array a typed
|
||||
/// object checked per array level, and the argument buffer's texture array a handle table. The rest
|
||||
/// refuse with what they lack, a typed refusal in both legs: the profiles without device addresses
|
||||
/// or 64-bit integers the loaded pointer, and those without descriptor indexing the argument
|
||||
/// buffer's textures.
|
||||
/// in-shader check on every committed profile, in both legs: the buffer a loaded pointer reaches is
|
||||
/// a device address the resident set resolves, the thread-local array a typed object checked per
|
||||
/// array level, and the argument buffer's texture array a handle table. A device without device
|
||||
/// addresses or 64-bit integers refuses the loaded pointer, and one without descriptor indexing the
|
||||
/// argument buffer's textures, with what it lacks; every committed profile has them.
|
||||
#[test]
|
||||
fn the_ob2_fixtures_contain_each_target_in_the_shader_on_every_profile() {
|
||||
use metal2vulkan_devtools::{engine_dir, llvm_assemble};
|
||||
@@ -946,21 +963,8 @@ fn the_ob2_fixtures_contain_each_target_in_the_shader_on_every_profile() {
|
||||
}
|
||||
}
|
||||
}
|
||||
let pointer = [
|
||||
"lunarg-desktop-baseline-2023",
|
||||
"roadmap-2022",
|
||||
"swiftshader",
|
||||
"vk12-floor",
|
||||
];
|
||||
let handles = ["vk12-floor"];
|
||||
assert_eq!(
|
||||
refused,
|
||||
pointer
|
||||
.map(|stem| ("ob2_loaded_pointer", stem))
|
||||
.into_iter()
|
||||
.chain(handles.map(|stem| ("ob2_handle_array", stem)))
|
||||
.collect::<BTreeSet<_>>()
|
||||
);
|
||||
// Every committed profile has device addresses, 64-bit integers and descriptor indexing.
|
||||
assert!(refused.is_empty(), "{refused:?}");
|
||||
}
|
||||
|
||||
/// The case of an OB3 fixture: its committed manifest's literals, as the coverage report reads them
|
||||
|
||||
@@ -1505,8 +1505,8 @@ mod tests {
|
||||
#[test]
|
||||
fn committed_profiles_load_and_unknown_stems_are_refused() {
|
||||
let stems = committed_profiles().unwrap();
|
||||
assert!(stems.iter().any(|s| s == "vk12-floor"), "{stems:?}");
|
||||
assert!(load_profile("vk12-floor").is_ok());
|
||||
assert!(stems.iter().any(|s| s == "runtime-floor"), "{stems:?}");
|
||||
assert!(load_profile("runtime-floor").is_ok());
|
||||
let error = load_profile("../moltenvk-m3").unwrap_err();
|
||||
assert!(error.contains("unknown profile"), "{error}");
|
||||
}
|
||||
@@ -1524,7 +1524,7 @@ mod tests {
|
||||
}
|
||||
Err(AssembleError::Rejected(why)) => panic!("llvm-as rejected store_const.ll: {why}"),
|
||||
};
|
||||
let profile = load_profile("vk12-floor").unwrap();
|
||||
let profile = load_profile("runtime-floor").unwrap();
|
||||
let attempt = translate_new(&bitcode, "store_const", &profile, None);
|
||||
assert_eq!(attempt.outcome, Outcome::Translated, "{attempt:?}");
|
||||
assert!(attempt.words.is_some_and(|words| words > 5));
|
||||
@@ -1553,7 +1553,7 @@ mod tests {
|
||||
}
|
||||
Err(AssembleError::Rejected(why)) => panic!("llvm-as rejected color_groups.ll: {why}"),
|
||||
};
|
||||
for (stem, groups) in [("vk12-floor", 2), ("lavapipe", 1)] {
|
||||
for (stem, groups) in [("runtime-floor", 2), ("lavapipe", 1)] {
|
||||
let profile = load_profile(stem).unwrap();
|
||||
for (entry, modules) in [("cg_five", groups), ("cg_seven", groups), ("cg_sparse", 1)] {
|
||||
let (attempt, pending) = translate_new_unvalidated(&bitcode, entry, &profile, None);
|
||||
@@ -1568,7 +1568,7 @@ mod tests {
|
||||
}
|
||||
let counts = translate_new(&bitcode, "cg_counts", &profile, None);
|
||||
let expected = match stem {
|
||||
"vk12-floor" => "device_capability_missing",
|
||||
"runtime-floor" => "device_capability_missing",
|
||||
_ => "translated",
|
||||
};
|
||||
assert_eq!(
|
||||
@@ -1604,7 +1604,7 @@ mod tests {
|
||||
#[test]
|
||||
fn rows_without_retained_bitcode_are_assembled_from_their_text() {
|
||||
use metal2vulkan_devtools::engine_dir;
|
||||
let profile = load_profile("vk12-floor").unwrap();
|
||||
let profile = load_profile("runtime-floor").unwrap();
|
||||
let text = std::fs::read_to_string(engine_dir().join("store_const.ll")).unwrap();
|
||||
let source = RowSource::of(None, text.clone());
|
||||
assert_eq!(source, RowSource::Text(Cow::Borrowed(text.as_str())));
|
||||
@@ -1659,7 +1659,7 @@ mod tests {
|
||||
#[test]
|
||||
fn a_public_rows_attempt_does_not_follow_its_scratch_directory() {
|
||||
use metal2vulkan_devtools::engine_dir;
|
||||
let profile = load_profile("vk12-floor").unwrap();
|
||||
let profile = load_profile("runtime-floor").unwrap();
|
||||
let text: String = std::fs::read_to_string(engine_dir().join("store_const.ll"))
|
||||
.unwrap()
|
||||
.lines()
|
||||
@@ -1695,7 +1695,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn garbage_bitcode_is_typed_invalid_input_not_a_panic() {
|
||||
let profile = load_profile("vk12-floor").unwrap();
|
||||
let profile = load_profile("runtime-floor").unwrap();
|
||||
let attempt = translate_new(b"not bitcode", "main", &profile, None);
|
||||
assert_eq!(attempt.outcome.label(), "invalid_input", "{attempt:?}");
|
||||
assert!(attempt.detail.is_some());
|
||||
|
||||
@@ -3120,7 +3120,10 @@ mod tests {
|
||||
"VkPhysicalDeviceProperties": {
|
||||
"deviceName": "Toy GPU", "vendorID": 4098, "deviceID": 5567,
|
||||
"driverVersion": 109060100,
|
||||
"limits": {"maxComputeWorkGroupInvocations": 1024},
|
||||
"limits": {
|
||||
"maxComputeWorkGroupInvocations": 1024,
|
||||
"maxPushConstantsSize": 256,
|
||||
},
|
||||
},
|
||||
"VkPhysicalDeviceDriverProperties": {
|
||||
"driverID": "VK_DRIVER_ID_MESA_RADV", "driverInfo": "Mesa 26.2.4",
|
||||
|
||||
@@ -988,7 +988,7 @@ mod tests {
|
||||
};
|
||||
let validation = serde_json::json!({"layer": "VK_LAYER_KHRONOS_validation"});
|
||||
let profiles = serde_json::json!({"layer": "VK_LAYER_KHRONOS_profiles"});
|
||||
let restriction = serde_json::json!({"profile": "vk12-floor"});
|
||||
let restriction = serde_json::json!({"profile": "runtime-floor"});
|
||||
|
||||
// Native rows, with and without recorded tools.
|
||||
assert_eq!(row(serde_json::json!({}), None).validate_content(), Ok(()));
|
||||
@@ -1008,15 +1008,15 @@ mod tests {
|
||||
"profiles_layer": restriction,
|
||||
});
|
||||
assert_eq!(
|
||||
row(restricted.clone(), Some("vk12-floor")).validate_content(),
|
||||
row(restricted.clone(), Some("runtime-floor")).validate_content(),
|
||||
Ok(())
|
||||
);
|
||||
assert!(row(restricted.clone(), None).validate_content().is_err());
|
||||
assert!(row(restricted, Some("roadmap-2022"))
|
||||
assert!(row(restricted, Some("lavapipe"))
|
||||
.validate_content()
|
||||
.is_err());
|
||||
let inactive = serde_json::json!({"tools": [validation], "profiles_layer": restriction});
|
||||
assert!(row(inactive, Some("vk12-floor"))
|
||||
assert!(row(inactive, Some("runtime-floor"))
|
||||
.validate_content()
|
||||
.unwrap_err()
|
||||
.contains("not active"));
|
||||
|
||||
@@ -902,7 +902,7 @@ mod tests {
|
||||
&bitcode,
|
||||
"fcfold",
|
||||
&FunctionConstantValues::defaults(),
|
||||
"vk12-floor",
|
||||
"runtime-floor",
|
||||
);
|
||||
assert_eq!(
|
||||
undefined.attempt.outcome,
|
||||
@@ -917,7 +917,7 @@ mod tests {
|
||||
// One required constant: 0 and 1, each also its defined and covering set.
|
||||
assert_eq!(row.specializations.len(), 2, "{row:#?}");
|
||||
for set in &row.specializations {
|
||||
let result = attempt(&bitcode, "fcfold", &set.values(), "vk12-floor");
|
||||
let result = attempt(&bitcode, "fcfold", &set.values(), "runtime-floor");
|
||||
if set.kinds.contains(&SpecKind::One) {
|
||||
assert_eq!(result.attempt.outcome, Outcome::Translated, "{result:?}");
|
||||
}
|
||||
@@ -1050,7 +1050,8 @@ mod tests {
|
||||
assert_eq!(result.attempt.outcome, Outcome::Translated, "{result:?}");
|
||||
}
|
||||
|
||||
/// A storage texture on a profile without formatless storage access is supplied the widest
|
||||
/// A storage texture on a profile without formatless storage access (`runtime-floor` without
|
||||
/// `shaderStorageImageWriteWithoutFormat`, below the runtime's floor) is supplied the widest
|
||||
/// format of its texel class.
|
||||
#[test]
|
||||
fn a_storage_texture_is_supplied_the_widest_format_of_its_class() {
|
||||
@@ -1059,12 +1060,24 @@ mod tests {
|
||||
else {
|
||||
return;
|
||||
};
|
||||
let result = attempt(
|
||||
let mut description = crate::engine::load_description("runtime-floor").unwrap();
|
||||
assert!(description
|
||||
.features
|
||||
.remove(&metal2vulkan::device::VkFeature::ShaderStorageImageWriteWithoutFormat));
|
||||
let profile =
|
||||
metal2vulkan::device::Device::from_queries(description, DevicePolicy::default())
|
||||
.unwrap()
|
||||
.profile()
|
||||
.clone();
|
||||
let result = replay_specialized(
|
||||
&bitcode,
|
||||
"kernel_write_one_dimensional_textures",
|
||||
&FunctionConstantValues::defaults(),
|
||||
"roadmap-2022",
|
||||
);
|
||||
&profile,
|
||||
None,
|
||||
None,
|
||||
)
|
||||
.attempt;
|
||||
assert!(
|
||||
result
|
||||
.supplied
|
||||
|
||||
@@ -2335,7 +2335,7 @@ mod tests {
|
||||
let case = make_case("restricted", "AAAAAA==");
|
||||
store.put_case(case.clone()).unwrap();
|
||||
let refused = NotSupported::Restriction {
|
||||
profile: "lunarg-desktop-baseline-2023".into(),
|
||||
profile: "runtime-floor".into(),
|
||||
gaps: vec![
|
||||
"formats.VK_FORMAT_R8_SNORM.optimal_tiling 0xdd83 beyond the device's 0x1dc83"
|
||||
.into(),
|
||||
@@ -2344,13 +2344,13 @@ mod tests {
|
||||
let restricted = |slot: &str, leg: &str| RefusalObservation {
|
||||
environment: serde_json::json!({
|
||||
"robustness": {"leg": leg},
|
||||
"profiles_layer": {"profile": "lunarg-desktop-baseline-2023"},
|
||||
"profiles_layer": {"profile": "runtime-floor"},
|
||||
}),
|
||||
refusal: crate::refusal::Refusal::of(&refused),
|
||||
..refusal(&case, slot, leg)
|
||||
};
|
||||
let stated = "env@engine@lunarg-desktop-baseline-2023";
|
||||
let off = "env@engine@lunarg-desktop-baseline-2023+robustness-off";
|
||||
let stated = "env@engine@runtime-floor";
|
||||
let off = "env@engine@runtime-floor+robustness-off";
|
||||
store.upsert_refusal(restricted(stated, "stated")).unwrap();
|
||||
store
|
||||
.upsert_refusal(restricted(off, "robustness_off"))
|
||||
@@ -2376,7 +2376,7 @@ mod tests {
|
||||
assert!(stored[0]
|
||||
.refusal
|
||||
.detail
|
||||
.contains("profile lunarg-desktop-baseline-2023 states 1 capabilities the device lacks: formats.VK_FORMAT_R8_SNORM"));
|
||||
.contains("profile runtime-floor states 1 capabilities the device lacks: formats.VK_FORMAT_R8_SNORM"));
|
||||
// The venue's own slot keeps its row.
|
||||
assert_eq!(store.read_candidates(Backend::Vulkan).unwrap().len(), 1);
|
||||
assert!(store.layout_errors().unwrap().is_empty());
|
||||
|
||||
@@ -615,7 +615,7 @@ mod tests {
|
||||
let (_scratch, index) = index();
|
||||
let skipped = write_engine_results(
|
||||
&index,
|
||||
"vk12-floor",
|
||||
"runtime-floor",
|
||||
"fp1",
|
||||
&[
|
||||
new_result("a", Outcome::Translated),
|
||||
@@ -637,12 +637,12 @@ mod tests {
|
||||
.unwrap();
|
||||
assert_eq!(skipped, 1, "a deadline is transient and never recorded");
|
||||
assert_eq!(
|
||||
engine_census(&index, "vk12-floor", "fp1")
|
||||
engine_census(&index, "runtime-floor", "fp1")
|
||||
.unwrap()
|
||||
.defects(),
|
||||
0
|
||||
);
|
||||
let census = engine_census(&index, "vk12-floor", "fp1").unwrap();
|
||||
let census = engine_census(&index, "runtime-floor", "fp1").unwrap();
|
||||
assert_eq!(
|
||||
(census.total_sources, census.attempted, census.remaining),
|
||||
(3, 2, 1)
|
||||
@@ -657,7 +657,7 @@ mod tests {
|
||||
);
|
||||
// The timed-out row is selected again by every mode that selects unattempted rows.
|
||||
let select = |mode, after| {
|
||||
select_engine_batch(&index, "vk12-floor", "fp1", mode, after, 10).unwrap()
|
||||
select_engine_batch(&index, "runtime-floor", "fp1", mode, after, 10).unwrap()
|
||||
};
|
||||
assert_eq!(select(SelectionMode::CurrentFingerprint, None), ["c"]);
|
||||
assert_eq!(select(SelectionMode::Discovery, None), ["c"]);
|
||||
@@ -666,7 +666,7 @@ mod tests {
|
||||
// A new fingerprint re-selects everything for a fresh sweep; discovery remembers the
|
||||
// profile's earlier success.
|
||||
let fresh =
|
||||
|mode| select_engine_batch(&index, "vk12-floor", "fp2", mode, None, 10).unwrap();
|
||||
|mode| select_engine_batch(&index, "runtime-floor", "fp2", mode, None, 10).unwrap();
|
||||
assert_eq!(fresh(SelectionMode::CurrentFingerprint), ["a", "b", "c"]);
|
||||
assert_eq!(fresh(SelectionMode::Discovery), ["b", "c"]);
|
||||
// Another profile's success is not this profile's.
|
||||
@@ -682,7 +682,7 @@ mod tests {
|
||||
.unwrap(),
|
||||
["a", "b", "c"]
|
||||
);
|
||||
assert_eq!(engine_recorded_profiles(&index).unwrap(), ["vk12-floor"]);
|
||||
assert_eq!(engine_recorded_profiles(&index).unwrap(), ["runtime-floor"]);
|
||||
let outcomes =
|
||||
engine_outcomes(&index, "fp1", &["a".into(), "b".into(), "c".into()]).unwrap();
|
||||
assert_eq!(outcomes.len(), 2);
|
||||
@@ -700,7 +700,7 @@ mod tests {
|
||||
};
|
||||
write_engine_results(
|
||||
&index,
|
||||
"vk12-floor",
|
||||
"runtime-floor",
|
||||
"fp1",
|
||||
&[
|
||||
new_result("a", limit(LimitKind::Budget, "WorkUnits")),
|
||||
@@ -709,7 +709,7 @@ mod tests {
|
||||
],
|
||||
)
|
||||
.unwrap();
|
||||
let census = engine_census(&index, "vk12-floor", "fp1").unwrap();
|
||||
let census = engine_census(&index, "runtime-floor", "fp1").unwrap();
|
||||
assert_eq!(census.count("limit_exceeded"), 3);
|
||||
assert_eq!(census.defects(), 2);
|
||||
}
|
||||
@@ -719,7 +719,7 @@ mod tests {
|
||||
#[test]
|
||||
fn readers_never_create_audit_schema() {
|
||||
let (_scratch, index) = index();
|
||||
let census = engine_census(&index, "vk12-floor", "fp1").unwrap();
|
||||
let census = engine_census(&index, "runtime-floor", "fp1").unwrap();
|
||||
assert_eq!(
|
||||
(census.total_sources, census.attempted, census.remaining),
|
||||
(3, 0, 3)
|
||||
@@ -733,10 +733,10 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn engine_fingerprint_separates_profiles() {
|
||||
let floor = crate::engine::load_profile("vk12-floor").unwrap();
|
||||
let floor = crate::engine::load_profile("runtime-floor").unwrap();
|
||||
let mvk = crate::engine::load_profile("moltenvk-m3").unwrap();
|
||||
let a = engine_fingerprint("vk12-floor", &floor);
|
||||
assert_eq!(a, engine_fingerprint("vk12-floor", &floor));
|
||||
let a = engine_fingerprint("runtime-floor", &floor);
|
||||
assert_eq!(a, engine_fingerprint("runtime-floor", &floor));
|
||||
assert_ne!(a, engine_fingerprint("moltenvk-m3", &mvk));
|
||||
}
|
||||
|
||||
@@ -775,7 +775,7 @@ mod tests {
|
||||
product,
|
||||
lane_version: ENGINE_CENSUS_VERSION,
|
||||
semantics: metal2vulkan::cache::SEMANTICS_VERSION,
|
||||
profile: ("vk12-floor".into(), [1; 32]),
|
||||
profile: ("runtime-floor".into(), [1; 32]),
|
||||
tools: vec![
|
||||
("llvm-as".into(), "LLVM version 23.1.2".into()),
|
||||
("spirv-val".into(), "SPIRV-Tools v2026.3".into()),
|
||||
@@ -789,7 +789,7 @@ mod tests {
|
||||
before.product.as_bytes(),
|
||||
&ENGINE_CENSUS_VERSION.to_le_bytes(),
|
||||
&metal2vulkan::cache::SEMANTICS_VERSION.to_le_bytes(),
|
||||
b"vk12-floor",
|
||||
b"runtime-floor",
|
||||
&[1; 32],
|
||||
b"llvm-as",
|
||||
b"LLVM version 23.1.2",
|
||||
@@ -824,7 +824,7 @@ mod tests {
|
||||
changed(|key| key.semantics += 1),
|
||||
changed(|key| key.lane_version += 1),
|
||||
changed(|key| key.profile = ("moltenvk-m3".into(), [1; 32])),
|
||||
changed(|key| key.profile = ("vk12-floor".into(), [2; 32])),
|
||||
changed(|key| key.profile = ("runtime-floor".into(), [2; 32])),
|
||||
changed(|key| key.tools[0].1 = "LLVM version 24.0.0".into()),
|
||||
changed(|key| key.tools[1].1 = "unavailable".into()),
|
||||
];
|
||||
@@ -855,8 +855,8 @@ mod tests {
|
||||
);
|
||||
|
||||
// This build's keys take the product fingerprint.
|
||||
let floor = crate::engine::load_profile("vk12-floor").unwrap();
|
||||
let current = CensusKey::engine("vk12-floor", &floor);
|
||||
let floor = crate::engine::load_profile("runtime-floor").unwrap();
|
||||
let current = CensusKey::engine("runtime-floor", &floor);
|
||||
assert_eq!(current.product, PRODUCT_FINGERPRINT);
|
||||
assert_eq!(
|
||||
(current.lane_version, current.semantics),
|
||||
@@ -865,7 +865,10 @@ mod tests {
|
||||
metal2vulkan::cache::SEMANTICS_VERSION
|
||||
)
|
||||
);
|
||||
assert_eq!(current.profile, ("vk12-floor".into(), floor.fingerprint()));
|
||||
assert_eq!(
|
||||
current.profile,
|
||||
("runtime-floor".into(), floor.fingerprint())
|
||||
);
|
||||
let tools: Vec<_> = current
|
||||
.tools
|
||||
.iter()
|
||||
@@ -873,7 +876,7 @@ mod tests {
|
||||
.collect();
|
||||
assert_eq!(tools, CENSUS_TOOLS);
|
||||
assert_eq!(
|
||||
engine_fingerprint("vk12-floor", &floor),
|
||||
engine_fingerprint("runtime-floor", &floor),
|
||||
current.fingerprint()
|
||||
);
|
||||
}
|
||||
@@ -885,8 +888,8 @@ mod tests {
|
||||
let (_scratch, index) = index();
|
||||
let mut a = new_result("a", Outcome::Translated);
|
||||
a.attempt.words = Some(150);
|
||||
write_engine_results(&index, "vk12-floor", "fp1", &[a]).unwrap();
|
||||
let rows = engine_cost_rows(&index, "vk12-floor", "fp1").unwrap();
|
||||
write_engine_results(&index, "runtime-floor", "fp1", &[a]).unwrap();
|
||||
let rows = engine_cost_rows(&index, "runtime-floor", "fp1").unwrap();
|
||||
assert_eq!(rows.len(), 1);
|
||||
assert_eq!(rows[0].cost.words, Some(150));
|
||||
Connection::open(&index)
|
||||
@@ -897,6 +900,9 @@ mod tests {
|
||||
status TEXT NOT NULL);",
|
||||
)
|
||||
.unwrap();
|
||||
assert_eq!(engine_cost_rows(&index, "vk12-floor", "fp1").unwrap(), rows);
|
||||
assert_eq!(
|
||||
engine_cost_rows(&index, "runtime-floor", "fp1").unwrap(),
|
||||
rows
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -805,7 +805,7 @@ while [ $# -gt 0 ]; do
|
||||
*) shift 2 ;;
|
||||
esac
|
||||
done
|
||||
[ "$profile" = vk12-floor ] || exit 9
|
||||
[ "$profile" = runtime-floor ] || exit 9
|
||||
printf '{{"case_id":"%s","environment_id":"%s","status":"match"}}\n' "$id" "{ENV}@engine@$profile$leg" \
|
||||
>> "$store/observations/vulkan/{shard}"
|
||||
echo "Match $id"
|
||||
@@ -813,7 +813,7 @@ echo "Match $id"
|
||||
),
|
||||
);
|
||||
let config = BatchConfig {
|
||||
restricted_to: Some("vk12-floor".into()),
|
||||
restricted_to: Some("runtime-floor".into()),
|
||||
..config(scratch.path(), executor, Duration::from_secs(60))
|
||||
};
|
||||
let legs = [Leg::Stated, Leg::RobustnessOff].map(Pass::Leg);
|
||||
@@ -831,7 +831,11 @@ echo "Match $id"
|
||||
rows.sort();
|
||||
assert_eq!(
|
||||
rows,
|
||||
["@engine@vk12-floor", "@engine@vk12-floor+robustness-off"].map(|slot| format!(
|
||||
[
|
||||
"@engine@runtime-floor",
|
||||
"@engine@runtime-floor+robustness-off"
|
||||
]
|
||||
.map(|slot| format!(
|
||||
r#"{{"case_id":"{}","environment_id":"{ENV}{slot}","status":"match"}}"#,
|
||||
matching.case_id
|
||||
))
|
||||
@@ -842,7 +846,7 @@ echo "Match $id"
|
||||
.unwrap()
|
||||
.restricted_to
|
||||
.as_deref(),
|
||||
Some("vk12-floor")
|
||||
Some("runtime-floor")
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1273,14 +1277,14 @@ fn an_out_directory_resumes_only_its_own_build() {
|
||||
};
|
||||
assert!(BatchBuild::claim(&other_backend).is_err());
|
||||
let restricted = BatchConfig {
|
||||
restricted_to: Some("vk12-floor".into()),
|
||||
restricted_to: Some("runtime-floor".into()),
|
||||
..config.clone()
|
||||
};
|
||||
assert!(BatchBuild::claim(&restricted).is_err());
|
||||
// A restricted batch's record names its profile; an unrestricted one's has no field for it.
|
||||
assert_eq!(
|
||||
BatchBuild::of(&restricted).restricted_to.as_deref(),
|
||||
Some("vk12-floor")
|
||||
Some("runtime-floor")
|
||||
);
|
||||
assert!(!serde_json::to_string(&recorded)
|
||||
.unwrap()
|
||||
|
||||
@@ -776,7 +776,7 @@ mod tests {
|
||||
return;
|
||||
};
|
||||
// SwiftShader reads storage images only with a format, so the texture needs its input.
|
||||
let device = worker_device("swiftshader");
|
||||
let device = worker_device("runtime-floor");
|
||||
let case = ComputeCase {
|
||||
out_of_bounds: Vec::new(),
|
||||
creation_bound: crate::budgets::PIPELINE_CREATION_CEILING,
|
||||
@@ -1055,7 +1055,7 @@ mod tests {
|
||||
let Some(bitcode) = fixture("store_const.ll") else {
|
||||
return;
|
||||
};
|
||||
let device = worker_device("vk12-floor");
|
||||
let device = worker_device("runtime-floor");
|
||||
for (source, entry, label) in [
|
||||
(bitcode.as_slice(), "no_such_entry", "invalid_descriptor"),
|
||||
(b"not bitcode".as_slice(), "main", "invalid_input"),
|
||||
@@ -1393,7 +1393,7 @@ mod tests {
|
||||
};
|
||||
compile(
|
||||
&CompileWorker::lib_tests_as(&probe.name()).unwrap(),
|
||||
&worker_device("vk12-floor"),
|
||||
&worker_device("runtime-floor"),
|
||||
&[crate::acceptance::retained(b"bitcode")],
|
||||
&request,
|
||||
)
|
||||
|
||||
@@ -340,7 +340,7 @@ fn the_input_and_every_typed_result_cross_the_boundary() {
|
||||
restricted(DeviceType::Cpu, "gate-lavapipe"),
|
||||
DeviceInput {
|
||||
leg: Leg::RobustnessOff,
|
||||
..restricted(DeviceType::Cpu, "vk12-floor")
|
||||
..restricted(DeviceType::Cpu, "runtime-floor")
|
||||
},
|
||||
DeviceInput {
|
||||
generated_commands: false,
|
||||
@@ -415,7 +415,7 @@ fn a_worker_run_under_another_restriction_is_refused() {
|
||||
(input(DeviceType::Cpu), Some("gate-lavapipe")),
|
||||
(
|
||||
restricted(DeviceType::Cpu, "gate-lavapipe"),
|
||||
Some("vk12-floor"),
|
||||
Some("runtime-floor"),
|
||||
),
|
||||
];
|
||||
for (input, census) in runs {
|
||||
|
||||
@@ -290,7 +290,21 @@ fn case_compiles_lists_the_replay_variants_where_the_device_replay_runs() {
|
||||
prepare_case(device, admitted).unwrap_or_else(|error| panic!("preparation: {error}"))
|
||||
};
|
||||
let profile = |label: &str| CensusProfile::load(&ProfileLeg::parse(label).unwrap()).unwrap();
|
||||
let (lavapipe, floor) = (profile("lavapipe"), profile("vk12-floor"));
|
||||
let lavapipe = profile("lavapipe");
|
||||
// A device without device addresses (`runtime-floor` without `bufferDeviceAddress`, below the
|
||||
// runtime's floor): the GPU-encoded command buffers replay on the host there.
|
||||
let floor = {
|
||||
let mut description =
|
||||
metal2vulkan_validation::engine::load_description("runtime-floor").unwrap();
|
||||
assert!(description
|
||||
.features
|
||||
.remove(&metal2vulkan::device::VkFeature::BufferDeviceAddress));
|
||||
metal2vulkan_validation::worker::compile::WorkerDevice::new(
|
||||
description,
|
||||
metal2vulkan::device::DevicePolicy::default(),
|
||||
)
|
||||
.unwrap()
|
||||
};
|
||||
|
||||
let (scratch, case) =
|
||||
corpus_with_templates("gpu-encoded-buffers-keep-the-host-encoded-dispatches");
|
||||
@@ -313,12 +327,12 @@ fn case_compiles_lists_the_replay_variants_where_the_device_replay_runs() {
|
||||
.expect("a device-replayed case's digest");
|
||||
let again = compile_prepared(&compute, &worker, &lavapipe.device);
|
||||
assert_eq!(again.artifact, Some(digest));
|
||||
let on_host = case_compiles(&compute, &floor.device).unwrap();
|
||||
let on_host = case_compiles(&compute, &floor).unwrap();
|
||||
assert_eq!(on_host.host_replayed, 1);
|
||||
assert_eq!(on_host.compiles.len(), 1);
|
||||
// Where the host replay runs a command buffer, the census compiles less than the run does:
|
||||
// no digest.
|
||||
let host = compile_prepared(&compute, &worker, &floor.device);
|
||||
let host = compile_prepared(&compute, &worker, &floor);
|
||||
assert_eq!(host.artifact, None, "{host:?}");
|
||||
|
||||
let (scratch, case) =
|
||||
|
||||
@@ -225,7 +225,7 @@ fn a_vertex_function_and_a_refusal_cross_the_worker_boundary() {
|
||||
|
||||
#[test]
|
||||
fn a_program_that_does_not_serve_the_worker_is_a_worker_failure() {
|
||||
let device = device("vk12-floor");
|
||||
let device = device("runtime-floor");
|
||||
// `true` exits successfully without a result: the result cannot be read.
|
||||
match compile_compute(
|
||||
&CompileWorker::program("true"),
|
||||
|
||||
@@ -146,7 +146,7 @@ fn a_case_with_visible_function_references_compiles_linked_through_the_worker()
|
||||
}
|
||||
|
||||
let worker = worker();
|
||||
for stem in ["moltenvk-m3", "vk12-floor", "lavapipe"] {
|
||||
for stem in ["moltenvk-m3", "runtime-floor", "lavapipe"] {
|
||||
let device =
|
||||
WorkerDevice::new(load_description(stem).unwrap(), DevicePolicy::default()).unwrap();
|
||||
let profile = device.device().profile();
|
||||
@@ -278,7 +278,7 @@ fn a_case_with_a_visible_function_table_binds_the_products_table_words() {
|
||||
}
|
||||
|
||||
let worker = worker();
|
||||
for stem in ["moltenvk-m3", "vk12-floor", "lavapipe"] {
|
||||
for stem in ["moltenvk-m3", "runtime-floor", "lavapipe"] {
|
||||
let device =
|
||||
WorkerDevice::new(load_description(stem).unwrap(), DevicePolicy::default()).unwrap();
|
||||
let profile = device.device().profile();
|
||||
|
||||
@@ -56,7 +56,7 @@ fn engine_selection_reads_only_the_selected_row_and_names_its_engine() {
|
||||
&["--hash", hash.as_str(), "--compile-only"][..],
|
||||
&[
|
||||
"--profile",
|
||||
"vk12-floor",
|
||||
"runtime-floor",
|
||||
"--hash",
|
||||
hash.as_str(),
|
||||
"--compile-only",
|
||||
@@ -92,7 +92,13 @@ fn a_fetch_without_an_ordered_form_compiles_noted() {
|
||||
eprintln!("SKIPPED the compile check: {why}");
|
||||
return;
|
||||
}
|
||||
let args = ["--profile", "vk12-floor", "--hash", &hash, "--compile-only"];
|
||||
let args = [
|
||||
"--profile",
|
||||
"runtime-floor",
|
||||
"--hash",
|
||||
&hash,
|
||||
"--compile-only",
|
||||
];
|
||||
let compiled = String::from_utf8(run(&args).stdout).unwrap();
|
||||
assert_eq!(compiled.lines().count(), 1, "{compiled}");
|
||||
assert!(compiled.contains("\tCOMPILED\t"), "{compiled}");
|
||||
|
||||
@@ -286,7 +286,7 @@ entry:
|
||||
.args(roots)
|
||||
.args(["--audit", "authored-compile", "--case"])
|
||||
.arg(&case_id)
|
||||
.args(["--profile", "vk12-floor"])
|
||||
.args(["--profile", "runtime-floor"])
|
||||
.output()
|
||||
.unwrap();
|
||||
let text = format!(
|
||||
@@ -297,7 +297,7 @@ entry:
|
||||
assert!(output.status.success(), "{text}");
|
||||
assert!(
|
||||
text.contains(&format!(
|
||||
"authored-compile-cell\t{case_id}\tprofile=vk12-floor\toutcome=compiled\t"
|
||||
"authored-compile-cell\t{case_id}\tprofile=runtime-floor\toutcome=compiled\t"
|
||||
)),
|
||||
"{text}"
|
||||
);
|
||||
|
||||
@@ -56,7 +56,7 @@ fn census(corpus: &Path, hashes: &Path, spirv_val: &Path) -> String {
|
||||
"--audit",
|
||||
"translation",
|
||||
"--profile",
|
||||
"vk12-floor",
|
||||
"runtime-floor",
|
||||
"--hash-file",
|
||||
])
|
||||
.arg(hashes)
|
||||
|
||||
@@ -203,7 +203,7 @@ fn the_ledger_carries_the_payloads_of_a_call_heavy_body() {
|
||||
);
|
||||
|
||||
// Planning the call-heavy entry keeps the ledger at the floor of the allocator peak.
|
||||
let profile = load_profile("vk12-floor").expect("profile");
|
||||
let profile = load_profile("runtime-floor").expect("profile");
|
||||
let entry = EntryDescriptor::new(&bitcode, EntryRef::Name("call_payloads"));
|
||||
let budget = Budget::default();
|
||||
let ((plan, report), allocator) =
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
//! It compiles a kernel for the committed `moltenvk-m3` profile (and the same kernel as a bare
|
||||
//! module's entry, linked alone), prints its pipeline interface, layout, and binding plan,
|
||||
//! instantiates one dispatch, round-trips the pipeline through its cache encoding, answers a
|
||||
//! pipeline-input request, shows a typed refusal on `vk12-floor`, dispatches a kernel with
|
||||
//! pipeline-input request, shows a typed refusal on `runtime-floor`, dispatches a kernel with
|
||||
//! `[[stage_in]]`, and compiles, plans, and draws a render pipeline and a tessellation pipeline. `tests/api_preview_example.rs` runs it in the gate and checks that
|
||||
//! every code block of `docs/API.md` is quoted from it.
|
||||
|
||||
@@ -249,8 +249,8 @@ pub fn main() -> Result<()> {
|
||||
println!("function constant supplied: {:?}", specialized.key);
|
||||
|
||||
// 8. A typed refusal: fragment function `sample_min_lod` clamps its level of detail, which
|
||||
// needs `shaderResourceMinLod`; the `vk12-floor` profile lacks it.
|
||||
let floor = committed_device("vk12-floor")?;
|
||||
// needs `shaderResourceMinLod`; the `runtime-floor` profile lacks it.
|
||||
let floor = committed_device("runtime-floor")?;
|
||||
let min_lod = FunctionDescriptor::new(sampling.function("sample_min_lod")?);
|
||||
match floor.compile_function(&min_lod, &LoweringInputs::new(), &Budget::standard()) {
|
||||
Err(Error::Unsupported(refusal)) => match (&refusal.feature, &refusal.needs) {
|
||||
@@ -260,7 +260,7 @@ pub fn main() -> Result<()> {
|
||||
(feature, needs) => println!("refused {feature:?}: {needs:?}"),
|
||||
},
|
||||
Err(other) => return Err(other.into()),
|
||||
Ok(_) => return Err("vk12-floor compiled sample_min_lod".into()),
|
||||
Ok(_) => return Err("runtime-floor compiled sample_min_lod".into()),
|
||||
}
|
||||
|
||||
stage_in(&device, &budget)?;
|
||||
|
||||
@@ -1175,9 +1175,13 @@ fn a_late_cubic_sampler_is_listed_with_its_cubic_bit_beside_tested_stages() {
|
||||
#[test]
|
||||
fn sampler_tables_admit_the_shapes_the_plan_s_checks_pass() {
|
||||
let profile = m3();
|
||||
let floor =
|
||||
crate::pipeline::testing::profile("vk12-floor", crate::device::DevicePolicy::default())
|
||||
.expect("profile");
|
||||
// The runtime's floor requires `samplerAnisotropy`; a device without it is below the floor.
|
||||
let floor = crate::pipeline::testing::profile_without(
|
||||
"runtime-floor",
|
||||
&[crate::device::requirements::VkFeature::SamplerAnisotropy],
|
||||
crate::device::DevicePolicy::default(),
|
||||
)
|
||||
.expect("profile");
|
||||
let placement = HeapPlacement::ResourceId;
|
||||
let planned = PlannedHandleTable {
|
||||
set: 0,
|
||||
@@ -1256,7 +1260,7 @@ fn sampler_tables_admit_the_shapes_the_plan_s_checks_pass() {
|
||||
.enabled
|
||||
.features
|
||||
.contains(&crate::device::requirements::VkFeature::SamplerAnisotropy),
|
||||
"vk12-floor states samplerAnisotropy"
|
||||
"the floor without samplerAnisotropy states it"
|
||||
);
|
||||
assert!(
|
||||
!held_on(&floor, &sampled, anisotropic),
|
||||
|
||||
@@ -491,7 +491,10 @@ fn view_aspects_and_the_default_storage_choice() {
|
||||
}
|
||||
// SwiftShader's `R32_UINT` buffer features lack `STORAGE_WRITE_WITHOUT_FORMAT` though it has
|
||||
// `shaderStorageImageWriteWithoutFormat`; lavapipe's state it.
|
||||
assert!(texel_variants.contains("swiftshader"), "{texel_variants:?}");
|
||||
assert!(
|
||||
texel_variants.contains("runtime-floor"),
|
||||
"{texel_variants:?}"
|
||||
);
|
||||
assert!(!texel_variants.contains("lavapipe"), "{texel_variants:?}");
|
||||
// A view format without a SPIR-V image format is declared formatless.
|
||||
let bgra = StorageImageChoice::new(vk::Format::B8G8R8A8_UNORM, StorageImageClass::SrgbEncode);
|
||||
@@ -584,7 +587,8 @@ fn a_depth_read_as_colour_replicates_its_depth_as_metal_does() {
|
||||
/// refused nowhere (without `samplerAnisotropy` the Vulkan sampler is isotropic and the module
|
||||
/// emulates Metal's filter or announces the device's), a min reduction reads the weighted average,
|
||||
/// refused nowhere, and an axis clamping to zero beside one clamping to a white border reads the one
|
||||
/// color, refused nowhere. Every refusal kind occurs on some committed profile.
|
||||
/// color, refused nowhere. Every refusal kind occurs on some committed profile or on
|
||||
/// `runtime-floor` without `samplerMirrorClampToEdge` (below the runtime's floor, which requires it).
|
||||
#[test]
|
||||
fn runtime_sampler_values_are_checked_at_plan_time() {
|
||||
use crate::bind::state::SamplerDescriptor;
|
||||
@@ -620,7 +624,17 @@ fn runtime_sampler_values_are_checked_at_plan_time() {
|
||||
cases.push(("inverted LOD", d));
|
||||
let mut refused = BTreeMap::new();
|
||||
let mut accepted = BTreeMap::new();
|
||||
for (stem, p) in crate::spirv::testing::committed_profiles().expect("profiles") {
|
||||
let mut profiles = crate::spirv::testing::committed_profiles().expect("profiles");
|
||||
profiles.push((
|
||||
"runtime-floor without samplerMirrorClampToEdge".into(),
|
||||
crate::pipeline::testing::profile_without(
|
||||
"runtime-floor",
|
||||
&[crate::device::requirements::VkFeature::SamplerMirrorClampToEdge],
|
||||
crate::device::DevicePolicy::default(),
|
||||
)
|
||||
.expect("profile"),
|
||||
));
|
||||
for (stem, p) in profiles {
|
||||
for compare in [false, true] {
|
||||
let mut slots = BTreeMap::new();
|
||||
slots.insert(
|
||||
@@ -902,7 +916,7 @@ fn a_linear_compare_sampler_needs_no_filterable_view() {
|
||||
}
|
||||
if compare && !filterable {
|
||||
unfilterable += 1;
|
||||
floor_seen |= stem == "vk12-floor";
|
||||
floor_seen |= stem == "runtime-floor";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -71,7 +71,8 @@ fn planned(index: u32, bound: BoundKind, form: BufferForm) -> PlannedBuffer {
|
||||
|
||||
/// On Profile A a large bound buffer under a `BufferRangeLimit` fact needs the variant, in either
|
||||
/// form (a fixed point); a small one, an unbound slot, or a slot without the fact does not.
|
||||
/// Profile F honors the fact at instantiation and never asks for a variant.
|
||||
/// Profile F (below the runtime's floor, [`PROFILE_F`](crate::pipeline::testing::PROFILE_F))
|
||||
/// honors the fact at instantiation and never asks for a variant.
|
||||
#[test]
|
||||
fn a_large_buffer_needs_the_device_address_variant_on_profile_a_only() {
|
||||
let deps = [0, 1, 2, 3].map(|n| RuntimeDependency {
|
||||
@@ -80,7 +81,13 @@ fn a_large_buffer_needs_the_device_address_variant_on_profile_a_only() {
|
||||
});
|
||||
let storage = BufferForm::Descriptor(DescriptorView::Storage);
|
||||
let mut seen = [false; 2];
|
||||
for (stem, p) in committed_profiles().expect("profiles") {
|
||||
let mut profiles = committed_profiles().expect("profiles");
|
||||
let f = crate::pipeline::testing::device_f(Default::default()).expect("Profile F");
|
||||
profiles.push((
|
||||
crate::pipeline::testing::PROFILE_F.to_string(),
|
||||
f.profile().clone(),
|
||||
));
|
||||
for (stem, p) in profiles {
|
||||
let max = u64::from(p.fields().limits.max_storage_buffer_range);
|
||||
let big = length_class(max.saturating_add(1));
|
||||
let small = length_class(max / 4);
|
||||
@@ -131,7 +138,7 @@ fn a_large_buffer_needs_the_device_address_variant_on_profile_a_only() {
|
||||
}
|
||||
}
|
||||
}
|
||||
assert_eq!(seen, [true, true], "both profile kinds are committed");
|
||||
assert_eq!(seen, [true, true], "both profile kinds are checked");
|
||||
}
|
||||
|
||||
/// A shape asks for the storage-view variant exactly when it binds, at a slot the pipeline views as
|
||||
@@ -140,7 +147,8 @@ fn a_large_buffer_needs_the_device_address_variant_on_profile_a_only() {
|
||||
/// and the slots the pipeline was compiled keeping, so the variant's plan restates it.
|
||||
#[test]
|
||||
fn a_large_viewed_slot_asks_for_every_large_candidate_to_stay_storage() {
|
||||
let p = crate::pipeline::testing::profile("vk12-floor", Default::default()).expect("profile");
|
||||
let p =
|
||||
crate::pipeline::testing::profile("runtime-floor", Default::default()).expect("profile");
|
||||
let max = u64::from(p.fields().limits.max_uniform_buffer_range);
|
||||
let big = BoundKind::Buffer {
|
||||
device_address: false,
|
||||
|
||||
@@ -36,7 +36,7 @@ const C: (u64, u64, u64) = (0x0000_0001_0002_0000, 0x0000_0022_0000_0000, 100);
|
||||
/// The device address of the consumer's upload of inline bytes the encoder bound.
|
||||
const BYTES: u64 = 0x0000_0023_0000_0040;
|
||||
|
||||
/// Every committed profile as a device, by stem.
|
||||
/// Every committed profile as a device, by stem, then Profile F's.
|
||||
fn devices() -> Vec<(String, Device)> {
|
||||
let dir = PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("../metal2vulkan-validation/profiles");
|
||||
let mut out: Vec<(String, Device)> = std::fs::read_dir(&dir)
|
||||
@@ -58,6 +58,9 @@ fn devices() -> Vec<(String, Device)> {
|
||||
})
|
||||
.collect();
|
||||
out.sort_by(|a, b| a.0.cmp(&b.0));
|
||||
// Profile F, below the runtime's floor: the form of a device without device addresses.
|
||||
let f = crate::pipeline::testing::device_f(DevicePolicy::default()).expect("Profile F");
|
||||
out.push((crate::pipeline::testing::PROFILE_F.to_string(), f));
|
||||
out
|
||||
}
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ fn token(t: u64) -> NonZeroU64 {
|
||||
NonZeroU64::new(t).expect("token")
|
||||
}
|
||||
|
||||
/// Every committed profile as a device, by stem.
|
||||
/// Every committed profile as a device, by stem, then Profile F's.
|
||||
fn devices() -> Vec<(String, Device)> {
|
||||
let dir = PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("../metal2vulkan-validation/profiles");
|
||||
let mut out: Vec<(String, Device)> = std::fs::read_dir(&dir)
|
||||
@@ -62,6 +62,9 @@ fn devices() -> Vec<(String, Device)> {
|
||||
})
|
||||
.collect();
|
||||
out.sort_by(|a, b| a.0.cmp(&b.0));
|
||||
// Profile F, below the runtime's floor: the form of a device without device addresses.
|
||||
let f = crate::pipeline::testing::device_f(DevicePolicy::default()).expect("Profile F");
|
||||
out.push((crate::pipeline::testing::PROFILE_F.to_string(), f));
|
||||
out
|
||||
}
|
||||
|
||||
|
||||
+4
-3
@@ -251,7 +251,7 @@ fn foreign_bytes_are_refused() {
|
||||
let Some((compiled, pipe)) = store_const(&dev) else {
|
||||
return;
|
||||
};
|
||||
let other = device("vk12-floor");
|
||||
let other = device("runtime-floor");
|
||||
assert_ne!(other.profile().fingerprint(), dev.profile().fingerprint());
|
||||
assert_eq!(
|
||||
CompiledFunction::from_bytes(&compiled.to_bytes(), &other),
|
||||
@@ -1492,7 +1492,8 @@ fn the_storage_view_variant_round_trips() {
|
||||
use crate::bind::{BindState, BoundBuffer, StageTable};
|
||||
use crate::cache::VariantKey;
|
||||
use crate::pipeline::facts::{RuntimeFact, UniformViewChoice};
|
||||
let dev = device("vk12-floor");
|
||||
// Profile F's descriptor buffers: four storage buffers a stage, below the runtime's floor.
|
||||
let dev = crate::pipeline::testing::device_f(DevicePolicy::default()).expect("device");
|
||||
let Some(bc) = fixture("descriptor_limit_uniform_views") else {
|
||||
return;
|
||||
};
|
||||
@@ -2107,7 +2108,7 @@ fn a_descriptors_answers_and_reflection_round_trip_under_its_key() {
|
||||
DirectArgumentUse, LinkedUseAnswers, LinkedUseGap, UnwrittenFragmentInputs,
|
||||
};
|
||||
let dev = device("moltenvk-m3");
|
||||
let other = device("vk12-floor");
|
||||
let other = device("runtime-floor");
|
||||
let key = PipelineKey::new([3; 32]);
|
||||
let wrong_key = PipelineKey::new([4; 32]);
|
||||
let mut answers = LinkedUseAnswers::default();
|
||||
|
||||
@@ -21,7 +21,7 @@ use crate::device::profile::{
|
||||
};
|
||||
use crate::device::requirements::{
|
||||
ApiVersion, FloatControl, FloatWidth, FormatUsage, ResolveMode, SubgroupOp, VkExtension,
|
||||
VkFeature, VkProperty,
|
||||
VkFeature, VkLimit, VkProperty,
|
||||
};
|
||||
use crate::device::subgroup::{OpBits, StageSubgroup, SubgroupModel, SubgroupSizes};
|
||||
use crate::error::{Capability, DescriptorError, Error, Feature, Unsupported};
|
||||
@@ -59,7 +59,9 @@ impl Device {
|
||||
/// ([`DeviceDescription::from_khronos_json`]) or built field by field
|
||||
/// ([`DeviceDescription::new`]) makes a device with no `VkDevice` behind it.
|
||||
///
|
||||
/// Refuses a device below Vulkan 1.2 (`Unsupported{VulkanVersion}`), a description that lists
|
||||
/// Refuses a device below Vulkan 1.2 (`Unsupported{VulkanVersion}`), a device whose
|
||||
/// `maxPushConstantsSize` is below the 256 bytes of the push window every stage is lowered for
|
||||
/// (`Unsupported{PushWindow}`, a `Limit` of `MaxPushConstantsSize`), a description that lists
|
||||
/// a feature neither its version nor its listed extensions expose or a feature without the
|
||||
/// feature Vulkan requires enabled with it (`InvalidDescriptor`, the invariants
|
||||
/// `device::enables` states), a policy that turns containment off while guest isolation
|
||||
@@ -83,6 +85,18 @@ impl Device {
|
||||
)
|
||||
.into());
|
||||
}
|
||||
let push = desc.limits.max_push_constants_size;
|
||||
if push < crate::lower::push::FLOOR_BYTES {
|
||||
return Err(Unsupported::needs(
|
||||
Feature::PushWindow,
|
||||
Capability::Limit {
|
||||
limit: VkLimit::MaxPushConstantsSize,
|
||||
required: u64::from(crate::lower::push::FLOOR_BYTES),
|
||||
available: u64::from(push),
|
||||
},
|
||||
)
|
||||
.into());
|
||||
}
|
||||
crate::device::enables::check_invariants(&desc)?;
|
||||
identity_domains(&desc, &policy)?;
|
||||
let profile = DeviceProfile::of(derive_fields(&desc, &policy));
|
||||
|
||||
@@ -947,7 +947,7 @@ fn float_controls(p: &Props<'_>) -> Result<FloatControls, Error> {
|
||||
|
||||
/// The limits and subgroup properties every device of `version` guarantees, for the members the
|
||||
/// core reads: the Vulkan "Required Limits" table as transcribed by Vulkan-Profiles
|
||||
/// `VP_LUNARG_minimum_requirements_1_2` (the source of the committed `vk12-floor` profile), plus
|
||||
/// `VP_LUNARG_minimum_requirements_1_2` (the source of `below-floor/vk12-floor`), plus
|
||||
/// `maxBufferSize ≥ 2^30` from Vulkan 1.3. A Khronos *profile* document states only what it
|
||||
/// raises above its base version, so an omitted member means this value, never "unsupported".
|
||||
/// Device reports list every member and are not affected.
|
||||
|
||||
@@ -36,6 +36,16 @@ pub(super) fn committed_profiles() -> Vec<(String, String)> {
|
||||
out
|
||||
}
|
||||
|
||||
/// `runtime-floor` without `features`. Without a feature the runtime's floor requires, the
|
||||
/// description is below that floor: a test of a form only such a device takes builds it so.
|
||||
pub(super) fn floor_without(features: &[VkFeature]) -> DeviceDescription {
|
||||
let mut d = profile("runtime-floor");
|
||||
for f in features {
|
||||
d.features.remove(f);
|
||||
}
|
||||
d
|
||||
}
|
||||
|
||||
/// The description of one committed profile.
|
||||
pub(super) fn profile(stem: &str) -> DeviceDescription {
|
||||
let (_, text) = committed_profiles()
|
||||
|
||||
@@ -14,14 +14,11 @@ const COMMITTED: &[&str] = &[
|
||||
"intel-irisxe-rplp-anv",
|
||||
"intel-uhd770-rpls-anv",
|
||||
"lavapipe",
|
||||
"lunarg-desktop-baseline-2023",
|
||||
"moltenvk-m3",
|
||||
"nvidia-pascal-linux",
|
||||
"nvidia-rtx50-linux",
|
||||
"nvidia-rtx5080-laptop",
|
||||
"roadmap-2022",
|
||||
"swiftshader",
|
||||
"vk12-floor",
|
||||
"runtime-floor",
|
||||
];
|
||||
|
||||
#[test]
|
||||
@@ -101,17 +98,17 @@ fn device_reports_carry_identity_and_formats() {
|
||||
assert!(nv.has(VkFeature::ShaderInt64));
|
||||
}
|
||||
|
||||
/// The floor is Vulkan 1.2 core: no optional feature, not even one the product uses where present
|
||||
/// (narrow integers and storage access, formatless storage images), since no product path needs
|
||||
/// one.
|
||||
/// `runtime-floor` is Vulkan 1.3 core and what the runtime requires of every device: the floor's
|
||||
/// features (64-bit and narrow integers, narrow storage access, device addresses, writes without a
|
||||
/// format) and none it leaves optional (reads without a format, 64-bit floats), and the Vulkan 1.2
|
||||
/// Required Format Support tables' entries for the features it requires.
|
||||
#[test]
|
||||
fn vk12_floor_is_vulkan_1_2_core() {
|
||||
let d = profile("vk12-floor");
|
||||
assert_eq!(d.api_version, ApiVersion::V1_2);
|
||||
// Vulkan 1.2 requires uniformBufferStandardLayout.
|
||||
assert!(d.has(VkFeature::UniformBufferStandardLayout));
|
||||
assert!(d.has(VkFeature::RobustBufferAccess));
|
||||
fn runtime_floor_is_vulkan_1_3_core_and_the_runtime_s_floor() {
|
||||
let d = profile("runtime-floor");
|
||||
assert_eq!(d.api_version, ApiVersion::V1_3);
|
||||
for f in [
|
||||
VkFeature::UniformBufferStandardLayout,
|
||||
VkFeature::RobustBufferAccess,
|
||||
VkFeature::ShaderInt16,
|
||||
VkFeature::ShaderInt64,
|
||||
VkFeature::BufferDeviceAddress,
|
||||
@@ -120,15 +117,16 @@ fn vk12_floor_is_vulkan_1_2_core() {
|
||||
VkFeature::SubgroupSizeControl,
|
||||
VkFeature::StorageBuffer8BitAccess,
|
||||
VkFeature::StorageBuffer16BitAccess,
|
||||
VkFeature::ShaderStorageImageReadWithoutFormat,
|
||||
VkFeature::ShaderStorageImageWriteWithoutFormat,
|
||||
] {
|
||||
assert!(d.has(f), "{f:?}");
|
||||
}
|
||||
for f in [
|
||||
VkFeature::ShaderStorageImageReadWithoutFormat,
|
||||
VkFeature::ShaderFloat64,
|
||||
] {
|
||||
assert!(!d.has(f), "{f:?}");
|
||||
}
|
||||
// The formats are the Vulkan 1.2 Required Format Support tables' unconditional entries: a
|
||||
// storage view of a 8-bit format needs shaderStorageImageExtendedFormats, and depth attachments
|
||||
// other than D16 and the compressed families are choices.
|
||||
assert_eq!(d.formats.formats.len(), 56);
|
||||
for usage in [
|
||||
FormatUsage::SampledImage,
|
||||
FormatUsage::SampledImageFilterLinear,
|
||||
@@ -145,8 +143,12 @@ fn vk12_floor_is_vulkan_1_2_core() {
|
||||
assert!(d
|
||||
.formats
|
||||
.supports(vk::Format::D16_UNORM, FormatUsage::DepthStencilAttachment));
|
||||
// A storage view of an 8-bit format: `shaderStorageImageExtendedFormats`, which the floor
|
||||
// requires.
|
||||
assert!(d
|
||||
.formats
|
||||
.supports(vk::Format::R8_UNORM, FormatUsage::StorageImage));
|
||||
for (format, usage) in [
|
||||
(vk::Format::R8_UNORM, FormatUsage::StorageImage),
|
||||
(vk::Format::D32_SFLOAT, FormatUsage::DepthStencilAttachment),
|
||||
(vk::Format::BC1_RGBA_UNORM_BLOCK, FormatUsage::SampledImage),
|
||||
(
|
||||
@@ -158,7 +160,8 @@ fn vk12_floor_is_vulkan_1_2_core() {
|
||||
}
|
||||
assert_eq!(d.driver_id, None);
|
||||
assert_eq!(d.limits.max_compute_shared_memory_size, 16384);
|
||||
assert_eq!(d.limits.max_compute_work_group_size, [128, 128, 64]);
|
||||
assert_eq!(d.limits.max_compute_work_group_size, [1024, 1024, 64]);
|
||||
assert_eq!(d.limits.max_push_constants_size, 256);
|
||||
assert_eq!(d.limits.min_storage_buffer_offset_alignment, 256);
|
||||
}
|
||||
|
||||
@@ -170,8 +173,8 @@ fn divisor_first_instance_support_follows_exposure() {
|
||||
("lavapipe", false),
|
||||
("moltenvk-m3", true),
|
||||
("nvidia-rtx50-linux", true),
|
||||
("lunarg-desktop-baseline-2023", false),
|
||||
("vk12-floor", false),
|
||||
("runtime-floor", false),
|
||||
("runtime-floor", false),
|
||||
] {
|
||||
assert_eq!(
|
||||
profile(stem).limits.supports_non_zero_first_instance,
|
||||
@@ -195,8 +198,10 @@ fn rgba4_opaque_black_swizzled_follows_exposure() {
|
||||
r#""a""#,
|
||||
&format!(r#""a": {{"extensions": {{"VK_KHR_maintenance10": 1}}, {props}}}"#),
|
||||
);
|
||||
let d = DeviceDescription::from_khronos_json(&with, None).unwrap();
|
||||
let mut d = DeviceDescription::from_khronos_json(&with, None).unwrap();
|
||||
assert!(d.rgba4_opaque_black_swizzled);
|
||||
// The push window the floor needs, which a Vulkan 1.2 document leaves at 128.
|
||||
d.limits.max_push_constants_size = 256;
|
||||
let dev =
|
||||
crate::device::Device::from_queries(d, crate::device::DevicePolicy::default()).unwrap();
|
||||
assert!(dev
|
||||
@@ -230,11 +235,13 @@ fn the_arm_spelling_of_rasterization_order_access_is_the_ext_one() {
|
||||
"features": {{{feature}}}}}"#
|
||||
),
|
||||
);
|
||||
let d = DeviceDescription::from_khronos_json(&arm, None).unwrap();
|
||||
let mut d = DeviceDescription::from_khronos_json(&arm, None).unwrap();
|
||||
assert!(d
|
||||
.extensions
|
||||
.contains(&VkExtension::ExtRasterizationOrderAttachmentAccess));
|
||||
assert!(d.has(VkFeature::RasterizationOrderColorAttachmentAccess));
|
||||
// The push window the floor needs, which a Vulkan 1.2 document leaves at 128.
|
||||
d.limits.max_push_constants_size = 256;
|
||||
let dev =
|
||||
crate::device::Device::from_queries(d, crate::device::DevicePolicy::default()).unwrap();
|
||||
assert!(
|
||||
@@ -261,10 +268,10 @@ fn robust_buffer_access_update_after_bind_is_read_where_stated() {
|
||||
("lavapipe", true),
|
||||
("moltenvk-m3", true),
|
||||
("nvidia-rtx50-linux", true),
|
||||
("swiftshader", false),
|
||||
("lunarg-desktop-baseline-2023", false),
|
||||
("vk12-floor", false),
|
||||
("roadmap-2022", false),
|
||||
("runtime-floor", false),
|
||||
("runtime-floor", false),
|
||||
("runtime-floor", false),
|
||||
("runtime-floor", false),
|
||||
] {
|
||||
assert_eq!(
|
||||
profile(stem).robust_buffer_access_update_after_bind,
|
||||
@@ -387,7 +394,7 @@ fn portability_stride_alignment_follows_exposure() {
|
||||
for stem in [
|
||||
"lavapipe",
|
||||
"nvidia-rtx50-linux",
|
||||
"vk12-floor",
|
||||
"runtime-floor",
|
||||
"amd-rdna3-radv",
|
||||
] {
|
||||
assert_eq!(
|
||||
@@ -534,7 +541,7 @@ fn early_coverage_after_counting_reads_the_maintenance5_structure() {
|
||||
#[test]
|
||||
fn profile_documents_imply_version_required_features() {
|
||||
// The LunarG baseline lists 1.2 structures but not every member 1.2 requires.
|
||||
let d = profile("lunarg-desktop-baseline-2023");
|
||||
let d = profile("runtime-floor");
|
||||
assert!(d.has(VkFeature::ShaderSubgroupExtendedTypes));
|
||||
assert!(d.has(VkFeature::UniformBufferStandardLayout));
|
||||
}
|
||||
@@ -643,13 +650,13 @@ fn maintenance8_reads_its_extension_structure() {
|
||||
("intel-arl-anv", true),
|
||||
("intel-irisxe-anv", true),
|
||||
("lavapipe", true),
|
||||
("lunarg-desktop-baseline-2023", false),
|
||||
("runtime-floor", false),
|
||||
("moltenvk-m3", true),
|
||||
("nvidia-pascal-linux", true),
|
||||
("nvidia-rtx50-linux", true),
|
||||
("roadmap-2022", false),
|
||||
("swiftshader", false),
|
||||
("vk12-floor", false),
|
||||
("runtime-floor", false),
|
||||
("runtime-floor", false),
|
||||
("runtime-floor", false),
|
||||
] {
|
||||
assert_eq!(
|
||||
profile(stem).has(VkFeature::Maintenance8),
|
||||
@@ -702,7 +709,7 @@ fn border_color_swizzle_and_format_extensions_are_read() {
|
||||
] {
|
||||
assert!(mvk.extensions.contains(&ext), "moltenvk-m3 lists {ext:?}");
|
||||
}
|
||||
assert!(!profile("vk12-floor")
|
||||
assert!(!profile("runtime-floor")
|
||||
.extensions
|
||||
.contains(&VkExtension::KhrPortabilitySubset));
|
||||
}
|
||||
|
||||
@@ -35,9 +35,11 @@ fn description_error(result: Result<DeviceDescription, Error>) -> String {
|
||||
}
|
||||
}
|
||||
|
||||
/// A 1.2 description exposing only what `extensions` add to the floor.
|
||||
/// A 1.2 description, `runtime-floor` as a Vulkan 1.2 context reads it, exposing only what
|
||||
/// `extensions` add to it.
|
||||
fn floor_with(extensions: &[VkExtension], features: &[VkFeature]) -> DeviceDescription {
|
||||
let mut d = profile("vk12-floor");
|
||||
let mut d = crate::pipeline::testing::description_at_1_2("runtime-floor", false)
|
||||
.expect("runtime-floor");
|
||||
assert_eq!(d.api_version, ApiVersion::V1_2);
|
||||
d.extensions.extend(extensions.iter().copied());
|
||||
d.features.extend(features.iter().copied());
|
||||
@@ -47,8 +49,9 @@ fn floor_with(extensions: &[VkExtension], features: &[VkFeature]) -> DeviceDescr
|
||||
/// On every committed profile the recommendation lists only what the description lists, is closed
|
||||
/// (`with_enabled` accepts it, `Device::from_queries` accepts the result), and is a fixed point:
|
||||
/// the device made from it needs exactly it, as does the device made from the full description. It
|
||||
/// leaves out exactly the buffer update-after-bind features of the three profiles that list them
|
||||
/// with `robustBufferAccess` and without `robustBufferAccessUpdateAfterBind`.
|
||||
/// leaves out nothing: no committed profile lists the buffer update-after-bind features with
|
||||
/// `robustBufferAccess` and without `robustBufferAccessUpdateAfterBind`
|
||||
/// ([`a_recommendation_keeps_vuid_10247`] builds one).
|
||||
#[test]
|
||||
fn recommendations_are_closed_fixed_points_on_every_committed_profile() {
|
||||
let mut left_out = Vec::new();
|
||||
@@ -113,16 +116,7 @@ fn recommendations_are_closed_fixed_points_on_every_committed_profile() {
|
||||
}
|
||||
let m = profile("moltenvk-m3").recommended_enables();
|
||||
assert!(m.extensions.contains(&VkExtension::KhrPortabilitySubset));
|
||||
let stems: BTreeSet<&str> = left_out.iter().map(|(s, _)| s.as_str()).collect();
|
||||
assert_eq!(
|
||||
stems,
|
||||
set(&[
|
||||
"lunarg-desktop-baseline-2023",
|
||||
"roadmap-2022",
|
||||
"swiftshader"
|
||||
])
|
||||
);
|
||||
assert_eq!(left_out.len(), 9, "{left_out:?}");
|
||||
assert!(left_out.is_empty(), "{left_out:?}");
|
||||
}
|
||||
|
||||
/// A description listing `robustBufferAccess` and update-after-bind features: without
|
||||
@@ -160,16 +154,19 @@ fn recommendations_keep_robust_buffer_access_and_vuid_10247() {
|
||||
}
|
||||
}
|
||||
|
||||
/// SwiftShader's committed profile states `robustBufferAccessUpdateAfterBind` false and lists
|
||||
/// `robustBufferAccess` with the buffer update-after-bind features (the finding: a device made from
|
||||
/// the recommendation failed `vkCreateDevice`). Its recommendation now keeps the rule, so the
|
||||
/// `runtime-floor` with the buffer update-after-bind features and
|
||||
/// `robustBufferAccessUpdateAfterBind` false, as SwiftShader's report stated them beside
|
||||
/// `robustBufferAccess` (the finding: a device made from the recommendation failed
|
||||
/// `vkCreateDevice`). Its recommendation keeps the rule, so the
|
||||
/// stated robustness can be created; adding the buffer update-after-bind features to the restricted
|
||||
/// description changes only the profile's update-after-bind facts, which only the set-1 arrays that
|
||||
/// need them read (the function tables', the texel-buffer classes'): the containment encoding and
|
||||
/// every other field are the same.
|
||||
#[test]
|
||||
fn the_swiftshader_recommendation_keeps_vuid_10247() {
|
||||
let desc = profile("swiftshader");
|
||||
fn a_recommendation_keeps_vuid_10247() {
|
||||
let mut desc = profile("runtime-floor");
|
||||
desc.features
|
||||
.extend(BUFFER_UPDATE_AFTER_BIND.iter().copied());
|
||||
assert!(!desc.robust_buffer_access_update_after_bind);
|
||||
assert!(desc.has(VkFeature::RobustBufferAccess));
|
||||
assert!(BUFFER_UPDATE_AFTER_BIND.iter().all(|&f| desc.has(f)));
|
||||
@@ -630,7 +627,7 @@ fn required_enables_follow_version_dependencies_formats_and_flags() {
|
||||
..Requirements::default()
|
||||
};
|
||||
assert_eq!(
|
||||
profile("vk12-floor").required_enables(&a8),
|
||||
floor_with(&[], &[]).required_enables(&a8),
|
||||
Err(Capability::Extension(VkExtension::KhrMaintenance5))
|
||||
);
|
||||
let m5 = floor_with(
|
||||
@@ -656,7 +653,7 @@ fn required_enables_follow_version_dependencies_formats_and_flags() {
|
||||
..Requirements::default()
|
||||
};
|
||||
assert_eq!(
|
||||
profile("vk12-floor").required_enables(&rgba),
|
||||
floor_with(&[], &[]).required_enables(&rgba),
|
||||
Ok(EnableSet::new())
|
||||
);
|
||||
// The API version and missing listed items are the first missing capability.
|
||||
@@ -665,7 +662,7 @@ fn required_enables_follow_version_dependencies_formats_and_flags() {
|
||||
..Requirements::default()
|
||||
};
|
||||
assert_eq!(
|
||||
profile("vk12-floor").required_enables(&newer),
|
||||
floor_with(&[], &[]).required_enables(&newer),
|
||||
Err(Capability::ApiVersion(ApiVersion { major: 1, minor: 3 }))
|
||||
);
|
||||
let named = Requirements {
|
||||
@@ -673,7 +670,7 @@ fn required_enables_follow_version_dependencies_formats_and_flags() {
|
||||
..Requirements::default()
|
||||
};
|
||||
assert_eq!(
|
||||
profile("vk12-floor").required_enables(&named),
|
||||
floor_with(&[], &[]).required_enables(&named),
|
||||
Err(Capability::Extension(VkExtension::ExtShaderStencilExport))
|
||||
);
|
||||
// The portability subset is part of every set on a device that lists it.
|
||||
@@ -686,7 +683,7 @@ fn required_enables_follow_version_dependencies_formats_and_flags() {
|
||||
/// `Device::from_queries` refuses a description listing a feature it does not expose.
|
||||
#[test]
|
||||
fn device_new_refuses_unexposed_features() {
|
||||
let mut d = profile("vk12-floor");
|
||||
let mut d = profile("runtime-floor");
|
||||
d.features.insert(VkFeature::Maintenance8);
|
||||
let e = match Device::from_queries(d.clone(), DevicePolicy::default()) {
|
||||
Err(Error::InvalidDescriptor(DescriptorError::DeviceDescription { detail })) => detail,
|
||||
@@ -734,7 +731,7 @@ fn profile_format_tables_hold_only_exposed_formats() {
|
||||
);
|
||||
}
|
||||
}
|
||||
let mut d = profile("vk12-floor");
|
||||
let mut d = profile("runtime-floor");
|
||||
let entry = d.formats.formats[&vk::Format::R8_UNORM];
|
||||
d.formats.formats.insert(vk::Format::A8_UNORM, entry);
|
||||
let a8 = |d: &DeviceDescription| {
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
//! nothing it derives.
|
||||
|
||||
use super::*;
|
||||
use crate::device::requirements::VkLimit;
|
||||
use crate::error::{Capability, Feature, Needs};
|
||||
|
||||
/// The identities each committed profile is also read under, each with a device type: MoltenVK
|
||||
/// on an Apple GPU, the NVIDIA driver on a GA10x, RADV, Intel's Mesa driver and none.
|
||||
@@ -138,6 +140,46 @@ entry:
|
||||
/// the device computes the `half` product in 16 bits) or not: no Vulkan query states that a
|
||||
/// device reads an `f32` denormal as Metal does, and a driver may keep one under the 16-bit
|
||||
/// controls, so the note is static.
|
||||
/// A device whose `maxPushConstantsSize` is below the 256 bytes of the push window every stage is
|
||||
/// lowered for is below the floor: `Unsupported{PushWindow}`, needing `MaxPushConstantsSize` 256.
|
||||
/// The descriptions below it are committed apart (`validation/profiles/below-floor/`, this test's
|
||||
/// input alone): `vk12-floor`, the Vulkan 1.2 minimum, and `swiftshader`, each with 128. Every
|
||||
/// committed profile is above it.
|
||||
#[test]
|
||||
fn a_push_window_below_256_bytes_is_below_the_floor() {
|
||||
let dir = PathBuf::from(env!("CARGO_MANIFEST_DIR"))
|
||||
.join("../metal2vulkan-validation/profiles/below-floor");
|
||||
let mut below: Vec<String> = std::fs::read_dir(&dir)
|
||||
.unwrap_or_else(|e| panic!("{}: {e}", dir.display()))
|
||||
.map(|e| e.expect("directory entry").path())
|
||||
.filter(|p| p.extension().is_some_and(|x| x == "json"))
|
||||
.map(|p| p.file_stem().unwrap().to_string_lossy().into_owned())
|
||||
.collect();
|
||||
below.sort();
|
||||
assert_eq!(below, ["swiftshader", "vk12-floor"]);
|
||||
for stem in &below {
|
||||
let text = std::fs::read_to_string(dir.join(format!("{stem}.json"))).expect("readable");
|
||||
let description = DeviceDescription::from_khronos_json(&text, None).expect("parses");
|
||||
match Device::from_queries(description, DevicePolicy::default()) {
|
||||
Err(Error::Unsupported(u)) => {
|
||||
assert_eq!(u.feature, Feature::PushWindow, "{stem}");
|
||||
let limit = Capability::Limit {
|
||||
limit: VkLimit::MaxPushConstantsSize,
|
||||
required: 256,
|
||||
available: 128,
|
||||
};
|
||||
assert_eq!(u.needs, Needs::AnyOf(vec![vec![limit]]), "{stem}");
|
||||
}
|
||||
other => panic!("{stem}: {other:?}"),
|
||||
}
|
||||
}
|
||||
for (stem, _) in committed_profiles() {
|
||||
if let Err(e) = Device::from_queries(profile(&stem), DevicePolicy::default()) {
|
||||
panic!("{stem} is committed but below the floor: {e}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn from_queries_records_the_device_denormals_of_a_float_product() {
|
||||
use crate::device::requirements::VkProperty;
|
||||
|
||||
@@ -570,7 +570,19 @@ fn profile_dependent_rows_differ_where_the_design_says() {
|
||||
index: 0,
|
||||
},
|
||||
};
|
||||
let floor = device("vk12-floor");
|
||||
// Below the runtime's floor: `runtime-floor` as a Vulkan 1.2 context reads it, without device
|
||||
// addresses, 64-bit integers or shader draw parameters.
|
||||
use crate::device::requirements::VkFeature;
|
||||
let mut below = crate::pipeline::testing::description_at_1_2("runtime-floor", false).unwrap();
|
||||
for f in [
|
||||
VkFeature::BufferDeviceAddress,
|
||||
VkFeature::ShaderInt64,
|
||||
VkFeature::ShaderDrawParameters,
|
||||
] {
|
||||
below.features.remove(&f);
|
||||
}
|
||||
let floor =
|
||||
crate::device::Device::from_queries(below, crate::device::DevicePolicy::default()).unwrap();
|
||||
let addressed = device("nvidia-rtx50-linux");
|
||||
assert_eq!(mechanism(&range, floor.profile()), Mechanism::PlanTimeCheck);
|
||||
assert_eq!(mechanism(&range, addressed.profile()), Mechanism::Variant);
|
||||
|
||||
@@ -49,7 +49,7 @@ fn every_committed_profile_derives() {
|
||||
fn occlusion_query_precise_follows_each_source() {
|
||||
for (stem, text) in committed_profiles() {
|
||||
let stated = text.contains("\"occlusionQueryPrecise\": true");
|
||||
assert_eq!(stated, stem != "vk12-floor", "{stem}");
|
||||
assert_eq!(stated, stem != "runtime-floor", "{stem}");
|
||||
let desc = DeviceDescription::from_khronos_json(&text, None).unwrap();
|
||||
assert_eq!(
|
||||
desc.features.contains(&VkFeature::OcclusionQueryPrecise),
|
||||
@@ -141,15 +141,20 @@ fn find_structure(v: &serde_json::Value, name: &str, out: &mut Option<serde_json
|
||||
|
||||
#[test]
|
||||
fn memory_profiles_follow_bda_and_int64() {
|
||||
// roadmap-2022 requires device addresses but not shaderInt64.
|
||||
for stem in ["vk12-floor", "roadmap-2022"] {
|
||||
// Without either, below the runtime's floor, which requires both.
|
||||
for without in [
|
||||
&[VkFeature::BufferDeviceAddress, VkFeature::ShaderInt64][..],
|
||||
&[VkFeature::ShaderInt64],
|
||||
] {
|
||||
let dev = Device::from_queries(floor_without(without), DevicePolicy::default()).unwrap();
|
||||
assert_eq!(
|
||||
device(stem).profile().fields().buffer_access,
|
||||
dev.profile().fields().buffer_access,
|
||||
BufferAccess::Floor,
|
||||
"{stem}"
|
||||
"{without:?}"
|
||||
);
|
||||
}
|
||||
for stem in [
|
||||
"runtime-floor",
|
||||
"moltenvk-m3",
|
||||
"nvidia-rtx50-linux",
|
||||
"amd-rdna3-radv",
|
||||
@@ -165,33 +170,39 @@ fn memory_profiles_follow_bda_and_int64() {
|
||||
}
|
||||
}
|
||||
|
||||
/// A Profile F refusal names what the device lacks of Profile A, never a feature it has.
|
||||
/// A Profile F refusal names what the device lacks of Profile A, never a feature it has: on
|
||||
/// `runtime-floor` without either feature, and without `shaderInt64` alone.
|
||||
#[test]
|
||||
fn addressed_needs_name_only_the_missing_features() {
|
||||
let bda = Capability::Feature(VkFeature::BufferDeviceAddress);
|
||||
let int64 = Capability::Feature(VkFeature::ShaderInt64);
|
||||
let needs = |without: &[VkFeature]| {
|
||||
Device::from_queries(floor_without(without), DevicePolicy::default())
|
||||
.unwrap()
|
||||
.profile()
|
||||
.addressed_needs()
|
||||
};
|
||||
assert_eq!(
|
||||
device("vk12-floor").profile().addressed_needs(),
|
||||
needs(&[VkFeature::BufferDeviceAddress, VkFeature::ShaderInt64]),
|
||||
vec![bda, int64.clone()]
|
||||
);
|
||||
// roadmap-2022 has device addresses; only the 64-bit integers are missing.
|
||||
assert_eq!(
|
||||
device("roadmap-2022").profile().addressed_needs(),
|
||||
vec![int64]
|
||||
);
|
||||
assert_eq!(needs(&[VkFeature::ShaderInt64]), vec![int64]);
|
||||
}
|
||||
|
||||
/// `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.
|
||||
#[test]
|
||||
fn vk12_floor_derives_a_floor_profile() {
|
||||
let dev = device("vk12-floor");
|
||||
fn runtime_floor_derives_the_floor_profile() {
|
||||
let dev = device("runtime-floor");
|
||||
let f = dev.profile().fields();
|
||||
assert_eq!(f.robustness, Robustness::Rba);
|
||||
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);
|
||||
assert!(!f.dynamic_vertex_stride);
|
||||
// The Vulkan 1.2 Required Format Support tables: what they require unconditionally is
|
||||
// supported, and a usage they leave conditional is refused (a typed Format capability).
|
||||
assert!(f.leaf.vertex_stores_and_atomics);
|
||||
assert!(f.leaf.fragment_stores_and_atomics);
|
||||
// What the tables require of it is supported, and a usage they leave to a feature it does not
|
||||
// require is refused (a typed Format capability).
|
||||
assert!(!f.vertex_formats.formats.is_empty());
|
||||
assert!(!f.storage_formats.formats.is_empty());
|
||||
assert!(!f.image_formats.formats.is_empty());
|
||||
@@ -207,9 +218,16 @@ fn vk12_floor_derives_a_floor_profile() {
|
||||
assert_eq!(
|
||||
dev.profile()
|
||||
.check(&req(vk::Format::R8_UNORM, FormatUsage::StorageImage)),
|
||||
Ok(())
|
||||
);
|
||||
assert_eq!(
|
||||
dev.profile().check(&req(
|
||||
vk::Format::D32_SFLOAT,
|
||||
FormatUsage::DepthStencilAttachment
|
||||
)),
|
||||
Err(Capability::Format {
|
||||
format: vk::Format::R8_UNORM,
|
||||
usage: FormatUsage::StorageImage
|
||||
format: vk::Format::D32_SFLOAT,
|
||||
usage: FormatUsage::DepthStencilAttachment
|
||||
})
|
||||
);
|
||||
assert!(!f.subgroup.kernel.pinnable);
|
||||
@@ -261,7 +279,7 @@ fn robustness2_selects_the_rba2_encoding() {
|
||||
|
||||
#[test]
|
||||
fn below_1_2_is_refused() {
|
||||
let mut desc = profile("vk12-floor");
|
||||
let mut desc = profile("runtime-floor");
|
||||
desc.api_version = ApiVersion { major: 1, minor: 1 };
|
||||
match Device::from_queries(desc, DevicePolicy::default()) {
|
||||
Err(Error::Unsupported(u)) => {
|
||||
@@ -305,8 +323,8 @@ fn the_identity_domains_come_as_a_pair_on_a_device_with_addresses() {
|
||||
"{half:?}"
|
||||
);
|
||||
}
|
||||
// roadmap-2022 has device addresses but not shaderInt64.
|
||||
match Device::from_queries(profile("roadmap-2022"), identity) {
|
||||
// `runtime-floor` without `shaderInt64`: device addresses, no 64-bit integers.
|
||||
match Device::from_queries(floor_without(&[VkFeature::ShaderInt64]), identity) {
|
||||
Err(Error::Unsupported(u)) => {
|
||||
assert_eq!(u.feature, Feature::IdentityDomains);
|
||||
let both = [VkFeature::BufferDeviceAddress, VkFeature::ShaderInt64];
|
||||
@@ -465,30 +483,31 @@ fn allocation_sizes_are_no_profile_field() {
|
||||
|
||||
#[test]
|
||||
fn check_reports_the_first_missing_capability() {
|
||||
let dev = device("vk12-floor");
|
||||
let dev = device("runtime-floor");
|
||||
let p = dev.profile();
|
||||
assert_eq!(p.check(&Requirements::default()), Ok(()));
|
||||
let need = |r: Requirements| p.check(&r);
|
||||
let v1_4 = ApiVersion { major: 1, minor: 4 };
|
||||
assert_eq!(
|
||||
need(Requirements {
|
||||
api_version: Some(ApiVersion::V1_3),
|
||||
api_version: Some(v1_4),
|
||||
..Requirements::default()
|
||||
}),
|
||||
Err(Capability::ApiVersion(ApiVersion::V1_3))
|
||||
Err(Capability::ApiVersion(v1_4))
|
||||
);
|
||||
assert_eq!(
|
||||
need(Requirements {
|
||||
features: [VkFeature::RobustBufferAccess, VkFeature::ShaderInt64].into(),
|
||||
features: [VkFeature::RobustBufferAccess, VkFeature::ShaderFloat64].into(),
|
||||
..Requirements::default()
|
||||
}),
|
||||
Err(Capability::Feature(VkFeature::ShaderInt64))
|
||||
Err(Capability::Feature(VkFeature::ShaderFloat64))
|
||||
);
|
||||
assert_eq!(
|
||||
need(Requirements {
|
||||
extensions: [VkExtension::ExtRobustness2].into(),
|
||||
extensions: [VkExtension::ExtShaderStencilExport].into(),
|
||||
..Requirements::default()
|
||||
}),
|
||||
Err(Capability::Extension(VkExtension::ExtRobustness2))
|
||||
Err(Capability::Extension(VkExtension::ExtShaderStencilExport))
|
||||
);
|
||||
assert_eq!(
|
||||
need(Requirements {
|
||||
@@ -540,9 +559,15 @@ fn check_reports_the_first_missing_capability() {
|
||||
}),
|
||||
Err(Capability::Property(VkProperty::RoundingIndependenceAll))
|
||||
);
|
||||
// Stage flags need their enabling features.
|
||||
// Stage flags need their enabling features, which the floor requires: the floor without
|
||||
// `computeFullSubgroups`, a device below it, names it.
|
||||
let without = Device::from_queries(
|
||||
floor_without(&[VkFeature::ComputeFullSubgroups]),
|
||||
DevicePolicy::default(),
|
||||
)
|
||||
.unwrap();
|
||||
assert_eq!(
|
||||
need(Requirements {
|
||||
without.profile().check(&Requirements {
|
||||
stage_flags: [StageCreateFlag::RequireFullSubgroups].into(),
|
||||
..Requirements::default()
|
||||
}),
|
||||
@@ -599,8 +624,9 @@ fn storage_without_format_follows_each_format() {
|
||||
buffer: F::STORAGE_TEXEL_BUFFER | buffer,
|
||||
..Default::default()
|
||||
};
|
||||
// The floor states neither formatless feature: the test grants both.
|
||||
let mut desc = profile("vk12-floor");
|
||||
// `runtime-floor` as a Vulkan 1.2 context without `VK_KHR_format_feature_flags2` reads it, with
|
||||
// both formatless features.
|
||||
let mut desc = crate::pipeline::testing::description_at_1_2("runtime-floor", false).unwrap();
|
||||
desc.features
|
||||
.insert(VkFeature::ShaderStorageImageReadWithoutFormat);
|
||||
desc.features
|
||||
@@ -674,15 +700,6 @@ fn storage_without_format_follows_each_format() {
|
||||
[U::StorageImageWriteWithoutFormat]
|
||||
);
|
||||
|
||||
// SwiftShader (Vulkan 1.3, no `VkFormatProperties3` in its document): its `R32_UINT` image is
|
||||
// written without a format, as the specification implies, and its texel buffer is not, which
|
||||
// its driver reports (`VUID-vkCmdDispatch-OpTypeImage-07029`); it has no read feature.
|
||||
let swiftshader = device("swiftshader");
|
||||
assert!(profile("swiftshader").has_format_feature_flags2());
|
||||
assert_eq!(
|
||||
usages(&swiftshader, vk::Format::R32_UINT),
|
||||
[U::StorageImageWriteWithoutFormat]
|
||||
);
|
||||
// lavapipe's document states `VkFormatProperties3` with all four bits.
|
||||
assert_eq!(usages(&device("lavapipe"), vk::Format::R32_UINT), all);
|
||||
}
|
||||
@@ -700,7 +717,7 @@ fn the_profile_holds_the_largest_whole_point_size() {
|
||||
("intel-irisxe-rplp-anv", 255),
|
||||
("lavapipe", 256),
|
||||
("moltenvk-m3", 511),
|
||||
("vk12-floor", 1),
|
||||
("runtime-floor", 63),
|
||||
] {
|
||||
assert_eq!(
|
||||
device(stem).profile().fields().limits.max_point_size,
|
||||
|
||||
@@ -138,8 +138,7 @@ const FEATURES: [(&str, &str, VkFeature, Option<VkExtension>); 12] = [
|
||||
/// exposed structure (or its version requires it: `fullDrawIndexUint32` from Vulkan 1.4). Where
|
||||
/// the source lists the feature's extension it states the member, true or false; a member a
|
||||
/// source does not state reads as absent, and is refused. The extensions are enabled exactly
|
||||
/// where the source lists them. Every profile but the derived 1.2 floors (whose base drops it,
|
||||
/// unrequired by 1.2) states `fullDrawIndexUint32`.
|
||||
/// where the source lists them. Every committed profile states `fullDrawIndexUint32`.
|
||||
#[test]
|
||||
fn render_features_follow_each_source() {
|
||||
let mut listed: BTreeMap<VkExtension, usize> = BTreeMap::new();
|
||||
@@ -156,7 +155,7 @@ fn render_features_follow_each_source() {
|
||||
if extension.is_some() {
|
||||
assert_eq!(states, exposed, "{stem}: {structure}.{member}");
|
||||
} else {
|
||||
assert_eq!(states, !stem.starts_with("vk12-"), "{stem}: {member}");
|
||||
assert!(states, "{stem}: {member}");
|
||||
}
|
||||
let required = required_features(desc.api_version).any(|f| f == feature);
|
||||
let want = exposed && (stated_true(&json, structure, member) || required);
|
||||
@@ -186,13 +185,13 @@ fn render_features_follow_each_source() {
|
||||
}
|
||||
// RADV, ANV, NVIDIA and lavapipe list depth clipping and list restart; RADV, ANV and NVIDIA
|
||||
// the clamp control; every Linux venue and MoltenVK the sample locations; every native
|
||||
// profile (RADV, ANV, NVIDIA, lavapipe, SwiftShader) the provoking vertex; RADV, ANV, NVIDIA
|
||||
// profile (RADV, ANV, NVIDIA, lavapipe) the provoking vertex; RADV, ANV, NVIDIA
|
||||
// and lavapipe the multi-draw.
|
||||
for (extension, at_least) in [
|
||||
(VkExtension::ExtDepthClipEnable, 10),
|
||||
(VkExtension::ExtDepthClampControl, 5),
|
||||
(VkExtension::ExtPrimitiveTopologyListRestart, 10),
|
||||
(VkExtension::ExtProvokingVertex, 15),
|
||||
(VkExtension::ExtProvokingVertex, 14),
|
||||
(VkExtension::ExtSampleLocations, 10),
|
||||
(VkExtension::ExtMultiDraw, 10),
|
||||
] {
|
||||
@@ -202,7 +201,7 @@ fn render_features_follow_each_source() {
|
||||
}
|
||||
|
||||
/// The depth/stencil resolve properties and the two limits are stated by every committed profile
|
||||
/// (a device report its device's; a requirements document or derived floor its version's, which
|
||||
/// (a device report its device's; the derived floor its version's, which
|
||||
/// the regeneration states where its source omits them), and the description derives exactly
|
||||
/// the stated modes and booleans. The sample-location properties are stated, and derived, exactly
|
||||
/// where the profile lists `VK_EXT_sample_locations`.
|
||||
@@ -372,7 +371,7 @@ fn an_omitted_resolve_mode_or_index_value_reads_its_versions_guarantee() {
|
||||
|
||||
/// `provokingVertexModePerPipeline` is read where `VK_EXT_provoking_vertex` is listed, and holds
|
||||
/// as the profile states it: every committed profile that lists the extension states it true
|
||||
/// (RADV, ANV, NVIDIA, lavapipe and SwiftShader); MoltenVK lists no extension and has neither the
|
||||
/// (RADV, ANV, NVIDIA and lavapipe); MoltenVK lists no extension and has neither the
|
||||
/// feature nor the property.
|
||||
#[test]
|
||||
fn the_provoking_vertex_mode_per_pipeline_follows_each_source() {
|
||||
@@ -403,5 +402,5 @@ fn the_provoking_vertex_mode_per_pipeline_follows_each_source() {
|
||||
}
|
||||
listed += usize::from(exposed && stated);
|
||||
}
|
||||
assert!(listed >= 15, "{listed}");
|
||||
assert!(listed >= 14, "{listed}");
|
||||
}
|
||||
@@ -221,14 +221,9 @@ fn the_tables_read_the_specification() {
|
||||
}
|
||||
|
||||
/// Every committed profile covers the tables. A device report states one device, which meets
|
||||
/// every requirement that applies to it (including a choice between formats or tables); a
|
||||
/// requirements profile states a lower bound, which cannot hold a choice, so only its
|
||||
/// unconditional and feature-conditioned entries are checked.
|
||||
///
|
||||
/// The one expected gap: `lunarg-desktop-baseline-2023` is the intersection of gpuinfo reports
|
||||
/// that include portability-subset (MoltenVK) devices on Intel, AMD, and NVIDIA Macs, which lack
|
||||
/// the 16-bit packed formats and, on some, `R32` image atomics; the profile states its own
|
||||
/// formats, so the regeneration keeps them as they are.
|
||||
/// every requirement that applies to it (including a choice between formats or tables); the
|
||||
/// derived floor states a lower bound, which cannot hold a choice, so only its unconditional and
|
||||
/// feature-conditioned entries are checked.
|
||||
#[test]
|
||||
fn committed_profiles_cover_the_vulkan_1_2_required_formats() {
|
||||
let docs: Vec<(String, Value)> = committed_profiles()
|
||||
@@ -265,24 +260,5 @@ fn committed_profiles_cover_the_vulkan_1_2_required_formats() {
|
||||
}
|
||||
}
|
||||
assert!(failures.is_empty(), "{failures:#?}");
|
||||
use vk::FormatFeatureFlags2 as F;
|
||||
let mut expected = Table::new();
|
||||
for format in [
|
||||
vk::Format::A1R5G5B5_UNORM_PACK16,
|
||||
vk::Format::B4G4R4A4_UNORM_PACK16,
|
||||
vk::Format::R5G6B5_UNORM_PACK16,
|
||||
] {
|
||||
expected.insert(format, unconditional[&format]);
|
||||
}
|
||||
for format in [vk::Format::R32_UINT, vk::Format::R32_SINT] {
|
||||
let atomic = FormatProperties {
|
||||
optimal_tiling: F::STORAGE_IMAGE_ATOMIC,
|
||||
..FormatProperties::default()
|
||||
};
|
||||
expected.insert(format, atomic);
|
||||
}
|
||||
assert_eq!(
|
||||
gaps,
|
||||
BTreeMap::from([("lunarg-desktop-baseline-2023".to_string(), expected)])
|
||||
);
|
||||
assert!(gaps.is_empty(), "{gaps:#?}");
|
||||
}
|
||||
@@ -8,8 +8,6 @@ use crate::device::subgroup::{
|
||||
SubgroupSizes, Tier,
|
||||
};
|
||||
use crate::error::{Capability, Feature};
|
||||
use crate::metal::format::storage_image_choice;
|
||||
use crate::metal::PixelFormat;
|
||||
use crate::metal::{ArgumentBuffersTier, ReadWriteTextureTier};
|
||||
use crate::pipeline::sym::Stage;
|
||||
|
||||
@@ -61,14 +59,11 @@ intel-irisxe-anv: -,D,D,D,D,D,D | -,D,D,D,D,D,D | -,L,D,D,D,D,D
|
||||
intel-irisxe-rplp-anv: -,D,D,D,D,D,D | -,D,D,D,D,D,D | -,L,D,D,D,D,D
|
||||
intel-uhd770-rpls-anv: -,D,D,D,D,D,D | -,D,D,D,D,D,D | -,L,D,D,D,D,D
|
||||
lavapipe: -,xO,xO,xO,xO,xO,xM | -,P,P,P,P,P,xW | -,L,E,E,E,E,E
|
||||
lunarg-desktop-baseline-2023: -,xO,xO,xO,xO,xO,xM | -,P,xQ,xO,xO,xO,xM | -,L,E,E,E,E,E
|
||||
moltenvk-m3: -,xO,xO,xO,xO,xO,xM | -,D,D,D,D,D,D | -,L,D,D,D,D,D
|
||||
nvidia-pascal-linux: -,D,D,D,D,D,D | -,D,D,D,D,D,D | -,L,D,D,D,D,D
|
||||
nvidia-rtx50-linux: -,D,D,D,D,D,D | -,D,D,D,D,D,D | -,L,D,D,D,D,D
|
||||
nvidia-rtx5080-laptop: -,D,D,D,D,D,D | -,D,D,D,D,D,D | -,L,D,D,D,D,D
|
||||
roadmap-2022: -,xO,xO,xO,xO,xO,xM | -,P,P,P,P,P,xW | -,L,E,E,E,E,E
|
||||
swiftshader: -,P,xQ,P,P,P,xW | -,P,P,P,P,P,xW | -,L,E,E,E,E,E
|
||||
vk12-floor: -,xO,xO,xO,xO,xO,xM | -,xO,xQ,xO,xO,xO,xM | -,L,E,E,E,E,E
|
||||
runtime-floor: -,xO,xO,xO,xO,xO,xM | -,xO,xQ,xO,xO,xO,xM | -,L,E,E,E,E,E
|
||||
";
|
||||
|
||||
fn table() -> String {
|
||||
@@ -534,27 +529,14 @@ fn metal_properties_report_d3_d4_values() {
|
||||
);
|
||||
assert!(m.max_buffer_length > 0, "{stem}");
|
||||
}
|
||||
let floor = device("vk12-floor");
|
||||
let floor = device("runtime-floor");
|
||||
let m = floor.metal_properties();
|
||||
assert_eq!(m.max_threads_per_threadgroup, [128, 128, 128]);
|
||||
assert_eq!(m.argument_buffers_tier, ArgumentBuffersTier::Tier1);
|
||||
// Vulkan 1.2 requires R32 storage images: tier 1. Tier 2's 8- and 16-bit single-channel formats
|
||||
// need shaderStorageImageExtendedFormats, which the floor lacks, so formatless reads and
|
||||
// writes added to it do not make it tier 2.
|
||||
assert_eq!(m.read_write_texture_tier, ReadWriteTextureTier::Tier1);
|
||||
let mut formatless = profile("vk12-floor");
|
||||
formatless
|
||||
.features
|
||||
.insert(VkFeature::ShaderStorageImageReadWithoutFormat);
|
||||
formatless
|
||||
.features
|
||||
.insert(VkFeature::ShaderStorageImageWriteWithoutFormat);
|
||||
let formatless = Device::from_queries(formatless, DevicePolicy::default()).unwrap();
|
||||
assert_eq!(
|
||||
formatless.metal_properties().read_write_texture_tier,
|
||||
ReadWriteTextureTier::Tier1
|
||||
);
|
||||
assert!(storage_image_choice(PixelFormat::R16Float, formatless.profile()).is_err());
|
||||
assert_eq!(m.max_threads_per_threadgroup, [1024, 1024, 1024]);
|
||||
// Device addresses and update-after-bind sampled and storage images: tier 2.
|
||||
assert_eq!(m.argument_buffers_tier, ArgumentBuffersTier::Tier2);
|
||||
// Tier 2's 8- and 16-bit single-channel storage formats come with
|
||||
// shaderStorageImageExtendedFormats, which the floor requires.
|
||||
assert_eq!(m.read_write_texture_tier, ReadWriteTextureTier::Tier2);
|
||||
// Typed storage images are enough: intel-irisxe-anv reads storage images only with a
|
||||
// declared format and still has every tier-2 format.
|
||||
let irisxe = device("intel-irisxe-anv");
|
||||
@@ -563,7 +545,8 @@ fn metal_properties_report_d3_d4_values() {
|
||||
irisxe.metal_properties().read_write_texture_tier,
|
||||
ReadWriteTextureTier::Tier2
|
||||
);
|
||||
assert_eq!(m.max_buffer_length, 1 << 27);
|
||||
// Vulkan 1.3's maxBufferSize and maxMemoryAllocationSize guarantees.
|
||||
assert_eq!(m.max_buffer_length, 1 << 30);
|
||||
// Without subgroup operations a kernel's simdgroups, matrices included, are emulated; a
|
||||
// fragment's are not.
|
||||
assert!(m.simd.kernel.matrix);
|
||||
@@ -571,9 +554,8 @@ 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));
|
||||
for f in [Feature::ArgumentBufferPointers, Feature::RasterOrderGroups] {
|
||||
assert!(has(&f), "vk12-floor should report {f:?}");
|
||||
}
|
||||
assert!(!has(&Feature::ArgumentBufferPointers));
|
||||
assert!(has(&Feature::RasterOrderGroups));
|
||||
// Neither rasterization-order access nor the pixel interlock: framebuffer fetch reads input
|
||||
// attachments ordered between draws, a note, not a refusal.
|
||||
let fragment = floor.profile().fields().fragment;
|
||||
|
||||
@@ -1113,6 +1113,10 @@ pub enum Feature {
|
||||
// ---- Device ----
|
||||
/// The device's Vulkan version is below the 1.2 floor.
|
||||
VulkanVersion,
|
||||
/// The device's `maxPushConstantsSize` is below the 256 bytes of the push window every stage
|
||||
/// is lowered for: a compute stage's dispatch region and buffer addresses, a render
|
||||
/// pipeline's two stages together.
|
||||
PushWindow,
|
||||
/// The identity pointer and handle domains (`PointerDomain::Identity`,
|
||||
/// `HandleDomain::Identity`): on a device without `bufferDeviceAddress` and `shaderInt64`,
|
||||
/// and, on any device, a compile of a function they do not lower yet: anything but a kernel
|
||||
|
||||
@@ -22,9 +22,9 @@ fn floor() -> DeviceProfile {
|
||||
committed_profiles()
|
||||
.expect("profiles")
|
||||
.into_iter()
|
||||
.find(|(n, _)| n == "vk12-floor")
|
||||
.find(|(n, _)| n == "runtime-floor")
|
||||
.map(|(_, p)| p)
|
||||
.expect("vk12-floor")
|
||||
.expect("runtime-floor")
|
||||
}
|
||||
|
||||
/// [`check_accept`] after L3 on `vk12-floor` (unless a form needs 64-bit floats), the module there
|
||||
|
||||
@@ -776,7 +776,7 @@ fn builtin_facts_and_projections() {
|
||||
/// whose kernel stage has subgroups (the flattened form reads subgroup builtins).
|
||||
#[test]
|
||||
fn derivation_modules_are_valid() {
|
||||
for stem in ["moltenvk-m3", "lunarg-desktop-baseline-2023"] {
|
||||
for stem in ["moltenvk-m3", "runtime-floor"] {
|
||||
let p = crate::pipeline::testing::profile(stem, DevicePolicy::default()).expect(stem);
|
||||
for form in [LocalSizeForm::Spec, LocalSizeForm::Flat] {
|
||||
for mr in [false, true] {
|
||||
|
||||
@@ -148,7 +148,7 @@ fn a_clean_state_takes_the_storage_form() {
|
||||
}
|
||||
}
|
||||
}
|
||||
for stem in ["lavapipe", "vk12-floor", "swiftshader"] {
|
||||
for stem in ["lavapipe", "runtime-floor"] {
|
||||
assert!(!interlock_orders(&profile(stem, &[])), "{stem}");
|
||||
}
|
||||
}
|
||||
@@ -1144,7 +1144,7 @@ fn an_extended_range_blend_follows_the_ordered_storage_form() {
|
||||
"{stem}"
|
||||
);
|
||||
}
|
||||
for stem in ["lavapipe", "gate-lavapipe-x86_64", "swiftshader"] {
|
||||
for stem in ["lavapipe", "gate-lavapipe-x86_64"] {
|
||||
let p = profile(stem, &[]);
|
||||
assert!(!interlock_orders(&p), "{stem}");
|
||||
for pf in blended {
|
||||
@@ -1168,14 +1168,11 @@ fn an_extended_range_blend_follows_the_ordered_storage_form() {
|
||||
)],
|
||||
],
|
||||
);
|
||||
for stem in ["vk12-floor", "roadmap-2022"] {
|
||||
let p = profile(stem, &[]);
|
||||
assert_eq!(
|
||||
extended_range_blend(PixelFormat::BGRA10XR, &p),
|
||||
Err(unordered.clone()),
|
||||
"{stem}"
|
||||
);
|
||||
}
|
||||
let p = profile("runtime-floor", &[]);
|
||||
assert_eq!(
|
||||
extended_range_blend(PixelFormat::BGRA10XR, &p),
|
||||
Err(unordered)
|
||||
);
|
||||
// The storage form's own device needs, named where the device lacks one.
|
||||
let p = profile("moltenvk-m3", &[VkFeature::FragmentStoresAndAtomics]);
|
||||
assert!(extended_range_blend(PixelFormat::BGRA10XR, &p)
|
||||
|
||||
@@ -69,7 +69,7 @@ fn nvidia_declares_the_shadow_and_a_device_without_the_interlock_names_both_ways
|
||||
Capability::Feature(VkFeature::FragmentStoresAndAtomics),
|
||||
]
|
||||
);
|
||||
for stem in ["vk12-floor", "roadmap-2022", "lunarg-desktop-baseline-2023"] {
|
||||
for stem in ["runtime-floor"] {
|
||||
let a = alternatives(device_form(&profile(stem, &[]), false).expect_err(stem));
|
||||
assert_eq!(a.len(), 2, "{stem}");
|
||||
assert_eq!(a[0], ext, "{stem}");
|
||||
|
||||
@@ -886,7 +886,7 @@ fn anisotropic_samples_at_every_offset_call_one_routine() {
|
||||
("lavapipe", true),
|
||||
("intel-irisxe-anv", true),
|
||||
("nvidia-rtx5080-laptop", true),
|
||||
("vk12-floor", false),
|
||||
("runtime-floor", false),
|
||||
] {
|
||||
let p = p(stem);
|
||||
let images = &p.fields().images;
|
||||
|
||||
@@ -416,7 +416,7 @@ mod tests {
|
||||
/// The constexpr feature checks are refusals at compile time.
|
||||
#[test]
|
||||
fn constexpr_feature_checks_refuse() {
|
||||
let p = profile("vk12-floor");
|
||||
let p = profile("runtime-floor");
|
||||
// A bicubic sampler's filters are nearest placeholders: its samples are fetches.
|
||||
let mut s = state(FIXTURE_WORDS[0]);
|
||||
s.mag_filter = Filter::Bicubic;
|
||||
|
||||
@@ -7,12 +7,27 @@ fn needs(f: VkFeature) -> Error {
|
||||
Unsupported::needs(Feature::CoherentMemory, Capability::Feature(f)).into()
|
||||
}
|
||||
|
||||
/// The committed profiles, and the runtime's floor without the Vulkan model's device scope and
|
||||
/// without the model: devices below that floor, which the floor's own model leaves no committed
|
||||
/// profile short of.
|
||||
fn profiles() -> Vec<(String, crate::device::profile::DeviceProfile)> {
|
||||
let mut out = committed_profiles().expect("profiles");
|
||||
let scope = VkFeature::VulkanMemoryModelDeviceScope;
|
||||
for without in [&[scope][..], &[VkFeature::VulkanMemoryModel, scope]] {
|
||||
let p =
|
||||
crate::pipeline::testing::profile_without("runtime-floor", without, Default::default())
|
||||
.expect("below the floor");
|
||||
out.push((format!("runtime-floor without {without:?}"), p));
|
||||
}
|
||||
out
|
||||
}
|
||||
|
||||
/// `GLSL450` needs nothing, with or without `Coherent` resources; the Vulkan model needs
|
||||
/// `vulkanMemoryModel`, and with a `Device`-scope operation also `vulkanMemoryModelDeviceScope`,
|
||||
/// on every committed profile.
|
||||
/// on every committed profile and below the floor ([`profiles`]).
|
||||
#[test]
|
||||
fn the_vulkan_model_is_checked_against_the_profile() {
|
||||
let profiles = committed_profiles().expect("profiles");
|
||||
let profiles = profiles();
|
||||
let (mut refused, mut accepted) = (0, 0);
|
||||
for (stem, p) in &profiles {
|
||||
for device_scope in [false, true] {
|
||||
@@ -83,7 +98,7 @@ fn the_default_model_is_glsl450() {
|
||||
/// device scope) cannot meet the Vulkan model: its check names the feature the profile lacks.
|
||||
#[test]
|
||||
fn glsl450_coherent_resources_never_pass_under_the_vulkan_model() {
|
||||
let profiles = committed_profiles().expect("profiles");
|
||||
let profiles = profiles();
|
||||
let mut checked = 0;
|
||||
for (stem, p) in &profiles {
|
||||
if vulkan_model(p) {
|
||||
@@ -102,5 +117,5 @@ fn glsl450_coherent_resources_never_pass_under_the_vulkan_model() {
|
||||
assert_eq!(check(&plan, p), Err(want), "{stem}");
|
||||
checked += 1;
|
||||
}
|
||||
assert!(checked > 0, "no committed profile lacks the Vulkan model");
|
||||
assert!(checked > 0, "no profile lacks the Vulkan model");
|
||||
}
|
||||
@@ -24,8 +24,10 @@ fn addressed() -> DeviceProfile {
|
||||
profile("moltenvk-m3", DevicePolicy::default()).expect("moltenvk-m3")
|
||||
}
|
||||
|
||||
/// Profile F: a device without device addresses, below the runtime's floor.
|
||||
fn floor() -> DeviceProfile {
|
||||
profile("vk12-floor", DevicePolicy::default()).expect("vk12-floor")
|
||||
let dev = crate::pipeline::testing::device_f(DevicePolicy::default()).expect("Profile F");
|
||||
dev.profile().clone()
|
||||
}
|
||||
|
||||
fn slot(index: u32) -> Slot {
|
||||
@@ -498,8 +500,9 @@ fn a_loaded_pointer_is_dynamic_wide_and_makes_every_window_whole() {
|
||||
assert_eq!(window_of(&plan, 1), Some(Window::Whole));
|
||||
}
|
||||
|
||||
/// Profile F refuses the dereference of a dynamic root, naming `bufferDeviceAddress` and
|
||||
/// `shaderInt64` (both missing on `vk12-floor`), at the dereferencing instruction.
|
||||
/// Profile F refuses the dereference of a dynamic root, naming what it lacks of
|
||||
/// `bufferDeviceAddress` and `shaderInt64` (the first, on [`floor`]), at the dereferencing
|
||||
/// instruction.
|
||||
#[test]
|
||||
fn profile_f_refuses_a_dynamic_dereference_naming_buffer_device_address() {
|
||||
let (e, _) = loaded_pointer_kernel();
|
||||
@@ -510,10 +513,9 @@ fn profile_f_refuses_a_dynamic_dereference_naming_buffer_device_address() {
|
||||
assert_eq!(u.feature, Feature::DereferenceLoadedPointer);
|
||||
assert_eq!(
|
||||
u.needs,
|
||||
Needs::AnyOf(vec![vec![
|
||||
Capability::Feature(VkFeature::BufferDeviceAddress),
|
||||
Capability::Feature(VkFeature::ShaderInt64),
|
||||
]])
|
||||
Needs::AnyOf(vec![vec![Capability::Feature(
|
||||
VkFeature::BufferDeviceAddress
|
||||
)]])
|
||||
);
|
||||
assert!(u.location.is_some());
|
||||
}
|
||||
|
||||
@@ -32,8 +32,8 @@ pub(crate) fn committed_devices() -> Vec<(String, Device)> {
|
||||
fn floor_with(formats: &[(vk::Format, vk::FormatFeatureFlags)]) -> DeviceDescription {
|
||||
let (_, mut desc) = committed_descriptions()
|
||||
.into_iter()
|
||||
.find(|(s, _)| s == "vk12-floor")
|
||||
.expect("vk12-floor is committed");
|
||||
.find(|(s, _)| s == "runtime-floor")
|
||||
.expect("runtime-floor is committed");
|
||||
desc.formats = FormatSupport::default();
|
||||
for &(format, optimal) in formats {
|
||||
desc.formats.formats.insert(
|
||||
@@ -843,9 +843,10 @@ fn a_swizzled_candidate_needs_the_subset_s_view_swizzle() {
|
||||
|
||||
/// The ASTC HDR and PVRTC RGBA formats are their `SFLOAT` and PVRTC1 blocks where the profile
|
||||
/// exposes them: on `moltenvk-m3` (a 1.4 device with `VK_IMG_format_pvrtc`) they map directly;
|
||||
/// on the 1.2 floor listing the same blocks without the extensions, the refusal names the
|
||||
/// extension, and for a PVRTC format the format of its decoded twin's codes, which that floor does
|
||||
/// not list either.
|
||||
/// on a Vulkan 1.2 device listing the same blocks without the extensions (the runtime's floor read
|
||||
/// at 1.2, below that floor: 1.3 made the ASTC HDR blocks core), the refusal names the extension,
|
||||
/// and for a PVRTC format the format of its decoded twin's codes, which that device does not list
|
||||
/// either.
|
||||
#[test]
|
||||
fn compressed_extension_formats_follow_exposure() {
|
||||
use FormatUsage as U;
|
||||
@@ -876,7 +877,13 @@ fn compressed_extension_formats_follow_exposure() {
|
||||
.into_iter()
|
||||
.find(|(s, _)| s == "moltenvk-m3")
|
||||
.expect("moltenvk-m3 is committed");
|
||||
let floor = device(floor_with(&cases.map(|(_, format, _)| (format, SAMPLED))));
|
||||
let mut at_1_2 = floor_with(&cases.map(|(_, format, _)| (format, SAMPLED)));
|
||||
at_1_2.api_version = ApiVersion::V1_2;
|
||||
let extensions = at_1_2.extensions.clone();
|
||||
at_1_2
|
||||
.features
|
||||
.retain(|&f| f.exposure().exposed(ApiVersion::V1_2, &extensions));
|
||||
let floor = device(at_1_2);
|
||||
for (pf, format, extension) in cases {
|
||||
let m =
|
||||
vk_format(pf, &sampled, moltenvk.profile()).unwrap_or_else(|e| panic!("{pf:?}: {e}"));
|
||||
@@ -888,7 +895,7 @@ fn compressed_extension_formats_follow_exposure() {
|
||||
usage: U::SampledImage,
|
||||
},
|
||||
]];
|
||||
// A PVRTC format's decoded twin, whose codes' format this floor does not list; an ASTC
|
||||
// A PVRTC format's decoded twin, whose codes' format this device does not list; an ASTC
|
||||
// HDR format's, whose halves' format it does not list.
|
||||
if crate::bind::PvrtcDecode::of(pf).is_some() {
|
||||
let codes = match crate::metal::texel_format::srgb_coded(pf) {
|
||||
@@ -2699,13 +2706,13 @@ fn packed_sixteen_bit_formats_sit_in_the_vulkan_word_of_their_bits() {
|
||||
&sampled,
|
||||
committed_devices()
|
||||
.iter()
|
||||
.find(|(s, _)| s == "vk12-floor")
|
||||
.expect("vk12-floor is committed")
|
||||
.find(|(s, _)| s == "runtime-floor")
|
||||
.expect("runtime-floor is committed")
|
||||
.1
|
||||
.profile(),
|
||||
)
|
||||
.is_err(),
|
||||
"the 1.2 floor exposes no 4-bit word of Metal's channel order"
|
||||
"the runtime floor exposes no 4-bit word of Metal's channel order"
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -1368,7 +1368,7 @@ mod tests {
|
||||
fn device(features: &[VkFeature], remove: &[VkFeature]) -> Device {
|
||||
let (_, mut desc) = committed_descriptions()
|
||||
.into_iter()
|
||||
.find(|(s, _)| s == "vk12-floor")
|
||||
.find(|(s, _)| s == "runtime-floor")
|
||||
.unwrap();
|
||||
desc.features.extend(features.iter().copied());
|
||||
for f in remove {
|
||||
@@ -1545,7 +1545,7 @@ mod tests {
|
||||
use DeviceLodBias::{Capped, Exact, NotANumber, Withheld};
|
||||
let mut floor = committed_descriptions()
|
||||
.into_iter()
|
||||
.find(|(s, _)| s == "vk12-floor")
|
||||
.find(|(s, _)| s == "runtime-floor")
|
||||
.unwrap()
|
||||
.1;
|
||||
floor.limits.max_sampler_lod_bias_bits = 15.5f32.to_bits();
|
||||
@@ -1796,7 +1796,7 @@ mod tests {
|
||||
use SamplerMinMagFilter::{Linear, Nearest};
|
||||
let (_, mut desc) = committed_descriptions()
|
||||
.into_iter()
|
||||
.find(|(s, _)| s == "vk12-floor")
|
||||
.find(|(s, _)| s == "runtime-floor")
|
||||
.unwrap();
|
||||
desc.features.insert(VkFeature::SamplerAnisotropy);
|
||||
desc.limits.max_sampler_anisotropy_bits = 16f32.to_bits();
|
||||
@@ -1996,7 +1996,7 @@ mod tests {
|
||||
let swizzling = {
|
||||
let (_, mut desc) = committed_descriptions()
|
||||
.into_iter()
|
||||
.find(|(s, _)| s == "vk12-floor")
|
||||
.find(|(s, _)| s == "runtime-floor")
|
||||
.unwrap();
|
||||
desc.extensions.extend([
|
||||
VkExtension::ExtBorderColorSwizzle,
|
||||
@@ -2163,7 +2163,7 @@ mod tests {
|
||||
let with = |swizzle: bool, rgba4: bool| {
|
||||
let (_, mut desc) = committed_descriptions()
|
||||
.into_iter()
|
||||
.find(|(s, _)| s == "vk12-floor")
|
||||
.find(|(s, _)| s == "runtime-floor")
|
||||
.unwrap();
|
||||
if swizzle {
|
||||
desc.extensions.extend([
|
||||
@@ -2255,7 +2255,7 @@ mod tests {
|
||||
let with = |features: &[VkFeature]| {
|
||||
let (_, mut desc) = committed_descriptions()
|
||||
.into_iter()
|
||||
.find(|(s, _)| s == "vk12-floor")
|
||||
.find(|(s, _)| s == "runtime-floor")
|
||||
.unwrap();
|
||||
if !features.is_empty() {
|
||||
desc.extensions.extend([
|
||||
|
||||
@@ -502,7 +502,7 @@ mod tests {
|
||||
fn device(dual: bool) -> Device {
|
||||
let (_, mut desc) = committed_descriptions()
|
||||
.into_iter()
|
||||
.find(|(s, _)| s == "vk12-floor")
|
||||
.find(|(s, _)| s == "runtime-floor")
|
||||
.unwrap();
|
||||
if dual {
|
||||
desc.features.insert(VkFeature::DualSrcBlend);
|
||||
@@ -636,7 +636,7 @@ mod tests {
|
||||
/// their features and are refused, naming the feature, where it does not.
|
||||
#[test]
|
||||
fn encoder_raster_state_needs_its_features() {
|
||||
let (floor, lavapipe) = (committed("vk12-floor"), committed("lavapipe"));
|
||||
let (floor, lavapipe) = (committed("runtime-floor"), committed("lavapipe"));
|
||||
let needs =
|
||||
|what, feature| Error::from(Unsupported::needs(what, Capability::Feature(feature)));
|
||||
assert_eq!(
|
||||
|
||||
@@ -512,7 +512,7 @@ mod tests {
|
||||
fn floor() -> crate::device::DeviceDescription {
|
||||
committed_descriptions()
|
||||
.into_iter()
|
||||
.find(|(s, _)| s == "vk12-floor")
|
||||
.find(|(s, _)| s == "runtime-floor")
|
||||
.unwrap()
|
||||
.1
|
||||
}
|
||||
|
||||
@@ -206,7 +206,7 @@ fn a_metallib_parses_from_its_tags_alone() {
|
||||
));
|
||||
}
|
||||
// Compiling the broken function fails at decode, typed.
|
||||
let dev = device("lunarg-desktop-baseline-2023");
|
||||
let dev = device("runtime-floor");
|
||||
let broken = lib.function("broken").expect("broken");
|
||||
assert!(matches!(
|
||||
dev.compile_compute_pipeline(&kernel(broken), &Budget::standard()),
|
||||
@@ -221,7 +221,7 @@ fn a_metallib_function_compiles_after_its_container_check() {
|
||||
let Some(bc) = fixture("store_const") else {
|
||||
return;
|
||||
};
|
||||
let dev = device("lunarg-desktop-baseline-2023");
|
||||
let dev = device("runtime-floor");
|
||||
let bytes = metallib(&[MtlbFunction {
|
||||
name: "store_const",
|
||||
type_code: 2,
|
||||
@@ -287,7 +287,7 @@ fn a_compute_pipeline_compiles_from_a_function() {
|
||||
};
|
||||
let lib = Library::from_air(&bc).expect("library");
|
||||
let f = lib.function("store_const").expect("function");
|
||||
for stem in ["moltenvk-m3", "lunarg-desktop-baseline-2023", "vk12-floor"] {
|
||||
for stem in ["moltenvk-m3", "runtime-floor"] {
|
||||
let dev = device(stem);
|
||||
let mut d = kernel(f.clone());
|
||||
d.max_total_threads_per_threadgroup = Some(64);
|
||||
@@ -407,7 +407,7 @@ fn a_compiled_stage_links_without_decoding() {
|
||||
assert_eq!(from_compiled.key, dev.compute_pipeline_key(&d));
|
||||
|
||||
// A function compiled for another profile is refused, not linked.
|
||||
let other = device("vk12-floor");
|
||||
let other = device("runtime-floor");
|
||||
assert_eq!(
|
||||
other.compile_compute_pipeline(&d, &Budget::standard()),
|
||||
Err(Error::InvalidDescriptor(
|
||||
@@ -474,7 +474,7 @@ fn function_keys_cover_their_inputs() {
|
||||
.expect("library")
|
||||
.function("stage_io_vertex_gated")
|
||||
.expect("function");
|
||||
let (a, b) = (device("moltenvk-m3"), device("vk12-floor"));
|
||||
let (a, b) = (device("moltenvk-m3"), device("runtime-floor"));
|
||||
let mut fd = FunctionDescriptor::new(f);
|
||||
let none = LoweringInputs::new();
|
||||
let base = a.function_compile_key(&fd, &none);
|
||||
@@ -792,7 +792,7 @@ fn concurrent_compiles_of_one_function_agree() {
|
||||
let Some(bc) = fixture("store_const") else {
|
||||
return;
|
||||
};
|
||||
let dev = device("lunarg-desktop-baseline-2023");
|
||||
let dev = device("runtime-floor");
|
||||
let f = Library::from_air(&bc)
|
||||
.expect("library")
|
||||
.function("store_const")
|
||||
@@ -834,7 +834,7 @@ fn determinism_stage_words() -> Option<Vec<(String, Vec<u32>)>> {
|
||||
let vertex = lib.function("colored_vertex").expect("vertex");
|
||||
let fragment = lib.function("sampled_fragment").expect("fragment");
|
||||
let mut out = Vec::new();
|
||||
for stem in ["moltenvk-m3", "lunarg-desktop-baseline-2023"] {
|
||||
for stem in ["moltenvk-m3", "runtime-floor"] {
|
||||
for format in [
|
||||
metal::PixelFormat::RGBA8Unorm,
|
||||
metal::PixelFormat::BGRA8Unorm,
|
||||
@@ -1051,7 +1051,7 @@ fn a_render_pipeline_compiles_from_functions() {
|
||||
};
|
||||
let lib = Library::from_air(&bc).expect("library");
|
||||
let vertex = lib.function("stage_io_vertex_position").expect("vertex");
|
||||
for stem in ["moltenvk-m3", "lunarg-desktop-baseline-2023"] {
|
||||
for stem in ["moltenvk-m3", "runtime-floor"] {
|
||||
let dev = device(stem);
|
||||
let mut d = RenderPipelineDescriptor::new(StageSource::Function(FunctionDescriptor::new(
|
||||
vertex.clone(),
|
||||
@@ -1309,7 +1309,7 @@ fn a_queried_render_descriptor_key_covers_each_field_group() {
|
||||
assert_eq!(dev.queried_render_descriptor_key(&d.clone()), key);
|
||||
assert_eq!(device("moltenvk-m3").queried_render_descriptor_key(&d), key);
|
||||
assert_ne!(
|
||||
device("lunarg-desktop-baseline-2023").queried_render_descriptor_key(&d),
|
||||
device("runtime-floor").queried_render_descriptor_key(&d),
|
||||
key,
|
||||
"the profile"
|
||||
);
|
||||
@@ -1560,7 +1560,7 @@ fn a_render_descriptor_key_covers_its_fields() {
|
||||
assert_eq!(dev.render_descriptor_key(&d.clone()), key);
|
||||
assert_eq!(device("moltenvk-m3").render_descriptor_key(&d), key);
|
||||
assert_ne!(
|
||||
device("lunarg-desktop-baseline-2023").render_descriptor_key(&d),
|
||||
device("runtime-floor").render_descriptor_key(&d),
|
||||
key,
|
||||
"the profile"
|
||||
);
|
||||
@@ -1660,8 +1660,10 @@ fn a_render_pipeline_requires_extended_dynamic_state_exactly_when_it_makes_one_d
|
||||
l3(&pipe.stages[0].spirv, &pipe.requirements, &dev);
|
||||
pipe
|
||||
};
|
||||
// Vulkan 1.2 without the extension: static states, no requirement.
|
||||
let floor = description("lunarg-desktop-baseline-2023");
|
||||
// Vulkan 1.2 without the extension (`runtime-floor` as a 1.2 context reads it): static states,
|
||||
// no requirement.
|
||||
let floor = crate::pipeline::testing::description_at_1_2("runtime-floor", false)
|
||||
.expect("runtime-floor");
|
||||
assert!(!floor.has(VkFeature::ExtendedDynamicState));
|
||||
let plain = compile(&floor);
|
||||
assert!(plain
|
||||
@@ -1692,7 +1694,7 @@ fn a_render_pipeline_requires_extended_dynamic_state_exactly_when_it_makes_one_d
|
||||
);
|
||||
|
||||
// From Vulkan 1.3 the states are core without a feature member: required, nothing to enable.
|
||||
for stem in ["lavapipe", "moltenvk-m3", "roadmap-2022"] {
|
||||
for stem in ["lavapipe", "moltenvk-m3", "runtime-floor"] {
|
||||
let desc = description(stem);
|
||||
assert!(desc.api_version >= crate::device::requirements::ApiVersion::V1_3);
|
||||
let pipe = compile(&desc);
|
||||
@@ -1758,7 +1760,9 @@ fn a_vertex_pipeline_makes_its_input_assembly_dynamic_exactly_with_both_extended
|
||||
);
|
||||
topology
|
||||
};
|
||||
let floor = description("lunarg-desktop-baseline-2023");
|
||||
// `runtime-floor` as a Vulkan 1.2 context reads it, without either extension.
|
||||
let floor = crate::pipeline::testing::description_at_1_2("runtime-floor", false)
|
||||
.expect("runtime-floor");
|
||||
assert!(!floor.has(VkFeature::ExtendedDynamicState));
|
||||
assert!(!floor.has(VkFeature::ExtendedDynamicState2));
|
||||
assert!(!assembly(&compile(&floor)));
|
||||
@@ -1795,7 +1799,7 @@ fn a_vertex_pipeline_makes_its_input_assembly_dynamic_exactly_with_both_extended
|
||||
Err(Capability::Feature(VkFeature::ExtendedDynamicState2))
|
||||
);
|
||||
// From Vulkan 1.3: dynamic, nothing to enable.
|
||||
for stem in ["lavapipe", "moltenvk-m3", "roadmap-2022"] {
|
||||
for stem in ["lavapipe", "moltenvk-m3", "runtime-floor"] {
|
||||
let desc = description(stem);
|
||||
let pipe = compile(&desc);
|
||||
assert!(assembly(&pipe), "{stem}");
|
||||
@@ -2415,7 +2419,7 @@ fn a_multisampled_framebuffer_fetch_reads_each_samples_own_color() {
|
||||
/// A render pipeline requires `independentBlend` exactly when the elements of its `pAttachments`
|
||||
/// differ, and `dualSrcBlend` exactly when a blend reads the second output. `exf2_skip_one` writes
|
||||
/// color attachments 0 and 2, not 1: on `lavapipe` attachment 1 is masked and the feature required
|
||||
/// (and enabled); on `vk12-floor`, without the feature, every element is identical, an absent
|
||||
/// (and enabled); on `runtime-floor` without the feature, every element is identical, an absent
|
||||
/// attachment 1's included, and a written attachment that blends differently is refused typed. A
|
||||
/// blend of one and zero, added, of an attachment whose channels convert by a rule other than the
|
||||
/// device's (`StageIo::color_writes`) takes no Vulkan blend, so it differs from no other element.
|
||||
@@ -2449,8 +2453,7 @@ fn a_render_pipeline_requires_the_blend_features_its_attachments_need() {
|
||||
));
|
||||
d
|
||||
};
|
||||
let compile = |stem: &str, d: &RenderPipelineDescriptor| {
|
||||
let desc = description(stem);
|
||||
let compile = |desc: &DeviceDescription, d: &RenderPipelineDescriptor| {
|
||||
let dev = Device::from_queries(desc.clone(), DevicePolicy::default()).expect("device");
|
||||
let pipe = dev.compile_render_pipeline(d, &Budget::standard())?;
|
||||
let enables = desc
|
||||
@@ -2477,21 +2480,24 @@ fn a_render_pipeline_requires_the_blend_features_its_attachments_need() {
|
||||
| vk::ColorComponentFlags::B
|
||||
| vk::ColorComponentFlags::A;
|
||||
let none = vk::ColorComponentFlags::empty();
|
||||
assert!(description("lavapipe").has(INDEPENDENT));
|
||||
assert!(!description("vk12-floor").has(INDEPENDENT));
|
||||
let lavapipe = description("lavapipe");
|
||||
assert!(lavapipe.has(INDEPENDENT));
|
||||
// `runtime-floor` without `independentBlend`, which the runtime's floor requires.
|
||||
let mut floor = description("runtime-floor");
|
||||
floor.features.remove(&INDEPENDENT);
|
||||
|
||||
// The unwritten attachment.
|
||||
let d = descriptor(&fragment, true);
|
||||
let pipe = compile("lavapipe", &d).expect("lavapipe");
|
||||
let pipe = compile(&lavapipe, &d).expect("lavapipe");
|
||||
assert_eq!(masks(&pipe), [all, none, all]);
|
||||
assert!(pipe.requirements.features.contains(&INDEPENDENT));
|
||||
let pipe = compile("vk12-floor", &d).expect("vk12-floor");
|
||||
let pipe = compile(&floor, &d).expect("the floor");
|
||||
assert_eq!(masks(&pipe), [all, all, all]);
|
||||
assert!(!pipe.requirements.features.contains(&INDEPENDENT));
|
||||
// An absent attachment 1: its element is the others'.
|
||||
let d = descriptor(&fragment, false);
|
||||
for stem in ["lavapipe", "vk12-floor"] {
|
||||
let pipe = compile(stem, &d).expect(stem);
|
||||
for (stem, desc) in [("lavapipe", &lavapipe), ("the floor", &floor)] {
|
||||
let pipe = compile(desc, &d).expect(stem);
|
||||
assert!(pipe.graphics.color_attachments[1].is_none());
|
||||
assert_eq!(masks(&pipe), [all, all, all], "{stem}");
|
||||
assert!(!pipe.requirements.features.contains(&INDEPENDENT), "{stem}");
|
||||
@@ -2502,7 +2508,7 @@ fn a_render_pipeline_requires_the_blend_features_its_attachments_need() {
|
||||
if let Some(a) = d.color_attachments[0].as_mut() {
|
||||
a.blending_enabled = true;
|
||||
}
|
||||
let pipe = compile("lavapipe", &d).expect("lavapipe");
|
||||
let pipe = compile(&lavapipe, &d).expect("lavapipe");
|
||||
let blend = |pipe: &RenderPipeline, at: usize| {
|
||||
pipe.graphics.color_attachments[at]
|
||||
.as_ref()
|
||||
@@ -2515,7 +2521,7 @@ fn a_render_pipeline_requires_the_blend_features_its_attachments_need() {
|
||||
if let Some(a) = d.color_attachments[0].as_mut() {
|
||||
a.destination_rgb_blend_factor = metal::BlendFactor::OneMinusSourceAlpha;
|
||||
}
|
||||
let pipe = compile("lavapipe", &d).expect("lavapipe");
|
||||
let pipe = compile(&lavapipe, &d).expect("lavapipe");
|
||||
assert!(blend(&pipe, 0).is_some());
|
||||
assert_eq!(blend(&pipe, 2), None);
|
||||
assert!(pipe.requirements.features.contains(&INDEPENDENT));
|
||||
@@ -2523,7 +2529,7 @@ fn a_render_pipeline_requires_the_blend_features_its_attachments_need() {
|
||||
let at_2 = crate::error::Location::render_pipeline()
|
||||
.with_attachment(crate::error::Attachment::Color(2));
|
||||
assert_eq!(
|
||||
compile("vk12-floor", &d).unwrap_err(),
|
||||
compile(&floor, &d).unwrap_err(),
|
||||
Error::Unsupported(
|
||||
Unsupported::needs(
|
||||
Feature::IndependentBlending,
|
||||
@@ -2547,7 +2553,7 @@ fn a_render_pipeline_requires_the_blend_features_its_attachments_need() {
|
||||
a.blending_enabled = true;
|
||||
a.source_rgb_blend_factor = factor;
|
||||
}
|
||||
let pipe = compile("lavapipe", &d).expect("lavapipe");
|
||||
let pipe = compile(&lavapipe, &d).expect("lavapipe");
|
||||
assert_eq!(
|
||||
pipe.requirements
|
||||
.features
|
||||
@@ -2727,12 +2733,7 @@ fn each_stage_carries_its_own_constant_blob() {
|
||||
let lib = Library::from_air(&bc).expect("library");
|
||||
let vertex = lib.function("blob_vertex").expect("vertex");
|
||||
let fragment = lib.function("blob_fragment").expect("fragment");
|
||||
for stem in [
|
||||
"moltenvk-m3",
|
||||
"lunarg-desktop-baseline-2023",
|
||||
"lavapipe",
|
||||
"vk12-floor",
|
||||
] {
|
||||
for stem in ["moltenvk-m3", "runtime-floor", "lavapipe"] {
|
||||
let dev = device(stem);
|
||||
let mut d = RenderPipelineDescriptor::new(StageSource::Function(FunctionDescriptor::new(
|
||||
vertex.clone(),
|
||||
@@ -2989,24 +2990,38 @@ fn a_render_pipeline_requires_its_framebuffer_sample_counts() {
|
||||
/// The interface states the texture slots a fragment function reads only at its own pixel
|
||||
/// (`spirv::requirements::own_pixel`): owned fixture `tob_renders`'s `tob_read`
|
||||
/// (`t.read(uint2(in.position.xy))`) on every profile, whether the device's robustness returns
|
||||
/// Metal's out-of-bounds texel or the shader clamps the read (both kinds of profile are among
|
||||
/// them); not `tob_sample` (a sample at the pixel's center), `tob_read_buffer` (a texture
|
||||
/// buffer's texel by arithmetic), nor `tob_solid`, which reads no texture.
|
||||
/// Metal's out-of-bounds texel or the shader clamps the read (the runtime's floor without
|
||||
/// `robustImageAccess2`, a device below that floor); not `tob_sample` (a sample at the pixel's
|
||||
/// center), `tob_read_buffer` (a texture buffer's texel by arithmetic), nor `tob_solid`, which
|
||||
/// reads no texture.
|
||||
#[test]
|
||||
fn the_interface_states_the_textures_read_at_the_fragments_own_pixel() {
|
||||
use crate::device::requirements::VkFeature;
|
||||
let Some(bc) = fixture("tob_renders") else {
|
||||
return;
|
||||
};
|
||||
let mut checks = std::collections::BTreeSet::new();
|
||||
for stem in [
|
||||
let mut profiles: Vec<(&str, crate::device::profile::DeviceProfile)> = [
|
||||
"intel-irisxe-anv",
|
||||
"nvidia-rtx5080-laptop",
|
||||
"amd-780m-radv",
|
||||
"lavapipe",
|
||||
"moltenvk-m3",
|
||||
"vk12-floor",
|
||||
] {
|
||||
"runtime-floor",
|
||||
]
|
||||
.map(|stem| {
|
||||
let p = crate::pipeline::testing::profile(stem, DevicePolicy::default()).expect("profile");
|
||||
(stem, p)
|
||||
})
|
||||
.into();
|
||||
let clamped = crate::pipeline::testing::profile_without(
|
||||
"runtime-floor",
|
||||
&[VkFeature::RobustImageAccess2],
|
||||
DevicePolicy::default(),
|
||||
)
|
||||
.expect("profile");
|
||||
profiles.push(("runtime-floor without robustImageAccess2", clamped));
|
||||
for (stem, p) in profiles {
|
||||
checks.insert(crate::memory::contain::device_reads_texels(&p, false));
|
||||
for (entry, own) in [
|
||||
("tob_read", &[0u32][..]),
|
||||
@@ -3154,7 +3169,7 @@ fn a_snapshot_variant_reads_its_texture_in_the_copy_alone() {
|
||||
"amd-780m-radv",
|
||||
"lavapipe",
|
||||
"moltenvk-m3",
|
||||
"vk12-floor",
|
||||
"runtime-floor",
|
||||
] {
|
||||
let p = crate::pipeline::testing::profile(stem, DevicePolicy::default()).expect("profile");
|
||||
let base = crate::pipeline::testing::compile(&bc, "tob_read", &p)
|
||||
|
||||
@@ -175,7 +175,7 @@ fn the_control_push_range_takes_the_first_free_gap() {
|
||||
offset,
|
||||
size,
|
||||
};
|
||||
let p = profile("lunarg-desktop-baseline-2023");
|
||||
let p = profile("runtime-floor");
|
||||
let control_offset = |ranges: &[PushConstantRange]| {
|
||||
push_offset(ranges, (control::PUSH_BYTES, 4), Feature::Tessellation, &p)
|
||||
};
|
||||
@@ -193,14 +193,14 @@ fn the_control_push_range_takes_the_first_free_gap() {
|
||||
control_offset(&[range(0, 48), range(64, 8)]).expect("too small a gap"),
|
||||
72
|
||||
);
|
||||
// 128 bytes: a vertex window of 64 and a fragment range to 120 leave no 24-byte gap.
|
||||
match control_offset(&[range(0, 64), range(64, 56)]) {
|
||||
// 256 bytes: a vertex window of 64 and a fragment range to 248 leave no 24-byte gap.
|
||||
match control_offset(&[range(0, 64), range(64, 184)]) {
|
||||
Err(Error::Unsupported(u)) => assert_eq!(
|
||||
u.needs,
|
||||
Needs::AnyOf(vec![vec![Capability::Limit {
|
||||
limit: VkLimit::MaxPushConstantsSize,
|
||||
required: 144,
|
||||
available: 128,
|
||||
required: 272,
|
||||
available: 256,
|
||||
}]])
|
||||
),
|
||||
other => panic!("{other:?}"),
|
||||
|
||||
@@ -1116,22 +1116,21 @@ fn alpha_to_one_is_refused_only_without_the_feature() {
|
||||
let va = artifact(iface(Stage::Vertex, vec![], vec![]), None);
|
||||
let fa = artifact(iface(Stage::Fragment, vec![], vec![]), None);
|
||||
let inputs = LinkInputs::Render(Box::new(r));
|
||||
// `swiftshader` lists `alphaToOne` as unsupported, and `vk12-floor` states no such member.
|
||||
for stem in ["swiftshader", "vk12-floor"] {
|
||||
let p = profile(stem);
|
||||
assert!(
|
||||
!p.fields().enabled.features.contains(&VkFeature::AlphaToOne),
|
||||
"{stem} has the feature"
|
||||
);
|
||||
assert_eq!(
|
||||
link(&[&va, &fa], &inputs, &p).unwrap_err(),
|
||||
Error::Unsupported(Unsupported::needs(
|
||||
Feature::AlphaToOne,
|
||||
Capability::Feature(VkFeature::AlphaToOne)
|
||||
)),
|
||||
"{stem}"
|
||||
);
|
||||
}
|
||||
// `runtime-floor` without `alphaToOne`, which the runtime's floor requires.
|
||||
let p = crate::pipeline::testing::profile_without(
|
||||
"runtime-floor",
|
||||
&[VkFeature::AlphaToOne],
|
||||
DevicePolicy::default(),
|
||||
)
|
||||
.expect("profile");
|
||||
assert!(!p.fields().enabled.features.contains(&VkFeature::AlphaToOne));
|
||||
assert_eq!(
|
||||
link(&[&va, &fa], &inputs, &p).unwrap_err(),
|
||||
Error::Unsupported(Unsupported::needs(
|
||||
Feature::AlphaToOne,
|
||||
Capability::Feature(VkFeature::AlphaToOne)
|
||||
))
|
||||
);
|
||||
// The same inputs on a device with the feature link, and carry it.
|
||||
let p = profile("moltenvk-m3");
|
||||
let g = link(&[&va, &fa], &inputs, &p)
|
||||
@@ -1572,7 +1571,13 @@ fn attachment_states_are_identical_or_need_independent_blend() {
|
||||
a.write_mask = mask;
|
||||
a
|
||||
};
|
||||
let floor = profile("vk12-floor");
|
||||
// `runtime-floor` without `independentBlend`, which the runtime's floor requires.
|
||||
let floor = crate::pipeline::testing::profile_without(
|
||||
"runtime-floor",
|
||||
&[VkFeature::IndependentBlend],
|
||||
DevicePolicy::default(),
|
||||
)
|
||||
.expect("profile");
|
||||
let lavapipe = profile("lavapipe");
|
||||
assert!(!floor.fields().fragment.independent_blend);
|
||||
assert!(lavapipe.fields().fragment.independent_blend);
|
||||
@@ -1800,7 +1805,13 @@ fn a_dual_source_blend_needs_dual_src_blend() {
|
||||
"{factor:?}"
|
||||
);
|
||||
}
|
||||
let floor = profile("vk12-floor");
|
||||
// `runtime-floor` without `dualSrcBlend`, which the runtime's floor requires.
|
||||
let floor = crate::pipeline::testing::profile_without(
|
||||
"runtime-floor",
|
||||
&[VkFeature::DualSrcBlend],
|
||||
DevicePolicy::default(),
|
||||
)
|
||||
.expect("profile");
|
||||
assert!(!floor.fields().fragment.dual_src_blend);
|
||||
assert_eq!(
|
||||
link(
|
||||
@@ -1876,7 +1887,13 @@ fn color_outputs_follow_metals_measured_rules() {
|
||||
})
|
||||
};
|
||||
let lavapipe = profile("lavapipe");
|
||||
let floor = profile("vk12-floor");
|
||||
// `runtime-floor` without `independentBlend`, which the runtime's floor requires.
|
||||
let floor = crate::pipeline::testing::profile_without(
|
||||
"runtime-floor",
|
||||
&[VkFeature::IndependentBlend],
|
||||
DevicePolicy::default(),
|
||||
)
|
||||
.expect("profile");
|
||||
for p in [&lavapipe, &profile("moltenvk-m3")] {
|
||||
// Components against channels.
|
||||
for (format, components, ok) in [
|
||||
@@ -2486,7 +2503,13 @@ fn multisampled_fragment_invocations_follow_metals_measured_rules() {
|
||||
assert_eq!(four, want, "{stem} case {i} at 4 samples");
|
||||
}
|
||||
}
|
||||
let p = profile("vk12-floor");
|
||||
// `runtime-floor` without `sampleRateShading`, which the runtime's floor requires.
|
||||
let p = crate::pipeline::testing::profile_without(
|
||||
"runtime-floor",
|
||||
&[VkFeature::SampleRateShading],
|
||||
DevicePolicy::default(),
|
||||
)
|
||||
.expect("profile");
|
||||
assert!(!p.fields().fragment.sample_rate_shading);
|
||||
assert_eq!(
|
||||
link(&[&va, &cases[1].0], &at(4), &p).unwrap_err(),
|
||||
|
||||
@@ -109,6 +109,40 @@ pub fn profile(stem: &str, policy: DevicePolicy) -> Result<DeviceProfile, String
|
||||
Ok(dev.profile().clone())
|
||||
}
|
||||
|
||||
/// Committed profile `stem` derived under `policy` without `features`. Without a feature the
|
||||
/// runtime's floor requires (`runtime-floor` states each), the device is below that floor: a test
|
||||
/// of a form only such a device takes builds it so.
|
||||
pub fn profile_without(
|
||||
stem: &str,
|
||||
features: &[crate::device::requirements::VkFeature],
|
||||
policy: DevicePolicy,
|
||||
) -> Result<DeviceProfile, String> {
|
||||
let mut desc = description(stem)?;
|
||||
for feature in features {
|
||||
desc.features.remove(feature);
|
||||
}
|
||||
let dev = Device::from_queries(desc, policy).map_err(|e| format!("{stem}: {e}"))?;
|
||||
Ok(dev.profile().clone())
|
||||
}
|
||||
|
||||
/// The name a test's messages give [`device_f`]'s device.
|
||||
pub const PROFILE_F: &str = "runtime-floor without bufferDeviceAddress";
|
||||
|
||||
/// `runtime-floor` without `bufferDeviceAddress`: a device below the runtime's floor whose buffers
|
||||
/// take the floor form (`BufferAccess::Floor`, Profile F), which no committed profile takes. A
|
||||
/// test of that form builds it so.
|
||||
pub fn description_f() -> Result<DeviceDescription, String> {
|
||||
let mut desc = description("runtime-floor")?;
|
||||
desc.features
|
||||
.remove(&crate::device::requirements::VkFeature::BufferDeviceAddress);
|
||||
Ok(desc)
|
||||
}
|
||||
|
||||
/// [`description_f`]'s device, derived under `policy`.
|
||||
pub fn device_f(policy: DevicePolicy) -> Result<Device, String> {
|
||||
Device::from_queries(description_f()?, policy).map_err(|e| format!("{PROFILE_F}: {e}"))
|
||||
}
|
||||
|
||||
/// Committed profile `stem` derived under `policy`, with `storage` storage buffers a stage
|
||||
/// (`maxPerStageDescriptorStorageBuffers`).
|
||||
pub fn profile_with_storage_buffers(
|
||||
@@ -123,15 +157,15 @@ pub fn profile_with_storage_buffers(
|
||||
}
|
||||
|
||||
/// The name [`formatless_floor`]'s profile goes by in a test's messages.
|
||||
pub const FORMATLESS_FLOOR: &str = "vk12-floor+formatless";
|
||||
pub const FORMATLESS_FLOOR: &str = "Profile F+formatless";
|
||||
|
||||
/// `vk12-floor` derived under `policy` with the two optional features that let a shader access a
|
||||
/// storage image without its format (`shaderStorageImageReadWithoutFormat` and
|
||||
/// `shaderStorageImageWriteWithoutFormat`): the floor, which states neither, beside a device that
|
||||
/// leaves a storage texture's format to the bound view.
|
||||
/// [`description_f`]'s device derived under `policy` with `shaderStorageImageReadWithoutFormat`,
|
||||
/// the optional feature that, beside the floor's `shaderStorageImageWriteWithoutFormat`, lets a
|
||||
/// shader access a storage image without its format: Profile F beside a device that leaves a
|
||||
/// storage texture's format to the bound view.
|
||||
pub fn formatless_floor(policy: DevicePolicy) -> Result<DeviceProfile, String> {
|
||||
use crate::device::requirements::VkFeature;
|
||||
let mut desc = description("vk12-floor")?;
|
||||
let mut desc = description_f()?;
|
||||
desc.features.extend([
|
||||
VkFeature::ShaderStorageImageReadWithoutFormat,
|
||||
VkFeature::ShaderStorageImageWriteWithoutFormat,
|
||||
|
||||
@@ -265,7 +265,7 @@ fn a_text_is_charged_the_same_wherever_it_is_assembled() {
|
||||
let (Some(a), Some(b)) = (assembled(&near), assembled(&far)) else {
|
||||
return;
|
||||
};
|
||||
let p = profile("vk12-floor", DevicePolicy::default()).expect("vk12-floor");
|
||||
let p = profile("runtime-floor", DevicePolicy::default()).expect("runtime-floor");
|
||||
let charged = |bitcode: &[u8]| {
|
||||
let mut m = meter();
|
||||
let artifact = compile_bitcode(
|
||||
|
||||
@@ -645,7 +645,7 @@ fn a_dropped_unwritten_fragment_input_is_absent_from_the_compiled_fragment() {
|
||||
let rgb = ColorWriteMask::RED
|
||||
.union(ColorWriteMask::GREEN)
|
||||
.union(ColorWriteMask::BLUE);
|
||||
let devices: Vec<(&str, Device)> = ["moltenvk-m3", "vk12-floor"]
|
||||
let devices: Vec<(&str, Device)> = ["moltenvk-m3", "runtime-floor"]
|
||||
.into_iter()
|
||||
.map(|stem| {
|
||||
let path = std::path::Path::new(env!("CARGO_MANIFEST_DIR"))
|
||||
|
||||
@@ -955,7 +955,13 @@ fn workgroup_initialized() -> TypedModule {
|
||||
fn workgroup_initializers_need_zero_initialize_workgroup_memory() {
|
||||
let m = workgroup_initialized();
|
||||
structure(&m).expect("structurally valid");
|
||||
let floor = profile("vk12-floor");
|
||||
// The runtime's floor without the feature, which the floor requires: a device below it.
|
||||
let floor = crate::pipeline::testing::profile_without(
|
||||
"runtime-floor",
|
||||
&[VkFeature::ShaderZeroInitializeWorkgroupMemory],
|
||||
Default::default(),
|
||||
)
|
||||
.expect("profile");
|
||||
assert!(!floor
|
||||
.fields()
|
||||
.enabled
|
||||
|
||||
@@ -294,8 +294,8 @@ fn profile() -> DeviceProfile {
|
||||
committed_profiles()
|
||||
.unwrap()
|
||||
.into_iter()
|
||||
.find(|(name, _)| name == "swiftshader")
|
||||
.expect("committed swiftshader profile")
|
||||
.find(|(name, _)| name == "runtime-floor")
|
||||
.expect("committed runtime-floor profile")
|
||||
.1
|
||||
}
|
||||
|
||||
|
||||
@@ -175,7 +175,7 @@ fn an_absent_vertex_attribute_is_not_declared() {
|
||||
return;
|
||||
};
|
||||
let entry = "fca_vertex_absent_attribute";
|
||||
for stem in ["moltenvk-m3", "vk12-floor"] {
|
||||
for stem in ["moltenvk-m3", "runtime-floor"] {
|
||||
let p = prof(stem);
|
||||
for (on, want) in [(false, vec![0]), (true, vec![0, 1])] {
|
||||
let gates: &[u32] = if on { &[0] } else { &[] };
|
||||
|
||||
@@ -59,12 +59,7 @@ use crate::spirv::ir::{
|
||||
use crate::spirv::verify::verify;
|
||||
|
||||
/// Profiles with and without 64-bit integers and 8/16-bit storage.
|
||||
const PROFILES: [&str; 4] = [
|
||||
"moltenvk-m3",
|
||||
"lunarg-desktop-baseline-2023",
|
||||
"vk12-floor",
|
||||
"lavapipe",
|
||||
];
|
||||
const PROFILES: [&str; 3] = ["moltenvk-m3", "runtime-floor", "lavapipe"];
|
||||
|
||||
fn policy() -> DevicePolicy {
|
||||
DevicePolicy::default()
|
||||
@@ -975,7 +970,7 @@ fn offsets(size: u64) -> Vec<u64> {
|
||||
#[test]
|
||||
fn every_leaf_path_is_exact_in_bounds_and_contained_out_of_bounds() {
|
||||
let size = 32u64;
|
||||
for stem in ["moltenvk-m3", "vk12-floor"] {
|
||||
for stem in ["moltenvk-m3", "runtime-floor"] {
|
||||
let p = profile_with(stem, false, true);
|
||||
for k in leaf_kernels() {
|
||||
let what = format!("{stem} {}", k.name);
|
||||
@@ -1998,7 +1993,7 @@ fn narrow_units_are_exact_at_every_bind_residual() {
|
||||
let profiles: [(&str, &[VkFeature]); 3] = [
|
||||
("moltenvk-m3", &[]),
|
||||
("moltenvk-m3", NO8),
|
||||
("lunarg-desktop-baseline-2023", &[]),
|
||||
("runtime-floor", &[]),
|
||||
];
|
||||
for (stem, removed) in profiles {
|
||||
let p = profile_without(stem, removed);
|
||||
@@ -2126,6 +2121,10 @@ fn narrow_views_are_declared_where_the_profile_accesses_the_unit() {
|
||||
const ATOMIC_OR: u16 = 241;
|
||||
const NO16: &[VkFeature] = &[VkFeature::StorageBuffer16BitAccess];
|
||||
const NO8: &[VkFeature] = &[VkFeature::StorageBuffer8BitAccess];
|
||||
const NO_NARROW: &[VkFeature] = &[
|
||||
VkFeature::StorageBuffer16BitAccess,
|
||||
VkFeature::StorageBuffer8BitAccess,
|
||||
];
|
||||
let cases: [NarrowCase; 14] = [
|
||||
("moltenvk-m3", &[], "store_half", 2, 0, false),
|
||||
("moltenvk-m3", &[], "store_i8", 2, 0, false),
|
||||
@@ -2139,18 +2138,12 @@ fn narrow_views_are_declared_where_the_profile_accesses_the_unit() {
|
||||
("moltenvk-m3", NO16, "store_half", 1, 0, true),
|
||||
("moltenvk-m3", NO8, "store_half", 2, 0, false),
|
||||
("moltenvk-m3", NO8, "store_i8", 1, 0, true),
|
||||
// The floor has no narrow storage access: every sub-word store joins its word.
|
||||
("vk12-floor", &[], "store_half", 1, 0, true),
|
||||
("vk12-floor", &[], "store_i8", 1, 0, true),
|
||||
(
|
||||
"lunarg-desktop-baseline-2023",
|
||||
&[],
|
||||
"store_half",
|
||||
1,
|
||||
0,
|
||||
true,
|
||||
),
|
||||
("lunarg-desktop-baseline-2023", &[], "store_i8", 2, 0, false),
|
||||
// Without narrow storage access (below the runtime's floor, which requires both widths)
|
||||
// every sub-word store joins its word; with 8-bit access alone a byte store does not.
|
||||
("runtime-floor", NO_NARROW, "store_half", 1, 0, true),
|
||||
("runtime-floor", NO_NARROW, "store_i8", 1, 0, true),
|
||||
("runtime-floor", NO16, "store_half", 1, 0, true),
|
||||
("runtime-floor", NO16, "store_i8", 2, 0, false),
|
||||
];
|
||||
let kernels = leaf_kernels();
|
||||
for (stem, removed, name, data_views, out_views, atomics) in cases {
|
||||
|
||||
@@ -93,7 +93,7 @@ fn an_aggregate_buffer_access_moves_every_member() {
|
||||
p.extend(&m);
|
||||
let mut want = vec![105.0f32, 206.0, 307.0, 408.0];
|
||||
want.extend(&m);
|
||||
for stem in ["moltenvk-m3", "lavapipe", "vk12-floor"] {
|
||||
for stem in ["moltenvk-m3", "lavapipe", "runtime-floor"] {
|
||||
let profile = profile(stem, DevicePolicy::default()).expect("profile");
|
||||
let (_, _, module) =
|
||||
compile_kept(&bitcode, "k", &profile).unwrap_or_else(|e| panic!("{stem}: {e}"));
|
||||
|
||||
@@ -85,13 +85,25 @@ fn every_entry_of_an_air_2_1_module_compiles() {
|
||||
|
||||
/// A status-less read whose alpha the function never uses needs no `OutOfBoundsAlpha`
|
||||
/// specialization; the same read with the whole texel used needs it. At least one profile must
|
||||
/// ask for it, or the pair proves nothing.
|
||||
/// ask for it, or the pair proves nothing: the runtime's floor without `robustImageAccess2` (a
|
||||
/// device below that floor, whose reads the shader checks) does.
|
||||
#[test]
|
||||
fn a_status_less_reads_alpha_is_observed_only_where_the_function_uses_it() {
|
||||
let Some(bc) = fixture() else { return };
|
||||
let fact = RuntimeFact::OutOfBoundsAlpha { slot: RAW };
|
||||
let mut asked = 0;
|
||||
for (stem, p) in &committed_profiles().expect("profiles") {
|
||||
let mut profiles = committed_profiles().expect("profiles");
|
||||
let checked = crate::pipeline::testing::profile_without(
|
||||
"runtime-floor",
|
||||
&[crate::device::requirements::VkFeature::RobustImageAccess2],
|
||||
Default::default(),
|
||||
)
|
||||
.expect("profile");
|
||||
profiles.push((
|
||||
"runtime-floor without robustImageAccess2".to_string(),
|
||||
checked,
|
||||
));
|
||||
for (stem, p) in &profiles {
|
||||
for (entry, uses_alpha) in [("a21_blit_fs", false), ("a21_alpha_fs", true)] {
|
||||
let (plan, _) =
|
||||
typed_module(&bc, entry, p).unwrap_or_else(|e| panic!("{entry}: {e:?}"));
|
||||
@@ -107,6 +119,6 @@ fn a_status_less_reads_alpha_is_observed_only_where_the_function_uses_it() {
|
||||
}
|
||||
assert!(
|
||||
asked > 0,
|
||||
"no committed profile checks this read in the shader, so the pair proves nothing"
|
||||
"no profile checks this read in the shader, so the pair proves nothing"
|
||||
);
|
||||
}
|
||||
@@ -738,7 +738,7 @@ fn thread_atomics_compute_their_documented_words() {
|
||||
let entry = "a27_thread_atomics";
|
||||
let threads = 8;
|
||||
let want: Vec<u32> = (0..threads).flat_map(thread_atomic_words).collect();
|
||||
for stem in ["moltenvk-m3", "lavapipe", "vk12-floor"] {
|
||||
for stem in ["moltenvk-m3", "lavapipe", "runtime-floor"] {
|
||||
let p = profile(stem, DevicePolicy::default()).expect("profile");
|
||||
let a = compile(&bc, entry, &p).unwrap_or_else(|e| panic!("{stem}: {e}"));
|
||||
let (_, words) = link_and_validate(&a, &p).unwrap_or_else(|e| panic!("{stem}: {e}"));
|
||||
|
||||
@@ -844,7 +844,7 @@ fn a_variant_draws_each_amplification_with_its_push_fields() {
|
||||
fn amplification_draws_refuse_what_the_variant_cannot_be() {
|
||||
let Some(bc) = fixture() else { return };
|
||||
let budget = Budget::standard();
|
||||
let dev = device("lunarg-desktop-baseline-2023");
|
||||
let dev = device("runtime-floor");
|
||||
let d = render(&bc, "amp_vertex_store", None, 2);
|
||||
let p = dev.compile_render_pipeline(&d, &budget).expect("base");
|
||||
let state = amplified(2, &[(0, 1), (0, 0)]);
|
||||
@@ -897,7 +897,7 @@ fn output_layer_or_geometry() -> Needs {
|
||||
fn a_profile_without_shader_output_layer_draws_or_refuses_every_amplification() {
|
||||
let Some(bc) = fixture() else { return };
|
||||
let budget = Budget::standard();
|
||||
let lunarg = "lunarg-desktop-baseline-2023";
|
||||
let lunarg = "runtime-floor";
|
||||
assert!(!description(lunarg).features.contains(&F::ShaderOutputLayer));
|
||||
assert!(!description(lunarg).features.contains(&F::GeometryShader));
|
||||
let mut lavapipe = description("lavapipe");
|
||||
|
||||
@@ -40,7 +40,7 @@ use crate::spirv::interp::{run, Buffer, Config, InterpError, Order, Resources, S
|
||||
use crate::spirv::ir::TypedModule;
|
||||
|
||||
/// Profiles with and without 64-bit integers, 16 and 32 KiB of shared memory.
|
||||
const PROFILES: [&str; 4] = ["moltenvk-m3", "swiftshader", "roadmap-2022", "lavapipe"];
|
||||
const PROFILES: [&str; 3] = ["moltenvk-m3", "runtime-floor", "lavapipe"];
|
||||
|
||||
const DATALAYOUT: &str = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v16:16:16-v24:32:32-v32:32:32-v48:64:64-v64:64:64-v96:128:128-v128:128:128-v192:256:256-v256:256:256-v512:512:512-v1024:1024:1024-n8:16:32";
|
||||
|
||||
@@ -229,10 +229,10 @@ fn the_static_arena_is_checked_against_max_compute_shared_memory_size() {
|
||||
};
|
||||
let e = compile(&over, "big", &p("moltenvk-m3")).expect_err("over the limit");
|
||||
assert_eq!(strip(e), refusal(32772, 32768));
|
||||
let e = compile(&full, "big", &p("roadmap-2022")).expect_err("over 16 KiB");
|
||||
let e = compile(&full, "big", &p("runtime-floor")).expect_err("over 16 KiB");
|
||||
assert_eq!(strip(e), refusal(32768, 16384));
|
||||
l3(&full, "big", &p("moltenvk-m3"), "moltenvk-m3 32768");
|
||||
l3(&half, "big", &p("roadmap-2022"), "roadmap-2022 16384");
|
||||
l3(&half, "big", &p("runtime-floor"), "runtime-floor 16384");
|
||||
}
|
||||
|
||||
const REGIONS: &str = r#"@s = internal addrspace(3) global [3 x i32] undef, align 4
|
||||
|
||||
@@ -167,8 +167,8 @@ fn snapshot_profiles() -> Vec<(String, DeviceProfile)> {
|
||||
|
||||
/// The kernels compile and validate on every committed profile: where the device has the four
|
||||
/// features they declare the heap's function-table array and no snapshot, and where it lacks
|
||||
/// one (the 2023 desktop baseline, without non-uniform storage-buffer indexing, and the two
|
||||
/// Vulkan 1.2 floors) the stage's snapshot and no array, beside the directory.
|
||||
/// one (the runtime's floor, without non-uniform storage-buffer indexing and storage-buffer
|
||||
/// update-after-bind) the stage's snapshot and no array, beside the directory.
|
||||
#[test]
|
||||
fn argument_tables_compile_on_every_profile() {
|
||||
let Some((caller, functions)) = fixtures() else {
|
||||
@@ -204,7 +204,7 @@ fn argument_tables_compile_on_every_profile() {
|
||||
snapshots.push(stem);
|
||||
}
|
||||
}
|
||||
assert_eq!(snapshots, ["lunarg-desktop-baseline-2023", "vk12-floor"]);
|
||||
assert_eq!(snapshots, ["runtime-floor"]);
|
||||
}
|
||||
|
||||
/// A call through a table loaded from an argument buffer that no linked function can answer
|
||||
@@ -442,7 +442,7 @@ fn the_plan_writes_the_snapshot_and_its_directory() {
|
||||
let Some((caller, functions)) = fixtures() else {
|
||||
return;
|
||||
};
|
||||
for stem in ["lunarg-desktop-baseline-2023", "vk12-floor"] {
|
||||
for stem in ["runtime-floor"] {
|
||||
let dev = device(stem);
|
||||
let pipe = pipeline(&dev, &caller, &functions, ONE);
|
||||
assert!(
|
||||
@@ -638,7 +638,7 @@ fn an_argument_table_call_calls_the_entry_its_table_holds() {
|
||||
table_bytes(&h, &[]),
|
||||
];
|
||||
let heap = directory_of("moltenvk-m3", &caller, &functions);
|
||||
let snapshot_directory = directory_of("vk12-floor", &caller, &functions);
|
||||
let snapshot_directory = directory_of("runtime-floor", &caller, &functions);
|
||||
let snapshot = FunctionTableSnapshot::of(state().function_tables.iter().map(|f| f.size))
|
||||
.expect("snapshot")
|
||||
.bytes(tables.iter().map(Vec::as_slice))
|
||||
@@ -797,7 +797,7 @@ fn tables_past_the_storage_range_are_read_at_their_addresses() {
|
||||
let wide = wide_state();
|
||||
assert_eq!(state().shape().function_tables.bytes_class, 0);
|
||||
assert_eq!(wide.shape().function_tables.bytes_class, 28);
|
||||
for stem in ["gate-lavapipe", "moltenvk-m3", "vk12-floor"] {
|
||||
for stem in ["gate-lavapipe", "moltenvk-m3", "runtime-floor"] {
|
||||
let dev = device(stem);
|
||||
let addressed = dev.profile().fields().buffer_access == BufferAccess::Addressed;
|
||||
let limit = dev.profile().fields().limits.max_storage_buffer_range;
|
||||
|
||||
@@ -35,12 +35,7 @@ use crate::pipeline::testing::{
|
||||
use crate::spirv::interp::{run, Buffer, Config, Resources};
|
||||
|
||||
/// The profiles: the M1 set plus one with 64-bit floats.
|
||||
const PROFILES: [&str; 4] = [
|
||||
"moltenvk-m3",
|
||||
"lunarg-desktop-baseline-2023",
|
||||
"vk12-floor",
|
||||
"amd-rdna3-radv",
|
||||
];
|
||||
const PROFILES: [&str; 3] = ["moltenvk-m3", "runtime-floor", "amd-rdna3-radv"];
|
||||
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||
enum Need {
|
||||
@@ -1260,9 +1255,15 @@ fn wide_divisions_share_one_routine_per_form() {
|
||||
return;
|
||||
};
|
||||
let cases = [
|
||||
// The runtime's floor without `shaderInt64`, a device below that floor.
|
||||
(
|
||||
"vk12-floor",
|
||||
profile("vk12-floor", crate::device::DevicePolicy::default()).expect("profile"),
|
||||
"runtime-floor without shaderInt64",
|
||||
crate::pipeline::testing::profile_without(
|
||||
"runtime-floor",
|
||||
&[crate::device::requirements::VkFeature::ShaderInt64],
|
||||
crate::device::DevicePolicy::default(),
|
||||
)
|
||||
.expect("profile"),
|
||||
3,
|
||||
5,
|
||||
0,
|
||||
@@ -1334,7 +1335,7 @@ fn fused_multiply_adds_take_the_profiles_route() {
|
||||
};
|
||||
// (profile, OpFmaKHR of the float kernel); its route is the device's `Fma` without them, the
|
||||
// `half` kernel's on every profile.
|
||||
for (stem, khr) in [("moltenvk-m3", 3), ("lavapipe", 0), ("vk12-floor", 0)] {
|
||||
for (stem, khr) in [("moltenvk-m3", 3), ("lavapipe", 0), ("runtime-floor", 0)] {
|
||||
let p = profile(stem, crate::device::DevicePolicy::default()).expect("profile");
|
||||
for kk in &ks {
|
||||
let float = kk.name == "fma_float_rounds_once";
|
||||
@@ -1452,7 +1453,7 @@ fn a_half_fused_multiply_add_is_the_devices_16_bit_fma_on_from_queries() {
|
||||
"intel-irisxe-anv",
|
||||
"nvidia-rtx50-linux",
|
||||
"lavapipe",
|
||||
"vk12-floor",
|
||||
"runtime-floor",
|
||||
] {
|
||||
let what = format!("fma_half_rounds_once on {stem} (from_queries)");
|
||||
let desc = description(stem).expect("description");
|
||||
@@ -1627,13 +1628,7 @@ fn dot_is_the_devices_op_dot_on_every_profile() {
|
||||
&& w.get(4) == Some(&(crate::spv::GlslStd450Op::Fma as u32))
|
||||
}) + count_op(words, crate::spv::Op::FmaKHR)
|
||||
};
|
||||
for stem in [
|
||||
"moltenvk-m3",
|
||||
"amd-rdna3-radv",
|
||||
"lavapipe",
|
||||
"vk12-floor",
|
||||
"lunarg-desktop-baseline-2023",
|
||||
] {
|
||||
for stem in ["moltenvk-m3", "amd-rdna3-radv", "lavapipe", "runtime-floor"] {
|
||||
{
|
||||
let policy = DevicePolicy::default();
|
||||
let p = profile(stem, policy).expect("profile");
|
||||
@@ -1697,7 +1692,7 @@ fn fast_fmod_is_metals_composition() {
|
||||
for (stem, khr, functions) in [
|
||||
("moltenvk-m3", 1, 1),
|
||||
("lavapipe", 0, 1),
|
||||
("vk12-floor", 0, 1),
|
||||
("runtime-floor", 0, 1),
|
||||
] {
|
||||
let p = profile(stem, crate::device::DevicePolicy::default()).expect("profile");
|
||||
let kk = &ks[0];
|
||||
@@ -1752,7 +1747,7 @@ fn an_ordered_not_equal_is_the_negated_unordered_equal() {
|
||||
let Some(bitcode) = assemble("ordered-not-equal", &module(&ks)) else {
|
||||
return;
|
||||
};
|
||||
for stem in ["moltenvk-m3", "lavapipe", "vk12-floor"] {
|
||||
for stem in ["moltenvk-m3", "lavapipe", "runtime-floor"] {
|
||||
let p = profile(stem, crate::device::DevicePolicy::default()).expect("profile");
|
||||
let kk = &ks[0];
|
||||
let what = format!("{} on {stem}", kk.name);
|
||||
@@ -1818,7 +1813,7 @@ fn an_arcp_division_is_the_devices_quotient() {
|
||||
let Some(bitcode) = assemble("fast-divide", &module(&ks)) else {
|
||||
return;
|
||||
};
|
||||
for stem in ["moltenvk-m3", "lavapipe", "vk12-floor"] {
|
||||
for stem in ["moltenvk-m3", "lavapipe", "runtime-floor"] {
|
||||
let p = profile(stem, crate::device::DevicePolicy::default()).expect("profile");
|
||||
for kk in &ks {
|
||||
let what = format!("{} on {stem}", kk.name);
|
||||
@@ -2006,7 +2001,7 @@ fn a_division_without_arcp_is_the_devices_quotient() {
|
||||
let Some(bitcode) = assemble("precise-divide", &module(&ks)) else {
|
||||
return;
|
||||
};
|
||||
for stem in ["moltenvk-m3", "lavapipe", "vk12-floor"] {
|
||||
for stem in ["moltenvk-m3", "lavapipe", "runtime-floor"] {
|
||||
let p = profile(stem, crate::device::DevicePolicy::default()).expect("profile");
|
||||
let device_nans =
|
||||
p.takes_driver_deviation(crate::error::DriverDeviation::MetalCanonicalNans);
|
||||
@@ -2087,7 +2082,7 @@ fn fast_sincos_is_the_devices_sine_and_cosine() {
|
||||
let Some(bitcode) = assemble("fast-sincos", &text) else {
|
||||
return;
|
||||
};
|
||||
for stem in ["moltenvk-m3", "lavapipe", "vk12-floor"] {
|
||||
for stem in ["moltenvk-m3", "lavapipe", "runtime-floor"] {
|
||||
let p = profile(stem, crate::device::DevicePolicy::default()).expect("profile");
|
||||
for kk in &ks {
|
||||
let what = format!("{} on {stem}", kk.name);
|
||||
|
||||
@@ -49,10 +49,9 @@ use crate::spirv::ir::TypedModule;
|
||||
use crate::spirv::verify::verify;
|
||||
|
||||
/// Profiles with robust descriptors and without, with and without 64-bit integers.
|
||||
const PROFILES: [&str; 5] = [
|
||||
const PROFILES: [&str; 4] = [
|
||||
"moltenvk-m3",
|
||||
"swiftshader",
|
||||
"roadmap-2022",
|
||||
"runtime-floor",
|
||||
"lavapipe",
|
||||
"nvidia-pascal-linux",
|
||||
];
|
||||
|
||||
@@ -331,7 +331,7 @@ fn a_bias_without_the_samplers_own_is_the_bias_operand() {
|
||||
fixtures.push((what, bc, "k"));
|
||||
}
|
||||
}
|
||||
for stem in ["moltenvk-m3", "amd-rdna3-radv", "lavapipe", "vk12-floor"] {
|
||||
for stem in ["moltenvk-m3", "amd-rdna3-radv", "lavapipe", "runtime-floor"] {
|
||||
let prof = p(stem);
|
||||
let property = match prof
|
||||
.fields()
|
||||
@@ -427,17 +427,27 @@ fn a_constant_bias_is_decided_at_compile_time_with_the_samplers_own() {
|
||||
/// `bias(0.5)`) are scaled by the whole bias through the same finite scaling: no clamp of the bias
|
||||
/// to `maxSamplerLodBias` (formerly `FClamp(bias, ±max)` before `Exp2`). Off Metal's own sampler,
|
||||
/// the runtime slot among the candidates takes them into Metal's anisotropic filter, emulated where
|
||||
/// its word states anisotropy.
|
||||
/// its word states anisotropy on a device without `samplerAnisotropy` (the runtime's floor without
|
||||
/// it, below that floor).
|
||||
#[test]
|
||||
fn hoisted_derivatives_take_the_whole_bias() {
|
||||
let Some(bc) = assemble_file("sampling_completion.ll") else {
|
||||
return;
|
||||
};
|
||||
for (stem, emulations) in [("moltenvk-m3", 0), ("vk12-floor", 1)] {
|
||||
let without = crate::pipeline::testing::profile_without(
|
||||
"runtime-floor",
|
||||
&[crate::device::requirements::VkFeature::SamplerAnisotropy],
|
||||
crate::device::DevicePolicy::default(),
|
||||
)
|
||||
.expect("profile");
|
||||
for (stem, profile, emulations) in [
|
||||
("moltenvk-m3", p("moltenvk-m3"), 0),
|
||||
("runtime-floor without samplerAnisotropy", without, 1),
|
||||
] {
|
||||
let a = ok_with(
|
||||
&bc,
|
||||
"fragment_mixed_samplers",
|
||||
&p(stem),
|
||||
&profile,
|
||||
&anisotropic_slot_0(),
|
||||
);
|
||||
let s = shape(&a);
|
||||
@@ -468,7 +478,7 @@ fn a_base_level_takes_the_whole_bias() {
|
||||
let Some(bc) = assemble_file("sampling_completion.ll") else {
|
||||
return;
|
||||
};
|
||||
for stem in ["moltenvk-m3", "vk12-floor"] {
|
||||
for stem in ["moltenvk-m3", "runtime-floor"] {
|
||||
let a = ok(&bc, "sample_bias_kernel", &p(stem));
|
||||
let s = shape(&a);
|
||||
assert_eq!(s.glsl_count(GLSL_FCLAMP), 0, "{stem}");
|
||||
|
||||
@@ -103,6 +103,12 @@ pub(super) fn device(stem: &str, tweak: impl FnOnce(&mut DeviceDescription)) ->
|
||||
Device::from_queries(desc, DevicePolicy::default()).expect("device")
|
||||
}
|
||||
|
||||
/// Profile F: `runtime-floor` without device addresses, below the runtime's floor, whose buffers
|
||||
/// are descriptors at its four storage buffers a stage.
|
||||
fn no_addresses(desc: &mut DeviceDescription) {
|
||||
desc.features.remove(&VkFeature::BufferDeviceAddress);
|
||||
}
|
||||
|
||||
fn no_robustness(desc: &mut DeviceDescription) {
|
||||
desc.features.remove(&VkFeature::RobustBufferAccess);
|
||||
desc.features.remove(&VkFeature::RobustBufferAccess2);
|
||||
@@ -466,7 +472,7 @@ entry:\n\
|
||||
}
|
||||
|
||||
/// Every profile with a compute-capable Vulkan 1.2 floor the M1 milestone names.
|
||||
const PROFILES: [&str; 3] = ["moltenvk-m3", "lavapipe", "vk12-floor"];
|
||||
const PROFILES: [&str; 3] = ["moltenvk-m3", "lavapipe", "runtime-floor"];
|
||||
|
||||
#[test]
|
||||
fn plans_are_total_on_every_committed_profile() {
|
||||
@@ -594,9 +600,9 @@ fn dispatch_threads_edges_and_group_splits_compute_metal_grid_builtins() {
|
||||
}
|
||||
|
||||
/// A kernel's `seq_cst` fence orders through the command buffer's status: on a device that does
|
||||
/// not address buffers (`vk12-floor`, `lunarg-desktop-baseline-2023`) the plan binds it
|
||||
/// not address buffers (Profile F, [`no_addresses`]) the plan binds it
|
||||
/// (`WriteSource::ExecutionStatus`) and pushes no status address, and where the device addresses
|
||||
/// buffers (`moltenvk-m3`) it pushes the address and binds nothing. Either way each of the
|
||||
/// buffers (`runtime-floor`, `moltenvk-m3`) it pushes the address and binds nothing. Either way each of the
|
||||
/// dispatch's threads increments `StatusWord::SeqCstFences` of the one status the command buffer
|
||||
/// keeps, and the store after the fence lands.
|
||||
#[test]
|
||||
@@ -604,12 +610,18 @@ fn a_seq_cst_fence_reaches_the_status_by_binding_or_address_as_the_device_allows
|
||||
let Some(bc) = fixture("dispatch_builtins") else {
|
||||
return;
|
||||
};
|
||||
for (stem, bound) in [
|
||||
("vk12-floor", true),
|
||||
("lunarg-desktop-baseline-2023", true),
|
||||
("moltenvk-m3", false),
|
||||
let same = |_: &mut DeviceDescription| {};
|
||||
for (stem, tweak, bound) in [
|
||||
(
|
||||
"runtime-floor",
|
||||
no_addresses as fn(&mut DeviceDescription),
|
||||
true,
|
||||
),
|
||||
("runtime-floor", same, false),
|
||||
("moltenvk-m3", same, false),
|
||||
] {
|
||||
let dev = device(stem, |_| {});
|
||||
let dev = device(stem, tweak);
|
||||
let stem = &format!("{stem}{}", if bound { " without addresses" } else { "" });
|
||||
let pipe = pipeline(&dev, &bc, "device_fence_store").expect(stem);
|
||||
let (_, m) = typed_module(&bc, "device_fence_store", dev.profile()).expect("module");
|
||||
let mut w = World::new([(0, Alloc::new(16, 0))]);
|
||||
@@ -658,7 +670,7 @@ fn bind_offsets_reach_metal_bytes_through_range_and_residual() {
|
||||
groups: [1, 1, 1],
|
||||
threads_per_group: [1, 1, 1],
|
||||
};
|
||||
for stem in ["moltenvk-m3", "lavapipe", "vk12-floor"] {
|
||||
for stem in ["moltenvk-m3", "lavapipe", "runtime-floor"] {
|
||||
for robust in [true, false] {
|
||||
let dev = if robust {
|
||||
device(stem, |_| {})
|
||||
@@ -750,7 +762,7 @@ fn threadgroup_lengths_specialize_the_arena_and_are_checked() {
|
||||
let Some(bc) = assemble_text("tg_region", &tg_region()) else {
|
||||
return;
|
||||
};
|
||||
for stem in ["moltenvk-m3", "lavapipe", "roadmap-2022"] {
|
||||
for stem in ["moltenvk-m3", "lavapipe", "runtime-floor"] {
|
||||
let dev = device(stem, |_| {});
|
||||
let pipe = pipeline(&dev, &bc, "tg_region").expect(stem);
|
||||
assert_eq!(
|
||||
@@ -1073,8 +1085,8 @@ fn descriptor_only_kernels_need_no_root_table_or_addresses() {
|
||||
let Some(bc) = assemble_text("grid_ids", &grid_ids()) else {
|
||||
return;
|
||||
};
|
||||
let dev = device("vk12-floor", |_| {});
|
||||
let pipe = pipeline(&dev, &bc, "grid_ids").expect("vk12-floor");
|
||||
let dev = device("runtime-floor", |_| {});
|
||||
let pipe = pipeline(&dev, &bc, "grid_ids").expect("runtime-floor");
|
||||
assert!(!pipe.interface.needs_pointer_translation);
|
||||
let w = World::new([(0, Alloc::new(64, 0))]);
|
||||
let state = w.state();
|
||||
@@ -1125,7 +1137,7 @@ fn compared_slots_get_their_guest_bases_and_inline_bytes_are_refused() {
|
||||
groups: [1, 1, 1],
|
||||
threads_per_group: [1, 1, 1],
|
||||
};
|
||||
for stem in ["moltenvk-m3", "vk12-floor"] {
|
||||
for stem in ["moltenvk-m3", "runtime-floor"] {
|
||||
let dev = device(stem, |_| {});
|
||||
let pipe = pipeline(&dev, &bc, "guest_bases").expect(stem);
|
||||
let (_, m) = typed_module(&bc, "guest_bases", dev.profile()).expect("module");
|
||||
@@ -1246,7 +1258,7 @@ fn limit_pipeline(
|
||||
)
|
||||
}
|
||||
|
||||
/// On Profile F (`vk12-floor`: four storage buffers per stage) the fixture's six
|
||||
/// On Profile F ([`no_addresses`]: four storage buffers per stage) the fixture's six
|
||||
/// buffer slots fit because the per-stage fallback views two read-only slots as uniform buffers:
|
||||
/// the `device` struct first (its window bounds its range), then the `constant` array (its `Whole`
|
||||
/// window leaves the range to the binder). The `device` view depends on the alias check, the
|
||||
@@ -1261,8 +1273,10 @@ fn profile_f_views_read_only_slots_as_uniform_buffers_over_the_storage_limit() {
|
||||
let n = 64;
|
||||
let uniform = BufferForm::Descriptor(DescriptorView::UniformWords);
|
||||
let storage = BufferForm::Descriptor(DescriptorView::Storage);
|
||||
for stem in ["vk12-floor", "lunarg-desktop-baseline-2023", "moltenvk-m3"] {
|
||||
let dev = device(stem, |_| {});
|
||||
for (stem, dev) in [
|
||||
("Profile F", device("runtime-floor", no_addresses)),
|
||||
("moltenvk-m3", device("moltenvk-m3", |_| {})),
|
||||
] {
|
||||
let pipe = pipeline(&dev, &bc, LIMIT_ENTRY).unwrap_or_else(|e| panic!("{stem}: {e}"));
|
||||
let small = dev
|
||||
.profile()
|
||||
@@ -1332,7 +1346,7 @@ fn profile_f_views_read_only_slots_as_uniform_buffers_over_the_storage_limit() {
|
||||
}
|
||||
}
|
||||
|
||||
/// A shape that binds a buffer larger than `maxUniformBufferRange` (16 KiB on `vk12-floor`) at the
|
||||
/// A shape that binds a buffer larger than `maxUniformBufferRange` (16 KiB on Profile F) at the
|
||||
/// `constant` array, which the base pipeline views as a uniform buffer, asks for the variant that
|
||||
/// keeps it a storage view (`VariantKey::storage_view_slots`, from the length class); instantiating
|
||||
/// the base pipeline anyway is `DescriptorRangeExceeded`. The variant views the highest-index
|
||||
@@ -1345,7 +1359,7 @@ fn a_large_buffer_at_a_uniform_view_asks_for_the_variant_that_keeps_it_storage()
|
||||
return;
|
||||
};
|
||||
let n = 64;
|
||||
let dev = device("vk12-floor", |_| {});
|
||||
let dev = device("runtime-floor", no_addresses);
|
||||
let base = limit_pipeline(&dev, &bc, &LoweringInputs::new()).expect("base");
|
||||
// `c` holds 8192 words (32 KiB): its length class cannot prove a uniform range.
|
||||
let (mut w, want) = limit_world(n, [n, n, 8192, n]);
|
||||
@@ -1417,8 +1431,8 @@ fn a_device_uniform_view_bound_where_the_pipeline_writes_is_refused() {
|
||||
return;
|
||||
};
|
||||
let n = 64;
|
||||
let dev = device("vk12-floor", |_| {});
|
||||
let pipe = pipeline(&dev, &bc, LIMIT_ENTRY).expect("vk12-floor");
|
||||
let dev = device("runtime-floor", no_addresses);
|
||||
let pipe = pipeline(&dev, &bc, LIMIT_ENTRY).expect("Profile F");
|
||||
let one = limit_dispatch(n);
|
||||
// The world with `out` bound at bind offset `offset` of a 1 KiB allocation at Metal address
|
||||
// `guest`: its `Whole` window reaches from the offset to the allocation's end.
|
||||
@@ -1470,8 +1484,8 @@ fn an_atomically_loaded_slot_stays_a_storage_view_under_the_fallback() {
|
||||
let limit = 40u32;
|
||||
let uniform = BufferForm::Descriptor(DescriptorView::UniformWords);
|
||||
let storage = BufferForm::Descriptor(DescriptorView::Storage);
|
||||
for stem in ["vk12-floor", "lunarg-desktop-baseline-2023"] {
|
||||
let dev = device(stem, |_| {});
|
||||
for stem in ["Profile F"] {
|
||||
let dev = device("runtime-floor", no_addresses);
|
||||
let pipe = pipeline(&dev, &bc, ENTRY).unwrap_or_else(|e| panic!("{stem}: {e}"));
|
||||
let small = dev
|
||||
.profile()
|
||||
|
||||
@@ -55,7 +55,7 @@ fn profile_with(stem: &str, robust: bool) -> DeviceProfile {
|
||||
/// `vk12-floor` (no `shaderInt64`) and `moltenvk-m3`, each in both encodings.
|
||||
fn encodings() -> Vec<(String, DeviceProfile)> {
|
||||
let mut out = Vec::new();
|
||||
for stem in ["vk12-floor", "moltenvk-m3"] {
|
||||
for stem in ["runtime-floor", "moltenvk-m3"] {
|
||||
for robust in [true, false] {
|
||||
out.push((
|
||||
format!("{stem} robust={robust}"),
|
||||
|
||||
@@ -2,8 +2,9 @@
|
||||
//! (`pipeline::compile::color_group`): the owned fixtures `engine/color_groups`,
|
||||
//! `engine/color_groups_fetch`, `engine/dfk_dead_group` and `engine/dfk_dead_rog` on `lavapipe`
|
||||
//! with four color attachments and four fragment output locations (Vulkan's floor, the device of
|
||||
//! the groups' lane), on `moltenvk-m3` likewise, on `vk12-floor`, and on `lavapipe` as it is
|
||||
//! (eight), where nothing groups. `llvm-as` assembles the fixtures; a missing tool skips visibly.
|
||||
//! the groups' lane), on `moltenvk-m3` likewise, on `runtime-floor` likewise (below the runtime's
|
||||
//! floor, which requires eight color attachments), and on `lavapipe` as it is (eight), where
|
||||
//! nothing groups. `llvm-as` assembles the fixtures; a missing tool skips visibly.
|
||||
|
||||
use std::collections::BTreeSet;
|
||||
|
||||
@@ -185,7 +186,7 @@ fn is_limit(e: &Error, required: u64) -> bool {
|
||||
/// Five colors on a device of four draw in two groups: the first four attachments, then the
|
||||
/// fifth, each variant's fragment stage writing its group's alone at locations `0..` in a state of
|
||||
/// its group's attachments alone, every variant's vertex stage the same module, and each variant
|
||||
/// noting the groups. A variant past the last group is no plan's. On `vk12-floor` too; on
|
||||
/// noting the groups. A variant past the last group is no plan's. On `runtime-floor` of four too; on
|
||||
/// `lavapipe` as it is, one pipeline of five, no note.
|
||||
#[test]
|
||||
fn five_colors_on_a_device_of_four_draw_in_two_groups() {
|
||||
@@ -193,7 +194,10 @@ fn five_colors_on_a_device_of_four_draw_in_two_groups() {
|
||||
return;
|
||||
};
|
||||
let d = pipeline(&bc, &bc, "cg_five", &[0, 1, 2, 3, 4]);
|
||||
for (stem, dev) in [("four", four()), ("vk12-floor", device("vk12-floor"))] {
|
||||
for (stem, dev) in [
|
||||
("four", four()),
|
||||
("runtime-floor of four", narrowed("runtime-floor")),
|
||||
] {
|
||||
let groups: Vec<RenderPipeline> = (0..2)
|
||||
.map(|g| compile(&dev, &d, g).unwrap_or_else(|e| panic!("{stem} group {g}: {e}")))
|
||||
.collect();
|
||||
@@ -401,13 +405,13 @@ fn specialized(
|
||||
|
||||
/// A read of a color of another group that the function's constants make dead reads nothing
|
||||
/// (`dfk_dead_group`: `dfg_branch`, the read of color 4 in the arm of a branch on constant 0, and
|
||||
/// `dfg_gated`, whose color 4 input the constant gates). Five colors on a device of four draw in two
|
||||
/// groups, color 4 in the second; on `lavapipe` of four (input attachments), `moltenvk-m3` of four
|
||||
/// (the pixel interlock) and `vk12-floor` (no ordered fetch form), specialized with the read dead,
|
||||
/// each group's variant compiles as a pipeline of its group's attachments that reads none (no input
|
||||
/// or storage attachment, every color a color attachment), passing L3. Specialized live, group 0's
|
||||
/// variant, which would read color 4 of group 1, is the pipeline's limit refusal. The misses are
|
||||
/// counted by kind before the test fails.
|
||||
/// `dfg_gated`, whose color 4 input the constant gates). Five colors on a device of four draw in
|
||||
/// two groups, color 4 in the second; on `lavapipe` of four (input attachments), `moltenvk-m3` of
|
||||
/// four (the pixel interlock) and `runtime-floor` of four (no ordered fetch form), specialized with
|
||||
/// the read dead, each group's variant compiles as a pipeline of its group's attachments that reads
|
||||
/// none (no input or storage attachment, every color a color attachment), passing L3. Specialized
|
||||
/// live, group 0's variant, which would read color 4 of group 1, is the pipeline's limit refusal.
|
||||
/// The misses are counted by kind before the test fails.
|
||||
#[test]
|
||||
fn a_read_of_another_group_dead_after_specialization_is_no_refusal() {
|
||||
let (Some(bc), Some(fs)) = (fixture("color_groups"), fixture("dfk_dead_group")) else {
|
||||
@@ -417,7 +421,7 @@ fn a_read_of_another_group_dead_after_specialization_is_no_refusal() {
|
||||
let devices = [
|
||||
("lavapipe of four", four()),
|
||||
("moltenvk-m3 of four", narrowed("moltenvk-m3")),
|
||||
("vk12-floor", device("vk12-floor")),
|
||||
("runtime-floor of four", narrowed("runtime-floor")),
|
||||
];
|
||||
let mut misses = std::collections::BTreeMap::<String, Vec<String>>::new();
|
||||
let mut checked = 0;
|
||||
@@ -470,11 +474,11 @@ fn interlocks(words: &[u32]) -> bool {
|
||||
/// pipeline of groups as in any (`dfk_dead_rog`: `dfr_color`, a color 0 input in group 0, and
|
||||
/// `dfr_buffer`, a buffer in group 0, each read in the arm of a branch on constant 0; plain Metal
|
||||
/// makes and draws both, dead and live). Five colors on a device of four draw in two groups; on
|
||||
/// `lavapipe` and `moltenvk-m3` of four (each with the pixel interlock) and `vk12-floor` (without),
|
||||
/// specialized with the read dead, each group's variant compiles as a pipeline of its group's
|
||||
/// attachments without an interlock, an input or a storage attachment, passing L3. Specialized
|
||||
/// live, group 0's variant, which would order its read in each group's draw, is the pipeline's limit
|
||||
/// refusal. The misses are counted by kind before the test fails.
|
||||
/// `lavapipe` and `moltenvk-m3` of four (each with the pixel interlock) and `runtime-floor` of four
|
||||
/// (without), specialized with the read dead, each group's variant compiles as a pipeline of its
|
||||
/// group's attachments without an interlock, an input or a storage attachment, passing L3.
|
||||
/// Specialized live, group 0's variant, which would order its read in each group's draw, is the
|
||||
/// pipeline's limit refusal. The misses are counted by kind before the test fails.
|
||||
#[test]
|
||||
fn a_raster_order_group_dead_after_specialization_is_no_refusal_in_groups() {
|
||||
let (Some(bc), Some(fs)) = (fixture("color_groups"), fixture("dfk_dead_rog")) else {
|
||||
@@ -484,7 +488,7 @@ fn a_raster_order_group_dead_after_specialization_is_no_refusal_in_groups() {
|
||||
let devices = [
|
||||
("lavapipe of four", four()),
|
||||
("moltenvk-m3 of four", narrowed("moltenvk-m3")),
|
||||
("vk12-floor", device("vk12-floor")),
|
||||
("runtime-floor of four", narrowed("runtime-floor")),
|
||||
];
|
||||
let mut misses = std::collections::BTreeMap::<String, Vec<String>>::new();
|
||||
let mut checked = 0;
|
||||
|
||||
@@ -43,10 +43,9 @@ use crate::spirv::interp::{run, Buffer, Config, InterpError, Order, Resources, T
|
||||
use crate::spirv::ir::{GlobalKind, TypedModule};
|
||||
use crate::spirv::testing::zeroes_threadgroup_memory;
|
||||
|
||||
const PROFILES: [&str; 5] = [
|
||||
const PROFILES: [&str; 4] = [
|
||||
"moltenvk-m3",
|
||||
"lunarg-desktop-baseline-2023",
|
||||
"vk12-floor",
|
||||
"runtime-floor",
|
||||
"lavapipe",
|
||||
"nvidia-pascal-linux",
|
||||
];
|
||||
|
||||
@@ -174,11 +174,17 @@ fn a_raster_order_group_on_an_input_dead_after_specialization_takes_no_interlock
|
||||
cases.push((name.to_owned(), dev, interlock, "dfr_output", vec![0]));
|
||||
}
|
||||
let floor = Device::from_queries(
|
||||
description("vk12-floor").expect("profile"),
|
||||
description("runtime-floor").expect("profile"),
|
||||
DevicePolicy::default(),
|
||||
)
|
||||
.expect("device");
|
||||
cases.push(("vk12-floor".to_owned(), floor, false, "dfr_output", vec![0]));
|
||||
cases.push((
|
||||
"runtime-floor".to_owned(),
|
||||
floor,
|
||||
false,
|
||||
"dfr_output",
|
||||
vec![0],
|
||||
));
|
||||
let mut misses = BTreeMap::<String, Vec<String>>::new();
|
||||
let mut checked = 0;
|
||||
for (name, dev, interlock, entry, colors) in &cases {
|
||||
|
||||
@@ -141,7 +141,7 @@ fn locations(words: &[u32], class: u32) -> Vec<u32> {
|
||||
}
|
||||
|
||||
/// Profiles with and without device addresses, and the floor.
|
||||
const PROFILES: [&str; 3] = ["nvidia-rtx5080-laptop", "moltenvk-m3", "vk12-floor"];
|
||||
const PROFILES: [&str; 3] = ["nvidia-rtx5080-laptop", "moltenvk-m3", "runtime-floor"];
|
||||
|
||||
#[test]
|
||||
fn an_unwritten_varying_has_a_producer_for_the_fragment_that_reads_it() {
|
||||
|
||||
@@ -167,16 +167,15 @@ fn unrestricted(p: &DeviceProfile) -> bool {
|
||||
}
|
||||
|
||||
/// The committed profiles the product reads the extension from: the RADV and lavapipe
|
||||
/// profiles list it, MoltenVK's and the 1.2 floor's do not.
|
||||
/// profiles list it, MoltenVK's and the runtime floor's do not.
|
||||
#[test]
|
||||
fn the_extension_is_read_from_the_device_description() {
|
||||
for (stem, listed) in [
|
||||
("amd-rdna3-radv", true),
|
||||
("lavapipe", true),
|
||||
("swiftshader", true),
|
||||
("moltenvk-m3", false),
|
||||
("intel-irisxe-anv", false),
|
||||
("vk12-floor", false),
|
||||
("runtime-floor", false),
|
||||
] {
|
||||
let p = profile(stem, DevicePolicy::default()).expect(stem);
|
||||
assert_eq!(unrestricted(&p), listed, "{stem}");
|
||||
|
||||
Loaded 100 of 181 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user