Skip to content

Commit 3f694ae

Browse files
authored
Use stable Rust on CI to test the x64 backend (#2766)
* Use stable Rust on CI to test the x64 backend This commit leverages the newly-released 1.51.0 compiler to test the new backend on Windows and Linux with a stable compiler instead of a nightly compiler. This isolates the nightly build to just the nightly documentation generation and fuzzing, both of which rely on nightly for the best results right now. * Use updated stable in book build job * Run rustfmt for new stable * Silence new warnings for wasi-nn * Allow some dead code in the x64 backend Looks like new rustc is better about emitting some dead-code warnings * Update rust in peepmatic job * Fix a test in the pooling allocator * Remove `package.metdata.docs.rs` temporarily Needs resolution of rust-lang/cargo#9300 first * Fix a warning in a wasi-nn example
1 parent 55006b5 commit 3f694ae

File tree

12 files changed

+31
-44
lines changed

12 files changed

+31
-44
lines changed

.github/workflows/main.yml

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ jobs:
4848
- uses: actions/checkout@v2
4949
with:
5050
submodules: true
51+
- run: rustup update stable && rustup default stable
5152
- run: |
5253
set -e
5354
curl -L https://github.com/rust-lang-nursery/mdBook/releases/download/v0.4.4/mdbook-v0.4.4-x86_64-unknown-linux-gnu.tar.gz | tar xzf -
@@ -73,11 +74,9 @@ jobs:
7374
- uses: actions/checkout@v2
7475
with:
7576
submodules: true
76-
# Note that we use nightly Rust for the doc_cfg feature (enabled via `nightlydoc` above)
77-
# This version is an older nightly for the new x64 backend (see below)
7877
- uses: ./.github/actions/install-rust
7978
with:
80-
toolchain: nightly-2020-12-26
79+
toolchain: nightly
8180
- run: cargo doc --no-deps --all --exclude wasmtime-cli --exclude test-programs --exclude cranelift-codegen-meta
8281
- run: cargo doc --package cranelift-codegen-meta --document-private-items
8382
- uses: actions/upload-artifact@v1
@@ -178,6 +177,7 @@ jobs:
178177
- uses: actions/checkout@v2
179178
with:
180179
submodules: true
180+
- run: rustup update stable && rustup default stable
181181
- name: Test `peepmatic`
182182
run: |
183183
cargo test \
@@ -321,10 +321,7 @@ jobs:
321321
RUST_BACKTRACE: 1
322322

323323
# Perform all tests (debug mode) for `wasmtime` with the experimental x64
324-
# backend. This runs on an older nightly of Rust (because of issues with
325-
# unifying Cargo features on stable) on Ubuntu such that it's new enough
326-
# to build Wasmtime, but old enough where the -Z options being used
327-
# haven't been stabilized yet.
324+
# backend.
328325
test_x64:
329326
name: Test x64 new backend
330327
runs-on: ubuntu-latest
@@ -334,7 +331,7 @@ jobs:
334331
submodules: true
335332
- uses: ./.github/actions/install-rust
336333
with:
337-
toolchain: nightly-2020-12-26
334+
toolchain: stable
338335
- uses: ./.github/actions/define-llvm-env
339336

340337
# Install wasm32 targets in order to build various tests throughout the
@@ -345,7 +342,6 @@ jobs:
345342
# Run the x64 CI script.
346343
- run: ./ci/run-experimental-x64-ci.sh
347344
env:
348-
CARGO_VERSION: "+nightly-2020-12-26"
349345
RUST_BACKTRACE: 1
350346

351347
# Perform tests on the new x64 backend on Windows as well.
@@ -357,8 +353,6 @@ jobs:
357353
with:
358354
submodules: true
359355
- uses: ./.github/actions/install-rust
360-
with:
361-
toolchain: nightly-2020-11-29
362356
- uses: ./.github/actions/define-llvm-env
363357

364358
- name: Install libclang
@@ -378,7 +372,6 @@ jobs:
378372
# Run the x64 CI script.
379373
- run: ./ci/run-experimental-x64-ci.sh
380374
env:
381-
CARGO_VERSION: "+nightly-2020-11-29"
382375
RUST_BACKTRACE: 1
383376

384377
# Build and test the wasi-nn module.
@@ -390,8 +383,6 @@ jobs:
390383
with:
391384
submodules: true
392385
- uses: ./.github/actions/install-rust
393-
with:
394-
toolchain: nightly
395386
- run: rustup target add wasm32-wasi
396387
- uses: ./.github/actions/install-openvino
397388
- run: ./ci/run-wasi-nn-example.sh

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ anyhow = "1.0.19"
6666
opt-level = 0
6767

6868
[workspace]
69+
resolver = '2'
6970
members = [
7071
"cranelift",
7172
"crates/bench-api",

ci/run-experimental-x64-ci.sh

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,7 @@
11
#!/bin/bash
22

3-
# Use the Nightly variant of the compiler to properly unify the
4-
# experimental_x64 feature across all crates. Once the feature has stabilized
5-
# and become the default, we can remove this.
6-
CARGO_VERSION=${CARGO_VERSION:-"+nightly"}
7-
8-
# Some WASI tests seem to have an issue on Windows with symlinks if we run them
9-
# with this particular invocation. It's unclear why (nightly toolchain?) but
10-
# we're moving to the new backend by default soon enough, and all tests seem to
11-
# work with the main test setup, so let's just work around this by skipping
12-
# the tests for now.
13-
MINGW_EXTRA=""
14-
if [ `uname -o` == "Msys" ]; then
15-
MINGW_EXTRA="-- --skip wasi_cap_std_sync"
16-
fi
17-
18-
cargo $CARGO_VERSION \
3+
cargo test \
194
--locked \
20-
-Zfeatures=all -Zpackage-features \
21-
test \
225
--features test-programs/test_programs \
236
--features experimental_x64 \
247
--all \
@@ -32,5 +15,4 @@ cargo $CARGO_VERSION \
3215
--exclude peepmatic-runtime \
3316
--exclude peepmatic-test \
3417
--exclude peepmatic-souper \
35-
--exclude lightbeam \
36-
$MINGW_EXTRA
18+
--exclude lightbeam

cranelift/codegen/meta/Cargo.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@ repository = "https://github.com/bytecodealliance/wasmtime"
88
readme = "README.md"
99
edition = "2018"
1010

11-
[package.metadata.docs.rs]
12-
rustdoc-args = [ "--document-private-items" ]
11+
# FIXME(rust-lang/cargo#9300): uncomment once that lands
12+
# [package.metadata.docs.rs]
13+
# rustdoc-args = [ "--document-private-items" ]
1314

1415
[dependencies]
1516
cranelift-codegen-shared = { path = "../shared", version = "0.72.0" }

cranelift/codegen/src/isa/x64/inst/args.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -462,6 +462,7 @@ pub(crate) enum InstructionSet {
462462

463463
/// Some SSE operations requiring 2 operands r/m and r.
464464
#[derive(Clone, Copy, PartialEq)]
465+
#[allow(dead_code)] // some variants here aren't used just yet
465466
pub enum SseOpcode {
466467
Addps,
467468
Addpd,

cranelift/codegen/src/isa/x64/lower.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,7 @@ enum ExtSpec {
204204
ZeroExtendTo32,
205205
ZeroExtendTo64,
206206
SignExtendTo32,
207+
#[allow(dead_code)] // not used just yet but may be used in the future!
207208
SignExtendTo64,
208209
}
209210

cranelift/peepmatic/crates/automata/Cargo.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@ edition = "2018"
66
license = "Apache-2.0 WITH LLVM-exception"
77
description = "Finite-state transducer automata"
88

9-
[package.metadata.docs.rs]
10-
all-features = true
9+
# FIXME(rust-lang/cargo#9300): uncomment once that lands
10+
# [package.metadata.docs.rs]
11+
# all-features = true
1112

1213
[dependencies]
1314
serde = { version = "1.0.106", optional = true }

crates/jit/src/unwind/systemv.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,10 @@ impl UnwindRegistry {
9090
let mut eh_frame = EhFrame(EndianVec::new(RunTimeEndian::default()));
9191
table.write_eh_frame(&mut eh_frame).unwrap();
9292

93-
if cfg!(any(all(target_os = "linux", target_env = "gnu"), target_os = "freebsd")) {
93+
if cfg!(any(
94+
all(target_os = "linux", target_env = "gnu"),
95+
target_os = "freebsd"
96+
)) {
9497
// libgcc expects a terminating "empty" length, so write a 0 length at the end of the table.
9598
eh_frame.0.write_u32(0).unwrap();
9699
}
@@ -101,7 +104,10 @@ impl UnwindRegistry {
101104
}
102105

103106
unsafe fn register_frames(&mut self) {
104-
if cfg!(any(all(target_os = "linux", target_env = "gnu"), target_os = "freebsd")) {
107+
if cfg!(any(
108+
all(target_os = "linux", target_env = "gnu"),
109+
target_os = "freebsd"
110+
)) {
105111
// On gnu (libgcc), `__register_frame` will walk the FDEs until an entry of length 0
106112
let ptr = self.frame_table.as_ptr();
107113
__register_frame(ptr);

crates/runtime/src/instance/allocator/pooling.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1618,7 +1618,7 @@ mod test {
16181618
}
16191619

16201620
#[cfg_attr(target_arch = "aarch64", ignore)] // https://github.com/bytecodealliance/wasmtime/pull/2518#issuecomment-747280133
1621-
#[cfg(all(unix, target_pointer_width = "64"))]
1621+
#[cfg(all(unix, target_pointer_width = "64", feature = "async"))]
16221622
#[test]
16231623
fn test_stack_zeroed() -> Result<()> {
16241624
let allocator = PoolingInstanceAllocator::new(

crates/wasi-nn/examples/classification-example/src/main.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ pub fn main() {
4949
0,
5050
&mut output_buffer[..] as *mut [f32] as *mut u8,
5151
(output_buffer.len() * 4).try_into().unwrap(),
52-
);
52+
)
53+
.unwrap();
5354
}
5455
println!(
5556
"Found results, sorted top 5: {:?}",

0 commit comments

Comments
 (0)