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 nightly-2022-12-18 #982

Merged
merged 8 commits into from
Jan 5, 2023
Merged
Show file tree
Hide file tree
Changes from 3 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
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");
const REQUIRED_RUST_TOOLCHAIN: &str = r#"[toolchain]
channel = "nightly-2022-10-29"
channel = "nightly-2022-12-10"
components = ["rust-src", "rustc-dev", "llvm-tools-preview"]
# commit_hash = 9565dfeb4e6225177bbe78f18cd48a7982f34401"#;
# commit_hash = dfe3fe710181738a2cb3060c23ec5efb3c68ca09"#;

fn get_rustc_commit_hash() -> Result<String, Box<dyn Error>> {
let rustc = std::env::var("RUSTC").unwrap_or_else(|_| String::from("rustc"));
Expand Down
2 changes: 1 addition & 1 deletion crates/rustc_codegen_spirv/src/abi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ 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<'a>(layout: &LayoutS<'a>) -> LayoutS<'a> {
fn clone_layout<V: Idx>(layout: &LayoutS<V>) -> LayoutS<V> {
let LayoutS {
ref fields,
ref variants,
Expand Down
2 changes: 1 addition & 1 deletion crates/rustc_codegen_spirv/src/attr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ impl<'tcx> Visitor<'tcx> for CheckSpirvAttrVisitor<'tcx> {
}

fn visit_variant(&mut self, variant: &'tcx hir::Variant<'tcx>) {
self.check_spirv_attributes(variant.id, Target::Variant);
self.check_spirv_attributes(variant.hir_id, Target::Variant);
intravisit::walk_variant(self, variant);
}

Expand Down
10 changes: 4 additions & 6 deletions crates/rustc_codegen_spirv/src/builder/builder_methods.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1126,13 +1126,13 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {

/// Called for `Rvalue::Repeat` when the elem is neither a ZST nor optimizable using memset.
fn write_operand_repeatedly(
mut self,
&mut self,
cg_elem: OperandRef<'tcx, Self::Value>,
count: u64,
dest: PlaceRef<'tcx, Self::Value>,
) -> Self {
) {
let zero = self.const_usize(0);
let start = dest.project_index(&mut self, zero).llval;
let start = dest.project_index(self, zero).llval;

let elem_layout = dest.layout.field(self.cx(), 0);
let elem_ty = elem_layout.spirv_type(self.span(), &self);
Expand All @@ -1141,12 +1141,10 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
for i in 0..count {
let current = self.inbounds_gep(elem_ty, start, &[self.const_usize(i)]);
cg_elem.val.store(
&mut self,
self,
PlaceRef::new_sized_aligned(current, cg_elem.layout, align),
);
}

self
}

fn range_metadata(&mut self, _load: Self::Value, _range: WrappingRange) {
Expand Down
3 changes: 2 additions & 1 deletion crates/rustc_codegen_spirv/src/builder/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ use rustc_span::source_map::Span;
use rustc_target::abi::call::{ArgAbi, FnAbi, PassMode};
use rustc_target::abi::{HasDataLayout, Size, TargetDataLayout};
use rustc_target::spec::{HasTargetSpec, Target};
use std::ops::Deref;
use std::ops::{Deref, Range};

pub struct Builder<'a, 'tcx> {
cx: &'a CodegenCx<'tcx>,
Expand Down Expand Up @@ -294,6 +294,7 @@ impl<'a, 'tcx> DebugInfoBuilderMethods for Builder<'a, 'tcx> {
_direct_offset: Size,
// NB: each offset implies a deref (i.e. they're steps in a pointer chain).
_indirect_offsets: &[Size],
_fragment: Option<Range<Size>>,
) {
todo!()
}
Expand Down
8 changes: 8 additions & 0 deletions crates/rustc_codegen_spirv/src/codegen_cx/type_.rs
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,14 @@ impl<'tcx> BaseTypeMethods<'tcx> for CodegenCx<'tcx> {
SpirvType::Float(64).def(DUMMY_SP, self)
}

fn type_array(&self, ty: Self::Type, len: u64) -> Self::Type {
SpirvType::Array {
element: ty,
count: self.constant_u64(DUMMY_SP, len),
}
.def(DUMMY_SP, self)
}

fn type_func(&self, args: &[Self::Type], ret: Self::Type) -> Self::Type {
SpirvType::Function {
return_type: ret,
Expand Down
2 changes: 1 addition & 1 deletion crates/rustc_codegen_spirv/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ impl ExtraBackendMethods for SpirvCodegenBackend {
_: TyCtxt<'tcx>,
_: &str,
_: AllocatorKind,
_: bool,
_: AllocatorKind,
) -> Self::Module {
todo!()
}
Expand Down
3 changes: 2 additions & 1 deletion crates/rustc_codegen_spirv/src/link.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ use rustc_session::config::{CrateType, DebugInfo, Lto, OptLevel, OutputFilenames
use rustc_session::output::{check_file_is_writeable, invalid_output_for_target, out_filename};
use rustc_session::utils::NativeLibKind;
use rustc_session::Session;
use rustc_span::Symbol;
use std::collections::BTreeMap;
use std::ffi::{CString, OsStr};
use std::fs::File;
Expand Down Expand Up @@ -58,7 +59,7 @@ pub fn link<'a>(
}

if outputs.outputs.should_codegen() {
let out_filename = out_filename(sess, crate_type, outputs, crate_name);
let out_filename = out_filename(sess, crate_type, outputs, Symbol::intern(crate_name));
match crate_type {
CrateType::Rlib => {
link_rlib(sess, codegen_results, &out_filename);
Expand Down
1 change: 1 addition & 0 deletions crates/rustc_codegen_spirv/src/linker/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ fn link_with_linker_opts(
false,
None,
false,
false,
);

rustc_errors::Handler::with_emitter_and_flags(
Expand Down
10 changes: 5 additions & 5 deletions crates/rustc_codegen_spirv/src/symbols.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::attr::{Entry, ExecutionModeExtra, IntrinsicType, SpirvAttribute};
use crate::builder::libm_intrinsics;
use rspirv::spirv::{BuiltIn, ExecutionMode, ExecutionModel, StorageClass};
use rustc_ast::ast::{AttrKind, Attribute, Lit, LitIntType, LitKind, NestedMetaItem};
use rustc_ast::ast::{AttrKind, Attribute, LitIntType, LitKind, MetaItemLit, NestedMetaItem};
use rustc_data_structures::fx::FxHashMap;
use rustc_span::symbol::{Ident, Symbol};
use rustc_span::Span;
Expand Down Expand Up @@ -500,7 +500,7 @@ fn parse_attr_int_value(arg: &NestedMetaItem) -> Result<u32, ParseAttrError> {
None => return Err((arg.span(), "attribute must have value".to_string())),
};
match arg.name_value_literal() {
Some(&Lit {
Some(&MetaItemLit {
kind: LitKind::Int(x, LitIntType::Unsuffixed),
..
}) if x <= u32::MAX as u128 => Ok(x as u32),
Expand All @@ -517,11 +517,11 @@ fn parse_local_size_attr(arg: &NestedMetaItem) -> Result<[u32; 3], ParseAttrErro
Some(tuple) if !tuple.is_empty() && tuple.len() < 4 => {
let mut local_size = [1; 3];
for (idx, lit) in tuple.iter().enumerate() {
match lit.literal() {
Some(&Lit {
match lit {
NestedMetaItem::Lit(MetaItemLit {
kind: LitKind::Int(x, LitIntType::Unsuffixed),
..
}) if x <= u32::MAX as u128 => local_size[idx] = x as u32,
}) if *x <= u32::MAX as u128 => local_size[idx] = *x as u32,
_ => return Err((lit.span(), "must be a u32 literal".to_string())),
}
}
Expand Down
4 changes: 2 additions & 2 deletions rust-toolchain
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
# to the user in the error, instead of "error: invalid channel name '[toolchain]'".

[toolchain]
channel = "nightly-2022-10-29"
channel = "nightly-2022-12-10"
components = ["rust-src", "rustc-dev", "llvm-tools-preview"]
# commit_hash = 9565dfeb4e6225177bbe78f18cd48a7982f34401
# commit_hash = dfe3fe710181738a2cb3060c23ec5efb3c68ca09

# 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.
Expand Down
4 changes: 2 additions & 2 deletions tests/ui/dis/ptr_copy.normal.stderr
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
error: Cannot memcpy dynamically sized data
--> $CORE_SRC/intrinsics.rs:2449:9
--> $CORE_SRC/intrinsics.rs:2519:9
|
2449 | copy(src, dst, count)
2519 | copy(src, dst, count)
| ^^^^^^^^^^^^^^^^^^^^^
|
= note: Stack:
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/dis/ptr_read.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
%4 = OpFunctionParameter %5
%6 = OpFunctionParameter %5
%7 = OpLabel
OpLine %8 1139 8
OpLine %8 1135 8
%9 = OpLoad %10 %4
OpLine %11 9 13
OpStore %6 %9
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/dis/ptr_read_method.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
%4 = OpFunctionParameter %5
%6 = OpFunctionParameter %5
%7 = OpLabel
OpLine %8 1139 8
OpLine %8 1135 8
%9 = OpLoad %10 %4
OpLine %11 9 13
OpStore %6 %9
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/dis/ptr_write.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
%7 = OpLabel
OpLine %8 9 35
%9 = OpLoad %10 %4
OpLine %11 1336 8
OpLine %11 1332 8
OpStore %6 %9
OpNoLine
OpReturn
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/dis/ptr_write_method.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
%7 = OpLabel
OpLine %8 9 37
%9 = OpLoad %10 %4
OpLine %11 1336 8
OpLine %11 1332 8
OpStore %6 %9
OpNoLine
OpReturn
Expand Down