Skip to content

Run AArch64 Winch tests on CI #10738

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

Closed
Show file tree
Hide file tree
Changes from all 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
77 changes: 74 additions & 3 deletions crates/test-util/src/wast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,8 @@ impl Compiler {
|| config.gc_types()
|| config.exceptions()
|| config.legacy_exceptions()
|| (cfg!(target_arch = "aarch64")
&& (config.simd() || config.threads() || config.wide_arithmetic()))
}

Compiler::CraneliftPulley => config.threads() || config.legacy_exceptions(),
Expand All @@ -365,9 +367,7 @@ impl Compiler {
|| cfg!(target_arch = "riscv64")
|| cfg!(target_arch = "s390x")
}
Compiler::Winch => {
cfg!(target_arch = "x86_64")
}
Compiler::Winch => cfg!(target_arch = "x86_64") || cfg!(target_arch = "aarch64"),
Compiler::CraneliftPulley => true,
}
}
Expand All @@ -392,6 +392,47 @@ impl WastTest {
spec_proposal_from_path(&self.path)
}

/// Returns whether this test should be skipped with this configuration
/// entirely, not running it at all.
///
/// Ideally all tests should be run at all times, even if they're expected
/// to fail. This ensures that the expected failure is a controlled
/// failure, for example an error is returned, which is more desirable than
/// a panic or a segfault/crash. As implementations progress, however,
/// tests will naturally crash when an implementation is not yet complete
/// or fully finished. In the interest of still getting at least some test
/// coverage, however, this is an escape hatch to avoid running a test
/// entirely.
///
/// Where possible avoid putting tests here. Instead add known and/or
/// expected failures to `should_fail`. Adding to `should_fail` means that
/// if a test is actually implemented then it'll require updating that
/// method to indicate that we expect success, not failure. Adding a test
/// here, however, means that someone will have to proactively review this
/// in the future to ensure that tests are removed here to start running
/// the tests.
pub fn should_skip_entirely(&self, config: &WastConfig) -> bool {
// FIXME(#8321): Winch on AArch64 is not yet fully complete. Most tests
// pass, there are some misc failures listed below, and this is a list
// of known tests that crash and thus cannot be run.
if config.compiler == Compiler::Winch && cfg!(target_arch = "aarch64") {
let unsupported = [
// different pass/fail result in release/debug mdoe
"misc_testsuite/issue4890.wast",
"misc_testsuite/memory64/offsets.wast",
// crashes, unsure why
"misc_testsuite/table_copy_on_imported_tables.wast",
// stack checks not implemented yet
"misc_testsuite/stack_overflow.wast",
];
if unsupported.iter().any(|part| self.path.ends_with(part)) {
return true;
}
}

false
}

/// Returns whether this test should fail under the specified extra
/// configuration.
pub fn should_fail(&self, config: &WastConfig) -> bool {
Expand Down Expand Up @@ -470,6 +511,36 @@ impl WastTest {
return true;
}

// FIXME(#8321): Winch on AArch64 is not yet fully complete, these
// are currently tests that are known and expected to fail due to
// unimplemented features and/or bugs.
if cfg!(target_arch = "aarch64") {
let unsupported = [
"misc_testsuite/call_indirect.wast",
"misc_testsuite/component-model/fused.wast",
"misc_testsuite/custom-page-sizes/custom-page-sizes.wast",
"misc_testsuite/float-round-doesnt-load-too-much.wast",
"misc_testsuite/imported-memory-copy.wast",
"misc_testsuite/issue4840.wast",
"misc_testsuite/memory-copy.wast",
"misc_testsuite/multi-memory/simple.wast",
"misc_testsuite/partial-init-memory-segment.wast",
"misc_testsuite/sink-float-but-dont-trap.wast",
"misc_testsuite/stack_overflow.wast",
"misc_testsuite/table_copy_on_imported_tables.wast",
"misc_testsuite/winch/global.wast",
"misc_testsuite/winch/select.wast",
"misc_testsuite/winch/table_fill.wast",
"misc_testsuite/winch/table_get.wast",
"misc_testsuite/winch/table_grow.wast",
"misc_testsuite/winch/table_set.wast",
"spec_testsuite/proposals/custom-page-sizes/custom-page-sizes.wast",
];
if unsupported.iter().any(|part| self.path.ends_with(part)) {
return true;
}
}

// SIMD on Winch requires AVX instructions.
#[cfg(target_arch = "x86_64")]
if !(std::is_x86_feature_detected!("avx") && std::is_x86_feature_detected!("avx2")) {
Expand Down
8 changes: 4 additions & 4 deletions crates/wasmtime/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2047,10 +2047,10 @@ impl Config {
// no support for simd on aarch64
unsupported |= WasmFeatures::SIMD;

// things like multi-table are technically supported on
// winch on aarch64 but this helps gate most spec tests
// by default which otherwise currently cause panics.
unsupported |= WasmFeatures::REFERENCE_TYPES;
// not implemented yet
unsupported |= WasmFeatures::WIDE_ARITHMETIC;

// also not implemented yet.
unsupported |= WasmFeatures::THREADS
}

Expand Down
4 changes: 4 additions & 0 deletions docs/stability-wasm-proposals.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,10 @@ For each column in the above tables, this is a further explanation of its meanin
must pass at least for Cranelift on all [tier 1](./stability-tiers.md)
platforms, but missing other platforms is otherwise acceptable.

> For maintainers be sure to audit the `WastTest::should_skip_entirely`
> method to ensure that there are no tests which are listed there for this
> feature. If so remove them to ensure that the test is run on CI.

* **Finished** - No open questions, design concerns, or serious known bugs. The
implementation should be complete to the extent that is possible. Support
must be implemented for all [tier 1](./stability-tiers.md) targets and
Expand Down
4 changes: 4 additions & 0 deletions tests/wast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ fn main() {
let mut trials = Vec::new();

let mut add_trial = |test: &WastTest, config: WastConfig| {
if test.should_skip_entirely(&config) {
return;
}

let trial = Trial::test(
format!(
"{:?}/{}{}{}",
Expand Down
8 changes: 6 additions & 2 deletions winch/codegen/src/isa/aarch64/masm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -387,8 +387,12 @@ impl Masm for MacroAssembler {
cc: IntCmpKind,
_size: OperandSize,
) -> Result<()> {
self.asm.csel(src, dst.to_reg(), dst, Cond::from(cc));
Ok(())
match (src.class(), dst.to_reg().class()) {
(RegClass::Int, RegClass::Int) => {
Ok(self.asm.csel(src, dst.to_reg(), dst, Cond::from(cc)))
}
_ => Err(anyhow!(CodeGenError::invalid_operand_combination())),
}
}

fn add(&mut self, dst: WritableReg, lhs: Reg, rhs: RegImm, size: OperandSize) -> Result<()> {
Expand Down