Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to latest nightly #1109

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed 🛠
- [PR#1112](https://github.com/EmbarkStudios/rust-gpu/pull/1112) updated wgpu and winit in example runners
- [PR#1109](https://github.com/EmbarkStudios/rust-gpu/pull/1109) updated toolchain to `nightly-2024-01-08`
- [PR#1100](https://github.com/EmbarkStudios/rust-gpu/pull/1100) updated toolchain to `nightly-2023-09-30`
- [PR#1091](https://github.com/EmbarkStudios/rust-gpu/pull/1091) updated toolchain to `nightly-2023-08-29`
- [PR#1085](https://github.com/EmbarkStudios/rust-gpu/pull/1085) updated toolchain to `nightly-2023-07-08`
Expand Down
4 changes: 2 additions & 2 deletions crates/rustc_codegen_spirv/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ use std::process::{Command, ExitCode};
/// `cargo publish`. We need to figure out a way to do this properly, but let's hardcode it for now :/
//const REQUIRED_RUST_TOOLCHAIN: &str = include_str!("../../rust-toolchain.toml");
const REQUIRED_RUST_TOOLCHAIN: &str = r#"[toolchain]
channel = "nightly-2023-09-30"
channel = "nightly-2024-01-08"
components = ["rust-src", "rustc-dev", "llvm-tools"]
# commit_hash = 8ce4540bd6fe7d58d4bc05f1b137d61937d3cf72"#;
# commit_hash = 75c68cfd2b9870f2953b62d250bd7d0564a7b56d"#;

fn get_rustc_commit_hash() -> Result<String, Box<dyn Error>> {
let rustc = std::env::var("RUSTC").unwrap_or_else(|_| String::from("rustc"));
Expand Down
41 changes: 23 additions & 18 deletions crates/rustc_codegen_spirv/src/abi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use rustc_middle::query::Providers;
use rustc_middle::ty::layout::{FnAbiOf, LayoutOf, TyAndLayout};
use rustc_middle::ty::GenericArgsRef;
use rustc_middle::ty::{
self, Const, FloatTy, GeneratorArgs, IntTy, ParamEnv, PolyFnSig, Ty, TyCtxt, TyKind,
self, Const, CoroutineArgs, FloatTy, IntTy, ParamEnv, PolyFnSig, Ty, TyCtxt, TyKind,
TypeAndMut, UintTy,
};
use rustc_middle::{bug, span_bug};
Expand Down Expand Up @@ -64,6 +64,9 @@ pub(crate) fn provide(providers: &mut Providers) {
) -> &'tcx FnAbi<'tcx, Ty<'tcx>> {
let readjust_arg_abi = |arg: &ArgAbi<'tcx, Ty<'tcx>>| {
let mut arg = ArgAbi::new(&tcx, arg.layout, |_, _, _| ArgAttributes::new());
// FIXME: this is bad! https://github.com/rust-lang/rust/issues/115666
// <https://github.com/rust-lang/rust/commit/eaaa03faf77b157907894a4207d8378ecaec7b45>
arg.make_direct_deprecated();

// Avoid pointlessly passing ZSTs, just like the official Rust ABI.
if arg.layout.is_zst() {
Expand Down Expand Up @@ -96,7 +99,9 @@ pub(crate) fn provide(providers: &mut Providers) {

// FIXME(eddyb) remove this by deriving `Clone` for `LayoutS` upstream.
// FIXME(eddyb) the `S` suffix is a naming antipattern, rename upstream.
fn clone_layout(layout: &LayoutS) -> LayoutS {
fn clone_layout<FieldIdx: Idx, VariantIdx: Idx>(
layout: &LayoutS<FieldIdx, VariantIdx>,
) -> LayoutS<FieldIdx, VariantIdx> {
let LayoutS {
ref fields,
ref variants,
Expand Down Expand Up @@ -575,7 +580,7 @@ fn dig_scalar_pointee<'tcx>(
let new_pointee = dig_scalar_pointee(cx, field, offset - field_offset);
match pointee {
Some(old_pointee) if old_pointee != new_pointee => {
cx.tcx.sess.fatal(format!(
cx.tcx.dcx().fatal(format!(
"dig_scalar_pointee: unsupported Pointer with different \
pointee types ({old_pointee:?} vs {new_pointee:?}) at offset {offset:?} in {layout:#?}"
));
Expand Down Expand Up @@ -723,7 +728,7 @@ fn trans_struct<'tcx>(cx: &CodegenCx<'tcx>, span: Span, ty: TyAndLayout<'tcx>) -
if i == 0 {
field_names.push(cx.sym.discriminant);
} else {
cx.tcx.sess.fatal("Variants::Multiple has multiple fields")
cx.tcx.dcx().fatal("Variants::Multiple has multiple fields")
}
};
}
Expand All @@ -744,7 +749,7 @@ fn trans_struct<'tcx>(cx: &CodegenCx<'tcx>, span: Span, ty: TyAndLayout<'tcx>) -
fn def_id_for_spirv_type_adt(layout: TyAndLayout<'_>) -> Option<DefId> {
match *layout.ty.kind() {
TyKind::Adt(def, _) => Some(def.did()),
TyKind::Foreign(def_id) | TyKind::Closure(def_id, _) | TyKind::Generator(def_id, ..) => {
TyKind::Foreign(def_id) | TyKind::Closure(def_id, _) | TyKind::Coroutine(def_id, ..) => {
Some(def_id)
}
_ => None,
Expand Down Expand Up @@ -779,8 +784,8 @@ impl fmt::Display for TyLayoutNameKey<'_> {
write!(f, "::{}", def.variants()[index].name)?;
}
}
if let (TyKind::Generator(_, _, _), Some(index)) = (self.ty.kind(), self.variant) {
write!(f, "::{}", GeneratorArgs::variant_name(index))?;
if let (TyKind::Coroutine(_, _), Some(index)) = (self.ty.kind(), self.variant) {
write!(f, "::{}", CoroutineArgs::variant_name(index))?;
}
Ok(())
}
Expand All @@ -799,7 +804,7 @@ fn trans_intrinsic_type<'tcx>(
if ty.size != Size::from_bytes(4) {
return Err(cx
.tcx
.sess
.dcx()
.err("#[spirv(generic_image)] type must have size 4"));
}

Expand Down Expand Up @@ -843,7 +848,7 @@ fn trans_intrinsic_type<'tcx>(
_ => {
return Err(cx
.tcx
.sess
.dcx()
.span_err(span, "Invalid sampled type to `Image`."));
}
};
Expand All @@ -866,7 +871,7 @@ fn trans_intrinsic_type<'tcx>(
Some(v) => Ok(v),
None => Err(cx
.tcx
.sess
.dcx()
.err(format!("Invalid value for Image const generic: {value}"))),
}
}
Expand All @@ -892,7 +897,7 @@ fn trans_intrinsic_type<'tcx>(
IntrinsicType::Sampler => {
// see SpirvType::sizeof
if ty.size != Size::from_bytes(4) {
return Err(cx.tcx.sess.err("#[spirv(sampler)] type must have size 4"));
return Err(cx.tcx.dcx().err("#[spirv(sampler)] type must have size 4"));
}
Ok(SpirvType::Sampler.def(span, cx))
}
Expand All @@ -905,7 +910,7 @@ fn trans_intrinsic_type<'tcx>(
if ty.size != Size::from_bytes(4) {
return Err(cx
.tcx
.sess
.dcx()
.err("#[spirv(sampled_image)] type must have size 4"));
}

Expand All @@ -918,15 +923,15 @@ fn trans_intrinsic_type<'tcx>(
} else {
Err(cx
.tcx
.sess
.dcx()
.err("#[spirv(sampled_image)] type must have a generic image type"))
}
}
IntrinsicType::RuntimeArray => {
if ty.size != Size::from_bytes(4) {
return Err(cx
.tcx
.sess
.dcx()
.err("#[spirv(runtime_array)] type must have size 4"));
}

Expand All @@ -938,7 +943,7 @@ fn trans_intrinsic_type<'tcx>(
} else {
Err(cx
.tcx
.sess
.dcx()
.err("#[spirv(runtime_array)] type must have a generic element type"))
}
}
Expand All @@ -953,12 +958,12 @@ fn trans_intrinsic_type<'tcx>(
if field_types.len() < 2 {
return Err(cx
.tcx
.sess
.dcx()
.span_err(span, "#[spirv(matrix)] type must have at least two fields"));
}
let elem_type = field_types[0];
if !field_types.iter().all(|&ty| ty == elem_type) {
return Err(cx.tcx.sess.span_err(
return Err(cx.tcx.dcx().span_err(
span,
"#[spirv(matrix)] type fields must all be the same type",
));
Expand All @@ -968,7 +973,7 @@ fn trans_intrinsic_type<'tcx>(
ty => {
return Err(cx
.tcx
.sess
.dcx()
.struct_span_err(span, "#[spirv(matrix)] type fields must all be vectors")
.note(format!("field type is {}", ty.debug(elem_type, cx)))
.emit());
Expand Down
20 changes: 10 additions & 10 deletions crates/rustc_codegen_spirv/src/attr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,13 +148,13 @@ impl AggregatedSpirvAttributes {
pub fn parse<'tcx>(cx: &CodegenCx<'tcx>, attrs: &'tcx [Attribute]) -> Self {
let mut aggregated_attrs = Self::default();

// NOTE(eddyb) `delay_span_bug` ensures that if attribute checking fails
// NOTE(eddyb) `span_delayed_bug` ensures that if attribute checking fails
// to see an attribute error, it will cause an ICE instead.
for parse_attr_result in crate::symbols::parse_attrs_for_checking(&cx.sym, attrs) {
let (span, parsed_attr) = match parse_attr_result {
Ok(span_and_parsed_attr) => span_and_parsed_attr,
Err((span, msg)) => {
cx.tcx.sess.delay_span_bug(span, msg);
cx.tcx.dcx().span_delayed_bug(span, msg);
continue;
}
};
Expand All @@ -165,8 +165,8 @@ impl AggregatedSpirvAttributes {
category,
}) => {
cx.tcx
.sess
.delay_span_bug(span, format!("multiple {category} attributes"));
.dcx()
.span_delayed_bug(span, format!("multiple {category} attributes"));
}
}
}
Expand Down Expand Up @@ -278,7 +278,7 @@ impl CheckSpirvAttrVisitor<'_> {
let (span, parsed_attr) = match parse_attr_result {
Ok(span_and_parsed_attr) => span_and_parsed_attr,
Err((span, msg)) => {
self.tcx.sess.span_err(span, msg);
self.tcx.dcx().span_err(span, msg);
continue;
}
};
Expand Down Expand Up @@ -323,7 +323,7 @@ impl CheckSpirvAttrVisitor<'_> {
.filter_map(|r| r.ok())
.any(|(_, attr)| matches!(attr, SpirvAttribute::Entry(_)));
if !parent_is_entry_point {
self.tcx.sess.span_err(
self.tcx.dcx().span_err(
span,
"attribute is only valid on a parameter of an entry-point function",
);
Expand All @@ -346,7 +346,7 @@ impl CheckSpirvAttrVisitor<'_> {
};

if let Err(msg) = valid {
self.tcx.sess.span_err(
self.tcx.dcx().span_err(
span,
format!("`{storage_class:?}` storage class {msg}"),
);
Expand All @@ -367,7 +367,7 @@ impl CheckSpirvAttrVisitor<'_> {
};
match valid_target {
Err(Expected(expected_target)) => {
self.tcx.sess.span_err(
self.tcx.dcx().span_err(
span,
format!(
"attribute is only valid on a {expected_target}, not on a {target}"
Expand All @@ -381,7 +381,7 @@ impl CheckSpirvAttrVisitor<'_> {
category,
}) => {
self.tcx
.sess
.dcx()
.struct_span_err(
span,
format!("only one {category} attribute is allowed on a {target}"),
Expand All @@ -397,7 +397,7 @@ impl CheckSpirvAttrVisitor<'_> {
// so we can perform further checks, emit warnings, etc.

if let Some(block_attr) = aggregated_attrs.block {
self.tcx.sess.span_warn(
self.tcx.dcx().span_warn(
block_attr.span,
"#[spirv(block)] is no longer needed and should be removed",
);
Expand Down
13 changes: 9 additions & 4 deletions crates/rustc_codegen_spirv/src/builder/builder_methods.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2282,7 +2282,7 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
order: AtomicOrdering,
failure_order: AtomicOrdering,
_weak: bool,
) -> Self::Value {
) -> (Self::Value, Self::Value) {
assert_ty_eq!(self, cmp.ty, src.ty);
let ty = src.ty;

Expand Down Expand Up @@ -2310,7 +2310,12 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
)
.unwrap()
.with_type(access_ty);
self.bitcast(result, ty)
let result = self.bitcast(result, ty);

let val = self.extract_value(result, 0);
let success = self.extract_value(result, 1);

(val, success)
}

fn atomic_rmw(
Expand Down Expand Up @@ -2987,7 +2992,7 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {

Err(FormatArgsNotRecognized(step)) => {
if let Some(current_span) = self.current_span {
let mut warn = self.tcx.sess.struct_span_warn(
let mut warn = self.tcx.dcx().struct_span_warn(
current_span,
"failed to find and remove `format_args!` construction for this `panic!`",
);
Expand Down Expand Up @@ -3037,7 +3042,7 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
self.intcast(val, dest_ty, false)
}

fn do_not_inline(&mut self, _llret: Self::Value) {
fn apply_attrs_to_cleanup_callsite(&mut self, _llret: Self::Value) {
// Ignore
}
}
2 changes: 1 addition & 1 deletion crates/rustc_codegen_spirv/src/builder/intrinsics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ use rustc_codegen_ssa::traits::{BuilderMethods, IntrinsicCallMethods};
use rustc_middle::bug;
use rustc_middle::ty::layout::LayoutOf;
use rustc_middle::ty::{FnDef, Instance, ParamEnv, Ty, TyKind};
use rustc_span::source_map::Span;
use rustc_span::sym;
use rustc_span::Span;
use rustc_target::abi::call::{FnAbi, PassMode};
use std::assert_matches::assert_matches;

Expand Down
21 changes: 9 additions & 12 deletions crates/rustc_codegen_spirv/src/builder/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use rustc_codegen_ssa::traits::{
AbiBuilderMethods, ArgAbiMethods, BackendTypes, BuilderMethods, CoverageInfoBuilderMethods,
DebugInfoBuilderMethods, HasCodegen, StaticBuilderMethods, TypeMembershipMethods,
};
use rustc_errors::{DiagnosticBuilder, DiagnosticMessage, ErrorGuaranteed};
use rustc_errors::{DiagnosticBuilder, DiagnosticMessage};
use rustc_middle::mir::Coverage;
use rustc_middle::span_bug;
use rustc_middle::ty::layout::{
Expand All @@ -29,7 +29,7 @@ use rustc_middle::ty::layout::{
};
use rustc_middle::ty::{Instance, ParamEnv, Ty, TyCtxt};
use rustc_span::def_id::DefId;
use rustc_span::source_map::Span;
use rustc_span::Span;
use rustc_target::abi::call::{ArgAbi, FnAbi, PassMode};
use rustc_target::abi::{HasDataLayout, Size, TargetDataLayout};
use rustc_target::spec::{HasTargetSpec, Target};
Expand Down Expand Up @@ -69,32 +69,29 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
}

#[track_caller]
pub fn struct_err(
&self,
msg: impl Into<DiagnosticMessage>,
) -> DiagnosticBuilder<'_, ErrorGuaranteed> {
pub fn struct_err(&self, msg: impl Into<DiagnosticMessage>) -> DiagnosticBuilder<'_> {
if let Some(current_span) = self.current_span {
self.tcx.sess.struct_span_err(current_span, msg)
self.tcx.dcx().struct_span_err(current_span, msg)
} else {
self.tcx.sess.struct_err(msg)
self.tcx.dcx().struct_err(msg)
}
}

#[track_caller]
pub fn err(&self, msg: impl Into<DiagnosticMessage>) {
if let Some(current_span) = self.current_span {
self.tcx.sess.span_err(current_span, msg);
self.tcx.dcx().span_err(current_span, msg);
} else {
self.tcx.sess.err(msg);
self.tcx.dcx().err(msg);
}
}

#[track_caller]
pub fn fatal(&self, msg: impl Into<DiagnosticMessage>) -> ! {
if let Some(current_span) = self.current_span {
self.tcx.sess.span_fatal(current_span, msg)
self.tcx.dcx().span_fatal(current_span, msg)
} else {
self.tcx.sess.fatal(msg)
self.tcx.dcx().fatal(msg)
}
}

Expand Down
Loading
Loading