Validation: texture buffers run through the runtime; the texture_buffer and texture_buffer_member requirements are retired
The runtime makes texture buffers (Buffer::new_texture over a buffer's bytes), bound and as argument-buffer members, so neither requirement stops the engine's candidate any more: - requirement.rs: TextureBuffer and TextureBufferMember are gone (ALL 39 -> 37), with their stops, limit, docs and tests; the retired-names test holds that neither name parses. - executor_contract.rs: case_requirements no longer names a bound texture buffer, and the reflection no longer marks a texture buffer member; the tests assert a bound texture buffer's case carries none. - runtime_textures::made_texture makes a texture buffer as the Metal oracle does: a Shared buffer of the case's bytes (Placed::new) and Buffer::new_texture at offset 0 with one row of every byte; the texture holds its buffer. - argument_buffers::embed_textures maps a texture buffer member; the executor's own context still refuses one at its bind state (used_texture), which the member test now asserts. - engine_compute: the two refusal tests become runs through the runtime: ob1_texel_buffer's bound texture buffers read and write their texels (and past them, zero and dropped), read back through the texture; rlm_member_texture_buffer reads as rlm_member_texture does. platform::on_runtime_device and make_kernel, which only those tests used, are deleted. - triage: rlm_member_texture_buffer carries what rlm_member_texture carries. - ENGINE_EXECUTOR_ABI vulkan-engine-v208 (main: development's v207 + 1). The authored compile census rows of the 29 texture-buffer cases move when it is re-blessed on development. Verified: rustfmt; the compile job and the validation suite follow on the rebased tip.
This commit is contained in:
1 parent
418494f380
commit
ed4f8976a5
11 files changed
+170
-240
No files matched your search
@@ -1,16 +1,17 @@
|
||||
// metal-std: metal4.1
|
||||
// metal-macos-min: 27.0
|
||||
// Owned fixture: shapes of the validation requirements whose limit is the runtime's typed refusal
|
||||
// (`Limit::Runtime`), each beside the same shape without it, so a device test holds the refusal
|
||||
// both ways: the runtime refuses the first of a pair at its pipeline's make and makes the second.
|
||||
// Owned fixture: a shape of a validation requirement whose limit is the runtime's typed refusal
|
||||
// (`Limit::Runtime`) beside the same shape without it, so a device test holds the refusal both
|
||||
// ways (the runtime refuses the first of the pair at its pipeline's make and makes the second),
|
||||
// and a pair of member reads the runtime makes both of.
|
||||
//
|
||||
// * rlm_fence_acq_rel: a4_device_fence's two stores, out[t] = in[t] + 1 and out[t + 8] = 2 in[t]
|
||||
// for eight threads, around a device-scope fence of `acq_rel` order, which the translator
|
||||
// orders without the execution status word; a4_device_fence's `seq_cst` fence is the shape
|
||||
// `seq_cst_fence` names.
|
||||
// * rlm_member_texture_buffer: thread t reads texel t of a texture buffer an argument buffer
|
||||
// holds, the shape `texture_buffer_member` names; rlm_member_texture: the same read of a 2D
|
||||
// texture the argument buffer holds, texel (t, 0).
|
||||
// holds; rlm_member_texture: the same read of a 2D texture the argument buffer holds, texel
|
||||
// (t, 0).
|
||||
//
|
||||
// Loop-free.
|
||||
#include <metal_stdlib>
|
||||
|
||||
@@ -110,7 +110,7 @@ pub mod variants;
|
||||
/// how it decides a match. A change no recorded row can observe (a case kind no earlier executor
|
||||
/// ran, or one it refused) needs no bump; its commit says why. The commit that bumps it says what
|
||||
/// changed; this comment keeps no history.
|
||||
pub const ENGINE_EXECUTOR_ABI: &str = "vulkan-engine-v207";
|
||||
pub const ENGINE_EXECUTOR_ABI: &str = "vulkan-engine-v208";
|
||||
|
||||
/// One kernel case in the terms the binder takes: what this executor supports of an
|
||||
/// [`AuthoredCase`] (buffers, device buffer arrays, argument-buffer buffers and textures,
|
||||
@@ -715,10 +715,10 @@ pub fn runtime_fingerprint() -> String {
|
||||
/// (each device buffer array's elements among them), bound textures and samplers, made as the
|
||||
/// Metal oracle makes them (`platform::runtime_textures`: a 32-bit float depth, whose bytes the
|
||||
/// runtime takes no upload of, filled by a draw, `platform::runtime_depth`, and a multisampled
|
||||
/// texture by a draw per slice, `platform::runtime_multisample`; a texture buffer and a sparse
|
||||
/// texture are the runtime's limits, which stop the candidate first), argument buffers of buffers,
|
||||
/// textures and samplers, threadgroup memory lengths, function constants and linked functions,
|
||||
/// dispatched by
|
||||
/// texture by a draw per slice, `platform::runtime_multisample`, and a texture buffer over a
|
||||
/// buffer of its bytes; a sparse texture is the runtime's limit, which stops the candidate
|
||||
/// first), argument buffers of buffers, textures (texture buffers among them) and samplers,
|
||||
/// threadgroup memory lengths, function constants and linked functions, dispatched by
|
||||
/// `dispatchThreads` or `dispatchThreadgroups`, observing any output the mapping makes, its
|
||||
/// out-of-bounds targets among them (`platform::runtime_bounds`). Decided by the case's structure
|
||||
/// alone: every field the mapping fills is named here, so a new one is decided when it is added.
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
|
||||
use super::resources;
|
||||
use super::BufferAddress;
|
||||
use crate::case::{ArgumentBufferSamplerResource, TextureType};
|
||||
use crate::case::ArgumentBufferSamplerResource;
|
||||
use crate::literal::{LiteralArgumentBufferBuffer, LiteralArgumentBufferTexture, LiteralTexture};
|
||||
use metal2vulkan::bind::{ArgumentSampler, BoundTexture, ResourceClass, UsedResource};
|
||||
use metal2vulkan::metal::{RenderStages, ResourceUsage};
|
||||
@@ -78,10 +78,9 @@ pub fn embed(
|
||||
/// The argument-buffer textures `literal` of a function whose bound buffers are `buffers`: each
|
||||
/// one as a texture of its authored type, format, extent, sample count, and contents, by its key
|
||||
/// (its `binding` is its owner's index, which only labels it), each owner grown with zeros to
|
||||
/// cover its 8-byte field. A texture buffer is refused, as its case's requirement refuses it first
|
||||
/// ([`TextureBufferMember`](crate::requirement::ToolingRequirement::TextureBufferMember)): the
|
||||
/// binder's planned heap makes no texture buffer a member, so a handle naming one misses. A key
|
||||
/// authored twice is refused.
|
||||
/// cover its 8-byte field; a texture buffer among them, which a run through the runtime makes over
|
||||
/// a buffer of its bytes (`platform::runtime_textures`), and the executor's own context refuses
|
||||
/// ([`used_texture`]). A key authored twice is refused.
|
||||
pub fn embed_textures(
|
||||
buffers: &mut BTreeMap<u32, Vec<u8>>,
|
||||
literal: &[LiteralArgumentBufferTexture],
|
||||
@@ -89,12 +88,6 @@ pub fn embed_textures(
|
||||
let mut embedded = BTreeMap::new();
|
||||
for texture in literal {
|
||||
let key = (texture.buffer_binding, texture.field_offset);
|
||||
if texture.texture_type == TextureType::Buffer {
|
||||
return Err(format!(
|
||||
"{} is a texture buffer, which no heap array holds",
|
||||
texture.label()
|
||||
));
|
||||
}
|
||||
cover(buffers, key, "argument-buffer texture")?;
|
||||
let bound = LiteralTexture {
|
||||
binding: texture.buffer_binding,
|
||||
@@ -275,7 +268,9 @@ pub fn used_buffer(
|
||||
/// The used resource of the argument-buffer texture `texture` whose consumer token is `token`
|
||||
/// ([`texture_tokens`]): a `Texture` of the facts a bound texture of it has
|
||||
/// ([`resources::bound_texture`]), whose resource id is [`resource_id`] of its token, resident
|
||||
/// for reading and writing in `stages` as the Metal oracle's `useResource` makes it.
|
||||
/// for reading and writing in `stages` as the Metal oracle's `useResource` makes it. A texture
|
||||
/// buffer is refused: the binder's planned heap makes no texture buffer a member, so a handle
|
||||
/// naming one would miss.
|
||||
pub fn used_texture(
|
||||
token: u32,
|
||||
texture: &LiteralTexture,
|
||||
|
||||
+10
-3
@@ -67,8 +67,9 @@ fn gap(case: &AuthoredCase, expected: &str) {
|
||||
/// argument-buffer buffers', its resource id nonzero and its own), resident for reading and
|
||||
/// writing like the oracle's `useResource`; the owner is created holding the buffer's address and
|
||||
/// each texture's resource id at their fields; a texture's region is an output; and an owner that
|
||||
/// is not bound, a key authored twice, a texture buffer, a field named twice, and overlapping
|
||||
/// fields are refused.
|
||||
/// is not bound, a key authored twice, a field named twice, and overlapping fields are refused. A
|
||||
/// texture buffer maps, as a run through the runtime makes it, and the executor's own bind state
|
||||
/// refuses it.
|
||||
#[test]
|
||||
fn argument_buffer_members_are_written_into_their_owner() {
|
||||
let mut case = kernel_case();
|
||||
@@ -212,7 +213,13 @@ fn argument_buffer_members_are_written_into_their_owner() {
|
||||
gap(&twice, "bound twice");
|
||||
let mut texel = case.clone();
|
||||
texel.argument_buffer_textures[0].texture_type = TextureType::Buffer;
|
||||
gap(&texel, "texture buffer");
|
||||
let texel = map_kernel(&texel).unwrap();
|
||||
assert_eq!(
|
||||
texel.argument_buffer_textures[&(0, 16)].texture_type,
|
||||
TextureType::Buffer
|
||||
);
|
||||
let refused = bind_state(&texel, &addresses, &embedded, BufferRanges::default()).unwrap_err();
|
||||
assert!(refused.contains("texture buffer"), "{refused}");
|
||||
}
|
||||
|
||||
/// End to end without a device: `argument_buffer_read` of the owned `handles` fixture on
|
||||
|
||||
@@ -28,8 +28,6 @@ pub use device::{capture_formats, echo_validation_messages, venue_check};
|
||||
pub use profiles::{requested_restriction, restrict_devices_to};
|
||||
pub use render::execute_engine_render;
|
||||
pub use runtime::execute_runtime;
|
||||
#[cfg(all(test, any(m2v_gpu, m2v_cpu_icd), target_os = "linux"))]
|
||||
pub use runtime::{make_kernel, on_runtime_device};
|
||||
pub use runtime_probe::probe_runtime;
|
||||
pub use runtime_render::execute_runtime_render;
|
||||
|
||||
|
||||
@@ -215,54 +215,6 @@ fn opened<T>(
|
||||
Ok(value)
|
||||
}
|
||||
|
||||
/// `body` on the runtime's device of `device_type` under the validation layer, as a run opens it
|
||||
/// ([`execute_runtime`]): what a device test needs of the runtime's answer to one call, beside a
|
||||
/// run. `Err` where no device of the kind opens, or where the layer reported a message.
|
||||
#[cfg(all(test, any(m2v_gpu, m2v_cpu_icd), target_os = "linux"))]
|
||||
pub fn on_runtime_device<T>(
|
||||
device_type: DeviceType,
|
||||
body: impl FnOnce(&rt::Device) -> T,
|
||||
) -> Result<T, String> {
|
||||
let log = std::env::temp_dir().join(format!(
|
||||
"metal2vulkan-validation-runtime-{}.log",
|
||||
std::process::id()
|
||||
));
|
||||
let _ = std::fs::remove_file(&log);
|
||||
validate_process(&log);
|
||||
let value = opened(device_type, EXECUTOR, |device, _, _| body(device));
|
||||
let messages = std::fs::read_to_string(&log);
|
||||
let _ = std::fs::remove_file(&log);
|
||||
match messages {
|
||||
Ok(messages) if !messages.trim().is_empty() => Err(format!(
|
||||
"{VALIDATION_LAYER} reported messages: {}",
|
||||
crate::engine::bounded_detail(&messages)
|
||||
)),
|
||||
_ => value,
|
||||
}
|
||||
}
|
||||
|
||||
/// The make of `entry`'s compute pipeline state from `bitcode` on `device`, with no constant, no
|
||||
/// linked function and no sampler it numbers: the runtime's own answer, a device test's to judge.
|
||||
#[cfg(all(test, any(m2v_gpu, m2v_cpu_icd), target_os = "linux"))]
|
||||
pub fn make_kernel(
|
||||
device: &rt::Device,
|
||||
bitcode: &[u8],
|
||||
entry: &str,
|
||||
) -> Result<rt::ComputePipelineState, rt::Error> {
|
||||
let function = Library::from_air(bitcode)
|
||||
.and_then(|library| library.function(entry))
|
||||
.map_err(|error| rt::Error::Translation {
|
||||
error,
|
||||
functions: Box::default(),
|
||||
})?;
|
||||
let descriptor = ComputePipelineDescriptor::new(StageSource::Function(
|
||||
FunctionDescriptor::new(function).with_specialized(true),
|
||||
));
|
||||
device.new_compute_pipeline_state(&descriptor, |samplers: &[NumberedSampler]| {
|
||||
Ok(vec![0; samplers.len()])
|
||||
})
|
||||
}
|
||||
|
||||
/// What a row records of the device that ran it.
|
||||
pub(super) struct Identity {
|
||||
device: String,
|
||||
|
||||
@@ -7,7 +7,9 @@
|
||||
//! argument-buffer member (`RuntimeKernel::texture_usages`, `RuntimeKernel::member_usages`), at an
|
||||
//! index of the run's texture grant (the bound textures first, then the members), and every
|
||||
//! level's slices written from the case's bytes before the work (`replaceRegion:`, level 0
|
||||
//! first), but for a 32-bit float depth's, which the run renders (`runtime_depth`), with the
|
||||
//! first), but for a texture buffer, a texture over a Shared buffer of the case's bytes
|
||||
//! (`newTextureWithDescriptor:offset:bytesPerRow:` at offset 0, one row of every byte, as the
|
||||
//! oracle makes it), and a 32-bit float depth's, which the run renders (`runtime_depth`), with the
|
||||
//! texture made for rendering too, and a multisampled texture's, Private as Metal keeps one, which
|
||||
//! the run renders sample by sample (`runtime_multisample`), made for rendering and for views of
|
||||
//! another pixel format too. Each sampler is the oracle's descriptor of it (`engine::resources::sampler_descriptor`,
|
||||
@@ -17,11 +19,12 @@
|
||||
//! program writes one into an argument buffer. A texture output is read back as the oracle reads
|
||||
//! it (`getBytes:`): the selected region of level 0, slice by slice.
|
||||
|
||||
use super::runtime::Placed;
|
||||
use super::runtime_depth;
|
||||
use super::runtime_multisample;
|
||||
use crate::candidate::engine::argument_buffers::FieldKey;
|
||||
use crate::candidate::engine::{resources, ComputeCase, RuntimeKernel};
|
||||
use crate::case::{ArgumentBufferSamplerResource, SamplerResource, TextureFormat};
|
||||
use crate::case::{ArgumentBufferSamplerResource, SamplerResource, TextureFormat, TextureType};
|
||||
use crate::check::admission::ExecutorError;
|
||||
use crate::executor_contract::multisample::{sample_read, SampleRead};
|
||||
use crate::gpu::DeviceType;
|
||||
@@ -230,9 +233,10 @@ fn next_index(at: &mut std::ops::Range<u32>) -> Result<u32, ExecutorError> {
|
||||
.ok_or_else(|| ExecutorError::Failed("the run's textures outnumber their indices".into()))
|
||||
}
|
||||
|
||||
/// `texture` made with `usage` at `index`, every level's slices written from its bytes; a 32-bit
|
||||
/// float depth's and a multisampled texture's are pushed to `fills` instead, which the run renders,
|
||||
/// a multisampled color one through its view at the next of `views`.
|
||||
/// `texture` made with `usage` at `index`, every level's slices written from its bytes; a texture
|
||||
/// buffer over a buffer of its bytes, which the texture holds; a 32-bit float depth's and a
|
||||
/// multisampled texture's are pushed to `fills` instead, which the run renders, a multisampled
|
||||
/// color one through its view at the next of `views`.
|
||||
fn made_texture(
|
||||
device: &rt::Device,
|
||||
texture: &LiteralTexture,
|
||||
@@ -270,6 +274,14 @@ fn made_texture(
|
||||
true => rt::StorageMode::Private,
|
||||
false => rt::StorageMode::Shared,
|
||||
};
|
||||
if texture.texture_type == TextureType::Buffer {
|
||||
let placed = Placed::new(device, &what, &texture.bytes)?;
|
||||
let row = texture.bytes.len() as u64;
|
||||
return placed
|
||||
.buffer
|
||||
.new_texture(&descriptor, Some(index), 0, row)
|
||||
.map_err(|e| error(&what, e));
|
||||
}
|
||||
let made = device
|
||||
.new_texture(&descriptor, Some(index))
|
||||
.map_err(|e| error(&what, e))?;
|
||||
|
||||
@@ -629,66 +629,98 @@ fn a_fence_of_another_order_is_made_through_the_runtime() {
|
||||
assert_eq!(output, expected);
|
||||
}
|
||||
|
||||
/// `ToolingRequirement::TextureBuffer`'s limit, and `ToolingRequirement::TextureBufferMember`'s at
|
||||
/// the texture, both ways: the runtime makes no texture buffer, so `new_texture` refuses one, typed
|
||||
/// (`Gap::TextureBuffer`), where it makes a 2D texture of the same format and width. The day the
|
||||
/// runtime makes one, this fails.
|
||||
/// A texture buffer bound at a slot, through the runtime: the owned `ob1_texel_buffer` reads
|
||||
/// texels 0 to 3 of its four-texel `src` into `out` and writes `0xA0000000 | t` to texels 0 to 3 of
|
||||
/// its four-texel `dst`, and threads 4 to 7 read and write past both: a read past the end is zero
|
||||
/// and a write past it is dropped, as Metal defines. Each texture buffer is made over a buffer of
|
||||
/// its bytes (`platform::runtime_textures`), and `dst` is read back through its texture.
|
||||
#[cfg(target_os = "linux")]
|
||||
#[test]
|
||||
fn a_texture_buffer_is_refused_where_a_2d_texture_is_made() {
|
||||
use metal2vulkan_runtime as rt;
|
||||
platform::on_runtime_device(crate::gpu::TEST_DEVICE, |device| {
|
||||
let index = rt::IndexClass::Texture.range().start;
|
||||
let _grant = device
|
||||
.grant_indices(rt::IndexClass::Texture, index, 1)
|
||||
.unwrap();
|
||||
let made = |texture_type| {
|
||||
let descriptor =
|
||||
rt::TextureDescriptor::new(texture_type, rt::PixelFormat::RGBA32Float, 16, 1);
|
||||
device.new_texture(&descriptor, Some(index)).map(drop)
|
||||
};
|
||||
let refused = made(rt::TextureType::TextureBuffer);
|
||||
assert!(
|
||||
matches!(
|
||||
refused,
|
||||
Err(rt::Error::Refused(rt::Refusal::TextureBufferNotOverBuffer))
|
||||
),
|
||||
"{refused:?}"
|
||||
);
|
||||
made(rt::TextureType::Type2D).unwrap();
|
||||
})
|
||||
.unwrap();
|
||||
fn a_bound_texture_buffer_reads_and_writes_its_texels_through_the_runtime() {
|
||||
use crate::case::{ResourceRole, TextureFormat, TextureType};
|
||||
let bitcode = llvm_assemble(&engine_dir().join("ob1_texel_buffer.ll")).unwrap();
|
||||
let words =
|
||||
|values: &[u32]| -> Vec<u8> { values.iter().copied().flat_map(u32::to_le_bytes).collect() };
|
||||
let texels = |binding, role, values: &[u32]| crate::literal::LiteralTexture {
|
||||
binding,
|
||||
role,
|
||||
texture_type: TextureType::Buffer,
|
||||
format: TextureFormat::R32Uint,
|
||||
dimensions: [4, 1, 1],
|
||||
sample_count: 1,
|
||||
bytes: words(values),
|
||||
sparse: None,
|
||||
mip_levels: 1,
|
||||
};
|
||||
let index = (0..8).chain(0..8).collect::<Vec<u32>>();
|
||||
let threads = Dispatch::Threads {
|
||||
threads: [8, 1, 1],
|
||||
threads_per_group: [8, 1, 1],
|
||||
};
|
||||
let mut texel = case("ob1_texel_buffer", words(&index), threads);
|
||||
texel.buffers.insert(1, vec![0xab; 32]);
|
||||
texel.textures = BTreeMap::from([
|
||||
(0, texels(0, ResourceRole::Input, &[11, 22, 33, 44])),
|
||||
(1, texels(1, ResourceRole::InOut, &[0; 4])),
|
||||
]);
|
||||
texel.output = ComputeOutput::Buffer {
|
||||
binding: 1,
|
||||
offset: 0,
|
||||
length: 32,
|
||||
};
|
||||
let run = run_through_runtime(&texel, &bitcode).unwrap();
|
||||
assert_eq!(run.output, words(&[11, 22, 33, 44, 0, 0, 0, 0]));
|
||||
texel.output = ComputeOutput::Texture {
|
||||
binding: 1,
|
||||
origin: [0, 0, 0],
|
||||
dimensions: [4, 1, 1],
|
||||
};
|
||||
let run = run_through_runtime(&texel, &bitcode).unwrap();
|
||||
let written = [0xA000_0000, 0xA000_0001, 0xA000_0002, 0xA000_0003];
|
||||
assert_eq!(run.output, words(&written));
|
||||
}
|
||||
|
||||
/// `ToolingRequirement::TextureBufferMember`'s limit at the pipeline, both ways: the make of
|
||||
/// `rlm_runtime_limits`'s `rlm_member_texture_buffer`, which reads a texture buffer an argument
|
||||
/// buffer holds, is refused, typed, where the same read of a 2D texture the argument buffer holds,
|
||||
/// `rlm_member_texture`, is made. The refusal is the translator's: the runtime's identity domains
|
||||
/// hold no texture buffer among an argument buffer's textures (`Unsupported{IdentityDomains}`),
|
||||
/// and a device whose answer lacks the features an argument buffer's texel buffers are read
|
||||
/// through is refused at that query first (`Feature::ArgumentBufferTextures`), as lavapipe's is
|
||||
/// under the runtime. The day the runtime makes the first, this fails.
|
||||
/// A texture buffer an argument buffer holds reads as a 2D texture it holds does, through the
|
||||
/// runtime: `rlm_runtime_limits`'s `rlm_member_texture_buffer` reads texel `t` of the texture
|
||||
/// buffer at field 0 of buffer 0 into `out[t]`, and `rlm_member_texture` texel `(t, 0)` of the 2D
|
||||
/// texture there; each member is the texture whose `gpuResourceID` its owner holds at its field.
|
||||
#[cfg(target_os = "linux")]
|
||||
#[test]
|
||||
fn a_texture_buffer_member_is_refused_at_the_make_where_a_2d_member_is_made() {
|
||||
use metal2vulkan::error::Feature;
|
||||
fn a_texture_buffer_member_reads_as_a_2d_member_does_through_the_runtime() {
|
||||
use crate::case::{ResourceRole, TextureFormat, TextureType};
|
||||
let bitcode = llvm_assemble(&engine_dir().join("rlm_runtime_limits.ll")).unwrap();
|
||||
platform::on_runtime_device(crate::gpu::TEST_DEVICE, |device| {
|
||||
match platform::make_kernel(device, &bitcode, "rlm_member_texture_buffer") {
|
||||
Err(metal2vulkan_runtime::Error::Translation {
|
||||
error: metal2vulkan::error::Error::Unsupported(refused),
|
||||
..
|
||||
}) => assert!(
|
||||
matches!(
|
||||
refused.feature,
|
||||
Feature::IdentityDomains | Feature::ArgumentBufferTextures
|
||||
),
|
||||
"{refused:?}"
|
||||
),
|
||||
Err(error) => panic!("not the translator's typed refusal: {error}"),
|
||||
Ok(_) => panic!("the runtime made a texture buffer member's pipeline"),
|
||||
}
|
||||
platform::make_kernel(device, &bitcode, "rlm_member_texture").unwrap();
|
||||
})
|
||||
.unwrap();
|
||||
let texels = (0..16u16)
|
||||
.flat_map(|value| (f32::from(value) * 0.5).to_le_bytes())
|
||||
.collect::<Vec<u8>>();
|
||||
for (entry, texture_type) in [
|
||||
("rlm_member_texture_buffer", TextureType::Buffer),
|
||||
("rlm_member_texture", TextureType::D2),
|
||||
] {
|
||||
let threads = Dispatch::Threads {
|
||||
threads: [4, 1, 1],
|
||||
threads_per_group: [4, 1, 1],
|
||||
};
|
||||
let mut member = case(entry, vec![0; 8], threads);
|
||||
member.buffers.insert(1, vec![0xab; texels.len()]);
|
||||
let texture = crate::literal::LiteralTexture {
|
||||
binding: 0,
|
||||
role: ResourceRole::Input,
|
||||
texture_type,
|
||||
format: TextureFormat::Rgba32Float,
|
||||
dimensions: [4, 1, 1],
|
||||
sample_count: 1,
|
||||
bytes: texels.clone(),
|
||||
sparse: None,
|
||||
mip_levels: 1,
|
||||
};
|
||||
member.argument_buffer_textures = BTreeMap::from([((0, 0), texture)]);
|
||||
member.output = ComputeOutput::Buffer {
|
||||
binding: 1,
|
||||
offset: 0,
|
||||
length: texels.len() as u64,
|
||||
};
|
||||
let run = run_through_runtime(&member, &bitcode)
|
||||
.unwrap_or_else(|error| panic!("{entry}: {error}"));
|
||||
assert_eq!(run.output, texels, "{entry}");
|
||||
}
|
||||
}
|
||||
@@ -16,14 +16,13 @@ pub mod tessellation;
|
||||
pub use depth_stencil::{depth_stencil_test, DepthStencilTest, DrawDepthStencil};
|
||||
|
||||
use crate::air::reflect::{
|
||||
ResourceKind, ShaderInterface, ShaderStage, TextureDimension,
|
||||
TextureFormat as ReflectedTextureFormat,
|
||||
ResourceKind, ShaderInterface, ShaderStage, TextureFormat as ReflectedTextureFormat,
|
||||
};
|
||||
use crate::case::indirect_commands::{CommandDescriptor, RenderDraws};
|
||||
use crate::case::out_of_bounds::OutOfBoundsResource;
|
||||
use crate::case::{
|
||||
AuthoredCase, DeviceBufferArrayResource, OutputSelection, Primitive, Stage, TextureFormat,
|
||||
TextureType, ThreadgroupMemoryResource,
|
||||
ThreadgroupMemoryResource,
|
||||
};
|
||||
use crate::requirement::{Executor, Limit, ToolingRequirement, UnobservedEffect};
|
||||
use std::borrow::Cow;
|
||||
@@ -650,16 +649,6 @@ pub fn unsupported_reflection_requirements(
|
||||
requirements.insert(ToolingRequirement::KernelStageInputLiteral);
|
||||
}
|
||||
if let Some(shape) = binding.texture_shape {
|
||||
// A texture buffer an argument buffer holds or a texture-handle array's element: a
|
||||
// case expresses it and the Metal oracle runs it, the engine's candidate runs neither.
|
||||
if shape.dimension == TextureDimension::Buffer
|
||||
&& !matches!(
|
||||
binding.kind,
|
||||
ResourceKind::Texture | ResourceKind::StorageImage
|
||||
)
|
||||
{
|
||||
requirements.insert(ToolingRequirement::TextureBufferMember);
|
||||
}
|
||||
if shape.storage_format.is_some_and(|format| {
|
||||
!matches!(
|
||||
format,
|
||||
@@ -810,9 +799,8 @@ pub fn engine_source_requirements(reflection: &ShaderInterface) -> BTreeSet<Tool
|
||||
/// (its out-of-bounds target, [`ToolingRequirement::IndexBufferPastEnd`]) and a depth/stencil
|
||||
/// attachment of both aspects ([`ToolingRequirement::SeparateDepthStencil`]). So are the families
|
||||
/// the runtime builds no call for, or refuses at creation on every device: a kernel's function
|
||||
/// table, explicit imageblock, acceleration structure or stage inputs, a bound texture buffer or
|
||||
/// sparse texture, a fragment function's imageblock, a rasterization-rate map, a vertex
|
||||
/// buffer's dynamic stride, an indirect command buffer of any form but kernel-encoded indexed
|
||||
/// table, explicit imageblock, acceleration structure or stage inputs, a sparse texture, a
|
||||
/// fragment function's imageblock, a rasterization-rate map, a vertex buffer's dynamic stride, an indirect command buffer of any form but kernel-encoded indexed
|
||||
/// draws that inherit the pipeline state and bind their own buffers (its compute commands, its
|
||||
/// other draw types, its other inheritance, or a command the host encodes), and a pipeline state
|
||||
/// an argument buffer holds.
|
||||
@@ -890,12 +878,6 @@ pub fn case_requirements(case: &AuthoredCase) -> BTreeSet<ToolingRequirement> {
|
||||
kernel && case.imageblock.is_some(),
|
||||
ToolingRequirement::KernelImageblock,
|
||||
),
|
||||
(
|
||||
case.textures
|
||||
.iter()
|
||||
.any(|texture| texture.texture_type == TextureType::Buffer),
|
||||
ToolingRequirement::TextureBuffer,
|
||||
),
|
||||
(
|
||||
case.fragment_imageblock.is_some(),
|
||||
ToolingRequirement::FragmentImageblock,
|
||||
@@ -3088,9 +3070,9 @@ entry:
|
||||
attachment.initial_stencil_b64 = Some("qw==".into());
|
||||
}
|
||||
only(&aspects, ToolingRequirement::SeparateDepthStencil);
|
||||
// What the runtime builds no call for, or refuses at creation: a bound texture buffer or
|
||||
// sparse texture, a kernel's stage inputs or stage-in region, a vertex buffer's dynamic
|
||||
// stride, a fragment function's imageblock and a rasterization-rate map.
|
||||
// What the runtime builds no call for, or refuses at creation: a sparse texture, a
|
||||
// kernel's stage inputs or stage-in region, a vertex buffer's dynamic stride, a fragment
|
||||
// function's imageblock and a rasterization-rate map. A bound texture buffer it makes.
|
||||
let texture = |texture_type| TextureResource {
|
||||
binding: 0,
|
||||
role: ResourceRole::Input,
|
||||
@@ -3107,7 +3089,7 @@ entry:
|
||||
textured.textures = vec![texture(TextureType::D2)];
|
||||
assert!(case_requirements(&textured).is_empty());
|
||||
textured.textures = vec![texture(TextureType::Buffer)];
|
||||
only(&textured, ToolingRequirement::TextureBuffer);
|
||||
assert!(case_requirements(&textured).is_empty());
|
||||
textured.textures = vec![TextureResource {
|
||||
sparse: Some(crate::case::sparse::SparseTextureResource {
|
||||
mappings: Vec::new(),
|
||||
@@ -3353,16 +3335,6 @@ entry:
|
||||
require_executor(&set(&[R::MeshRenderPipeline]), Executor::EngineCandidate),
|
||||
Err(set(&[R::MeshRenderPipeline]))
|
||||
);
|
||||
// So does a case of a texture buffer an argument buffer holds: the Metal oracle runs it.
|
||||
assert_eq!(evidence_gap(&set(&[R::TextureBufferMember])), None);
|
||||
assert_eq!(
|
||||
require_executor(&set(&[R::TextureBufferMember]), Executor::MetalOracle),
|
||||
Ok(())
|
||||
);
|
||||
assert_eq!(
|
||||
require_executor(&set(&[R::TextureBufferMember]), Executor::EngineCandidate),
|
||||
Err(set(&[R::TextureBufferMember]))
|
||||
);
|
||||
|
||||
let requirements = set(&[R::RenderDeviceBufferArray]);
|
||||
assert_eq!(
|
||||
|
||||
@@ -85,20 +85,6 @@ pub enum ToolingRequirement {
|
||||
TessellationSystemInputLiteral,
|
||||
FragmentImageblockMemberLiteral,
|
||||
KernelStageInputLiteral,
|
||||
/// A texture buffer that is no entry parameter of its own: one an argument buffer holds, or an
|
||||
/// element of a texture-handle array (`executor_contract`). The engine's candidate runs
|
||||
/// neither. The runtime makes no texture buffer (`metal2vulkan_runtime::Gap::TextureBuffer`
|
||||
/// at `new_texture`), and its identity domains hold no texture buffer among an argument
|
||||
/// buffer's textures, so it refuses such a function's pipeline at its make, typed
|
||||
/// (`Unsupported{IdentityDomains}`, or, on a device whose answer lacks the features an
|
||||
/// argument buffer's texel buffers are read through, `Feature::ArgumentBufferTextures` at
|
||||
/// that query first): the limit is the runtime's ([`Limit::Runtime`]), held both ways by the
|
||||
/// device tests
|
||||
/// `candidate::tests::engine_compute::a_texture_buffer_is_refused_where_a_2d_texture_is_made`
|
||||
/// and `..::a_texture_buffer_member_is_refused_at_the_make_where_a_2d_member_is_made`. The
|
||||
/// Metal oracle makes and binds both, so a case of either stays Metal-qualified
|
||||
/// ([`Self::qualifies_on_metal`]).
|
||||
TextureBufferMember,
|
||||
StorageTextureFormatLiteral,
|
||||
ImplicitImageblockLiteral,
|
||||
IndirectCommandBuffer,
|
||||
@@ -230,12 +216,6 @@ pub enum ToolingRequirement {
|
||||
/// `tests::kernel_input::an_explicit_imageblock_kernel_is_refused_as_its_named_runtime_fact`;
|
||||
/// it builds no tile function. Both are known gaps its README states.
|
||||
KernelImageblock,
|
||||
/// A texture buffer a case binds to an entry parameter (`executor_contract::case_requirements`;
|
||||
/// one an argument buffer holds is [`Self::TextureBufferMember`]). The runtime makes no texture
|
||||
/// buffer (`metal2vulkan_runtime::Gap::TextureBuffer` at `new_texture`), a known gap its README
|
||||
/// states, held both ways on lavapipe by the device test
|
||||
/// `candidate::tests::engine_compute::a_texture_buffer_is_refused_where_a_2d_texture_is_made`.
|
||||
TextureBuffer,
|
||||
/// A fragment function's imageblock, the case's cells of it
|
||||
/// (`executor_contract::case_requirements`). The runtime refuses a fragment function with an
|
||||
/// `[[imageblock_data]]` input or output at creation on every device (`Error::Translation`
|
||||
@@ -306,14 +286,13 @@ const AUTHORING: &[Executor] = &Executor::ALL;
|
||||
const ENGINE: &[Executor] = &[Executor::EngineCandidate];
|
||||
|
||||
impl ToolingRequirement {
|
||||
pub const ALL: [Self; 43] = [
|
||||
pub const ALL: [Self; 41] = [
|
||||
Self::FunctionConstantLiteral,
|
||||
Self::VertexAttributeLiteral,
|
||||
Self::TessellationAttributeLiteral,
|
||||
Self::TessellationSystemInputLiteral,
|
||||
Self::FragmentImageblockMemberLiteral,
|
||||
Self::KernelStageInputLiteral,
|
||||
Self::TextureBufferMember,
|
||||
Self::StorageTextureFormatLiteral,
|
||||
Self::ImplicitImageblockLiteral,
|
||||
Self::IndirectCommandBuffer,
|
||||
@@ -338,7 +317,6 @@ impl ToolingRequirement {
|
||||
Self::SeparateDepthStencil,
|
||||
Self::KernelFunctionTable,
|
||||
Self::KernelImageblock,
|
||||
Self::TextureBuffer,
|
||||
Self::FragmentImageblock,
|
||||
Self::SparseTexture,
|
||||
Self::KernelAccelerationStructure,
|
||||
@@ -360,7 +338,6 @@ impl ToolingRequirement {
|
||||
Self::TessellationSystemInputLiteral => "tessellation_system_input_literal",
|
||||
Self::FragmentImageblockMemberLiteral => "fragment_imageblock_member_literal",
|
||||
Self::KernelStageInputLiteral => "kernel_stage_input_literal",
|
||||
Self::TextureBufferMember => "texture_buffer_member",
|
||||
Self::StorageTextureFormatLiteral => "storage_texture_format_literal",
|
||||
Self::ImplicitImageblockLiteral => "implicit_imageblock_literal",
|
||||
Self::IndirectCommandBuffer => "indirect_command_buffer",
|
||||
@@ -387,7 +364,6 @@ impl ToolingRequirement {
|
||||
Self::SeparateDepthStencil => "separate_depth_stencil",
|
||||
Self::KernelFunctionTable => "kernel_function_table",
|
||||
Self::KernelImageblock => "kernel_imageblock",
|
||||
Self::TextureBuffer => "texture_buffer",
|
||||
Self::FragmentImageblock => "fragment_imageblock",
|
||||
Self::SparseTexture => "sparse_texture",
|
||||
Self::KernelAccelerationStructure => "kernel_acceleration_structure",
|
||||
@@ -417,13 +393,12 @@ impl ToolingRequirement {
|
||||
/// implementation's private layout where the engine's module decodes this crate's, and a
|
||||
/// depth outside `[0, 1]` a case gives a depth image, which the runtime puts nowhere
|
||||
/// ([`ToolingRequirement::DepthOutsideUnitRange`]), and a mesh render pipeline it does not
|
||||
/// draw ([`ToolingRequirement::MeshRenderPipeline`]), and a texture buffer an argument
|
||||
/// buffer or a texture-handle array holds ([`ToolingRequirement::TextureBufferMember`]),
|
||||
/// and a sequentially consistent fence, a render function's function table, an indexed draw
|
||||
/// past its index buffer, a 64-bit texture atomic and separate depth and stencil attachments,
|
||||
/// which the runtime refuses ([`ToolingRequirement::SeqCstFence`],
|
||||
/// [`ToolingRequirement::RenderFunctionTable`], [`ToolingRequirement::IndexBufferPastEnd`],
|
||||
/// [`ToolingRequirement::UlongTextureAtomic`], [`ToolingRequirement::SeparateDepthStencil`]).
|
||||
/// draw ([`ToolingRequirement::MeshRenderPipeline`]), and a sequentially consistent fence, a
|
||||
/// render function's function table, an indexed draw past its index buffer, a 64-bit texture
|
||||
/// atomic and separate depth and stencil attachments, which the runtime refuses
|
||||
/// ([`ToolingRequirement::SeqCstFence`], [`ToolingRequirement::RenderFunctionTable`],
|
||||
/// [`ToolingRequirement::IndexBufferPastEnd`], [`ToolingRequirement::UlongTextureAtomic`],
|
||||
/// [`ToolingRequirement::SeparateDepthStencil`]).
|
||||
///
|
||||
/// The requirements that stopped only the old engine's candidate were retired with it.
|
||||
pub const fn stops(self) -> &'static [Executor] {
|
||||
@@ -451,7 +426,6 @@ impl ToolingRequirement {
|
||||
| Self::RasterizationRateMapPlacement
|
||||
| Self::DepthOutsideUnitRange
|
||||
| Self::MeshRenderPipeline
|
||||
| Self::TextureBufferMember
|
||||
| Self::SeqCstFence
|
||||
| Self::RenderFunctionTable
|
||||
| Self::IndexBufferPastEnd
|
||||
@@ -459,7 +433,6 @@ impl ToolingRequirement {
|
||||
| Self::SeparateDepthStencil
|
||||
| Self::KernelFunctionTable
|
||||
| Self::KernelImageblock
|
||||
| Self::TextureBuffer
|
||||
| Self::FragmentImageblock
|
||||
| Self::SparseTexture
|
||||
| Self::KernelAccelerationStructure
|
||||
@@ -485,12 +458,11 @@ impl ToolingRequirement {
|
||||
|
||||
/// Whose limit this requirement records. Every requirement is this crate's tooling's except
|
||||
/// [`ToolingRequirement::KernelMinLodClamp`], which Apple's compiler cannot build a pipeline
|
||||
/// for, and [`ToolingRequirement::SeqCstFence`], [`ToolingRequirement::TextureBufferMember`],
|
||||
/// [`ToolingRequirement::DepthOutsideUnitRange`], [`ToolingRequirement::MeshRenderPipeline`],
|
||||
/// [`ToolingRequirement::RenderFunctionTable`], [`ToolingRequirement::IndexBufferPastEnd`],
|
||||
/// [`ToolingRequirement::UlongTextureAtomic`], [`ToolingRequirement::SeparateDepthStencil`],
|
||||
/// [`ToolingRequirement::KernelFunctionTable`], [`ToolingRequirement::KernelImageblock`],
|
||||
/// [`ToolingRequirement::TextureBuffer`], [`ToolingRequirement::FragmentImageblock`],
|
||||
/// for, and [`ToolingRequirement::SeqCstFence`], [`ToolingRequirement::DepthOutsideUnitRange`],
|
||||
/// [`ToolingRequirement::MeshRenderPipeline`], [`ToolingRequirement::RenderFunctionTable`],
|
||||
/// [`ToolingRequirement::IndexBufferPastEnd`], [`ToolingRequirement::UlongTextureAtomic`],
|
||||
/// [`ToolingRequirement::SeparateDepthStencil`], [`ToolingRequirement::KernelFunctionTable`],
|
||||
/// [`ToolingRequirement::KernelImageblock`], [`ToolingRequirement::FragmentImageblock`],
|
||||
/// [`ToolingRequirement::SparseTexture`], [`ToolingRequirement::KernelAccelerationStructure`],
|
||||
/// [`ToolingRequirement::KernelStageInput`], [`ToolingRequirement::RasterizationRateMap`],
|
||||
/// [`ToolingRequirement::DynamicVertexStride`], [`ToolingRequirement::IndirectComputeCommands`],
|
||||
@@ -502,7 +474,6 @@ impl ToolingRequirement {
|
||||
match self {
|
||||
Self::KernelMinLodClamp => Limit::Metal,
|
||||
Self::SeqCstFence
|
||||
| Self::TextureBufferMember
|
||||
| Self::DepthOutsideUnitRange
|
||||
| Self::MeshRenderPipeline
|
||||
| Self::RenderFunctionTable
|
||||
@@ -511,7 +482,6 @@ impl ToolingRequirement {
|
||||
| Self::SeparateDepthStencil
|
||||
| Self::KernelFunctionTable
|
||||
| Self::KernelImageblock
|
||||
| Self::TextureBuffer
|
||||
| Self::FragmentImageblock
|
||||
| Self::SparseTexture
|
||||
| Self::KernelAccelerationStructure
|
||||
@@ -667,21 +637,6 @@ mod tests {
|
||||
assert!(requirement.qualifies_on_metal(), "{requirement}");
|
||||
}
|
||||
|
||||
/// A texture buffer an argument buffer or a texture-handle array holds: a case expresses it
|
||||
/// and the Metal oracle runs it, so its cases stay Metal-qualified; the runtime refuses it, so
|
||||
/// the engine's candidate runs none, the runtime's limit, which closes its rows.
|
||||
#[test]
|
||||
fn a_texture_buffer_member_stops_only_the_candidate() {
|
||||
let requirement = ToolingRequirement::TextureBufferMember;
|
||||
assert_eq!(requirement.stops(), [Executor::EngineCandidate]);
|
||||
assert_eq!(requirement.limit(), Limit::Runtime, "{requirement}");
|
||||
assert!(!requirement.blocks_closure(), "{requirement}");
|
||||
assert!(requirement.qualifies_on_metal(), "{requirement}");
|
||||
assert!("texture_buffer_literal"
|
||||
.parse::<ToolingRequirement>()
|
||||
.is_err());
|
||||
}
|
||||
|
||||
/// A sequentially consistent fence: the Metal oracle runs it, so its cases stay
|
||||
/// Metal-qualified; the runtime refuses it, so the engine's candidate runs none, the runtime's
|
||||
/// limit, which closes its rows.
|
||||
@@ -758,7 +713,6 @@ mod tests {
|
||||
"kernel_function_table",
|
||||
),
|
||||
(ToolingRequirement::KernelImageblock, "kernel_imageblock"),
|
||||
(ToolingRequirement::TextureBuffer, "texture_buffer"),
|
||||
(
|
||||
ToolingRequirement::FragmentImageblock,
|
||||
"fragment_imageblock",
|
||||
@@ -847,7 +801,6 @@ mod tests {
|
||||
.filter(|requirement| requirement.limit() == Limit::Runtime)
|
||||
.collect::<Vec<_>>(),
|
||||
[
|
||||
ToolingRequirement::TextureBufferMember,
|
||||
ToolingRequirement::DepthOutsideUnitRange,
|
||||
ToolingRequirement::MeshRenderPipeline,
|
||||
ToolingRequirement::SeqCstFence,
|
||||
@@ -857,7 +810,6 @@ mod tests {
|
||||
ToolingRequirement::SeparateDepthStencil,
|
||||
ToolingRequirement::KernelFunctionTable,
|
||||
ToolingRequirement::KernelImageblock,
|
||||
ToolingRequirement::TextureBuffer,
|
||||
ToolingRequirement::FragmentImageblock,
|
||||
ToolingRequirement::SparseTexture,
|
||||
ToolingRequirement::KernelAccelerationStructure,
|
||||
@@ -880,7 +832,17 @@ mod tests {
|
||||
// The old engine's candidate and the requirements that stopped only it are retired: neither
|
||||
// name parses.
|
||||
assert!(serde_json::from_str::<Executor>("\"old_engine_candidate\"").is_err());
|
||||
for retired in ["static_sampler_pixel_address", "tile_grid", "ulong_texture"] {
|
||||
// So are the texture-buffer requirements: the runtime makes texture buffers, bound and in
|
||||
// argument buffers, and the engine's candidate runs them.
|
||||
let retired = [
|
||||
"static_sampler_pixel_address",
|
||||
"tile_grid",
|
||||
"ulong_texture",
|
||||
"texture_buffer",
|
||||
"texture_buffer_member",
|
||||
"texture_buffer_literal",
|
||||
];
|
||||
for retired in retired {
|
||||
assert!(retired.parse::<ToolingRequirement>().is_err(), "{retired}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1500,10 +1500,9 @@ entry:
|
||||
|
||||
/// The owned fixture `rlm_runtime_limits` holds each shape of a requirement the runtime refuses
|
||||
/// beside the same shape without it, as its device tests run them
|
||||
/// (`candidate::tests::engine_compute`): the read of a texture buffer an argument buffer holds
|
||||
/// carries `texture_buffer_member` and the same read of a 2D member does not, and the
|
||||
/// `acq_rel` fence carries no `seq_cst_fence`, which `a4_device_fence`'s `seq_cst` fence
|
||||
/// carries.
|
||||
/// (`candidate::tests::engine_compute`): the `acq_rel` fence carries no `seq_cst_fence`, which
|
||||
/// `a4_device_fence`'s `seq_cst` fence carries; and the read of a texture buffer an argument
|
||||
/// buffer holds carries what the same read of a 2D member carries, as the runtime makes both.
|
||||
#[test]
|
||||
fn the_runtime_limit_fixture_holds_each_shape_beside_its_pair() {
|
||||
let engine = metal2vulkan_devtools::engine_dir();
|
||||
@@ -1517,10 +1516,10 @@ entry:
|
||||
.tooling_requirements
|
||||
};
|
||||
let limits = "rlm_runtime_limits.ll";
|
||||
assert!(requirements(limits, "rlm_member_texture_buffer")
|
||||
.contains(&ToolingRequirement::TextureBufferMember));
|
||||
assert!(!requirements(limits, "rlm_member_texture")
|
||||
.contains(&ToolingRequirement::TextureBufferMember));
|
||||
assert_eq!(
|
||||
requirements(limits, "rlm_member_texture_buffer"),
|
||||
requirements(limits, "rlm_member_texture")
|
||||
);
|
||||
assert!(
|
||||
!requirements(limits, "rlm_fence_acq_rel").contains(&ToolingRequirement::SeqCstFence)
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user