From 888dbbbf2fc3a42921badd2f855afe4e9daeac7a Mon Sep 17 00:00:00 2001 From: Anees Iqbal Date: Tue, 3 Nov 2026 01:57:44 -0800 Subject: [PATCH] Refuse each constants-block record outside the typed model by LLVM's name What: `Feature::Constant { code: u32 }` becomes `Feature::Constant { record: ConstantRecord }`, in the front end and the translator, which re-exports the new `ConstantRecord`. ConstantRecord is non-exhaustive, one variant per LLVM name: - Select, ExtractElement, InsertElement, Compare; - ShuffleVector (CE_SHUFFLEVEC and CE_SHUFVEC_EX); - BlockAddress, UnaryOp, DsoLocalEquivalent, NoCfi, GepWithInrange; - PtrAuth (PTRAUTH and PTRAUTH2), Byte (BYTE and WIDE_BYTE); - PtrToAddr: a CE_CAST of `CAST_PTRTOADDR`. Each record is matched from its code (`codes::cst_unsupported`). A code LLVM does not define stays `UnknownRecord`. A refusal now reads `Constant { record: Select }` where it read `Constant { code: 13 }`. The names and codes come from `LLVMBitCodes.h` of the local LLVM 21.1.8 and 23.1.4 toolchains (`ConstantsCodes`, `CastOpcodes`). WIDE_INTEGER stays malformed, on purpose, with a comment that says why. LLVM writes it only for an integer wider than 64 bits. The type table already refuses those types (`Feature::Type`). So a WIDE_INTEGER that reaches the constants block has a type of at most 64 bits, which LLVM never writes. Why: a refusal should name what it refuses. The inline assembly record (code 30) reached a consumer as a bare `Constant { code: 30 }`; it now decodes, and this names the rest of the class. Verified (debug): - metal2vulkan-air suite passes, including `constant_errors_are_typed`: - each of the 15 refused codes yields its name; - CE_CAST opcode 13 yields PtrToAddr, opcode 14 is malformed; - WIDE_INTEGER of an i32 is malformed; - code 60 is UnknownRecord. At the base the test does not compile (no ConstantRecord), and the refusal there was the bare code. - The translator's api_surface, api_signatures (blessed: the new enum, its variants, the changed variant) and refusal_surface tests pass. - clippy -D warnings, workspace, all targets, plain and --cfg m2v_gpu. - docs/REFUSALS.md regenerated (the row's doc text). The census changes no outcome: no private-corpus row was refused with a constants-block code at d3e66f9415 or after the bit-manipulation change (nvidia-rtx5080-laptop and moltenvk-m3). SEMANTICS_VERSION 1954 -> 1956 (a refusal's class changes): the lane's value plus one after f19e887e4a takes 1955. Golden tables: none move (no fixture holds such a record). (cherry picked from commit 2af3e7891ee1ce7893107ff69f32ea879a06a56c) (cherry picked from commit 94412279d2b277a2b9cfc11a83fc1e231ef91ecb) (cherry picked from commit 3f5560c3fd7da0edab9a10d6b951986d8fcc6f80) --- crates/metal2vulkan-air/src/bitcode/codes.rs | 30 ++++++++--- .../metal2vulkan-air/src/bitcode/constants.rs | 17 +++++-- crates/metal2vulkan-air/src/bitcode/tests.rs | 51 +++++++++++++++++-- crates/metal2vulkan-air/src/error.rs | 47 +++++++++++++++-- crates/metal2vulkan-air/tests/api_surface.txt | 1 + crates/metal2vulkan/src/cache/mod.rs | 2 +- crates/metal2vulkan/src/error/mod.rs | 11 ++-- crates/metal2vulkan/tests/api_signatures.tsv | 32 +++++++++++- crates/metal2vulkan/tests/api_surface.rs | 1 + docs/REFUSALS.md | 2 +- 10 files changed, 168 insertions(+), 26 deletions(-) diff --git a/crates/metal2vulkan-air/src/bitcode/codes.rs b/crates/metal2vulkan-air/src/bitcode/codes.rs index 3e1f48921..078c7af85 100644 --- a/crates/metal2vulkan-air/src/bitcode/codes.rs +++ b/crates/metal2vulkan-air/src/bitcode/codes.rs @@ -5,6 +5,8 @@ //! known LLVM construct the typed model does not cover (`Unsupported`) or not LLVM at all //! (`UnknownRecord`); the per-block decoders decide which. +use crate::error::ConstantRecord; + // ---- Block ids (`enum BlockIDs`, FIRST_APPLICATION_BLOCKID = 8) ---- pub(crate) const MODULE_BLOCK: u32 = 8; pub(crate) const PARAMATTR_BLOCK: u32 = 9; @@ -100,12 +102,28 @@ pub(crate) const CST_INLINEASM_OLD3: u32 = 28; /// `INLINEASM`: `[fnty, sideeffect|alignstack|asmdialect|unwind, asmstr, conststr]` (LLVM 13+). pub(crate) const CST_INLINEASM: u32 = 30; pub(crate) const CST_CE_GEP: u32 = 32; -/// Constant codes LLVM defines that the typed model refuses: CE_SELECT, CE_EXTRACTELT, -/// CE_INSERTELT, CE_SHUFFLEVEC, CE_CMP, CE_SHUFVEC_EX, BLOCKADDRESS, CE_UNOP, -/// DSO_LOCAL_EQUIVALENT, NO_CFI_VALUE, CE_GEP_WITH_INRANGE, PTRAUTH, PTRAUTH2, BYTE and WIDE_BYTE -/// (LLVM 23: constants of the refused byte type). -pub(crate) const CST_UNSUPPORTED: &[u32] = - &[13, 14, 15, 16, 17, 19, 21, 25, 27, 29, 31, 33, 34, 35, 36]; +/// The constant code LLVM defines that the typed model refuses, by its name ([`ConstantRecord`]): +/// CE_SELECT, CE_EXTRACTELT, CE_INSERTELT, CE_SHUFFLEVEC and CE_SHUFVEC_EX, CE_CMP, +/// BLOCKADDRESS, CE_UNOP, DSO_LOCAL_EQUIVALENT, NO_CFI_VALUE, CE_GEP_WITH_INRANGE, PTRAUTH and +/// PTRAUTH2, and BYTE and WIDE_BYTE (LLVM 23: constants of the refused byte type). +pub(crate) fn cst_unsupported(code: u32) -> Option { + use ConstantRecord as R; + Some(match code { + 13 => R::Select, + 14 => R::ExtractElement, + 15 => R::InsertElement, + 16 | 19 => R::ShuffleVector, + 17 => R::Compare, + 21 => R::BlockAddress, + 25 => R::UnaryOp, + 27 => R::DsoLocalEquivalent, + 29 => R::NoCfi, + 31 => R::GepWithInrange, + 33 | 34 => R::PtrAuth, + 35 | 36 => R::Byte, + _ => return None, + }) +} // ---- METADATA ---- pub(crate) const METADATA_VALUE: u32 = 2; diff --git a/crates/metal2vulkan-air/src/bitcode/constants.rs b/crates/metal2vulkan-air/src/bitcode/constants.rs index c8d9d8a89..09e9f4d03 100644 --- a/crates/metal2vulkan-air/src/bitcode/constants.rs +++ b/crates/metal2vulkan-air/src/bitcode/constants.rs @@ -16,7 +16,7 @@ use super::stream::{signed_vbr, Stream}; use super::types::{grow, BitcodeTypes}; use crate::budget::Meter; use crate::error::{BitcodeError, InputError, InputErrorKind, Location}; -use crate::error::{Error, Feature}; +use crate::error::{ConstantRecord, Error, Feature}; use crate::ir::{ BinOp, CastOp, Const, ConstExpr, ConstId, ConstTable, Constant, InlineAsm, IntFlags, Type, TypeId, TypeTable, @@ -153,6 +153,9 @@ fn record( let v = signed_vbr(s.op(B, code, 0)?) as u64; splat(consts, types, ty, Const::Int(v & mask(u32::from(bits))), m) } + // LLVM writes an integer of more than 64 bits as WIDE_INTEGER and every other as INTEGER; + // the type table refuses the wider types (`Feature::Type`), so a WIDE_INTEGER here is of a + // type of at most 64 bits, which LLVM never writes. CST_WIDE_INTEGER => Err(bad()), CST_FLOAT => { let width = types.float_bits(ty).ok_or_else(bad)?; @@ -207,7 +210,11 @@ fn record( 11 => CastOp::Bitcast, 12 => CastOp::AddrSpaceCast, // CAST_PTRTOADDR: an LLVM cast the IR has no form for. - 13 => return Err(s.unsupported(Feature::Constant { code })), + 13 => { + return Err(s.unsupported(Feature::Constant { + record: ConstantRecord::PtrToAddr, + })) + } _ => return Err(bad()), }; Ok(Raw::Cast { @@ -268,8 +275,10 @@ fn record( CST_INLINEASM_OLD | CST_INLINEASM_OLD2 | CST_INLINEASM_OLD3 | CST_INLINEASM => { inline_asm(s, bc_types, types, code, (bc, ty), m) } - c if CST_UNSUPPORTED.contains(&c) => Err(s.unsupported(Feature::Constant { code })), - _ => Err(s.err(BitcodeError::UnknownRecord { block: B, code })), + c => match cst_unsupported(c) { + Some(record) => Err(s.unsupported(Feature::Constant { record })), + None => Err(s.err(BitcodeError::UnknownRecord { block: B, code })), + }, } } diff --git a/crates/metal2vulkan-air/src/bitcode/tests.rs b/crates/metal2vulkan-air/src/bitcode/tests.rs index 4bef9da69..00ed36721 100644 --- a/crates/metal2vulkan-air/src/bitcode/tests.rs +++ b/crates/metal2vulkan-air/src/bitcode/tests.rs @@ -1020,12 +1020,55 @@ fn constant_errors_are_typed() { bitcode_kind(&e), Some(BitcodeError::MalformedRecord { .. }) )); - // Block addresses, `select` expressions, and LLVM 23's byte constants are valid LLVM outside - // the typed model. - for code in [21u32, 13, 35, 36] { + // Every constant record LLVM defines outside the typed model is refused by its name: the + // constant expressions the IR has no form for, block addresses, signed pointers, and LLVM 23's + // byte constants. + use crate::error::ConstantRecord as R; + for (code, record) in [ + (13u32, R::Select), + (14, R::ExtractElement), + (15, R::InsertElement), + (16, R::ShuffleVector), + (17, R::Compare), + (19, R::ShuffleVector), + (21, R::BlockAddress), + (25, R::UnaryOp), + (27, R::DsoLocalEquivalent), + (29, R::NoCfi), + (31, R::GepWithInrange), + (33, R::PtrAuth), + (34, R::PtrAuth), + (35, R::Byte), + (36, R::Byte), + ] { let e = constants(&[(1, vec![0]), (u64::from(code), vec![0, 0, 0])]).unwrap_err(); - assert_eq!(unsupported_feature(&e), Some(&Feature::Constant { code })); + assert_eq!( + unsupported_feature(&e), + Some(&Feature::Constant { record }), + "{code}" + ); } + // A `ptrtoaddr` cast expression (CE_CAST with cast opcode 13) too; an opcode past it is no + // LLVM cast. + let e = constants(&[(1, vec![0]), (11, vec![13, 0, 0])]).unwrap_err(); + assert_eq!( + unsupported_feature(&e), + Some(&Feature::Constant { + record: R::PtrToAddr + }) + ); + let e = constants(&[(1, vec![0]), (11, vec![14, 0, 0])]).unwrap_err(); + assert!(matches!( + bitcode_kind(&e), + Some(BitcodeError::MalformedRecord { .. }) + )); + // A WIDE_INTEGER of an integer type of at most 64 bits, which LLVM never writes (the type + // table refuses the wider ones). + let e = constants(&[(1, vec![0]), (5, vec![2, 0])]).unwrap_err(); + assert!(matches!( + bitcode_kind(&e), + Some(BitcodeError::MalformedRecord { .. }) + )); let e = constants(&[(1, vec![0]), (60, vec![])]).unwrap_err(); assert_eq!( bitcode_kind(&e), diff --git a/crates/metal2vulkan-air/src/error.rs b/crates/metal2vulkan-air/src/error.rs index 3d2cb81cc..7203e2a8e 100644 --- a/crates/metal2vulkan-air/src/error.rs +++ b/crates/metal2vulkan-air/src/error.rs @@ -752,11 +752,12 @@ pub enum Feature { InlineAsm, /// Linkage signatures / stitching / dynamic libraries. Linking, - /// A bitcode constant record outside the typed model (block address, inline asm, `select` - /// and other constant expressions the IR has no form for). + /// A constants-block record LLVM defines that the typed model has no form for (a block + /// address, a `select` and the other constant expressions of [`ConstantRecord`]), by LLVM's + /// name for it. Constant { - /// The constants block's record code. - code: u32, + /// The record. + record: ConstantRecord, }, /// An LLVM attribute kind that changes the calling ABI and that AIR does not use /// (`inalloca`, `preallocated`, `byref`, `nest`, the `swift*` kinds). @@ -811,6 +812,44 @@ pub enum Feature { ProgramScopeBinding, } +/// A constants-block record that LLVM defines (`LLVMBitCodes.h`'s `ConstantsCodes`, and +/// `CAST_PTRTOADDR` among its cast opcodes) and that the typed model has no form for +/// ([`Feature::Constant`]), by LLVM's name. LLVM's code follows each name. A later LLVM's new +/// record is a new variant. +#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] +#[non_exhaustive] +pub enum ConstantRecord { + /// A `select` constant expression (`CST_CODE_CE_SELECT`, 13). + Select, + /// An `extractelement` constant expression (`CST_CODE_CE_EXTRACTELT`, 14). + ExtractElement, + /// An `insertelement` constant expression (`CST_CODE_CE_INSERTELT`, 15). + InsertElement, + /// A `shufflevector` constant expression (`CST_CODE_CE_SHUFFLEVEC`, 16, and + /// `CST_CODE_CE_SHUFVEC_EX`, 19, whose result length differs from its operands'). + ShuffleVector, + /// An `icmp` or `fcmp` constant expression (`CST_CODE_CE_CMP`, 17). + Compare, + /// A `blockaddress` (`CST_CODE_BLOCKADDRESS`, 21). + BlockAddress, + /// A unary constant expression, `fneg` (`CST_CODE_CE_UNOP`, 25). + UnaryOp, + /// A `dso_local_equivalent` (`CST_CODE_DSO_LOCAL_EQUIVALENT`, 27). + DsoLocalEquivalent, + /// A `no_cfi` function reference (`CST_CODE_NO_CFI_VALUE`, 29). + NoCfi, + /// A `getelementptr` constant expression with an `inrange` range (`CST_CODE_CE_GEP_WITH_INRANGE`, + /// 31). + GepWithInrange, + /// A signed pointer, `ptrauth` (`CST_CODE_PTRAUTH`, 33, and `CST_CODE_PTRAUTH2`, 34). + PtrAuth, + /// A constant of LLVM's byte type (`CST_CODE_BYTE`, 35, and `CST_CODE_WIDE_BYTE`, 36), which + /// the type table refuses too. + Byte, + /// A `ptrtoaddr` cast constant expression (`CST_CODE_CE_CAST` with `CAST_PTRTOADDR`, 13). + PtrToAddr, +} + /// An input the request did not supply. #[derive(Clone, Debug, PartialEq, Eq, Hash)] pub enum MissingInput { diff --git a/crates/metal2vulkan-air/tests/api_surface.txt b/crates/metal2vulkan-air/tests/api_surface.txt index 08a4d69df..3009c5dcb 100644 --- a/crates/metal2vulkan-air/tests/api_surface.txt +++ b/crates/metal2vulkan-air/tests/api_surface.txt @@ -234,6 +234,7 @@ error BitcodeError enum(N) error BitstreamError enum(N) error BudgetExceeded enum(N) error CanonError enum(N) +error ConstantRecord enum(N) error ContainerError enum(N) error DiagName struct(O) error Error enum(E) diff --git a/crates/metal2vulkan/src/cache/mod.rs b/crates/metal2vulkan/src/cache/mod.rs index 35541b9b0..c5f896931 100644 --- a/crates/metal2vulkan/src/cache/mod.rs +++ b/crates/metal2vulkan/src/cache/mod.rs @@ -60,7 +60,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 = 1955; +pub const SEMANTICS_VERSION: u32 = 1956; /// The byte-layout version of encoded artifacts (`CompiledFunction::to_bytes` and the /// [`PipelineArtifact`] encodings). Every encoded artifact carries it, and a decode under another diff --git a/crates/metal2vulkan/src/error/mod.rs b/crates/metal2vulkan/src/error/mod.rs index 3d719bd17..2f3850b83 100644 --- a/crates/metal2vulkan/src/error/mod.rs +++ b/crates/metal2vulkan/src/error/mod.rs @@ -62,6 +62,8 @@ pub use crate::air::error::{ // The vocabulary the front end and the translator share: the caps, the deadline, internal // invariants, and why a linked function cannot resolve a reference. pub use crate::air::error::{BudgetExceeded, InternalError, InternalKind, Limit, LinkProblem}; +// The constants-block records a refusal names (`Feature::Constant`). +pub use crate::air::error::ConstantRecord; use crate::air::error::{MissingInput, RequestError}; use crate::device::requirements::{ ApiVersion, FormatUsage, VkExtension, VkFeature, VkLimit, VkProperty, @@ -254,7 +256,7 @@ impl From for Feature { Air::DynamicCall => Feature::DynamicCall, Air::InlineAsm => Feature::InlineAsm, Air::Linking => Feature::Linking, - Air::Constant { code } => Feature::Constant { code }, + Air::Constant { record } => Feature::Constant { record }, Air::Attribute { kind } => Feature::Attribute { kind }, Air::BitcodeRecord { block, code } => Feature::BitcodeRecord { block, code }, Air::SyncScope => Feature::SyncScope, @@ -1307,10 +1309,11 @@ pub enum Feature { // ---- Device ---- /// The device's Vulkan version is below the 1.2 floor. VulkanVersion, - /// A bitcode constant record outside the typed model (block address, inline asm, `select` - /// and other constant expressions the IR has no form for). + /// A constants-block record LLVM defines that the typed model has no form for (a block + /// address, a `select` and the other constant expressions of [`ConstantRecord`]), by LLVM's + /// name for it. Constant { - code: u32, + record: ConstantRecord, }, /// An LLVM attribute kind that changes the calling ABI and that AIR does not use /// (`inalloca`, `preallocated`, `byref`, `nest`, the `swift*` kinds). diff --git a/crates/metal2vulkan/tests/api_signatures.tsv b/crates/metal2vulkan/tests/api_signatures.tsv index 18b2790ce..2b88426e8 100644 --- a/crates/metal2vulkan/tests/api_signatures.tsv +++ b/crates/metal2vulkan/tests/api_signatures.tsv @@ -1122,6 +1122,7 @@ enum metal2vulkan-air::error::BitcodeError #[derive(Clone, Debug, PartialEq, Eq) enum metal2vulkan-air::error::BitstreamError #[derive(Clone, Debug, PartialEq, Eq)] #[non_exhaustive] pub enum BitstreamError enum metal2vulkan-air::error::BudgetExceeded #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] #[non_exhaustive] pub enum BudgetExceeded enum metal2vulkan-air::error::CanonError #[derive(Clone, Debug, PartialEq, Eq)] #[non_exhaustive] pub enum CanonError +enum metal2vulkan-air::error::ConstantRecord #[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] #[non_exhaustive] pub enum ConstantRecord enum metal2vulkan-air::error::ContainerError #[derive(Clone, Debug, PartialEq, Eq)] #[non_exhaustive] pub enum ContainerError enum metal2vulkan-air::error::Error #[derive(Clone, Debug, PartialEq, Eq)] pub enum Error enum metal2vulkan-air::error::ErrorClass #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] #[non_exhaustive] pub enum ErrorClass @@ -1431,6 +1432,7 @@ enum metal2vulkan::error::BitstreamError #[derive(Clone, Debug, PartialEq, Eq)] enum metal2vulkan::error::BudgetExceeded #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] #[non_exhaustive] pub enum BudgetExceeded enum metal2vulkan::error::CanonError #[derive(Clone, Debug, PartialEq, Eq)] #[non_exhaustive] pub enum CanonError enum metal2vulkan::error::Capability #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] #[non_exhaustive] pub enum Capability +enum metal2vulkan::error::ConstantRecord #[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] #[non_exhaustive] pub enum ConstantRecord enum metal2vulkan::error::ContainerError #[derive(Clone, Debug, PartialEq, Eq)] #[non_exhaustive] pub enum ContainerError enum metal2vulkan::error::DescriptorError #[derive(Clone, Debug, PartialEq, Eq)] #[non_exhaustive] pub enum DescriptorError enum metal2vulkan::error::DriverDeviation #[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] #[non_exhaustive] pub enum DriverDeviation @@ -10327,6 +10329,19 @@ variant metal2vulkan-air::error::BudgetExceeded::Time Time variant metal2vulkan-air::error::CanonError::CallTypeMismatch CallTypeMismatch variant metal2vulkan-air::error::CanonError::StaticInitNotEvaluable StaticInitNotEvaluable variant metal2vulkan-air::error::CanonError::UndefCondition UndefCondition +variant metal2vulkan-air::error::ConstantRecord::BlockAddress BlockAddress +variant metal2vulkan-air::error::ConstantRecord::Byte Byte +variant metal2vulkan-air::error::ConstantRecord::Compare Compare +variant metal2vulkan-air::error::ConstantRecord::DsoLocalEquivalent DsoLocalEquivalent +variant metal2vulkan-air::error::ConstantRecord::ExtractElement ExtractElement +variant metal2vulkan-air::error::ConstantRecord::GepWithInrange GepWithInrange +variant metal2vulkan-air::error::ConstantRecord::InsertElement InsertElement +variant metal2vulkan-air::error::ConstantRecord::NoCfi NoCfi +variant metal2vulkan-air::error::ConstantRecord::PtrAuth PtrAuth +variant metal2vulkan-air::error::ConstantRecord::PtrToAddr PtrToAddr +variant metal2vulkan-air::error::ConstantRecord::Select Select +variant metal2vulkan-air::error::ConstantRecord::ShuffleVector ShuffleVector +variant metal2vulkan-air::error::ConstantRecord::UnaryOp UnaryOp variant metal2vulkan-air::error::ContainerError::BadMagic BadMagic variant metal2vulkan-air::error::ContainerError::BadOffset BadOffset variant metal2vulkan-air::error::ContainerError::BadTag BadTag @@ -10352,7 +10367,7 @@ variant metal2vulkan-air::error::Feature::AddressSpace AddressSpace(u32) variant metal2vulkan-air::error::Feature::Attribute Attribute { kind: u32 } variant metal2vulkan-air::error::Feature::BitcodeRecord BitcodeRecord { block: u32, code: u32 } variant metal2vulkan-air::error::Feature::CallingConvention CallingConvention(u32) -variant metal2vulkan-air::error::Feature::Constant Constant { code: u32 } +variant metal2vulkan-air::error::Feature::Constant Constant { record: ConstantRecord } variant metal2vulkan-air::error::Feature::DirectCall DirectCall variant metal2vulkan-air::error::Feature::DynamicCall DynamicCall variant metal2vulkan-air::error::Feature::FunctionConstantArgument FunctionConstantArgument @@ -13121,6 +13136,19 @@ variant metal2vulkan::error::Capability::Feature Feature(VkFeature) variant metal2vulkan::error::Capability::Format Format { format: vk::Format, usage: FormatUsage } variant metal2vulkan::error::Capability::Limit Limit { limit: VkLimit, required: u64, available: u64 } variant metal2vulkan::error::Capability::Property Property(VkProperty) +variant metal2vulkan::error::ConstantRecord::BlockAddress BlockAddress +variant metal2vulkan::error::ConstantRecord::Byte Byte +variant metal2vulkan::error::ConstantRecord::Compare Compare +variant metal2vulkan::error::ConstantRecord::DsoLocalEquivalent DsoLocalEquivalent +variant metal2vulkan::error::ConstantRecord::ExtractElement ExtractElement +variant metal2vulkan::error::ConstantRecord::GepWithInrange GepWithInrange +variant metal2vulkan::error::ConstantRecord::InsertElement InsertElement +variant metal2vulkan::error::ConstantRecord::NoCfi NoCfi +variant metal2vulkan::error::ConstantRecord::PtrAuth PtrAuth +variant metal2vulkan::error::ConstantRecord::PtrToAddr PtrToAddr +variant metal2vulkan::error::ConstantRecord::Select Select +variant metal2vulkan::error::ConstantRecord::ShuffleVector ShuffleVector +variant metal2vulkan::error::ConstantRecord::UnaryOp UnaryOp variant metal2vulkan::error::ContainerError::BadMagic BadMagic variant metal2vulkan::error::ContainerError::BadOffset BadOffset variant metal2vulkan::error::ContainerError::BadTag BadTag @@ -13229,7 +13257,7 @@ variant metal2vulkan::error::Feature::ClipDistance ClipDistance variant metal2vulkan::error::Feature::CoherentMemory CoherentMemory variant metal2vulkan::error::Feature::ComputeDerivatives ComputeDerivatives variant metal2vulkan::error::Feature::ComputeDerivativesWithSimd ComputeDerivativesWithSimd -variant metal2vulkan::error::Feature::Constant Constant { code: u32 } +variant metal2vulkan::error::Feature::Constant Constant { record: ConstantRecord } variant metal2vulkan::error::Feature::ConstantAlphaBlendFactor ConstantAlphaBlendFactor variant metal2vulkan::error::Feature::ConstantGlobalEscaping ConstantGlobalEscaping variant metal2vulkan::error::Feature::CountingVisibility CountingVisibility diff --git a/crates/metal2vulkan/tests/api_surface.rs b/crates/metal2vulkan/tests/api_surface.rs index 5c219c0e7..99db30227 100644 --- a/crates/metal2vulkan/tests/api_surface.rs +++ b/crates/metal2vulkan/tests/api_surface.rs @@ -204,6 +204,7 @@ surface! { enum LinkProblem N; enum Limit N; enum BudgetExceeded N; + enum ConstantRecord N; struct InternalError N; enum InternalKind N; enum BindError N; diff --git a/docs/REFUSALS.md b/docs/REFUSALS.md index 120cf3a7c..8e3b4a514 100644 --- a/docs/REFUSALS.md +++ b/docs/REFUSALS.md @@ -133,7 +133,7 @@ Columns: | `RasterizationRateMap` | | every device (not implemented) | `ours` | 1: `crates/metal2vulkan/src/lower/fragment/mod.rs (select)` | `rare`: rasterization rate maps | | `GpuEncodedIndirectCommands` | | devices short of a Vulkan feature the site names; devices without buffer device addresses (`addressed_needs`); every device (no Vulkan mechanism); every device (not implemented) | `ours` | 17: `crates/metal2vulkan/src/bind/replay.rs (preprocess)`, `crates/metal2vulkan/src/bind/replay.rs (replay_preprocess_module)` (+11) | `rare`: indirect command buffers encoded by a kernel | | `VulkanVersion` | The device's Vulkan version is below the 1.2 floor | devices without ApiVersion::V1_2 | `device` | 2: `crates/metal2vulkan/src/ash_interop/query.rs (query)`, `crates/metal2vulkan/src/device/derive.rs (with_deviations)` | `none`: a device below Vulkan 1.2 | -| `Constant` | A bitcode constant record outside the typed model (block address, inline asm, `select` and other constant expressions the IR has no form for) | - | `-` | via a helper: 3: `crates/metal2vulkan-air/src/bitcode/constants.rs (record, 2 sites)`, `crates/metal2vulkan/src/error/mod.rs (from)` | `none`: LLVM constant forms AIR does not emit | +| `Constant` | A constants-block record LLVM defines that the typed model has no form for (a block address, a `select` and the other constant expressions of... | - | `-` | via a helper: 3: `crates/metal2vulkan-air/src/bitcode/constants.rs (record, 2 sites)`, `crates/metal2vulkan/src/error/mod.rs (from)` | `none`: LLVM constant forms AIR does not emit | | `Attribute` | An LLVM attribute kind that changes the calling ABI and that AIR does not use (`inalloca`, `preallocated`, `byref`, `nest`, the `swift*` kinds) | - | `-` | via a helper: 2: `crates/metal2vulkan-air/src/bitcode/attrs.rs (known)`, `crates/metal2vulkan/src/error/mod.rs (from)` | `none`: LLVM ABI attributes AIR does not use | | `BitcodeRecord` | A bitcode record LLVM defines in `block` that the typed model does not cover and that has no more specific variant (legacy spellings predating... | - | `-` | via a helper: 7: `crates/metal2vulkan-air/src/bitcode/attrs.rs (decode_lists)`, `crates/metal2vulkan-air/src/bitcode/function.rs (symtab)` (+4) | `none`: bitcode records AIR does not emit | | `SyncScope` | An atomic access or fence in a synchronization scope other than LLVM's built-in `singlethread` and system scopes | - | `-` | via a helper: 2: `crates/metal2vulkan-air/src/bitcode/function.rs (atomic)`, `crates/metal2vulkan/src/error/mod.rs (from)` | `none`: synchronization scopes AIR does not use |