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

rustup: update to nightly-2023-07-08. #1085

Merged
merged 2 commits into from
Aug 1, 2023
Merged
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
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Changed 🛠
- [PR#1085](https://github.com/EmbarkStudios/rust-gpu/pull/1085) updated toolchain to `nightly-2023-07-08`

## [0.9.0]

### Added ⭐
Expand Down
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

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-05-27"
channel = "nightly-2023-07-08"
components = ["rust-src", "rustc-dev", "llvm-tools-preview"]
# commit_hash = 1a5f8bce74ee432f7cc3aa131bc3d6920e06de10"#;
# commit_hash = cb80ff132a0e9aa71529b701427e4e6c243b58df"#;

fn get_rustc_commit_hash() -> Result<String, Box<dyn Error>> {
let rustc = std::env::var("RUSTC").unwrap_or_else(|_| String::from("rustc"));
Expand Down
82 changes: 38 additions & 44 deletions crates/rustc_codegen_spirv/src/builder/builder_methods.rs
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
64 => self
.constant_u64(self.span(), memset_fill_u64(fill_byte))
.def(self),
_ => self.fatal(&format!(
_ => self.fatal(format!(
"memset on integer width {width} not implemented yet"
)),
},
Expand All @@ -212,9 +212,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
64 => self
.constant_f64(self.span(), f64::from_bits(memset_fill_u64(fill_byte)))
.def(self),
_ => self.fatal(&format!(
"memset on float width {width} not implemented yet"
)),
_ => self.fatal(format!("memset on float width {width} not implemented yet")),
},
SpirvType::Adt { .. } => self.fatal("memset on structs not implemented yet"),
SpirvType::Vector { element, count } | SpirvType::Matrix { element, count } => {
Expand Down Expand Up @@ -259,16 +257,14 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
16 => memset_dynamic_scalar(self, fill_var, 2, false),
32 => memset_dynamic_scalar(self, fill_var, 4, false),
64 => memset_dynamic_scalar(self, fill_var, 8, false),
_ => self.fatal(&format!(
_ => self.fatal(format!(
"memset on integer width {width} not implemented yet"
)),
},
SpirvType::Float(width) => match width {
32 => memset_dynamic_scalar(self, fill_var, 4, true),
64 => memset_dynamic_scalar(self, fill_var, 8, true),
_ => self.fatal(&format!(
"memset on float width {width} not implemented yet"
)),
_ => self.fatal(format!("memset on float width {width} not implemented yet")),
},
SpirvType::Adt { .. } => self.fatal("memset on structs not implemented yet"),
SpirvType::Array { element, count } => {
Expand Down Expand Up @@ -805,7 +801,7 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
) {
fn construct_8(self_: &Builder<'_, '_>, signed: bool, v: u128) -> Operand {
if v > u8::MAX as u128 {
self_.fatal(&format!(
self_.fatal(format!(
"Switches to values above u8::MAX not supported: {v:?}"
))
} else if signed {
Expand All @@ -817,7 +813,7 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
}
fn construct_16(self_: &Builder<'_, '_>, signed: bool, v: u128) -> Operand {
if v > u16::MAX as u128 {
self_.fatal(&format!(
self_.fatal(format!(
"Switches to values above u16::MAX not supported: {v:?}"
))
} else if signed {
Expand All @@ -828,7 +824,7 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
}
fn construct_32(self_: &Builder<'_, '_>, _signed: bool, v: u128) -> Operand {
if v > u32::MAX as u128 {
self_.fatal(&format!(
self_.fatal(format!(
"Switches to values above u32::MAX not supported: {v:?}"
))
} else {
Expand All @@ -837,7 +833,7 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
}
fn construct_64(self_: &Builder<'_, '_>, _signed: bool, v: u128) -> Operand {
if v > u64::MAX as u128 {
self_.fatal(&format!(
self_.fatal(format!(
"Switches to values above u64::MAX not supported: {v:?}"
))
} else {
Expand All @@ -852,13 +848,13 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
16 => construct_16,
32 => construct_32,
64 => construct_64,
other => self.fatal(&format!(
other => self.fatal(format!(
"switch selector cannot have width {other} (only 8, 16, 32, and 64 bits allowed)"
)),
};
(signed, construct_case)
}
other => self.fatal(&format!(
other => self.fatal(format!(
"switch selector cannot have non-integer type {}",
other.debug(v.ty, self)
)),
Expand Down Expand Up @@ -947,7 +943,7 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
SpirvType::Bool => self
.emit()
.logical_and(ty, None, lhs.def(self), rhs.def(self)),
o => self.fatal(&format!(
o => self.fatal(format!(
"and() not implemented for type {}",
o.debug(ty, self)
)),
Expand All @@ -966,7 +962,7 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
SpirvType::Bool => self
.emit()
.logical_or(ty, None, lhs.def(self), rhs.def(self)),
o => self.fatal(&format!(
o => self.fatal(format!(
"or() not implemented for type {}",
o.debug(ty, self)
)),
Expand All @@ -986,7 +982,7 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
self.emit()
.logical_not_equal(ty, None, lhs.def(self), rhs.def(self))
}
o => self.fatal(&format!(
o => self.fatal(format!(
"xor() not implemented for type {}",
o.debug(ty, self)
)),
Expand All @@ -1003,7 +999,7 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
self.emit()
.logical_not_equal(val.ty, None, val.def(self), true_.def(self))
}
o => self.fatal(&format!(
o => self.fatal(format!(
"not() not implemented for type {}",
o.debug(val.ty, self)
)),
Expand Down Expand Up @@ -1104,7 +1100,7 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
assert_ty_eq!(self, ty, pointee);
pointee
}
ty => self.fatal(&format!(
ty => self.fatal(format!(
"load called on variable that wasn't a pointer: {ty:?}"
)),
};
Expand Down Expand Up @@ -1133,7 +1129,7 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
assert_ty_eq!(self, ty, pointee);
pointee
}
ty => self.fatal(&format!(
ty => self.fatal(format!(
"atomic_load called on variable that wasn't a pointer: {ty:?}"
)),
};
Expand All @@ -1160,7 +1156,7 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
place: PlaceRef<'tcx, Self::Value>,
) -> OperandRef<'tcx, Self::Value> {
if place.layout.is_zst() {
return OperandRef::new_zst(self, place.layout);
return OperandRef::zero_sized(place.layout);
}

let val = if let Some(llextra) = place.llextra {
Expand Down Expand Up @@ -1236,7 +1232,7 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
fn store(&mut self, val: Self::Value, ptr: Self::Value, _align: Align) -> Self::Value {
let ptr_elem_ty = match self.lookup_type(ptr.ty) {
SpirvType::Pointer { pointee } => pointee,
ty => self.fatal(&format!(
ty => self.fatal(format!(
"store called on variable that wasn't a pointer: {ty:?}"
)),
};
Expand Down Expand Up @@ -1268,7 +1264,7 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
flags: MemFlags,
) -> Self::Value {
if flags != MemFlags::empty() {
self.err(&format!("store_with_flags is not supported yet: {flags:?}"));
self.err(format!("store_with_flags is not supported yet: {flags:?}"));
}
self.store(val, ptr, align)
}
Expand All @@ -1282,7 +1278,7 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
) {
let ptr_elem_ty = match self.lookup_type(ptr.ty) {
SpirvType::Pointer { pointee } => pointee,
ty => self.fatal(&format!(
ty => self.fatal(format!(
"atomic_store called on variable that wasn't a pointer: {ty:?}"
)),
};
Expand Down Expand Up @@ -1320,7 +1316,7 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
assert_ty_eq!(self, ty, pointee);
pointee
}
other => self.fatal(&format!(
other => self.fatal(format!(
"struct_gep not on pointer type: {other:?}, index {idx}"
)),
};
Expand All @@ -1335,7 +1331,7 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
assert_eq!(idx, 0);
inner_type
}
other => self.fatal(&format!(
other => self.fatal(format!(
"struct_gep not on struct, array, or vector type: {other:?}, index {idx}"
)),
};
Expand Down Expand Up @@ -1480,7 +1476,7 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
fn ptrtoint(&mut self, val: Self::Value, dest_ty: Self::Type) -> Self::Value {
match self.lookup_type(val.ty) {
SpirvType::Pointer { .. } => (),
other => self.fatal(&format!(
other => self.fatal(format!(
"ptrtoint called on non-pointer source type: {other:?}"
)),
}
Expand All @@ -1500,7 +1496,7 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
fn inttoptr(&mut self, val: Self::Value, dest_ty: Self::Type) -> Self::Value {
match self.lookup_type(dest_ty) {
SpirvType::Pointer { .. } => (),
other => self.fatal(&format!(
other => self.fatal(format!(
"inttoptr called on non-pointer dest type: {other:?}"
)),
}
Expand Down Expand Up @@ -1603,7 +1599,7 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
.unwrap()
.with_type(dest_ty)
}
(val_ty, dest_ty_spv) => self.fatal(&format!(
(val_ty, dest_ty_spv) => self.fatal(format!(
"TODO: intcast not implemented yet: val={val:?} val.ty={val_ty:?} dest_ty={dest_ty_spv:?} is_signed={is_signed}"
)),
}
Expand All @@ -1628,14 +1624,14 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {

_ => match self.lookup_type(val.ty) {
SpirvType::Pointer { pointee } => (val, pointee),
other => self.fatal(&format!(
other => self.fatal(format!(
"pointercast called on non-pointer source type: {other:?}"
)),
},
};
let dest_pointee = match self.lookup_type(dest_ty) {
SpirvType::Pointer { pointee } => pointee,
other => self.fatal(&format!(
other => self.fatal(format!(
"pointercast called on non-pointer dest type: {other:?}"
)),
};
Expand Down Expand Up @@ -1860,7 +1856,7 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
IntSLT => self.fatal("TODO: boolean operator IntSLT not implemented yet"),
IntSLE => self.fatal("TODO: boolean operator IntSLE not implemented yet"),
},
other => self.fatal(&format!(
other => self.fatal(format!(
"Int comparison not implemented on {}",
other.debug(lhs.ty, self)
)),
Expand Down Expand Up @@ -1930,7 +1926,7 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
flags: MemFlags,
) {
if flags != MemFlags::empty() {
self.err(&format!(
self.err(format!(
"memcpy with mem flags is not supported yet: {flags:?}"
));
}
Expand Down Expand Up @@ -1988,13 +1984,13 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
flags: MemFlags,
) {
if flags != MemFlags::empty() {
self.err(&format!(
self.err(format!(
"memset with mem flags is not supported yet: {flags:?}"
));
}
let elem_ty = match self.lookup_type(ptr.ty) {
SpirvType::Pointer { pointee } => pointee,
_ => self.fatal(&format!(
_ => self.fatal(format!(
"memset called on non-pointer type: {}",
self.debug_type(ptr.ty)
)),
Expand Down Expand Up @@ -2038,9 +2034,7 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
fn extract_element(&mut self, vec: Self::Value, idx: Self::Value) -> Self::Value {
let result_type = match self.lookup_type(vec.ty) {
SpirvType::Vector { element, .. } => element,
other => self.fatal(&format!(
"extract_element not implemented on type {other:?}"
)),
other => self.fatal(format!("extract_element not implemented on type {other:?}")),
};
match self.builder.lookup_const_u64(idx) {
Some(const_index) => self.emit().composite_extract(
Expand Down Expand Up @@ -2084,7 +2078,7 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
SpirvType::Array { element, .. }
| SpirvType::Vector { element, .. }
| SpirvType::Matrix { element, .. } => element,
other => self.fatal(&format!(
other => self.fatal(format!(
"extract_value not implemented on type {}",
other.debug(agg_val.ty, self)
)),
Expand All @@ -2105,7 +2099,7 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
SpirvType::Adt { field_types, .. } => {
assert_ty_eq!(self, field_types[idx as usize], elt.ty);
}
other => self.fatal(&format!("insert_value not implemented on type {other:?}")),
other => self.fatal(format!("insert_value not implemented on type {other:?}")),
};
self.emit()
.composite_insert(
Expand Down Expand Up @@ -2173,7 +2167,7 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
) -> Self::Value {
let dst_pointee_ty = match self.lookup_type(dst.ty) {
SpirvType::Pointer { pointee } => pointee,
ty => self.fatal(&format!(
ty => self.fatal(format!(
"atomic_cmpxchg called on variable that wasn't a pointer: {ty:?}"
)),
};
Expand Down Expand Up @@ -2209,7 +2203,7 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
) -> Self::Value {
let dst_pointee_ty = match self.lookup_type(dst.ty) {
SpirvType::Pointer { pointee } => pointee,
ty => self.fatal(&format!(
ty => self.fatal(format!(
"atomic_rmw called on variable that wasn't a pointer: {ty:?}"
)),
};
Expand Down Expand Up @@ -2562,8 +2556,8 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
enum Inst<'tcx, ID> {
Bitcast(ID, ID),
CompositeExtract(ID, ID, u32),
AccessChain(ID, ID, SpirvConst<'tcx>),
InBoundsAccessChain(ID, ID, SpirvConst<'tcx>),
AccessChain(ID, ID, SpirvConst<'tcx, 'tcx>),
InBoundsAccessChain(ID, ID, SpirvConst<'tcx, 'tcx>),
Store(ID, ID),
Load(ID, ID),
Call(ID, ID, SmallVec<[ID; 4]>),
Expand Down
Loading