mirror of
https://github.com/EmbarkStudios/rust-gpu.git
synced 2024-11-25 00:04:11 +00:00
rustup: update to nightly-2023-04-15
.
This commit is contained in:
parent
87b7d135ab
commit
e9cdb9666b
@ -36,6 +36,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
(using ranges instead of just the starting position, and tracking inlined calls)
|
||||
|
||||
### Changed 🛠
|
||||
- [PR#1067](https://github.com/EmbarkStudios/rust-gpu/pull/1067) updated toolchain to `nightly-2023-04-15`
|
||||
- [PR#1038](https://github.com/EmbarkStudios/rust-gpu/pull/1038) relaxed `glam` version requirements (from only `0.22`, to `>=0.22, <=0.24`)
|
||||
|
||||
### Removed 🔥
|
||||
@ -66,7 +67,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
(see also [the `--no-early-report-zombies` codegen args docs](docs/src/codegen-args.md#--no-early-report-zombies))
|
||||
- [PR#1035](https://github.com/EmbarkStudios/rust-gpu/pull/1035) reduced the number of CGUs ("codegen units") used by `spirv-builder` to just `1`
|
||||
- [PR#1011](https://github.com/EmbarkStudios/rust-gpu/pull/1011) made `NonWritable` all read-only storage buffers (i.e. those typed `&T`, where `T` doesn't have interior mutability)
|
||||
- [PR#1029](https://github.com/EmbarkStudios/rust-gpu/pull/1029) fixed SampledImage::sample() fns being unnecessarily marked as unsafe
|
||||
- [PR#1029](https://github.com/EmbarkStudios/rust-gpu/pull/1029) fixed `SampledImage::sample` `fn`s being unnecessarily marked as `unsafe`
|
||||
- [PR#1005](https://github.com/EmbarkStudios/rust-gpu/pull/1005) updated toolchain to `nightly-2023-03-04`
|
||||
|
||||
### Fixed 🩹
|
||||
- [PR#1041](https://github.com/EmbarkStudios/rust-gpu/pull/1041) fixed `Image::gather()` not always returning a `Vec4`.
|
||||
|
@ -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");
|
||||
const REQUIRED_RUST_TOOLCHAIN: &str = r#"[toolchain]
|
||||
channel = "nightly-2023-03-04"
|
||||
channel = "nightly-2023-04-15"
|
||||
components = ["rust-src", "rustc-dev", "llvm-tools-preview"]
|
||||
# commit_hash = 44cfafe2fafe816395d3acc434663a45d5178c41"#;
|
||||
# commit_hash = 84dd17b56a931a631a23dfd5ef2018fd3ef49108"#;
|
||||
|
||||
fn get_rustc_commit_hash() -> Result<String, Box<dyn Error>> {
|
||||
let rustc = std::env::var("RUSTC").unwrap_or_else(|_| String::from("rustc"));
|
||||
|
@ -424,7 +424,7 @@ impl<'tcx> ConvSpirvType<'tcx> for TyAndLayout<'tcx> {
|
||||
if let TyKind::Adt(adt, _) = self.ty.kind() {
|
||||
if let Variants::Single { index } = self.variants {
|
||||
for i in self.fields.index_by_increasing_offset() {
|
||||
let field = &adt.variants()[index].fields[i];
|
||||
let field = &adt.variants()[index].fields[i.into()];
|
||||
field_names.push(field.name);
|
||||
}
|
||||
}
|
||||
@ -711,7 +711,7 @@ fn trans_struct<'tcx>(cx: &CodegenCx<'tcx>, span: Span, ty: TyAndLayout<'tcx>) -
|
||||
field_offsets.push(offset);
|
||||
if let Variants::Single { index } = ty.variants {
|
||||
if let TyKind::Adt(adt, _) = ty.ty.kind() {
|
||||
let field = &adt.variants()[index].fields[i];
|
||||
let field = &adt.variants()[index].fields[i.into()];
|
||||
field_names.push(field.name);
|
||||
} else {
|
||||
// FIXME(eddyb) this looks like something that should exist in rustc.
|
||||
|
@ -657,6 +657,12 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
|
||||
}
|
||||
|
||||
fn set_span(&mut self, span: Span) {
|
||||
// HACK(eddyb) this is what `#[track_caller]` does, and we need it to be
|
||||
// able to point at e.g. a use of `panic!`, instead of its implementation,
|
||||
// but it should be more fine-grained and/or include macro backtraces in
|
||||
// debuginfo (so the decision to use them can be deferred).
|
||||
let span = span.ctxt().outer_expn().expansion_cause().unwrap_or(span);
|
||||
|
||||
let old_span = self.current_span.replace(span);
|
||||
|
||||
// FIXME(eddyb) enable this once cross-block interactions are figured out
|
||||
@ -2392,10 +2398,7 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
|
||||
&[SpirvValue {
|
||||
kind: SpirvValueKind::Def(format_args_id),
|
||||
..
|
||||
}, SpirvValue {
|
||||
kind: SpirvValueKind::IllegalConst(_panic_location_id),
|
||||
..
|
||||
}] => format_args_id,
|
||||
}, _] => format_args_id,
|
||||
|
||||
_ => return None,
|
||||
};
|
||||
@ -2445,21 +2448,27 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
|
||||
(operands.next().unwrap(), operands.next().unwrap())
|
||||
})
|
||||
.filter(|&(store_dst_id, _)| store_dst_id == load_src_id)?;
|
||||
let (call_fmt_args_new_idx, _) = relevant_insts_next_back(Op::FunctionCall)
|
||||
let call_fmt_args_new_idx = relevant_insts_next_back(Op::FunctionCall)
|
||||
.filter(|&(_, result_id, _)| result_id == Some(store_val_id))
|
||||
.map(|(i, _, mut operands)| (i, operands.next().unwrap(), operands))
|
||||
.filter(|&(_, callee, _)| self.fmt_args_new_fn_ids.borrow().contains(&callee))
|
||||
.map(|(i, _, mut call_args)| {
|
||||
assert_eq!(call_args.len(), 4);
|
||||
.and_then(|(i, _, mut call_args)| {
|
||||
if call_args.len() == 4 {
|
||||
// `<core::fmt::Arguments>::new_v1`
|
||||
let mut arg = || call_args.next().unwrap();
|
||||
(i, [arg(), arg(), arg(), arg()])
|
||||
})
|
||||
.filter(|&(_, [_, _, _, fmt_args_len_id])| {
|
||||
let [_, _, _, fmt_args_len_id] = [arg(), arg(), arg(), arg()];
|
||||
// Only ever remove `fmt::Arguments` with no runtime values.
|
||||
Some(i).filter(|_| {
|
||||
matches!(
|
||||
self.builder.lookup_const_by_id(fmt_args_len_id),
|
||||
Some(SpirvConst::U32(0))
|
||||
)
|
||||
})
|
||||
} else {
|
||||
// `<core::fmt::Arguments>::new_const`
|
||||
assert_eq!(call_args.len(), 2);
|
||||
Some(i)
|
||||
}
|
||||
})?;
|
||||
|
||||
// Lastly, ensure that the `Op{Store,Load}` pair operates on
|
||||
|
@ -683,6 +683,11 @@ impl<'tcx> BuilderSpirv<'tcx> {
|
||||
&self,
|
||||
span: Span,
|
||||
) -> (DebugFileSpirv<'tcx>, Range<(u32, u32)>) {
|
||||
// HACK(eddyb) this is similar to what `#[track_caller]` does, and it
|
||||
// allows us to point to the use site of a macro, instead of inside the
|
||||
// macro (but ideally we would record the entire macro backtrace).
|
||||
let span = span.ctxt().outer_expn().expansion_cause().unwrap_or(span);
|
||||
|
||||
let (lo, hi) = (span.lo(), span.hi());
|
||||
|
||||
let lo_loc = self.source_map.lookup_char_pos(lo);
|
||||
|
@ -127,6 +127,10 @@ impl<'tcx> ConstMethods<'tcx> for CodegenCx<'tcx> {
|
||||
fn const_undef(&self, ty: Self::Type) -> Self::Value {
|
||||
self.undef(ty)
|
||||
}
|
||||
fn const_poison(&self, ty: Self::Type) -> Self::Value {
|
||||
// No distinction between undef and poison.
|
||||
self.const_undef(ty)
|
||||
}
|
||||
fn const_int(&self, t: Self::Type, i: i64) -> Self::Value {
|
||||
self.constant_int(t, i as u64)
|
||||
}
|
||||
|
@ -7,6 +7,7 @@ use crate::spirv_type::SpirvType;
|
||||
use rspirv::spirv::{FunctionControl, LinkageType, StorageClass, Word};
|
||||
use rustc_attr::InlineAttr;
|
||||
use rustc_codegen_ssa::traits::{BaseTypeMethods, PreDefineMethods, StaticMethods};
|
||||
use rustc_hir::def::DefKind;
|
||||
use rustc_middle::bug;
|
||||
use rustc_middle::middle::codegen_fn_attrs::{CodegenFnAttrFlags, CodegenFnAttrs};
|
||||
use rustc_middle::mir::mono::{Linkage, MonoItem, Visibility};
|
||||
@ -124,8 +125,16 @@ impl<'tcx> CodegenCx<'tcx> {
|
||||
|
||||
let declared = fn_id.with_type(function_type);
|
||||
|
||||
let attrs =
|
||||
AggregatedSpirvAttributes::parse(self, self.tcx.get_attrs_unchecked(instance.def_id()));
|
||||
let attrs = AggregatedSpirvAttributes::parse(
|
||||
self,
|
||||
match self.tcx.def_kind(instance.def_id()) {
|
||||
// This was made to ICE cross-crate at some point, but then got
|
||||
// reverted in https://github.com/rust-lang/rust/pull/111381.
|
||||
// FIXME(eddyb) remove this workaround once we rustup past that.
|
||||
DefKind::Closure => &[],
|
||||
_ => self.tcx.get_attrs_unchecked(instance.def_id()),
|
||||
},
|
||||
);
|
||||
if let Some(entry) = attrs.entry.map(|attr| attr.value) {
|
||||
let entry_name = entry
|
||||
.name
|
||||
@ -178,7 +187,12 @@ impl<'tcx> CodegenCx<'tcx> {
|
||||
|
||||
// HACK(eddyb) there is no good way to identify this definition
|
||||
// (e.g. no `#[lang = "..."]` attribute), but this works well enough.
|
||||
if demangled_symbol_name == "<core::fmt::Arguments>::new_v1" {
|
||||
if [
|
||||
"<core::fmt::Arguments>::new_v1",
|
||||
"<core::fmt::Arguments>::new_const",
|
||||
]
|
||||
.contains(&&demangled_symbol_name[..])
|
||||
{
|
||||
self.fmt_args_new_fn_ids.borrow_mut().insert(fn_id);
|
||||
}
|
||||
|
||||
|
@ -69,7 +69,7 @@ pub struct CodegenCx<'tcx> {
|
||||
// it mandatory even for `panic!("...")` (that were previously separate).
|
||||
pub panic_entry_point_ids: RefCell<FxHashSet<Word>>,
|
||||
|
||||
/// `core::fmt::Arguments::new_v1` instances (for Rust 2021 panics).
|
||||
/// `core::fmt::Arguments::new_{v1,const}` instances (for Rust 2021 panics).
|
||||
pub fmt_args_new_fn_ids: RefCell<FxHashSet<Word>>,
|
||||
|
||||
/// Intrinsic for loading a <T> from a &[u32]. The PassMode is the mode of the <T>.
|
||||
|
@ -19,7 +19,7 @@
|
||||
#![feature(assert_matches)]
|
||||
#![feature(result_flattening)]
|
||||
#![feature(lint_reasons)]
|
||||
#![feature(once_cell)]
|
||||
#![feature(lazy_cell)]
|
||||
// crate-specific exceptions:
|
||||
#![allow(
|
||||
unsafe_code, // rustc_codegen_ssa requires unsafe functions in traits to be impl'd
|
||||
@ -104,7 +104,7 @@ use rustc_middle::dep_graph::{WorkProduct, WorkProductId};
|
||||
use rustc_middle::mir::mono::{Linkage, MonoItem, Visibility};
|
||||
use rustc_middle::mir::pretty::write_mir_pretty;
|
||||
use rustc_middle::ty::print::with_no_trimmed_paths;
|
||||
use rustc_middle::ty::{self, query, DefIdTree, Instance, InstanceDef, TyCtxt};
|
||||
use rustc_middle::ty::{self, query, Instance, InstanceDef, TyCtxt};
|
||||
use rustc_session::config::{self, OutputFilenames, OutputType};
|
||||
use rustc_session::Session;
|
||||
use rustc_span::symbol::{sym, Symbol};
|
||||
|
@ -99,24 +99,14 @@ fn link_rlib(sess: &Session, codegen_results: &CodegenResults, out_filename: &Pa
|
||||
file_list.push(obj);
|
||||
}
|
||||
for lib in codegen_results.crate_info.used_libraries.iter() {
|
||||
match lib.kind {
|
||||
NativeLibKind::Static {
|
||||
if let NativeLibKind::Static {
|
||||
bundle: None | Some(true),
|
||||
..
|
||||
} => {}
|
||||
NativeLibKind::Static {
|
||||
bundle: Some(false),
|
||||
..
|
||||
}
|
||||
| NativeLibKind::Dylib { .. }
|
||||
| NativeLibKind::Framework { .. }
|
||||
| NativeLibKind::RawDylib
|
||||
| NativeLibKind::LinkArg
|
||||
| NativeLibKind::Unspecified => continue,
|
||||
}
|
||||
if let Some(name) = lib.name {
|
||||
} = lib.kind
|
||||
{
|
||||
sess.err(format!(
|
||||
"Adding native library to rlib not supported yet: {name}"
|
||||
"adding native library to rlib not supported yet: {}",
|
||||
lib.name
|
||||
));
|
||||
}
|
||||
}
|
||||
@ -441,39 +431,23 @@ fn add_upstream_native_libraries(
|
||||
|
||||
for &cnum in &codegen_results.crate_info.used_crates {
|
||||
for lib in codegen_results.crate_info.native_libraries[&cnum].iter() {
|
||||
let name = match lib.name {
|
||||
Some(l) => l,
|
||||
None => continue,
|
||||
};
|
||||
if !relevant_lib(sess, lib) {
|
||||
continue;
|
||||
}
|
||||
match lib.kind {
|
||||
NativeLibKind::Dylib { .. } | NativeLibKind::Unspecified => sess.fatal(format!(
|
||||
"TODO: dylib nativelibkind not supported yet: {name}"
|
||||
)),
|
||||
NativeLibKind::Framework { .. } => sess.fatal(format!(
|
||||
"TODO: framework nativelibkind not supported yet: {name}"
|
||||
)),
|
||||
NativeLibKind::Static {
|
||||
bundle: Some(false),
|
||||
..
|
||||
} => {
|
||||
if data[cnum.as_usize() - 1] == Linkage::Static {
|
||||
sess.fatal(format!(
|
||||
"TODO: staticnobundle nativelibkind not supported yet: {name}"
|
||||
))
|
||||
}
|
||||
}
|
||||
} if data[cnum.as_usize() - 1] != Linkage::Static => {}
|
||||
|
||||
NativeLibKind::Static {
|
||||
bundle: None | Some(true),
|
||||
..
|
||||
} => {}
|
||||
NativeLibKind::RawDylib => {
|
||||
sess.fatal(format!("raw_dylib feature not yet implemented: {name}"))
|
||||
}
|
||||
NativeLibKind::LinkArg => sess.fatal(format!(
|
||||
"TODO: linkarg nativelibkind not supported yet: {name}"
|
||||
|
||||
_ => sess.fatal(format!(
|
||||
"`NativeLibKind::{:?}` (name={:?}) not supported yet",
|
||||
lib.kind, lib.name
|
||||
)),
|
||||
}
|
||||
}
|
||||
|
@ -195,6 +195,8 @@ pub fn gpu_only(_attr: TokenStream, item: TokenStream) -> TokenStream {
|
||||
block,
|
||||
} = syn::parse_macro_input!(item as syn::ItemFn);
|
||||
|
||||
// FIXME(eddyb) this looks like a clippy false positive (`sig` is used below).
|
||||
#[allow(clippy::redundant_clone)]
|
||||
let fn_name = sig.ident.clone();
|
||||
|
||||
let sig_cpu = syn::Signature {
|
||||
|
@ -1,7 +1,7 @@
|
||||
[toolchain]
|
||||
channel = "nightly-2023-03-04"
|
||||
channel = "nightly-2023-04-15"
|
||||
components = ["rust-src", "rustc-dev", "llvm-tools-preview"]
|
||||
# commit_hash = 44cfafe2fafe816395d3acc434663a45d5178c41
|
||||
# commit_hash = 84dd17b56a931a631a23dfd5ef2018fd3ef49108
|
||||
|
||||
# Whenever changing the nightly channel, update the commit hash above, and make
|
||||
# sure to change REQUIRED_TOOLCHAIN in crates/rustc_codegen_spirv/src/build.rs also.
|
||||
# sure to change `REQUIRED_TOOLCHAIN` in `crates/rustc_codegen_spirv/build.rs` also.
|
||||
|
@ -1,13 +1,13 @@
|
||||
error: cannot memcpy dynamically sized data
|
||||
--> $CORE_SRC/intrinsics.rs:2460:9
|
||||
--> $CORE_SRC/intrinsics.rs:2724:9
|
||||
|
|
||||
2460 | copy(src, dst, count)
|
||||
2724 | copy(src, dst, count)
|
||||
| ^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
note: used from within `core::intrinsics::copy::<f32>`
|
||||
--> $CORE_SRC/intrinsics.rs:2447:21
|
||||
--> $CORE_SRC/intrinsics.rs:2710:21
|
||||
|
|
||||
2447 | pub const unsafe fn copy<T>(src: *const T, dst: *mut T, count: usize) {
|
||||
2710 | pub const unsafe fn copy<T>(src: *const T, dst: *mut T, count: usize) {
|
||||
| ^^^^
|
||||
note: called by `ptr_copy::copy_via_raw_ptr`
|
||||
--> $DIR/ptr_copy.rs:28:18
|
||||
|
@ -2,7 +2,7 @@
|
||||
%4 = OpFunctionParameter %5
|
||||
%6 = OpFunctionParameter %5
|
||||
%7 = OpLabel
|
||||
OpLine %8 1157 8
|
||||
OpLine %8 1188 12
|
||||
%9 = OpLoad %10 %4
|
||||
OpLine %11 7 13
|
||||
OpStore %6 %9
|
||||
|
@ -2,7 +2,7 @@
|
||||
%4 = OpFunctionParameter %5
|
||||
%6 = OpFunctionParameter %5
|
||||
%7 = OpLabel
|
||||
OpLine %8 1157 8
|
||||
OpLine %8 1188 12
|
||||
%9 = OpLoad %10 %4
|
||||
OpLine %11 7 13
|
||||
OpStore %6 %9
|
||||
|
@ -4,7 +4,7 @@
|
||||
%7 = OpLabel
|
||||
OpLine %8 7 35
|
||||
%9 = OpLoad %10 %4
|
||||
OpLine %11 1354 8
|
||||
OpLine %11 1386 8
|
||||
OpStore %6 %9
|
||||
OpNoLine
|
||||
OpReturn
|
||||
|
@ -4,7 +4,7 @@
|
||||
%7 = OpLabel
|
||||
OpLine %8 7 37
|
||||
%9 = OpLoad %10 %4
|
||||
OpLine %11 1354 8
|
||||
OpLine %11 1386 8
|
||||
OpStore %6 %9
|
||||
OpNoLine
|
||||
OpReturn
|
||||
|
@ -3,9 +3,9 @@
|
||||
OpLine %5 13 11
|
||||
%6 = OpCompositeInsert %7 %8 %9 0
|
||||
%10 = OpCompositeExtract %11 %6 1
|
||||
OpLine %12 967 14
|
||||
OpLine %12 975 14
|
||||
%13 = OpBitcast %14 %8
|
||||
OpLine %12 967 8
|
||||
OpLine %12 975 8
|
||||
%15 = OpIEqual %16 %13 %17
|
||||
OpNoLine
|
||||
OpSelectionMerge %18 None
|
||||
|
@ -4,9 +4,7 @@
|
||||
use spirv_std::spirv;
|
||||
|
||||
#[spirv(matrix)]
|
||||
pub struct _EmptyStruct {}
|
||||
pub struct EmptyStruct {}
|
||||
|
||||
#[spirv(fragment)]
|
||||
pub fn _entry() {
|
||||
let _empty_struct = _EmptyStruct {};
|
||||
}
|
||||
pub fn entry(#[spirv(push_constant)] matrix: &EmptyStruct) {}
|
||||
|
@ -1,8 +1,8 @@
|
||||
error: #[spirv(matrix)] type must have at least two fields
|
||||
--> $DIR/invalid-matrix-type-empty.rs:7:1
|
||||
|
|
||||
7 | pub struct _EmptyStruct {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^
|
||||
7 | pub struct EmptyStruct {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user