Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
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 Cargo.lock

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

Original file line numberDiff line numberDiff line change
Expand Up@@ -22,5 +22,5 @@
},
"panic-strategy": "abort",
"simd-types-indirect": false,
"target-pointer-width": "32"
"target-pointer-width": 32
}
Original file line numberDiff line numberDiff line change
Expand Up@@ -22,5 +22,5 @@
},
"panic-strategy": "abort",
"simd-types-indirect": false,
"target-pointer-width": "32"
"target-pointer-width": 32
}
Original file line numberDiff line numberDiff line change
Expand Up@@ -22,5 +22,5 @@
},
"panic-strategy": "abort",
"simd-types-indirect": false,
"target-pointer-width": "32"
"target-pointer-width": 32
}
Original file line numberDiff line numberDiff line change
Expand Up@@ -22,5 +22,5 @@
},
"panic-strategy": "abort",
"simd-types-indirect": false,
"target-pointer-width": "32"
"target-pointer-width": 32
}
Original file line numberDiff line numberDiff line change
Expand Up@@ -22,5 +22,5 @@
},
"panic-strategy": "abort",
"simd-types-indirect": false,
"target-pointer-width": "32"
"target-pointer-width": 32
}
Original file line numberDiff line numberDiff line change
Expand Up@@ -22,5 +22,5 @@
},
"panic-strategy": "abort",
"simd-types-indirect": false,
"target-pointer-width": "32"
"target-pointer-width": 32
}
Original file line numberDiff line numberDiff line change
Expand Up@@ -22,5 +22,5 @@
},
"panic-strategy": "abort",
"simd-types-indirect": false,
"target-pointer-width": "32"
"target-pointer-width": 32
}
Original file line numberDiff line numberDiff line change
Expand Up@@ -22,5 +22,5 @@
},
"panic-strategy": "abort",
"simd-types-indirect": false,
"target-pointer-width": "32"
"target-pointer-width": 32
}
Original file line numberDiff line numberDiff line change
Expand Up@@ -22,5 +22,5 @@
},
"panic-strategy": "abort",
"simd-types-indirect": false,
"target-pointer-width": "32"
"target-pointer-width": 32
}
Original file line numberDiff line numberDiff line change
Expand Up@@ -22,5 +22,5 @@
},
"panic-strategy": "abort",
"simd-types-indirect": false,
"target-pointer-width": "32"
"target-pointer-width": 32
}
Original file line numberDiff line numberDiff line change
Expand Up@@ -22,5 +22,5 @@
},
"panic-strategy": "abort",
"simd-types-indirect": false,
"target-pointer-width": "32"
"target-pointer-width": 32
}
Original file line numberDiff line numberDiff line change
Expand Up@@ -22,5 +22,5 @@
},
"panic-strategy": "abort",
"simd-types-indirect": false,
"target-pointer-width": "32"
"target-pointer-width": 32
}
Original file line numberDiff line numberDiff line change
Expand Up@@ -22,5 +22,5 @@
},
"panic-strategy": "abort",
"simd-types-indirect": false,
"target-pointer-width": "32"
"target-pointer-width": 32
}
Original file line numberDiff line numberDiff line change
Expand Up@@ -22,5 +22,5 @@
},
"panic-strategy": "abort",
"simd-types-indirect": false,
"target-pointer-width": "32"
"target-pointer-width": 32
}
Original file line numberDiff line numberDiff line change
Expand Up@@ -22,5 +22,5 @@
},
"panic-strategy": "abort",
"simd-types-indirect": false,
"target-pointer-width": "32"
"target-pointer-width": 32
}
Original file line numberDiff line numberDiff line change
Expand Up@@ -22,5 +22,5 @@
},
"panic-strategy": "abort",
"simd-types-indirect": false,
"target-pointer-width": "32"
"target-pointer-width": 32
}
Original file line numberDiff line numberDiff line change
Expand Up@@ -22,5 +22,5 @@
},
"panic-strategy": "abort",
"simd-types-indirect": false,
"target-pointer-width": "32"
"target-pointer-width": 32
}
Original file line numberDiff line numberDiff line change
Expand Up@@ -22,5 +22,5 @@
},
"panic-strategy": "abort",
"simd-types-indirect": false,
"target-pointer-width": "32"
"target-pointer-width": 32
}
1 change: 1 addition & 0 deletions crates/rustc_codegen_spirv/Cargo.toml
Original file line numberDiff line numberDiff line change
Expand Up@@ -67,6 +67,7 @@ rustc_codegen_spirv-target-specs.workspace = true

[dev-dependencies]
pretty_assertions = "1.0"
termcolor = "1.1.3"

# HACK(eddyb) can't re-introduce deps of `rustc_codegen_ssa`, for `pqp_cg_ssa`
# (see `build.rs`).
Expand Down
18 changes: 14 additions & 4 deletions crates/rustc_codegen_spirv/build.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -8,7 +8,6 @@ use std::collections::VecDeque;
use std::error::Error;
use std::path::{Path, PathBuf};
use std::process::{Command, ExitCode};
use std::string::ToString;
use std::{env, fs, mem};

/// Current `rust-toolchain.toml` file
Expand All@@ -19,9 +18,9 @@ use std::{env, fs, mem};
/// `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-2025-06-30"
channel = "nightly-2025-11-11"
components = ["rust-src", "rustc-dev", "llvm-tools"]
# commit_hash = 35f6036521777bdc0dcea1f980be4c192962a168"#;
# commit_hash = 2286e5d224b3413484cf4f398a9f078487e7b49d"#;

fn rustc_output(arg: &str) -> Result<String, Box<dyn Error>> {
let rustc = env::var("RUSTC").unwrap_or_else(|_| "rustc".into());
Expand DownExpand Up@@ -73,7 +72,7 @@ fn check_toolchain_version() -> Result<(), Box<dyn Error>> {
let stripped_toolchain = REQUIRED_RUST_TOOLCHAIN
.lines()
.filter(|l| !l.trim().is_empty() && !l.starts_with("# "))
.map(ToString::to_string)
.map(|l| l.to_string())
.reduce(|a, b| a + "\n" + &b)
.unwrap_or_default();

Expand DownExpand Up@@ -135,6 +134,10 @@ fn generate_pqp_cg_ssa() -> Result<(), Box<dyn Error>> {
}

let in_path = entry.path();

if in_path.ends_with(".DS_Store") {
continue;
}
let out_path = out_dir.join(entry.file_name());

let mut src = fs::read_to_string(in_path)?;
Expand DownExpand Up@@ -198,6 +201,13 @@ mod win {",
for link_path in raw_dylib::",
);
}
src = src.replace(
"
for (link_path, as_needed) in raw_dylib::",
"
#[cfg(any())]
for (link_path, as_needed) in raw_dylib::",
);
if relative_path == Path::new("src/back/metadata.rs") {
// HACK(eddyb) remove `object` dependency.
src = src.replace(
Expand Down
6 changes: 3 additions & 3 deletions crates/rustc_codegen_spirv/src/abi.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -286,7 +286,7 @@ impl<'tcx> ConvSpirvType<'tcx> for TyAndLayout<'tcx> {
span = cx.tcx.def_span(adt.did());
}

let attrs = AggregatedSpirvAttributes::parse(cx, cx.tcx.get_attrs_unchecked(adt.did()));
let attrs = AggregatedSpirvAttributes::parse(cx, cx.tcx.get_all_attrs(adt.did()));

if let Some(intrinsic_type_attr) = attrs.intrinsic_type.map(|attr| attr.value)
&& let Ok(spirv_type) =
Expand DownExpand Up@@ -791,7 +791,7 @@ fn trans_intrinsic_type<'tcx>(
let sampled_type = match args.type_at(0).kind() {
TyKind::Int(int) => match int {
IntTy::Isize => {
SpirvType::Integer(cx.tcx.data_layout.pointer_size.bits() as u32, true)
SpirvType::Integer(cx.tcx.data_layout.pointer_size().bits() as u32, true)
.def(span, cx)
}
IntTy::I8 => SpirvType::Integer(8, true).def(span, cx),
Expand All@@ -802,7 +802,7 @@ fn trans_intrinsic_type<'tcx>(
},
TyKind::Uint(uint) => match uint {
UintTy::Usize => {
SpirvType::Integer(cx.tcx.data_layout.pointer_size.bits() as u32, false)
SpirvType::Integer(cx.tcx.data_layout.pointer_size().bits() as u32, false)
.def(span, cx)
}
UintTy::U8 => SpirvType::Integer(8, false).def(span, cx),
Expand Down
3 changes: 0 additions & 3 deletions crates/rustc_codegen_spirv/src/attr.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -75,7 +75,6 @@ pub enum IntrinsicType {
pub struct SpecConstant {
pub id: u32,
pub default: Option<u32>,
pub array_count: Option<u32>,
}

// NOTE(eddyb) when adding new `#[spirv(...)]` attributes, the tests found inside
Expand DownExpand Up@@ -662,8 +661,6 @@ fn parse_spec_constant_attr(
Ok(SpecConstant {
id: id.ok_or_else(|| (arg.span(), "expected `spec_constant(id = ...)`".into()))?,
default,
// to be set later
array_count: None,
})
}

Expand Down
Loading
Loading