Skip to content

Commit 15e705a

Browse files
committed
upgrade from rspirv 0.12 to 0.13
1 parent c904e5c commit 15e705a

18 files changed

Lines changed: 742 additions & 517 deletions

Cargo.lock

Lines changed: 670 additions & 462 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/rustc_codegen_spirv/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ thorin-dwp = "0.9.0"
4949
ar = "0.9.0"
5050
either = "1.8.0"
5151
indexmap = "2.6.0"
52-
rspirv = "0.12"
52+
rspirv = "0.13"
5353
rustc_codegen_spirv-types.workspace = true
5454
spirv-std-types = { workspace = true, features = ["std"] }
5555
rustc-demangle = "0.1.21"

crates/rustc_codegen_spirv/src/builder/builder_methods.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
341341
fn ordering_to_semantics_def(&mut self, ordering: AtomicOrdering) -> SpirvValue {
342342
let mut invalid_seq_cst = false;
343343
let semantics = match ordering {
344-
AtomicOrdering::Relaxed => MemorySemantics::NONE,
344+
AtomicOrdering::Relaxed => MemorySemantics::RELAXED,
345345
AtomicOrdering::Acquire => MemorySemantics::MAKE_VISIBLE | MemorySemantics::ACQUIRE,
346346
AtomicOrdering::Release => MemorySemantics::MAKE_AVAILABLE | MemorySemantics::RELEASE,
347347
AtomicOrdering::AcqRel => {

crates/rustc_codegen_spirv/src/builder/byte_addressable_buffer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use crate::builder_spirv::{SpirvValue, SpirvValueExt, SpirvValueKind};
66
use crate::spirv_type::SpirvType;
77
use rspirv::spirv::{Decoration, Word};
88
use rustc_abi::{Align, Size};
9-
use rustc_codegen_spirv_types::Capability;
9+
use rspirv::spirv::Capability;
1010
use rustc_codegen_ssa::traits::BuilderMethods;
1111
use rustc_errors::ErrorGuaranteed;
1212
use rustc_middle::ty::Ty;

crates/rustc_codegen_spirv/src/builder/ext_inst.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use super::Builder;
22
use crate::builder_spirv::{SpirvValue, SpirvValueExt};
33
use crate::custom_insts;
44
use rspirv::dr::Operand;
5-
use rspirv::spirv::{GLOp, Word};
5+
use rspirv::spirv::{GlslStd450Op as GLOp, Word};
66

77
const GLSL_STD_450: &str = "GLSL.std.450";
88

crates/rustc_codegen_spirv/src/builder/intrinsics.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use crate::codegen_cx::CodegenCx;
88
use crate::custom_insts::CustomInst;
99
use crate::spirv_type::SpirvType;
1010
use rspirv::dr::Operand;
11-
use rspirv::spirv::GLOp;
11+
use rspirv::spirv::GlslStd450Op as GLOp;
1212
use rustc_codegen_ssa::mir::operand::{OperandRef, OperandValue};
1313
use rustc_codegen_ssa::mir::place::PlaceRef;
1414
use rustc_codegen_ssa::traits::{BuilderMethods, IntrinsicCallBuilderMethods};

crates/rustc_codegen_spirv/src/builder/libm_intrinsics.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use crate::maybe_pqp_cg_ssa as rustc_codegen_ssa;
33

44
use super::Builder;
55
use crate::builder_spirv::{SpirvValue, SpirvValueExt};
6-
use rspirv::spirv::{GLOp, Word};
6+
use rspirv::spirv::{GlslStd450Op as GLOp, Word};
77
use rustc_codegen_ssa::traits::BuilderMethods;
88

99
#[derive(Copy, Clone, Debug)]

crates/rustc_codegen_spirv/src/builder/spirv_asm.rs

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ pub struct InstructionTable {
3232

3333
impl InstructionTable {
3434
pub fn new() -> Self {
35-
let table = rspirv::grammar::CoreInstructionTable::iter()
35+
let table = rspirv::grammar::INSTRUCTION_TABLE.iter()
3636
.map(|inst| (inst.opname, inst))
3737
.collect();
3838
Self { table }
@@ -1537,6 +1537,9 @@ impl<'cx, 'tcx> Builder<'cx, 'tcx> {
15371537
Ok(x) => inst.operands.push(dr::Operand::StoreCacheControl(x)),
15381538
Err(()) => self.err(format!("unknown StoreCacheControl {word}")),
15391539
},
1540+
(kind, Some(_)) => {
1541+
self.err(format!("unsupported operand kind {kind:?}"));
1542+
}
15401543
(kind, None) => match token {
15411544
Token::Word(_) => bug!(),
15421545
Token::String(_) => {
@@ -1573,14 +1576,14 @@ pub const IMAGE_OPERANDS: &[(&str, ImageOperands)] = &[
15731576
("MakeTexelAvailable", ImageOperands::MAKE_TEXEL_AVAILABLE),
15741577
(
15751578
"MakeTexelAvailableKHR",
1576-
ImageOperands::MAKE_TEXEL_AVAILABLE_KHR,
1579+
ImageOperands::MAKE_TEXEL_AVAILABLE,
15771580
),
15781581
("MakeTexelVisible", ImageOperands::MAKE_TEXEL_VISIBLE),
1579-
("MakeTexelVisibleKHR", ImageOperands::MAKE_TEXEL_VISIBLE_KHR),
1582+
("MakeTexelVisibleKHR", ImageOperands::MAKE_TEXEL_VISIBLE),
15801583
("NonPrivateTexel", ImageOperands::NON_PRIVATE_TEXEL),
1581-
("NonPrivateTexelKHR", ImageOperands::NON_PRIVATE_TEXEL_KHR),
1584+
("NonPrivateTexelKHR", ImageOperands::NON_PRIVATE_TEXEL),
15821585
("VolatileTexel", ImageOperands::VOLATILE_TEXEL),
1583-
("VolatileTexelKHR", ImageOperands::VOLATILE_TEXEL_KHR),
1586+
("VolatileTexelKHR", ImageOperands::VOLATILE_TEXEL),
15841587
("SignExtend", ImageOperands::SIGN_EXTEND),
15851588
("ZeroExtend", ImageOperands::ZERO_EXTEND),
15861589
];
@@ -1618,7 +1621,7 @@ pub const FUNCTION_CONTROL: &[(&str, FunctionControl)] = &[
16181621
];
16191622
pub const MEMORY_SEMANTICS: &[(&str, MemorySemantics)] = &[
16201623
("Relaxed", MemorySemantics::RELAXED),
1621-
("None", MemorySemantics::NONE),
1624+
("None", MemorySemantics::RELAXED),
16221625
("Acquire", MemorySemantics::ACQUIRE),
16231626
("Release", MemorySemantics::RELEASE),
16241627
("AcquireRelease", MemorySemantics::ACQUIRE_RELEASE),
@@ -1639,11 +1642,11 @@ pub const MEMORY_SEMANTICS: &[(&str, MemorySemantics)] = &[
16391642
),
16401643
("ImageMemory", MemorySemantics::IMAGE_MEMORY),
16411644
("OutputMemory", MemorySemantics::OUTPUT_MEMORY),
1642-
("OutputMemoryKHR", MemorySemantics::OUTPUT_MEMORY_KHR),
1645+
("OutputMemoryKHR", MemorySemantics::OUTPUT_MEMORY),
16431646
("MakeAvailable", MemorySemantics::MAKE_AVAILABLE),
1644-
("MakeAvailableKHR", MemorySemantics::MAKE_AVAILABLE_KHR),
1647+
("MakeAvailableKHR", MemorySemantics::MAKE_AVAILABLE),
16451648
("MakeVisible", MemorySemantics::MAKE_VISIBLE),
1646-
("MakeVisibleKHR", MemorySemantics::MAKE_VISIBLE_KHR),
1649+
("MakeVisibleKHR", MemorySemantics::MAKE_VISIBLE),
16471650
("Volatile", MemorySemantics::VOLATILE),
16481651
];
16491652
pub const MEMORY_ACCESS: &[(&str, MemoryAccess)] = &[
@@ -1654,17 +1657,17 @@ pub const MEMORY_ACCESS: &[(&str, MemoryAccess)] = &[
16541657
("MakePointerAvailable", MemoryAccess::MAKE_POINTER_AVAILABLE),
16551658
(
16561659
"MakePointerAvailableKHR",
1657-
MemoryAccess::MAKE_POINTER_AVAILABLE_KHR,
1660+
MemoryAccess::MAKE_POINTER_AVAILABLE,
16581661
),
16591662
("MakePointerVisible", MemoryAccess::MAKE_POINTER_VISIBLE),
16601663
(
16611664
"MakePointerVisibleKHR",
1662-
MemoryAccess::MAKE_POINTER_VISIBLE_KHR,
1665+
MemoryAccess::MAKE_POINTER_VISIBLE,
16631666
),
16641667
("NonPrivatePointer", MemoryAccess::NON_PRIVATE_POINTER),
16651668
(
16661669
"NonPrivatePointerKHR",
1667-
MemoryAccess::NON_PRIVATE_POINTER_KHR,
1670+
MemoryAccess::NON_PRIVATE_POINTER,
16681671
),
16691672
];
16701673
pub const KERNEL_PROFILING_INFO: &[(&str, KernelProfilingInfo)] = &[

crates/rustc_codegen_spirv/src/linker/inline.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -343,8 +343,8 @@ impl LegalGlobal {
343343
let global = match inst.class.opcode {
344344
Op::TypePointer => Self::TypePointer(inst.operands[0].unwrap_storage_class()),
345345
Op::Variable => Self::Variable,
346-
op if rspirv::grammar::reflect::is_type(op) => Self::TypeNonPointer,
347-
op if rspirv::grammar::reflect::is_constant(op) => Self::Const,
346+
op if op.is_type() => Self::TypeNonPointer,
347+
op if op.is_constant() => Self::Const,
348348

349349
// FIXME(eddyb) should this be `unreachable!()`?
350350
_ => continue,

crates/rustc_codegen_spirv/src/linker/simple_passes.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
use super::{get_name, get_names};
22
use rspirv::dr::{Block, Function, Module};
33
use rspirv::spirv::{Decoration, ExecutionModel, Op, Word};
4-
use rustc_codegen_spirv_types::Capability;
54
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
65
use rustc_session::Session;
76
use std::iter::once;
@@ -355,7 +354,7 @@ pub fn remove_unused_type_capabilities(module: &mut Module) {
355354
pub fn remove_non_uniform_decorations(_sess: &Session, module: &mut Module) -> super::Result<()> {
356355
let has_shader_non_uniform_capability = module.capabilities.iter().any(|inst| {
357356
inst.class.opcode == Op::Capability
358-
&& inst.operands[0].unwrap_capability() == Capability::ShaderNonUniform
357+
&& inst.operands[0].unwrap_capability() == rspirv::spirv::Capability::ShaderNonUniform
359358
});
360359
if !has_shader_non_uniform_capability {
361360
module.annotations.retain(|inst| {

0 commit comments

Comments
 (0)