metal2vulkan: PrecisionNote::DeviceReconvergence, a stage's implementation-defined reconvergence as a static note
A stage whose reconvergence is ImplementationDefined (a tangled instruction in its entry on a device without maximal reconvergence) records PrecisionNote::DeviceReconvergence, static per stage and as coarse as the field. metal2vulkan-rt forwards it through ComputePipelineState::precision_notes and adds none of its own; metal2vulkan-runtime announces its note kind beside its existing ImplementationDefinedReconvergence kind. The note is in API.md's degrade-notice catalogue, the fast-paths ledger's Elsewhere class, the cache codec (ARTIFACT_FORMAT_VERSION 528) and validation's Unbounded allowance. SEMANTICS_VERSION 2149: a stage's notes change on devices without maximal reconvergence; the golden tables are re-blessed on development. Tests: engine_simd reconvergence_follows_the_profile and the uniform-control-flow case assert the note exactly where the field is ImplementationDefined.
This commit is contained in:
1 parent
7a3fe46a33
commit
6e08f5aaef
11 files changed
+48
-7
No files matched your search
@@ -2937,6 +2937,9 @@ degradations! {
|
||||
/// device's, where Metal reads `0x7FC00000`. Not bounded: a NaN in a sum makes the sum a
|
||||
/// NaN.
|
||||
NativeFloat8 = "native-float8";
|
||||
/// Class: reconvergence. The stage's reconvergence after divergence is the device's, where
|
||||
/// Metal's is maximal; announced beside `ImplementationDefinedReconvergence`.
|
||||
DeviceReconvergence = "device-reconvergence";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -341,7 +341,8 @@ pub fn allowance(note: PrecisionNote) -> Allowance {
|
||||
| N::UnorderedFetchWithinDraw
|
||||
| N::NativeLogicOperation
|
||||
| N::NativeFloat8
|
||||
| N::CappedLodBias => Allowance::Unbounded,
|
||||
| N::CappedLodBias
|
||||
| N::DeviceReconvergence => Allowance::Unbounded,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -80,6 +80,7 @@ fn every_precision_note_has_its_table_row() {
|
||||
(N::NativeLogicOperation, Allowance::Unbounded),
|
||||
(N::NativeFloat8, Allowance::Unbounded),
|
||||
(N::CappedLodBias, Allowance::Unbounded),
|
||||
(N::DeviceReconvergence, Allowance::Unbounded),
|
||||
];
|
||||
for (note, expected) in rows {
|
||||
assert_eq!(allowance(note), expected, "{note:?}");
|
||||
|
||||
+1
@@ -1527,6 +1527,7 @@ codec_enum! {
|
||||
NativeLogicOperation,
|
||||
NativeFloat8,
|
||||
CappedLodBias,
|
||||
DeviceReconvergence,
|
||||
}
|
||||
BindingSource {
|
||||
Buffer(f0), Texture(f0), Sampler(f0), CombinedTextureSampler { texture, sampler },
|
||||
|
||||
Vendored
+2
-2
@@ -61,7 +61,7 @@ mod tests;
|
||||
/// unchanged version, and its bless records the version. Independent of the crate's version and of
|
||||
/// [`ARTIFACT_FORMAT_VERSION`]. The commit that bumps it says what changed; this comment keeps no
|
||||
/// history.
|
||||
pub const SEMANTICS_VERSION: u32 = 2148;
|
||||
pub const SEMANTICS_VERSION: u32 = 2149;
|
||||
|
||||
/// The byte-layout version of encoded artifacts (`CompiledFunction::to_bytes` and the
|
||||
/// [`PipelineArtifact`] encodings). Every encoded artifact carries it, and a decode under another
|
||||
@@ -71,7 +71,7 @@ pub const SEMANTICS_VERSION: u32 = 2148;
|
||||
/// re-typed in an encoded type, its `codec` body or its `envelope`. A variant removed while its tag
|
||||
/// stays unused needs no bump: an entry holding it fails to decode, which is a miss. The commit that
|
||||
/// bumps it says what changed; this comment keeps no history.
|
||||
pub const ARTIFACT_FORMAT_VERSION: u32 = 527;
|
||||
pub const ARTIFACT_FORMAT_VERSION: u32 = 528;
|
||||
|
||||
/// The version of what this crate's runtime does with a compiled pipeline: instantiating a binding
|
||||
/// plan (`BindingPlan::instantiate_*`: descriptor ranges, push bytes, root, argument, and handle
|
||||
|
||||
@@ -2385,6 +2385,18 @@ pub enum PrecisionNote {
|
||||
///
|
||||
/// Validation derives no tolerance from it.
|
||||
CappedLodBias,
|
||||
/// The stage holds a tangled instruction (a simdgroup or quad operation, or a barrier whose
|
||||
/// lanes depend on reconvergence) on a device without maximal reconvergence
|
||||
/// (`Reconvergence::ImplementationDefined`): after divergent control flow the device decides
|
||||
/// which lanes run it together, where Metal's lanes reconverge maximally, so such an operation
|
||||
/// may see other lanes active than Metal's. Under subgroup-uniform control flow
|
||||
/// (`shaderSubgroupUniformControlFlow`) the lanes reconverge where control flow is uniform.
|
||||
/// Static per stage: recorded for any tangled instruction in the entry, as the stage's
|
||||
/// `reconvergence` is.
|
||||
///
|
||||
/// Validation derives no tolerance from it: a difference stays a mismatch, which the note
|
||||
/// explains.
|
||||
DeviceReconvergence,
|
||||
}
|
||||
|
||||
/// The math mode of an entry's module, which decides, on a device whose `float` functions are
|
||||
|
||||
@@ -49,7 +49,7 @@ use crate::library::{
|
||||
};
|
||||
use crate::lower::dispatch::LocalSizeForm;
|
||||
use crate::lower::select::{LowerInputs, Plan};
|
||||
use crate::pipeline::artifact::{PrecisionNote, StrategyCensus, StrategyUse};
|
||||
use crate::pipeline::artifact::{PrecisionNote, Reconvergence, StrategyCensus, StrategyUse};
|
||||
use crate::pipeline::compile::key::{DynamicKey, LinkedKey};
|
||||
use crate::pipeline::descriptor::{
|
||||
ColorAttachmentDescriptor, DynamicLibraries, FunctionDescriptor, LinkedFunction,
|
||||
@@ -3317,15 +3317,22 @@ fn compile_bounded<K>(
|
||||
.insert(VkFeature::ShaderSampleRateInterpolationFunctions);
|
||||
}
|
||||
}
|
||||
// Implementation-defined where a tangled instruction runs without maximal reconvergence
|
||||
// (`lower::simd` chooses the entry's reconvergence mode), which the stage's note records.
|
||||
let reconvergence = crate::lower::simd::reconvergence(&plan);
|
||||
if reconvergence == Reconvergence::ImplementationDefined
|
||||
&& !precision.contains(&PrecisionNote::DeviceReconvergence)
|
||||
{
|
||||
precision.push(PrecisionNote::DeviceReconvergence);
|
||||
precision.sort_unstable();
|
||||
}
|
||||
let artifact = Arc::new(FunctionArtifact {
|
||||
key,
|
||||
module,
|
||||
interface,
|
||||
facts: plan.facts.clone(),
|
||||
subgroup: plan.subgroup,
|
||||
// Implementation-defined where a tangled instruction runs without maximal reconvergence
|
||||
// (`lower::simd` chooses the entry's reconvergence mode).
|
||||
reconvergence: crate::lower::simd::reconvergence(&plan),
|
||||
reconvergence,
|
||||
precision,
|
||||
strategies: emitted_census(&plan, helper_guard),
|
||||
stats,
|
||||
|
||||
@@ -636,6 +636,7 @@ fn reconvergence_follows_the_profile() {
|
||||
let (_, words) = link_and_validate(&a, &maximal).expect("valid");
|
||||
assert!(spirv_dis(&words).contains("MaximallyReconvergesKHR"));
|
||||
assert_eq!(a.reconvergence, Reconvergence::Guaranteed);
|
||||
assert!(!a.precision.contains(&PrecisionNote::DeviceReconvergence));
|
||||
|
||||
let pascal = profile("nvidia-pascal-linux", DevicePolicy::default()).expect("profile");
|
||||
let sg = pascal.fields().subgroup;
|
||||
@@ -648,6 +649,8 @@ fn reconvergence_follows_the_profile() {
|
||||
&& !text.contains("SubgroupUniformControlFlowKHR")
|
||||
);
|
||||
assert_eq!(a.reconvergence, Reconvergence::ImplementationDefined);
|
||||
// The stage records the device's reconvergence as a note.
|
||||
assert!(a.precision.contains(&PrecisionNote::DeviceReconvergence));
|
||||
}
|
||||
|
||||
/// Float sums record the device's association order.
|
||||
@@ -1023,6 +1026,7 @@ fn uniform_control_flow_mode_without_maximal_reconvergence() {
|
||||
.extensions
|
||||
.contains(&VkExtension::KhrShaderSubgroupUniformControlFlow));
|
||||
assert_eq!(a.reconvergence, Reconvergence::ImplementationDefined);
|
||||
assert!(a.precision.contains(&PrecisionNote::DeviceReconvergence));
|
||||
}
|
||||
|
||||
const HEADER: &str = "target datalayout = \"e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v16:16:16-v24:32:32-v32:32:32-v48:64:64-v64:64:64-v96:128:128-v128:128:128-v192:256:256-v256:256:256-v512:512:512-v1024:1024:1024-n8:16:32\"\ntarget triple = \"air64_v28-apple-macosx26.0.0\"\n\n";
|
||||
|
||||
@@ -182,6 +182,7 @@ fn notes() -> Vec<(&'static str, Ledger)> {
|
||||
NativeFloat8,
|
||||
],
|
||||
Elsewhere: [
|
||||
DeviceReconvergence,
|
||||
HalfOutputPrecision,
|
||||
NativeHalfConversion,
|
||||
NativeHalfQuantize,
|
||||
|
||||
@@ -6227,6 +6227,7 @@ macro-member metal2vulkan-runtime::Degradation::DeviceNanEncoding DeviceNanEncod
|
||||
macro-member metal2vulkan-runtime::Degradation::DevicePackConversion DevicePackConversion = "device-pack-conversion";
|
||||
macro-member metal2vulkan-runtime::Degradation::DevicePointSize DevicePointSize = "device-point-size";
|
||||
macro-member metal2vulkan-runtime::Degradation::DeviceRayIntersection DeviceRayIntersection = "device-ray-intersection";
|
||||
macro-member metal2vulkan-runtime::Degradation::DeviceReconvergence DeviceReconvergence = "device-reconvergence";
|
||||
macro-member metal2vulkan-runtime::Degradation::DeviceRecovered DeviceRecovered = "device-recovered", Performance,
|
||||
macro-member metal2vulkan-runtime::Degradation::DeviceRoundedResolve DeviceRoundedResolve = "device-rounded-resolve", Precision,
|
||||
macro-member metal2vulkan-runtime::Degradation::DeviceSampleLevel DeviceSampleLevel = "device-sample-level";
|
||||
@@ -12781,6 +12782,7 @@ variant metal2vulkan-rt::PrecisionNote::DeviceNanEncoding DeviceNanEncoding
|
||||
variant metal2vulkan-rt::PrecisionNote::DevicePackConversion DevicePackConversion
|
||||
variant metal2vulkan-rt::PrecisionNote::DevicePointSize DevicePointSize
|
||||
variant metal2vulkan-rt::PrecisionNote::DeviceRayIntersection DeviceRayIntersection
|
||||
variant metal2vulkan-rt::PrecisionNote::DeviceReconvergence DeviceReconvergence
|
||||
variant metal2vulkan-rt::PrecisionNote::DeviceSampleLevel DeviceSampleLevel
|
||||
variant metal2vulkan-rt::PrecisionNote::DeviceSampling DeviceSampling
|
||||
variant metal2vulkan-rt::PrecisionNote::DeviceSignedZeroInfNan DeviceSignedZeroInfNan
|
||||
@@ -15624,6 +15626,7 @@ variant metal2vulkan::pipeline::PrecisionNote::DeviceNanEncoding DeviceNanEncodi
|
||||
variant metal2vulkan::pipeline::PrecisionNote::DevicePackConversion DevicePackConversion
|
||||
variant metal2vulkan::pipeline::PrecisionNote::DevicePointSize DevicePointSize
|
||||
variant metal2vulkan::pipeline::PrecisionNote::DeviceRayIntersection DeviceRayIntersection
|
||||
variant metal2vulkan::pipeline::PrecisionNote::DeviceReconvergence DeviceReconvergence
|
||||
variant metal2vulkan::pipeline::PrecisionNote::DeviceSampleLevel DeviceSampleLevel
|
||||
variant metal2vulkan::pipeline::PrecisionNote::DeviceSampling DeviceSampling
|
||||
variant metal2vulkan::pipeline::PrecisionNote::DeviceSignedZeroInfNan DeviceSignedZeroInfNan
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -5345,6 +5345,14 @@ bound.
|
||||
reads them, and records none. An `air.convert` from `f8e4m3fn` or `f8e5m2` and a
|
||||
simdgroup-matrix cell of those formats widen through the same type there and record none: their
|
||||
formats are OCP's own, and Metal on Apple M3 does not compile them.
|
||||
- `metal2vulkan-degrade-device-reconvergence` (precision). `PrecisionNote::DeviceReconvergence`: A
|
||||
stage holds a simdgroup or quad operation, or a barrier whose lanes depend on reconvergence, on a
|
||||
device without maximal reconvergence (`Reconvergence::ImplementationDefined`): after divergent
|
||||
control flow the device decides which lanes run it together, where Metal's reconverge maximally,
|
||||
so the operation may see other lanes active than Metal's. With
|
||||
`shaderSubgroupUniformControlFlow` the lanes reconverge where control flow is uniform. Recorded
|
||||
for any such instruction in the stage's entry; `metal2vulkan-runtime` also announces
|
||||
`ImplementationDefinedReconvergence` there.
|
||||
- `metal2vulkan-degrade-device-pack-conversion` (precision). `PrecisionNote::DevicePackConversion`:
|
||||
Native device maths (a conversion): `air.pack` or `air.unpack` of a normalized format is the
|
||||
device's: `GLSL.std.450`'s `Pack`/`Unpack` `Unorm4x8`, `Snorm4x8`, `Unorm2x16` and `Snorm2x16`,
|
||||
|
||||
Reference in new issue
Block a user