Skip to content

Commit d9544b5

Browse files
committed
Merge branch 'main' of github.com:jcmnn/rust-gpu
2 parents 15e8736 + 3eecddc commit d9544b5

File tree

168 files changed

+7917
-460
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

168 files changed

+7917
-460
lines changed

.github/workflows/ci.yaml

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ jobs:
2929
with:
3030
version: 1.4.309.0
3131
cache: true
32+
- if: ${{ runner.os == 'Windows' }}
33+
name: Install Vulkan Runtime with SwiftShader (Windows)
34+
uses: NcStudios/VulkanCI@v1.2
35+
with:
36+
sdkVersion: 1.4.309.0
3237
- if: ${{ runner.os == 'Linux' }}
3338
name: Linux - Install native dependencies
3439
run: sudo apt install libwayland-cursor0 libxkbcommon-dev libwayland-dev
@@ -88,6 +93,11 @@ jobs:
8893
with:
8994
version: 1.4.309.0
9095
cache: true
96+
- if: ${{ runner.os == 'Windows' }}
97+
name: Install Vulkan Runtime with SwiftShader (Windows)
98+
uses: NcStudios/VulkanCI@v1.2
99+
with:
100+
sdkVersion: 1.4.309.0
91101
- name: install rust-toolchain
92102
run: cargo version
93103
- name: cargo fetch --locked
@@ -129,6 +139,11 @@ jobs:
129139
with:
130140
version: 1.4.309.0
131141
cache: true
142+
- if: ${{ runner.os == 'Windows' }}
143+
name: Install Vulkan Runtime with SwiftShader (Windows)
144+
uses: NcStudios/VulkanCI@v1.2
145+
with:
146+
sdkVersion: 1.4.309.0
132147
- name: install rust-toolchain
133148
run: echo "TARGET=$(rustc --print host-tuple)" >> "$GITHUB_ENV"
134149
- name: cargo fetch --locked
@@ -149,6 +164,11 @@ jobs:
149164
with:
150165
version: 1.4.309.0
151166
cache: true
167+
- if: ${{ runner.os == 'Windows' }}
168+
name: Install Vulkan Runtime with SwiftShader (Windows)
169+
uses: NcStudios/VulkanCI@v1.2
170+
with:
171+
sdkVersion: 1.4.309.0
152172
- if: ${{ runner.os == 'Linux' }}
153173
name: Linux - Install native dependencies
154174
run: sudo apt install libwayland-cursor0 libxkbcommon-dev libwayland-dev
@@ -222,7 +242,9 @@ jobs:
222242
run: |
223243
RUSTDOCFLAGS=-Dwarnings cargo +stable doc --no-deps -p spirv-std
224244
RUSTDOCFLAGS=-Dwarnings cargo +stable doc --no-deps -p spirv-builder --no-default-features
225-
- name: Clippy & custom lints
245+
- name: cargo clippy
246+
run: cargo clippy --all-targets -- -D warnings
247+
- name: custom lints
226248
run: .github/workflows/lint.sh
227249

228250
cargo-deny:

.github/workflows/lint.sh

Lines changed: 5 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,6 @@
11
#!/usr/bin/env bash
22
set -e
33

4-
if [[ -z "${CI}" ]]; then
5-
FEAT="use-compiled-tools"
6-
else
7-
FEAT="use-installed-tools"
8-
fi
9-
10-
function clippy() {
11-
echo ::group::"$1"
12-
cargo clippy \
13-
--manifest-path "$1/Cargo.toml" \
14-
--no-default-features \
15-
--features "$FEAT" \
16-
--all-targets \
17-
-- -D warnings
18-
echo ::endgroup::
19-
}
20-
21-
function clippy_no_features() {
22-
echo ::group::"$1"
23-
cargo clippy \
24-
--manifest-path "$1/Cargo.toml" \
25-
--all-targets \
26-
-- -D warnings
27-
echo ::endgroup::
28-
}
29-
30-
# Core crates
31-
clippy crates/rustc_codegen_spirv
32-
clippy crates/spirv-builder
33-
34-
# Examples
35-
36-
clippy examples/runners/ash
37-
clippy examples/runners/wgpu
38-
39-
clippy_no_features examples/runners/cpu
40-
clippy_no_features examples/shaders/sky-shader
41-
clippy_no_features examples/shaders/simplest-shader
42-
434
# Custom lints
445

456
# 1. Disallow `std::env` (mis)use from `rustc_codegen_spirv`
@@ -99,6 +60,11 @@ version_test crates/spirv-std
9960
# HACK(eddyb) see `crates/rustc_codegen_spirv/build.rs` for more on `pqp_cg_ssa`
10061
# (a patched copy of `rustc_codegen_ssa`).
10162
echo ::group::rustc_codegen_spirv_disable_pqp_cg_ssa
63+
if [[ -z "${CI}" ]]; then
64+
FEAT="use-compiled-tools"
65+
else
66+
FEAT="use-installed-tools"
67+
fi
10268
cargo clippy \
10369
--manifest-path "crates/rustc_codegen_spirv/Cargo.toml" \
10470
--no-default-features \

Cargo.lock

Lines changed: 67 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ spirv-builder = { path = "./crates/spirv-builder", version = "=0.9.0", default-f
4646
spirv-std = { path = "./crates/spirv-std", version = "=0.9.0" }
4747
spirv-std-types = { path = "./crates/spirv-std/shared", version = "=0.9.0" }
4848
spirv-std-macros = { path = "./crates/spirv-std/macros", version = "=0.9.0" }
49-
spirv-tools = { version = "0.12", default-features = false }
49+
spirv-tools = { version = "0.12.1", default-features = false }
5050
rustc_codegen_spirv = { path = "./crates/rustc_codegen_spirv", version = "=0.9.0", default-features = false }
5151
rustc_codegen_spirv-types = { path = "./crates/rustc_codegen_spirv-types", version = "=0.9.0" }
5252
rustc_codegen_spirv-target-specs = { path = "crates/rustc_codegen_spirv-target-specs", version = "=0.9.0" }

crates/rustc_codegen_spirv/src/codegen_cx/mod.rs

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use crate::maybe_pqp_cg_ssa as rustc_codegen_ssa;
1515

1616
use itertools::Itertools as _;
1717
use rspirv::dr::{Module, Operand};
18-
use rspirv::spirv::{Decoration, LinkageType, Op, Word};
18+
use rspirv::spirv::{Decoration, LinkageType, Word};
1919
use rustc_abi::{AddressSpace, HasDataLayout, TargetDataLayout};
2020
use rustc_ast::ast::{InlineAsmOptions, InlineAsmTemplatePiece};
2121
use rustc_codegen_ssa::mir::debuginfo::{FunctionDebugContext, VariableKind};
@@ -37,7 +37,7 @@ use rustc_target::spec::{HasTargetSpec, Target, TargetTuple};
3737
use std::cell::RefCell;
3838
use std::collections::BTreeSet;
3939
use std::iter::once;
40-
use std::path::{Path, PathBuf};
40+
use std::path::PathBuf;
4141
use std::rc::Rc;
4242
use std::str::FromStr;
4343

@@ -767,25 +767,6 @@ impl CodegenArgs {
767767

768768
if self.disassemble_globals {
769769
for inst in module.global_inst_iter() {
770-
// HACK: On Windows, paths are printed like `OpString "D:\\dir\\blah"`.
771-
// Unfortunately, compiletest will only normalize `D:\dir\blah` to `$DIR/blah` -
772-
// one backslash, not two. So, when disassembling for compiletest, check if the
773-
// argument to OpString can be parsed as an absolute path, and if it is, replace it
774-
// with just the filename component of the path.
775-
if inst.class.opcode == Op::String {
776-
let path = Path::new(inst.operands[0].unwrap_literal_string());
777-
if path.is_absolute()
778-
&& let Some(file_name) = path.file_name()
779-
{
780-
let mut inst = inst.clone();
781-
inst.operands[0] = Operand::LiteralString(format!(
782-
"$OPSTRING_FILENAME/{}",
783-
file_name.to_string_lossy(),
784-
));
785-
eprintln!("{}", inst.disassemble());
786-
continue;
787-
}
788-
}
789770
eprintln!("{}", inst.disassemble());
790771
}
791772
}

crates/rustc_codegen_spirv/src/linker/mod.rs

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -481,16 +481,6 @@ pub fn link(
481481
simple_passes::remove_non_uniform_decorations(sess, &mut output)?;
482482
}
483483

484-
{
485-
let _timer = sess.timer("link_remove_unused_type_capabilities");
486-
simple_passes::remove_unused_type_capabilities(&mut output);
487-
}
488-
489-
{
490-
let _timer = sess.timer("link_type_capability_check");
491-
simple_passes::check_type_capabilities(sess, &output)?;
492-
}
493-
494484
// NOTE(eddyb) SPIR-T pipeline is entirely limited to this block.
495485
{
496486
let (spv_words, module_or_err, lower_from_spv_timer) =
@@ -563,10 +553,16 @@ pub fn link(
563553
module,
564554
&opts.spirt_passes,
565555
|name, _module| before_pass(name),
566-
after_pass,
556+
&mut after_pass,
567557
);
568558
}
569559

560+
{
561+
let timer = before_pass("spirt_passes::validate");
562+
spirt_passes::validate::validate(module);
563+
after_pass("validate", module, timer);
564+
}
565+
570566
{
571567
let _timer = before_pass("spirt_passes::diagnostics::report_diagnostics");
572568
spirt_passes::diagnostics::report_diagnostics(sess, opts, module).map_err(
@@ -634,6 +630,11 @@ pub fn link(
634630
}
635631
}
636632

633+
{
634+
let _timer = sess.timer("link_remove_unused_type_capabilities");
635+
simple_passes::remove_unused_type_capabilities(&mut output);
636+
}
637+
637638
{
638639
let _timer = sess.timer("link_gather_all_interface_vars_from_uses");
639640
entry_interface::gather_all_interface_vars_from_uses(&mut output);

0 commit comments

Comments
 (0)