Skip to content

Commit c3b732d

Browse files
committed
Update to nightly-2024-05-20.
1 parent 666f1fc commit c3b732d

File tree

14 files changed

+46
-21
lines changed

14 files changed

+46
-21
lines changed

crates/rustc_codegen_spirv/build.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ use std::process::{Command, ExitCode};
1010
/// `cargo publish`. We need to figure out a way to do this properly, but let's hardcode it for now :/
1111
//const REQUIRED_RUST_TOOLCHAIN: &str = include_str!("../../rust-toolchain.toml");
1212
const REQUIRED_RUST_TOOLCHAIN: &str = r#"[toolchain]
13-
channel = "nightly-2024-04-24"
13+
channel = "nightly-2024-05-20"
1414
components = ["rust-src", "rustc-dev", "llvm-tools"]
15-
# commit_hash = 244da22fabd9fa677bbd0ac601a88e5ca6917526"#;
15+
# commit_hash = d84b9037541f45dc2c52a41d723265af211c0497"#;
1616

1717
fn get_rustc_commit_hash() -> Result<String, Box<dyn Error>> {
1818
let rustc = std::env::var("RUSTC").unwrap_or_else(|_| String::from("rustc"));

crates/rustc_codegen_spirv/src/abi.rs

+6-5
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ use rustc_span::DUMMY_SP;
2020
use rustc_span::{Span, Symbol};
2121
use rustc_target::abi::call::{ArgAbi, ArgAttributes, FnAbi, PassMode};
2222
use rustc_target::abi::{
23-
Abi, Align, FieldsShape, LayoutS, Primitive, Scalar, Size, TagEncoding, VariantIdx, Variants,
23+
Abi, Align, FieldsShape, Float, LayoutS, Primitive, Scalar, Size, TagEncoding, VariantIdx,
24+
Variants,
2425
};
2526
use rustc_target::spec::abi::Abi as SpecAbi;
2627
use std::cell::RefCell;
@@ -504,10 +505,10 @@ fn trans_scalar<'tcx>(
504505
Primitive::Int(width, signedness) => {
505506
SpirvType::Integer(width.size().bits() as u32, signedness).def(span, cx)
506507
}
507-
Primitive::F16 => SpirvType::Float(16).def(span, cx),
508-
Primitive::F32 => SpirvType::Float(32).def(span, cx),
509-
Primitive::F64 => SpirvType::Float(64).def(span, cx),
510-
Primitive::F128 => SpirvType::Float(128).def(span, cx),
508+
Primitive::Float(Float::F16) => SpirvType::Float(16).def(span, cx),
509+
Primitive::Float(Float::F32) => SpirvType::Float(32).def(span, cx),
510+
Primitive::Float(Float::F64) => SpirvType::Float(64).def(span, cx),
511+
Primitive::Float(Float::F128) => SpirvType::Float(128).def(span, cx),
511512
Primitive::Pointer(_) => {
512513
let pointee_ty = dig_scalar_pointee(cx, ty, offset);
513514
// Pointers can be recursive. So, record what we're currently translating, and if we're already translating

crates/rustc_codegen_spirv/src/builder/builder_methods.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
337337
let exit_bb = self.append_sibling_block("memset_exit");
338338

339339
let count = self.udiv(size_bytes, size_elem_const);
340-
let index = self.alloca(count.ty, zero_align);
340+
let index = self.alloca(Size::from_bytes(size_bytes.ty), zero_align);
341341
self.store(zero, index, zero_align);
342342
self.br(header_bb);
343343

@@ -1413,8 +1413,8 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
14131413
val
14141414
}
14151415

1416-
fn alloca(&mut self, ty: Self::Type, _align: Align) -> Self::Value {
1417-
let ptr_ty = self.type_ptr_to(ty);
1416+
fn alloca(&mut self, ty: Size, _align: Align) -> Self::Value {
1417+
let ptr_ty = self.type_ptr_to(ty.bits_usize() as u32);
14181418
// "All OpVariable instructions in a function must be the first instructions in the first block."
14191419
let mut builder = self.emit();
14201420
builder.select_block(Some(0)).unwrap();
@@ -1446,7 +1446,7 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
14461446
result_id.with_type(ptr_ty)
14471447
}
14481448

1449-
fn byte_array_alloca(&mut self, _len: Self::Value, _align: Align) -> Self::Value {
1449+
fn dynamic_alloca(&mut self, _size: Self::Value, _align: Align) -> Self::Value {
14501450
self.fatal("array alloca not supported yet")
14511451
}
14521452

crates/rustc_codegen_spirv/src/codegen_cx/constant.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use rustc_middle::bug;
88
use rustc_middle::mir::interpret::{alloc_range, ConstAllocation, GlobalAlloc, Scalar};
99
use rustc_middle::ty::layout::LayoutOf;
1010
use rustc_span::{Span, DUMMY_SP};
11-
use rustc_target::abi::{self, AddressSpace, HasDataLayout, Integer, Primitive, Size};
11+
use rustc_target::abi::{self, AddressSpace, Float, HasDataLayout, Integer, Primitive, Size};
1212

1313
impl<'tcx> CodegenCx<'tcx> {
1414
pub fn def_constant(&self, ty: Word, val: SpirvConst<'_, 'tcx>) -> SpirvValue {
@@ -273,21 +273,21 @@ impl<'tcx> ConstMethods<'tcx> for CodegenCx<'tcx> {
273273
other.debug(ty, self)
274274
)),
275275
},
276-
Primitive::F16 => self
276+
Primitive::Float(Float::F16) => self
277277
.tcx
278278
.dcx()
279279
.fatal("scalar_to_backend Primitive::F16 not supported"),
280-
Primitive::F32 => {
280+
Primitive::Float(Float::F32) => {
281281
let res = self.constant_f32(DUMMY_SP, f32::from_bits(data as u32));
282282
assert_eq!(res.ty, ty);
283283
res
284284
}
285-
Primitive::F64 => {
285+
Primitive::Float(Float::F64) => {
286286
let res = self.constant_f64(DUMMY_SP, f64::from_bits(data as u64));
287287
assert_eq!(res.ty, ty);
288288
res
289289
}
290-
Primitive::F128 => self
290+
Primitive::Float(Float::F128) => self
291291
.tcx
292292
.dcx()
293293
.fatal("scalar_to_backend Primitive::F128 not supported"),
@@ -488,8 +488,8 @@ impl<'tcx> CodegenCx<'tcx> {
488488
Primitive::Int(integer, int_signedness)
489489
}
490490
SpirvType::Float(float_size) => match float_size {
491-
32 => Primitive::F32,
492-
64 => Primitive::F64,
491+
32 => Primitive::Float(Float::F32),
492+
64 => Primitive::Float(Float::F64),
493493
other => {
494494
self.tcx
495495
.dcx()

examples/runners/ash/Cargo.toml

+3
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,8 @@ cfg-if = "1.0.0"
2323
shared = { path = "../../shaders/shared" }
2424
spirv-builder = { workspace = true, default-features = false }
2525

26+
[lints.rust]
27+
unexpected_cfgs = { level = "allow", check-cfg = ['cfg(target_arch, values("spirv"))'] }
28+
2629
[target.'cfg(target_os = "macos")'.dependencies]
2730
ash-molten = { version = "0.13.1", features = ["pre-built"] }

examples/runners/wgpu/Cargo.toml

+3
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ clap = { version = "4", features = ["derive"] }
2727
strum = { version = "0.25.0", default-features = false, features = ["std", "derive"] }
2828
bytemuck = "1.6.3"
2929

30+
[lints.rust]
31+
unexpected_cfgs = { level = "allow", check-cfg = ['cfg(target_arch, values("spirv"))'] }
32+
3033
[target.'cfg(not(any(target_os = "android", target_arch = "wasm32")))'.dependencies]
3134
env_logger = "0.11.0"
3235
spirv-builder = { workspace = true, features = ["watch"] }

examples/shaders/compute-shader/Cargo.toml

+3
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,8 @@ crate-type = ["dylib", "lib"]
1313
[dependencies]
1414
spirv-std = { workspace = true }
1515

16+
[lints.rust]
17+
unexpected_cfgs = { level = "allow", check-cfg = ['cfg(target_arch, values("spirv"))'] }
18+
1619
[target.'cfg(not(target_arch = "spirv"))'.dependencies]
1720
rayon = "1.5"

examples/shaders/compute-shader/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#![cfg_attr(target_arch = "spirv", no_std)]
22
// HACK(eddyb) can't easily see warnings otherwise from `spirv-builder` builds.
3-
#![deny(warnings)]
3+
//#![deny(warnings)]
44

55
use glam::UVec3;
66
use spirv_std::{glam, spirv};

examples/shaders/mouse-shader/Cargo.toml

+3
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,6 @@ crate-type = ["dylib"]
1313
[dependencies]
1414
shared = { path = "../../shaders/shared" }
1515
spirv-std = { workspace = true }
16+
17+
[lints.rust]
18+
unexpected_cfgs = { level = "allow", check-cfg = ['cfg(target_arch, values("spirv"))'] }

examples/shaders/reduce/Cargo.toml

+3
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,6 @@ crate-type = ["dylib", "lib"]
1212

1313
[dependencies]
1414
spirv-std = { workspace = true }
15+
16+
[lints.rust]
17+
unexpected_cfgs = { level = "allow", check-cfg = ['cfg(target_arch, values("spirv"))'] }

examples/shaders/shared/Cargo.toml

+3
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,6 @@ repository.workspace = true
1010
[dependencies]
1111
spirv-std = { workspace = true }
1212
bytemuck = { version = "1.18.0", features = ["derive"] }
13+
14+
[lints.rust]
15+
unexpected_cfgs = { level = "allow", check-cfg = ['cfg(target_arch, values("spirv"))'] }

examples/shaders/simplest-shader/Cargo.toml

+3
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,6 @@ crate-type = ["dylib"]
1313
[dependencies]
1414
spirv-std = { workspace = true }
1515
shared = { path = "../shared" }
16+
17+
[lints.rust]
18+
unexpected_cfgs = { level = "allow", check-cfg = ['cfg(target_arch, values("spirv"))'] }

examples/shaders/sky-shader/Cargo.toml

+3
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,6 @@ crate-type = ["lib", "dylib"]
1313
[dependencies]
1414
shared = { path = "../../shaders/shared" }
1515
spirv-std = { workspace = true }
16+
17+
[lints.rust]
18+
unexpected_cfgs = { level = "allow", check-cfg = ['cfg(target_arch, values("spirv"))'] }

rust-toolchain.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[toolchain]
2-
channel = "nightly-2024-04-24"
2+
channel = "nightly-2024-05-20"
33
components = ["rust-src", "rustc-dev", "llvm-tools"]
4-
# commit_hash = 244da22fabd9fa677bbd0ac601a88e5ca6917526
4+
# commit_hash = d84b9037541f45dc2c52a41d723265af211c0497
55

66
# Whenever changing the nightly channel, update the commit hash above, and make
77
# sure to change `REQUIRED_TOOLCHAIN` in `crates/rustc_codegen_spirv/build.rs` also.

0 commit comments

Comments
 (0)