Build on nightly-2026-11-03 with rustc's parallel front end, kache and incremental builds
The owner asked for a nightly toolchain, -Zthreads, kache 2.0 with its incremental cache, and Rust's incremental compilation on. - rust-toolchain.toml pins nightly-2026-11-03 (rustc 1.101.0-nightly 1c3a65069), dated so every machine runs one rustc, clippy and rustfmt. The published crates keep rust-version 1.98, which this build no longer checks by itself (clippy's incompatible_msrv still flags newer std items). - .cargo/config.toml passes -Zthreads=0 (a thread per core) through Cargo's profile rustflags, which add to RUSTFLAGS instead of being replaced by it, so `--cfg m2v_gpu` lanes and CI's -Dwarnings keep it. - scripts/rustc-wrapper hands each compile to kache where kache is on PATH outside CI, and to rustc otherwise; `RUSTC_WRAPPER=` (empty) builds without it. - CARGO_INCREMENTAL=0 is gone from scripts/device-lane, AGENTS.md and CONTRIBUTING.md. - CI installs the toolchain the file names; both Dockerfiles take the same nightly. What the nightly asked of the code: - Its standard library containers take more trait-solver levels (Box -> BoxRaw, RawVec -> PhantomData), so proving a RenderCommandEncoder `Send` from a program's crate ran past the default recursion limit (tests/consumer_auto_traits.rs failed, a future-incompat lint that will become an error). The encoder now holds its own lowering in `OwnLowering`, whose `Send` impl is written out over a compile-time proof that `RenderLowering` is `Send`, as `LoweringSlot` already was. The runtime crate's own proofs need recursion_limit 256. - New clippy lints: needless_range_loop, single_element_loop, new_instead_of_clear (a false positive on a moved-from Vec: the part's segments are now taken explicitly), needless_borrows_for_generic_args, redundant_closure, unnecessary_lazy_evaluations, manual_range_patterns; AtomicU64::fetch_update is deprecated for try_update (present in 1.98). - Cargo warns that `homepage` equals `repository`: homepage removed from the manifests. - nightly rustfmt formats ir_id! invocations one argument per line. Verified on the M3 Max: `cargo clippy --workspace --all-targets --all-features -- -D warnings` clean on the nightly; `cargo build -v` shows -Zthreads on every rustc invocation and scripts/rustc-wrapper in front of each.
This commit is contained in:
1 parent
bc127dbec3
commit
64b4e42d75
38 files changed
+211
-137
No files matched your search
@@ -0,0 +1,21 @@
|
||||
# Build settings for this workspace's own builds. A consumer that depends on the published crates
|
||||
# never reads this file (Cargo reads the configuration of the directory it runs in).
|
||||
|
||||
[build]
|
||||
# kache (a compiler cache) where it is installed, plain rustc where it is not, CI included:
|
||||
# `scripts/rustc-wrapper` decides per invocation. `RUSTC_WRAPPER` set in the environment replaces
|
||||
# it, and an empty `RUSTC_WRAPPER=` runs rustc with no wrapper at all.
|
||||
rustc-wrapper = "scripts/rustc-wrapper"
|
||||
|
||||
[unstable]
|
||||
profile-rustflags = true
|
||||
|
||||
# rustc's parallel front end on every compile, with as many threads as the machine has cores
|
||||
# (`0`). Profile rustflags are added to `RUSTFLAGS` rather than replaced by it, so the GPU lanes'
|
||||
# `--cfg m2v_gpu` and CI's `-Dwarnings` keep it. `test`, `bench` and `debugger` inherit it from
|
||||
# `dev` and `release`.
|
||||
[profile.dev]
|
||||
rustflags = ["-Zthreads=0"]
|
||||
|
||||
[profile.release]
|
||||
rustflags = ["-Zthreads=0"]
|
||||
@@ -25,9 +25,8 @@ jobs:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Install Rust
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
with:
|
||||
components: rustfmt, clippy
|
||||
# The dated nightly and components rust-toolchain.toml names.
|
||||
run: rustup toolchain install
|
||||
|
||||
- name: Cache cargo
|
||||
uses: Swatinem/rust-cache@v2
|
||||
|
||||
@@ -156,7 +156,8 @@ has the commands.
|
||||
- make worktrees with `scripts/lean-tree worktree` (the observations are clones) and source
|
||||
snapshots with `scripts/lean-tree snapshot` (no observations unless the tree runs validation);
|
||||
- start each new target directory from a seed with `scripts/seed-target`;
|
||||
- set `CARGO_INCREMENTAL=0` for one-shot builds;
|
||||
- builds are incremental, and compile through `scripts/rustc-wrapper` (kache where it is
|
||||
installed: a local cache that also carries incremental state between worktrees);
|
||||
- record Instruments traces through `scripts/xctrace-run`, and delete the `.trace` once
|
||||
exported.
|
||||
- `pgrep -f` and `ps | grep` match their own command line. Always bracket the first character:
|
||||
@@ -218,7 +219,9 @@ cargo nextest run -p metal2vulkan-conformance --all-features
|
||||
cargo test --workspace --all-features --doc
|
||||
```
|
||||
|
||||
- MSRV: `rust-version` in the crates' manifests (1.98).
|
||||
- MSRV: `rust-version` in the crates' manifests (1.98). The tree builds on the dated nightly
|
||||
`rust-toolchain.toml` pins, with rustc's parallel front end on every core (`-Zthreads=0`,
|
||||
`.cargo/config.toml`).
|
||||
- Warnings are errors everywhere (CI sets `RUSTFLAGS=-Dwarnings`). Never hide one behind
|
||||
`#[allow(...)]`; fix it.
|
||||
- Features: `serde`, `ash` and `cli` (which enables `serde`). Every gate passes `--all-features`;
|
||||
|
||||
+6
-2
@@ -5,7 +5,8 @@ they bind people too.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- Rust stable, at least the `rust-version` in the crates' manifests (1.98).
|
||||
- rustup. `rust-toolchain.toml` pins the nightly this tree builds with (rustup installs it on first
|
||||
use); the published crates promise the stable `rust-version` in their manifests (1.98).
|
||||
- [cargo-nextest](https://nexte.st): `cargo install cargo-nextest --locked`.
|
||||
- The external tools the tests and validation use (the libraries run none):
|
||||
- `llvm-as` (LLVM 21 or newer) for the `.ll` fixtures, and `llvm-dis` for validation's harvest
|
||||
@@ -83,7 +84,10 @@ Parallel worktrees and one-shot builds write a lot to disk. Three scripts keep t
|
||||
- `scripts/xctrace-run TRACE ARGS...` records with Instruments and removes the raw
|
||||
`instruments*.ktrace` files a recording leaves in the temp dir, an aborted one included.
|
||||
|
||||
Set `CARGO_INCREMENTAL=0` for a build that won't be edited and rebuilt.
|
||||
Builds are incremental. Every compile goes through `scripts/rustc-wrapper`, which hands it to
|
||||
[kache](https://github.com/kunobi-ninja/kache) when kache is on `PATH` (outside CI) and to rustc
|
||||
otherwise; kache restores matching compiles from its local store and imports incremental state
|
||||
between worktrees. `RUSTC_WRAPPER=` (empty) builds without it.
|
||||
|
||||
## Where tests go
|
||||
|
||||
|
||||
@@ -20,7 +20,6 @@ rust-version = "1.98"
|
||||
license = "GPL-2.0-or-later OR LGPL-3.0-or-later"
|
||||
authors = ["Anees Iqbal <hello@aneesiqbal.ai>"]
|
||||
repository = "https://github.com/steelbrain/metal2vulkan"
|
||||
homepage = "https://github.com/steelbrain/metal2vulkan"
|
||||
|
||||
# The external dependencies more than one crate takes, at one version each. A crate adds its own
|
||||
# features (and `optional`). The crates' dependencies on one another stay in their own manifests,
|
||||
|
||||
@@ -8,7 +8,6 @@ license.workspace = true
|
||||
authors.workspace = true
|
||||
description = "Read Metal AIR: the metallib container, LLVM bitcode, a typed IR, the AIR metadata ABI, intrinsics, and canonicalization"
|
||||
repository.workspace = true
|
||||
homepage.workspace = true
|
||||
documentation = "https://docs.rs/metal2vulkan-air"
|
||||
keywords = ["metal", "air", "llvm", "bitcode", "gpu"]
|
||||
categories = ["compilers", "graphics", "parser-implementations"]
|
||||
|
||||
@@ -57,40 +57,49 @@ macro_rules! ir_id {
|
||||
|
||||
ir_id!(
|
||||
/// An interned type ([`super::Type`]).
|
||||
TypeId, "t"
|
||||
TypeId,
|
||||
"t"
|
||||
);
|
||||
ir_id!(
|
||||
/// An interned constant ([`super::Constant`]).
|
||||
ConstId, "c"
|
||||
ConstId,
|
||||
"c"
|
||||
);
|
||||
ir_id!(
|
||||
/// A module-level global variable.
|
||||
GlobalId, "g"
|
||||
GlobalId,
|
||||
"g"
|
||||
);
|
||||
ir_id!(
|
||||
/// A function (definition or declaration).
|
||||
FuncId, "f"
|
||||
FuncId,
|
||||
"f"
|
||||
);
|
||||
ir_id!(
|
||||
/// A basic block within one function body. Block 0 is the entry.
|
||||
BlockId, "bb"
|
||||
BlockId,
|
||||
"bb"
|
||||
);
|
||||
ir_id!(
|
||||
/// An instruction within one function body (void instructions included).
|
||||
InstId, "i"
|
||||
InstId,
|
||||
"i"
|
||||
);
|
||||
ir_id!(
|
||||
/// A function parameter position.
|
||||
ArgIdx, "a"
|
||||
ArgIdx,
|
||||
"a"
|
||||
);
|
||||
ir_id!(
|
||||
/// A metadata node, string, or value.
|
||||
MdId, "md"
|
||||
MdId,
|
||||
"md"
|
||||
);
|
||||
ir_id!(
|
||||
/// An interned byte string (symbol names, metadata strings). Diagnostics and ABI only: no
|
||||
/// product decision may branch on its contents except stable `air.*`/`llvm.*` ABI keys.
|
||||
Sym, "s"
|
||||
Sym,
|
||||
"s"
|
||||
);
|
||||
|
||||
/// A dense arena of `T` indexed by `I`.
|
||||
|
||||
@@ -127,7 +127,7 @@ pub fn shape(name: &str) -> Option<Shape> {
|
||||
});
|
||||
}
|
||||
let (base, components) = match tail.as_bytes().last() {
|
||||
Some(digit @ (b'2' | b'3' | b'4')) => (&tail[..tail.len() - 1], usize::from(digit - b'0')),
|
||||
Some(digit @ b'2'..=b'4') => (&tail[..tail.len() - 1], usize::from(digit - b'0')),
|
||||
_ => (tail, 1),
|
||||
};
|
||||
let coding = match (base, normalized) {
|
||||
|
||||
@@ -231,7 +231,7 @@ pub struct PipelinesPerState {
|
||||
impl PipelinesPerState {
|
||||
/// The ratio this measurement read, where it read one.
|
||||
pub fn ratio(&self) -> Option<f64> {
|
||||
(self.states > 0).then(|| self.pipelines as f64 / self.states as f64)
|
||||
(self.states > 0).then_some(self.pipelines as f64 / self.states as f64)
|
||||
}
|
||||
|
||||
/// The most pipelines this bound allows a run that created `states` states.
|
||||
|
||||
@@ -6636,7 +6636,7 @@ impl RuntimeSide<'_> {
|
||||
))
|
||||
};
|
||||
let mut descriptor = RenderPipelineDescriptor::new(stage(&spec.vertex)?);
|
||||
descriptor.fragment = spec.fragment.as_ref().map(&stage).transpose()?;
|
||||
descriptor.fragment = spec.fragment.as_ref().map(stage).transpose()?;
|
||||
let apart = pipeline_fields(spec)?;
|
||||
descriptor.color_attachments = apart.color_attachments;
|
||||
descriptor.depth_format = apart.depth_format;
|
||||
@@ -7600,7 +7600,7 @@ fn encode_pass(command_buffer: &CommandBuffer, pass: &RenderPass, pools: &Pools)
|
||||
offset,
|
||||
instance_stride,
|
||||
} => {
|
||||
let factors = held.map(&buffer).transpose()?;
|
||||
let factors = held.map(buffer).transpose()?;
|
||||
encoder
|
||||
.set_tessellation_factor_buffer(factors, *offset, *instance_stride)
|
||||
.map_err(Failure::from_error)?;
|
||||
@@ -7617,7 +7617,7 @@ fn encode_pass(command_buffer: &CommandBuffer, pass: &RenderPass, pools: &Pools)
|
||||
instances,
|
||||
base_instance,
|
||||
} => {
|
||||
let indices = patch_indices.map(&buffer).transpose()?;
|
||||
let indices = patch_indices.map(buffer).transpose()?;
|
||||
encoder
|
||||
.draw_patches(
|
||||
*control_points,
|
||||
@@ -7641,7 +7641,7 @@ fn encode_pass(command_buffer: &CommandBuffer, pass: &RenderPass, pools: &Pools)
|
||||
instances,
|
||||
base_instance,
|
||||
} => {
|
||||
let indices = patch_indices.map(&buffer).transpose()?;
|
||||
let indices = patch_indices.map(buffer).transpose()?;
|
||||
encoder
|
||||
.draw_indexed_patches(
|
||||
*control_points,
|
||||
|
||||
@@ -5352,8 +5352,8 @@ fn the_runtime_side_forwards_every_field_of_a_pipeline_spec() {
|
||||
let third = made.color_attachments[2].expect("color 2");
|
||||
assert_eq!(third.pixel_format, PixelFormat::R16Snorm, "color 2 format");
|
||||
assert_eq!(third.write_mask, ColorWriteMask::GREEN, "color 2 mask");
|
||||
for at in 3..8 {
|
||||
assert!(made.color_attachments[at].is_none(), "color {at}");
|
||||
for (at, attachment) in made.color_attachments.iter().enumerate().take(8).skip(3) {
|
||||
assert!(attachment.is_none(), "color {at}");
|
||||
}
|
||||
|
||||
let vertex = made.vertex_descriptor.expect("vertex_descriptor");
|
||||
|
||||
@@ -528,7 +528,7 @@ impl TimeVerdict {
|
||||
pub fn ratio(&self) -> Option<f64> {
|
||||
match self {
|
||||
TimeVerdict::Within { ours, metal } | TimeVerdict::Over { ours, metal } => {
|
||||
(*metal > 0).then(|| *ours as f64 / *metal as f64)
|
||||
(*metal > 0).then_some(*ours as f64 / *metal as f64)
|
||||
}
|
||||
TimeVerdict::Unmeasured { .. } => None,
|
||||
}
|
||||
@@ -596,7 +596,7 @@ impl Comparison {
|
||||
match self {
|
||||
Comparison::Judged { verdict } => verdict.ratio(),
|
||||
Comparison::Noticed { ours, metal, .. } => {
|
||||
(*metal > 0).then(|| *ours as f64 / *metal as f64)
|
||||
(*metal > 0).then_some(*ours as f64 / *metal as f64)
|
||||
}
|
||||
Comparison::Apart { .. } => None,
|
||||
}
|
||||
@@ -824,7 +824,7 @@ pub struct Paired {
|
||||
impl Paired {
|
||||
/// How many times our leg's total is Metal's, where Metal's is not zero.
|
||||
pub fn ratio(&self) -> Option<f64> {
|
||||
(self.metal.wall > 0).then(|| self.ours.wall as f64 / self.metal.wall as f64)
|
||||
(self.metal.wall > 0).then_some(self.ours.wall as f64 / self.metal.wall as f64)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,6 @@ authors.workspace = true
|
||||
description = "The Metal API on Vulkan: Metal's objects and calls run on a Vulkan device through ash"
|
||||
readme = "README.md"
|
||||
repository.workspace = true
|
||||
homepage.workspace = true
|
||||
documentation = "https://docs.rs/metal2vulkan-runtime"
|
||||
keywords = ["metal", "vulkan", "gpu", "graphics"]
|
||||
categories = ["graphics", "api-bindings"]
|
||||
|
||||
@@ -1466,55 +1466,54 @@ impl BlitCommandEncoder {
|
||||
let one_extent = in_images.iter().all(|copy| copy.src.size == copy.dst.size);
|
||||
let samples = source.record().samples;
|
||||
let mut bits = Vec::new();
|
||||
for to in [into] {
|
||||
match Some(&from).filter(|from| from.copies_into(&to) && !overlap && one_extent) {
|
||||
Some(from) => {
|
||||
let mut regions: Vec<ImageCopyRegion> = in_images
|
||||
let to = into;
|
||||
match Some(&from).filter(|from| from.copies_into(&to) && !overlap && one_extent) {
|
||||
Some(from) => {
|
||||
let mut regions: Vec<ImageCopyRegion> = in_images
|
||||
.iter()
|
||||
.map(|copy| from.region(&to, copy))
|
||||
.collect();
|
||||
// Into a multisampled float image whose NaNs the device's copy converts:
|
||||
// the regions at one origin in both images by the sample planes' copies,
|
||||
// which move every sample's bits; the rest, or all where those cannot run,
|
||||
// copied by the device and announced.
|
||||
let device = self.core().device().clone();
|
||||
if nan_clear::converting_copy(&device, to.format, samples) {
|
||||
let (exact, rest): (Vec<&ImageCopyRegion>, Vec<&ImageCopyRegion>) = regions
|
||||
.iter()
|
||||
.map(|copy| from.region(&to, copy))
|
||||
.collect();
|
||||
// Into a multisampled float image whose NaNs the device's copy converts:
|
||||
// the regions at one origin in both images by the sample planes' copies,
|
||||
// which move every sample's bits; the rest, or all where those cannot run,
|
||||
// copied by the device and announced.
|
||||
let device = self.core().device().clone();
|
||||
if nan_clear::converting_copy(&device, to.format, samples) {
|
||||
let (exact, rest): (Vec<&ImageCopyRegion>, Vec<&ImageCopyRegion>) = regions
|
||||
.iter()
|
||||
.partition(|copy| copy.src.origin == copy.dst.origin);
|
||||
let pairs: Vec<(ImageRegion, ImageRegion)> =
|
||||
exact.iter().map(|copy| (copy.src, copy.dst)).collect();
|
||||
if let Some(copy) = sample_planes::BitsCopy::plan(
|
||||
self.core().command_buffer(),
|
||||
source,
|
||||
destination,
|
||||
to.format,
|
||||
&pairs,
|
||||
samples,
|
||||
)? {
|
||||
bits.push(copy);
|
||||
regions = rest.into_iter().copied().collect();
|
||||
}
|
||||
if !regions.is_empty() {
|
||||
nan_clear::degrade_converting_copy(&device, to.format, samples, || {
|
||||
format!(
|
||||
"a blit copy into a multisampled {:?} texture",
|
||||
destination.pixel_format()
|
||||
)
|
||||
});
|
||||
}
|
||||
.partition(|copy| copy.src.origin == copy.dst.origin);
|
||||
let pairs: Vec<(ImageRegion, ImageRegion)> =
|
||||
exact.iter().map(|copy| (copy.src, copy.dst)).collect();
|
||||
if let Some(copy) = sample_planes::BitsCopy::plan(
|
||||
self.core().command_buffer(),
|
||||
source,
|
||||
destination,
|
||||
to.format,
|
||||
&pairs,
|
||||
samples,
|
||||
)? {
|
||||
bits.push(copy);
|
||||
regions = rest.into_iter().copied().collect();
|
||||
}
|
||||
if !regions.is_empty() {
|
||||
let regions: Vec<vk::ImageCopy> = regions.iter().map(image_copy).collect();
|
||||
direct.push((from.image, to.image, regions));
|
||||
// A depth that may hold a negative value or a NaN, copied as it is.
|
||||
if to.aspect == ImageAspectFlags::DEPTH {
|
||||
destination.degrade_signed_depth(call);
|
||||
}
|
||||
nan_clear::degrade_converting_copy(&device, to.format, samples, || {
|
||||
format!(
|
||||
"a blit copy into a multisampled {:?} texture",
|
||||
destination.pixel_format()
|
||||
)
|
||||
});
|
||||
}
|
||||
}
|
||||
if !regions.is_empty() {
|
||||
let regions: Vec<vk::ImageCopy> = regions.iter().map(image_copy).collect();
|
||||
direct.push((from.image, to.image, regions));
|
||||
// A depth that may hold a negative value or a NaN, copied as it is.
|
||||
if to.aspect == ImageAspectFlags::DEPTH {
|
||||
destination.degrade_signed_depth(call);
|
||||
}
|
||||
}
|
||||
None => staged.push(to),
|
||||
}
|
||||
None => staged.push(to),
|
||||
}
|
||||
for copy in &bits {
|
||||
self.command_in_reading(
|
||||
|
||||
@@ -1759,7 +1759,7 @@ impl Device {
|
||||
{
|
||||
use std::sync::atomic::Ordering;
|
||||
let failing = &shared.failing_host_imports;
|
||||
if (failing.fetch_update(Ordering::Relaxed, Ordering::Relaxed, |n| n.checked_sub(1)))
|
||||
if (failing.try_update(Ordering::Relaxed, Ordering::Relaxed, |n| n.checked_sub(1)))
|
||||
.is_ok()
|
||||
{
|
||||
return Err(Error::OutOfMemory(MemoryKind::Device));
|
||||
|
||||
@@ -416,8 +416,8 @@ fn into_parts(
|
||||
segment.executions_at += base;
|
||||
if segment.host {
|
||||
let before = segment.at - taken;
|
||||
parts.push((raws.by_ref().take(before).collect::<Vec<_>>(), current));
|
||||
current = Vec::new();
|
||||
let finished = std::mem::take(&mut current);
|
||||
parts.push((raws.by_ref().take(before).collect::<Vec<_>>(), finished));
|
||||
taken = segment.at;
|
||||
}
|
||||
segment.at -= taken;
|
||||
|
||||
@@ -22,6 +22,11 @@
|
||||
// Every public item says what it is and its Metal counterpart: a new undocumented one fails the
|
||||
// warnings-denied gates.
|
||||
#![warn(missing_docs)]
|
||||
// The compiler's proofs of `Send` and `Sync` in this crate (`render/deferral.rs`) walk a render
|
||||
// encoder's lowering through the standard library's containers, which take more levels per
|
||||
// container than they did: past the default limit of 128 (`recursion_depth_exceeding_limit`). A
|
||||
// program's crate keeps the default (`tests/consumer_auto_traits.rs`).
|
||||
#![recursion_limit = "256"]
|
||||
|
||||
mod address;
|
||||
mod address_map;
|
||||
|
||||
@@ -430,8 +430,8 @@ mod vertex_strides;
|
||||
#[cfg(all(test, debug_assertions, any(m2v_gpu, m2v_cpu_icd)))]
|
||||
pub(crate) use bound::dynamic_compares;
|
||||
use bound::{Bound, EqualShapes, Now, Recorded};
|
||||
use deferral::Logged;
|
||||
pub(crate) use deferral::{lowering, DeferredEncoders, EndInFlight};
|
||||
use deferral::{Logged, OwnLowering};
|
||||
#[cfg(all(test, any(m2v_gpu, m2v_cpu_icd)))]
|
||||
pub(crate) use deferral::{BATCH_CALLS, HANDED_BATCHES};
|
||||
pub(crate) use draw_again::KeptStorage;
|
||||
@@ -1379,7 +1379,7 @@ pub struct RenderCommandEncoder {
|
||||
/// (`RenderLoweringPolicy::AtCall`): no slot, no lock (`render/deferral.rs`). Boxed where
|
||||
/// it is made ([`RenderLowering::assemble`]), so neither the encoder's return nor a caller's
|
||||
/// move of it copies the lowering's state, thousands of bytes.
|
||||
own: Option<Box<RenderLowering>>,
|
||||
own: Option<OwnLowering>,
|
||||
/// Else its slot of the device's, which holds its lowering, its checks at the call and its
|
||||
/// calls not yet lowered.
|
||||
logged: Option<Logged>,
|
||||
|
||||
@@ -197,6 +197,37 @@ const _: () = {
|
||||
sent::<Lowerer>();
|
||||
};
|
||||
|
||||
/// An encoder's own lowering (`RenderLoweringPolicy::AtCall`), boxed where it is made
|
||||
/// ([`RenderLowering::assemble`]).
|
||||
pub(super) struct OwnLowering(Box<RenderLowering>);
|
||||
|
||||
// SAFETY: an `OwnLowering` is `Send` exactly when `RenderLowering` is, its one field being a box of
|
||||
// one; the constant below makes the compiler prove that. Written out, as `LoweringSlot`'s are, the
|
||||
// impl ends a program's crate's walk of an encoder's fields there: the walk from a
|
||||
// `RenderCommandEncoder` through its own lowering ran past rustc's default recursion limit
|
||||
// (`tests/consumer_auto_traits.rs`).
|
||||
unsafe impl Send for OwnLowering {}
|
||||
|
||||
// The compiler's proof of what `OwnLowering`'s `Send` impl rests on.
|
||||
const _: () = {
|
||||
const fn sent<T: Send>() {}
|
||||
sent::<RenderLowering>();
|
||||
};
|
||||
|
||||
impl std::ops::Deref for OwnLowering {
|
||||
type Target = RenderLowering;
|
||||
|
||||
fn deref(&self) -> &RenderLowering {
|
||||
&self.0
|
||||
}
|
||||
}
|
||||
|
||||
impl std::ops::DerefMut for OwnLowering {
|
||||
fn deref_mut(&mut self) -> &mut RenderLowering {
|
||||
&mut self.0
|
||||
}
|
||||
}
|
||||
|
||||
/// A slot's lowering, and whether it refused a call.
|
||||
struct Lowerer {
|
||||
/// Its encoder's lowering: `None` once the encoder ended, and in a slot not taken.
|
||||
@@ -654,7 +685,7 @@ impl RenderCommandEncoder {
|
||||
let logs = device.compile_device().policy().render_lowering == RenderLoweringPolicy::Worker
|
||||
&& lowering.grouped.is_none();
|
||||
let (own, logged) = match logs {
|
||||
false => (Some(lowering), None),
|
||||
false => (Some(OwnLowering(lowering)), None),
|
||||
true => {
|
||||
let device = device.clone();
|
||||
let command_buffer = lowering.core.command_buffer().downgrade();
|
||||
@@ -845,7 +876,7 @@ impl RenderCommandEncoder {
|
||||
/// the end of an encoder that logged its calls name it as `endEncoding`, after its calls.
|
||||
pub(super) fn end(self) -> Result<(), Error> {
|
||||
let logged = match (self.own, self.logged) {
|
||||
(Some(lowering), _) => return lowering.end_encoding(),
|
||||
(Some(lowering), _) => return lowering.0.end_encoding(),
|
||||
(None, Some(logged)) => logged,
|
||||
(None, None) => return Err(internal("an encoder without its lowering")),
|
||||
};
|
||||
|
||||
@@ -1133,7 +1133,7 @@ fn the_threads_that_take_command_buffers_to_their_handlers_run_at_the_user_inter
|
||||
reaper.start().unwrap().reap(Box::new(Reaped(dropped)));
|
||||
let reaped = drops.recv_timeout(WAIT).unwrap();
|
||||
reaper.stop();
|
||||
let plain = exit_guard::spawn(std::thread::Builder::new(), || qos_class_self())
|
||||
let plain = exit_guard::spawn(std::thread::Builder::new(), qos_class_self)
|
||||
.unwrap()
|
||||
.join()
|
||||
.unwrap();
|
||||
|
||||
@@ -201,7 +201,7 @@ fn check_plan(
|
||||
// Or, with extended usage, through the view of the format's word.
|
||||
let word = WordAttachment::of(pf, profile).map(|w| w.word_format());
|
||||
assert!(
|
||||
supports(FormatUsage::ColorAttachment) || (extended && word.is_some_and(&viewable)),
|
||||
supports(FormatUsage::ColorAttachment) || (extended && word.is_some_and(viewable)),
|
||||
"{what}"
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1009,11 +1009,10 @@ fn generated_companions_link_with_their_cases_in_the_engine() {
|
||||
&draws,
|
||||
"mesh_draws_fragment",
|
||||
)));
|
||||
for index in 0..2 {
|
||||
descriptor.color_attachments[index] =
|
||||
Some(metal2vulkan::pipeline::ColorAttachmentDescriptor::new(
|
||||
metal2vulkan::metal::PixelFormat::RGBA32Uint,
|
||||
));
|
||||
for slot in descriptor.color_attachments.iter_mut().take(2) {
|
||||
*slot = Some(metal2vulkan::pipeline::ColorAttachmentDescriptor::new(
|
||||
metal2vulkan::metal::PixelFormat::RGBA32Uint,
|
||||
));
|
||||
}
|
||||
let linked = device
|
||||
.compile_mesh_pipeline(&descriptor, &metal2vulkan::Budget::standard())
|
||||
|
||||
@@ -9,7 +9,6 @@ description = "Translate Metal AIR / LLVM IR to Vulkan SPIR-V with a native Rust
|
||||
# The repository's README, at the root: `cargo package` puts it at the package's root.
|
||||
readme = "../../README.md"
|
||||
repository.workspace = true
|
||||
homepage.workspace = true
|
||||
documentation = "https://docs.rs/metal2vulkan"
|
||||
keywords = ["metal", "air", "spir-v", "vulkan", "gpu"]
|
||||
categories = ["compilers", "graphics", "encoding"]
|
||||
|
||||
@@ -860,11 +860,13 @@ fn a_field_written_alone_is_the_record_encoded_again() {
|
||||
}
|
||||
assert_eq!(view.buffer(stage, BINDING_COUNT), None);
|
||||
}
|
||||
for index in 0..THREADGROUP_COUNT {
|
||||
assert_eq!(
|
||||
view.threadgroup_memory_length(index),
|
||||
Some(record.threadgroup_memory_lengths[index])
|
||||
);
|
||||
for (index, &length) in record
|
||||
.threadgroup_memory_lengths
|
||||
.iter()
|
||||
.enumerate()
|
||||
.take(THREADGROUP_COUNT)
|
||||
{
|
||||
assert_eq!(view.threadgroup_memory_length(index), Some(length));
|
||||
}
|
||||
assert_eq!(view.threadgroup_memory_length(THREADGROUP_COUNT), None);
|
||||
let field = draws.field();
|
||||
|
||||
@@ -2887,8 +2887,8 @@ fn the_graphics_state_masks_the_colors_the_fragment_function_writes() {
|
||||
let p = profile("lavapipe");
|
||||
let f4 = io_ty(IoNumeric::Float, 4);
|
||||
let mut r = RenderLinkInputs::new();
|
||||
for index in 0..4 {
|
||||
r.color_attachments[index] = Some(ColorAttachmentDescriptor::new(PixelFormat::RGBA16Float));
|
||||
for slot in r.color_attachments.iter_mut().take(4) {
|
||||
*slot = Some(ColorAttachmentDescriptor::new(PixelFormat::RGBA16Float));
|
||||
}
|
||||
let inputs = LinkInputs::Render(Box::new(r));
|
||||
let va = artifact(iface(Stage::Vertex, vec![], vec![]), None);
|
||||
|
||||
@@ -1175,12 +1175,11 @@ fn integer_writes_into_narrow_floats_take_the_devices_conversion() {
|
||||
let img = images.into_iter().next().expect("image");
|
||||
for n in 0..SIDE * SIDE {
|
||||
let at = img.index(0, 0, 0, [n % SIDE, n / SIDE, 0]).expect("texel");
|
||||
for c in 0..4 {
|
||||
for (c, &stored) in img.texels[at].iter().enumerate().take(4) {
|
||||
assert_eq!(
|
||||
img.texels[at][c],
|
||||
stored,
|
||||
lane(n, c),
|
||||
"{what}: texel {n} lane {c} stored {:#x}",
|
||||
img.texels[at][c]
|
||||
"{what}: texel {n} lane {c} stored {stored:#x}"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1512,15 +1512,13 @@ fn a_sampled_slot_joins_the_variant() {
|
||||
assert_eq!(named.variant, plan.variant, "{what} {name}");
|
||||
}
|
||||
}
|
||||
for (name, desc) in [("mixed", mixed)] {
|
||||
match plain.plan(&dev, &sampled_state(pf, desc).shape()) {
|
||||
Err(crate::error::BindError::Unsupported(u)) => assert_eq!(
|
||||
u,
|
||||
Unsupported::not_implemented(Feature::Format),
|
||||
"{what} {name}"
|
||||
),
|
||||
other => panic!("{what} {name}: {:?}", other.map(|_| ())),
|
||||
}
|
||||
match plain.plan(&dev, &sampled_state(pf, mixed).shape()) {
|
||||
Err(crate::error::BindError::Unsupported(u)) => assert_eq!(
|
||||
u,
|
||||
Unsupported::not_implemented(Feature::Format),
|
||||
"{what} mixed"
|
||||
),
|
||||
other => panic!("{what} mixed: {:?}", other.map(|_| ())),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -134,8 +134,8 @@ fn attachments(
|
||||
let mut unwritten = ColorAttachmentDescriptor::new(PixelFormat::RGBA16Float);
|
||||
unwritten.write_mask = ColorWriteMask::NONE;
|
||||
let mut r = RenderLinkInputs::new();
|
||||
for c in 0..=color + 1 {
|
||||
r.color_attachments[c] = Some(unwritten);
|
||||
for slot in r.color_attachments.iter_mut().take(color + 2) {
|
||||
*slot = Some(unwritten);
|
||||
}
|
||||
r.color_attachments[color] = Some(blended);
|
||||
r
|
||||
|
||||
@@ -920,8 +920,8 @@ fn without_the_extension_a_mesh_pipeline_draws_its_records() {
|
||||
let dev = device(&stem);
|
||||
let mut d = MeshPipelineDescriptor::new(stage(&draws, "mesh_draws_grid"));
|
||||
d.fragment = Some(stage(&draws, "mesh_draws_fragment"));
|
||||
for i in 0..2 {
|
||||
d.color_attachments[i] = Some(ColorAttachmentDescriptor::new(PixelFormat::RGBA32Uint));
|
||||
for slot in d.color_attachments.iter_mut().take(2) {
|
||||
*slot = Some(ColorAttachmentDescriptor::new(PixelFormat::RGBA32Uint));
|
||||
}
|
||||
let pipeline = dev
|
||||
.compile_mesh_pipeline(&d, &budget)
|
||||
@@ -1147,8 +1147,8 @@ fn object_records_draws(dev: &crate::device::Device, draws: &crate::library::Lib
|
||||
let mut d = MeshPipelineDescriptor::new(stage("mesh_draws_mesh"));
|
||||
d.object = Some(stage("mesh_draws_object"));
|
||||
d.fragment = Some(stage("mesh_draws_fragment"));
|
||||
for i in 0..2 {
|
||||
d.color_attachments[i] = Some(ColorAttachmentDescriptor::new(PixelFormat::RGBA32Uint));
|
||||
for slot in d.color_attachments.iter_mut().take(2) {
|
||||
*slot = Some(ColorAttachmentDescriptor::new(PixelFormat::RGBA32Uint));
|
||||
}
|
||||
let pipeline = dev
|
||||
.compile_mesh_pipeline(&d, &Budget::standard())
|
||||
@@ -2019,8 +2019,8 @@ fn a_last_first_mesh_draw_reads_its_corners_from_the_last() {
|
||||
let dev = device(&stem);
|
||||
let mut d = MeshPipelineDescriptor::new(stage("mesh_draws_grid"));
|
||||
d.fragment = Some(stage("mesh_draws_fragment"));
|
||||
for i in 0..2 {
|
||||
d.color_attachments[i] = Some(ColorAttachmentDescriptor::new(PixelFormat::RGBA32Uint));
|
||||
for slot in d.color_attachments.iter_mut().take(2) {
|
||||
*slot = Some(ColorAttachmentDescriptor::new(PixelFormat::RGBA32Uint));
|
||||
}
|
||||
let base = dev
|
||||
.compile_mesh_pipeline(&d, &budget)
|
||||
|
||||
@@ -83,8 +83,8 @@ fn pipeline(
|
||||
) -> RenderPipelineDescriptor {
|
||||
let mut d = RenderPipelineDescriptor::new(StageSource::Function(function(bc, vertex)));
|
||||
d.fragment = fragment.map(|f| StageSource::Function(function(bc, f)));
|
||||
for c in 0..colors {
|
||||
d.color_attachments[c] = Some(ColorAttachmentDescriptor::new(PixelFormat::RGBA32Uint));
|
||||
for slot in d.color_attachments.iter_mut().take(colors) {
|
||||
*slot = Some(ColorAttachmentDescriptor::new(PixelFormat::RGBA32Uint));
|
||||
}
|
||||
d
|
||||
}
|
||||
|
||||
@@ -111,8 +111,8 @@ fn render(
|
||||
};
|
||||
let mut d = RenderPipelineDescriptor::new(stage(VERTEX));
|
||||
d.fragment = Some(stage(fragment));
|
||||
for i in 0..count {
|
||||
d.color_attachments[i] = Some(ColorAttachmentDescriptor::new(format));
|
||||
for slot in d.color_attachments.iter_mut().take(count) {
|
||||
*slot = Some(ColorAttachmentDescriptor::new(format));
|
||||
}
|
||||
d.raster_sample_count = samples;
|
||||
d
|
||||
|
||||
@@ -10,8 +10,8 @@
|
||||
//!
|
||||
//! `scripts/api-signatures/signatures.py` derives the surface from the sources and
|
||||
//! `tests/api_signatures.tsv` is what it must derive. The derivation reads source text only: no
|
||||
//! build, no toolchain, and no rustdoc, whose JSON surface is nightly-only while this workspace
|
||||
//! is pinned to stable. So it gives the same answer under any feature set, and the run is seconds.
|
||||
//! build, no toolchain, and no rustdoc, whose JSON surface is unstable and changes between
|
||||
//! nightlies. So it gives the same answer under any feature set, and the run is seconds.
|
||||
//!
|
||||
//! A record is `kind<TAB>key<TAB>signature`. The kinds are the declaration itself (`struct`,
|
||||
//! `enum`, `fn`, `trait`, `type`, `const`, `static`), a public field or an enum variant (`field`,
|
||||
|
||||
+9
-6
@@ -1,10 +1,13 @@
|
||||
# The toolchain every build of this tree uses. It travels with the tree, so a worktree, a snapshot
|
||||
# or a fresh clone cannot silently take whatever `stable` happens to be on the machine — which is
|
||||
# how three lints that exist only in a later Rust were once reported as a broken `development`.
|
||||
# or a fresh clone cannot silently take whatever toolchain happens to be the machine's default —
|
||||
# which is how three lints that exist only in a later Rust were once reported as a broken
|
||||
# `development`.
|
||||
#
|
||||
# The channel is the MSRV the published crates promise in `rust-version`, so an ordinary build is
|
||||
# what checks that promise rather than a separate job nobody runs. Raising it is a deliberate,
|
||||
# fleet-wide step: it is a consumer-facing contract, not a local convenience.
|
||||
# A dated nightly, for rustc's parallel front end (`-Zthreads`, set in `.cargo/config.toml`) and
|
||||
# Cargo's profile rustflags. The date is fixed so every machine runs one rustc, clippy and rustfmt;
|
||||
# moving it is a deliberate, fleet-wide step. The published crates still promise the stable
|
||||
# `rust-version` in their manifests (1.98), which this build no longer checks by itself: clippy's
|
||||
# `incompatible_msrv` catches a standard-library item newer than it, not a language feature.
|
||||
[toolchain]
|
||||
channel = "1.98.1"
|
||||
channel = "nightly-2026-11-03"
|
||||
components = ["clippy", "rustfmt"]
|
||||
@@ -11,8 +11,8 @@
|
||||
blessing it asserts. Every verb takes `--root DIR` (the repository, the default being this
|
||||
script's own two directories up) and `--table FILE`.
|
||||
|
||||
It reads source text only: no build, no toolchain, no rustdoc, whose JSON surface is nightly-only
|
||||
while this fleet is pinned to stable. So it is the same five seconds on any checkout, under any
|
||||
It reads source text only: no build, no toolchain, no rustdoc, whose JSON surface is unstable and
|
||||
changes between nightlies. So it is the same five seconds on any checkout, under any
|
||||
feature set: a `#[cfg]`-gated item is read as present, with its gate kept in the signature.
|
||||
|
||||
The surface is the set of names a consumer may write -- the module roots the crates export, their
|
||||
|
||||
@@ -118,7 +118,6 @@ nextest_list() {
|
||||
shift 3
|
||||
( cd "$repo" \
|
||||
&& CARGO_TARGET_DIR="$target" \
|
||||
CARGO_INCREMENTAL=0 \
|
||||
RUSTFLAGS="$flags" \
|
||||
cargo nextest list --workspace --all-features $profile_args \
|
||||
--run-ignored all --message-format json --list-type full "$@" ) \
|
||||
@@ -193,7 +192,6 @@ while IFS="$(printf '\t')" read -r name binary terms; do
|
||||
status=0
|
||||
( cd "$repo" \
|
||||
&& CARGO_TARGET_DIR="$cfg_target" \
|
||||
CARGO_INCREMENTAL=0 \
|
||||
RUSTFLAGS="--cfg m2v_gpu" \
|
||||
cargo nextest run --no-run --workspace --all-features $profile_args \
|
||||
--hide-progress-bar -E "$expression" ) >> "$log" 2>&1 || status=$?
|
||||
@@ -206,7 +204,6 @@ while IFS="$(printf '\t')" read -r name binary terms; do
|
||||
started=$(date +%s)
|
||||
( cd "$repo" \
|
||||
&& CARGO_TARGET_DIR="$cfg_target" \
|
||||
CARGO_INCREMENTAL=0 \
|
||||
RUSTFLAGS="--cfg m2v_gpu" \
|
||||
${wrap_words:+$wrap_words} \
|
||||
cargo nextest run --workspace --all-features $profile_args \
|
||||
|
||||
@@ -113,7 +113,7 @@ FROM ubuntu:26.04@sha256:da6fc2be547864451aa253836dd926da33623312df4a9a243e35dc8
|
||||
# First, so nothing below runs (or compiles) while the mesa stage builds.
|
||||
COPY --from=mesa /opt/mesa /opt/mesa
|
||||
|
||||
ARG RUST_VERSION=1.98.1
|
||||
ARG RUST_VERSION=nightly-2026-11-03
|
||||
ARG NEXTEST_VERSION=0.9.140
|
||||
|
||||
ENV DEBIAN_FRONTEND=noninteractive \
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
# already ships and the build needs (a C toolchain for linking and bundled SQLite, clang for the
|
||||
# tests that probe it), `vulkan-tools` (vulkaninfo), and what the two source builds below need
|
||||
# (git, cmake, ninja).
|
||||
# - Rust: `dtolnay/rust-toolchain@stable` with rustfmt + clippy in CI; pinned here to the stable
|
||||
# release current when this recipe was written. Bump RUST_VERSION when CI's stable moves.
|
||||
# - Rust: the dated nightly `rust-toolchain.toml` names, with rustfmt + clippy, as in CI. Keep
|
||||
# RUST_VERSION equal to that file's channel.
|
||||
# - cargo-nextest: `taiki-e/install-action` installs the latest in CI; pinned here by
|
||||
# NEXTEST_VERSION and built from crates.io with its lockfile.
|
||||
# - SwiftShader (Google's CPU Vulkan ICD; Ubuntu does not package it): built from source at
|
||||
@@ -30,7 +30,7 @@
|
||||
# Changing this file changes the image tag `scripts/linux-gate` computes, so the next run rebuilds.
|
||||
FROM ubuntu:26.04@sha256:da6fc2be547864451aa253836dd926da33623312df4a9a243e35dc877c378a78
|
||||
|
||||
ARG RUST_VERSION=1.98.1
|
||||
ARG RUST_VERSION=nightly-2026-11-03
|
||||
ARG NEXTEST_VERSION=0.9.140
|
||||
|
||||
ENV DEBIAN_FRONTEND=noninteractive \
|
||||
|
||||
Executable
+9
@@ -0,0 +1,9 @@
|
||||
#!/bin/sh
|
||||
# Cargo's rustc wrapper for this workspace (`.cargo/config.toml`): Cargo runs it as
|
||||
# `rustc-wrapper RUSTC ARGS...`. It hands the compile to kache, a local compiler cache, where
|
||||
# kache is on PATH and the build is not CI's; anywhere else it runs the compiler itself. kache is a
|
||||
# tool on PATH, never a dependency, and its store stays on the machine.
|
||||
if [ -z "${CI:-}" ] && command -v kache >/dev/null 2>&1; then
|
||||
exec kache "$@"
|
||||
fi
|
||||
exec "$@"
|
||||
Reference in new issue
Block a user