Skip to content

Commit

Permalink
Merge pull request bytecodealliance#67 from dhil/wasmfx-merge
Browse files Browse the repository at this point in the history
Merge with upstream
  • Loading branch information
dhil authored Dec 14, 2023
2 parents 6ed3e1d + 03df591 commit 362e31c
Show file tree
Hide file tree
Showing 103 changed files with 1,698 additions and 640 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/cargo-audit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
if: github.repository == 'bytecodealliance/wasmtime'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: true
- uses: actions-rs/audit-check@v1
Expand Down
36 changes: 18 additions & 18 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
name: Rustfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: true
- uses: ./.github/actions/install-rust
Expand All @@ -60,7 +60,7 @@ jobs:
name: Clang format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: true
- run: git ls-files '*.h' '*.c' '*.cpp' | xargs clang-format-15 --dry-run --Werror --verbose
Expand All @@ -79,7 +79,7 @@ jobs:
if: needs.determine.outputs.audit
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: true
- uses: ./.github/actions/install-rust
Expand All @@ -103,7 +103,7 @@ jobs:
if: needs.determine.outputs.audit
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: true
- uses: ./.github/actions/install-rust
Expand Down Expand Up @@ -138,7 +138,7 @@ jobs:
audit: ${{ steps.calculate.outputs.audit }}
preview1-adapter: ${{ steps.calculate.outputs.preview1-adapter }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- id: calculate
env:
GH_TOKEN: ${{ github.token }}
Expand Down Expand Up @@ -202,7 +202,7 @@ jobs:
RUSTDOCFLAGS: -Dbroken_intra_doc_links --cfg nightlydoc
OPENVINO_SKIP_LINKING: 1
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: true
- uses: ./.github/actions/install-rust
Expand Down Expand Up @@ -269,7 +269,7 @@ jobs:
env:
CARGO_NDK_VERSION: 2.12.2
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: true
- uses: ./.github/actions/install-rust
Expand Down Expand Up @@ -351,7 +351,7 @@ jobs:
name: Check Windows ARM64
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: true
- uses: ./.github/actions/install-rust
Expand All @@ -371,7 +371,7 @@ jobs:
name: Fuzz Targets
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: true
# Note that building with fuzzers requires nightly since it uses unstable
Expand Down Expand Up @@ -410,7 +410,7 @@ jobs:
fail-fast: ${{ github.event_name != 'pull_request' }}
matrix: ${{ fromJson(needs.determine.outputs.test-matrix) }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: true
- uses: ./.github/actions/install-rust
Expand Down Expand Up @@ -529,7 +529,7 @@ jobs:
name: Test wasi-nn module
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: true
- uses: ./.github/actions/install-rust
Expand Down Expand Up @@ -557,7 +557,7 @@ jobs:
deployments: write
contents: write
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: true
- run: rustup update stable && rustup default stable
Expand Down Expand Up @@ -591,7 +591,7 @@ jobs:
name: Run benchmarks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: true
- uses: ./.github/actions/install-rust
Expand All @@ -611,7 +611,7 @@ jobs:
name: Meta deterministic check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: true
- uses: ./.github/actions/install-rust
Expand All @@ -629,7 +629,7 @@ jobs:
if: github.repository == 'bytecodealliance/wasmtime' && needs.determine.outputs.run-full
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: true
- run: rustup update stable && rustup default stable
Expand Down Expand Up @@ -667,7 +667,7 @@ jobs:
env:
CARGO_NEXTEST_VERSION: 0.9.51
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: true
- uses: ./.github/actions/install-rust
Expand Down Expand Up @@ -709,7 +709,7 @@ jobs:
fail-fast: ${{ github.event_name != 'pull_request' }}
matrix: ${{ fromJson(needs.determine.outputs.build-matrix) }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: true

Expand Down Expand Up @@ -824,7 +824,7 @@ jobs:
&& startsWith(github.ref, 'refs/heads/release-')
&& github.repository == 'bytecodealliance/wasmtime'
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 0
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/performance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ jobs:
cargo build --release
- name: Checkout patch from bytecodealliance/wasmtime (pushed and triggering on this perf repo)
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
submodules: true
path: wasmtime_commit
Expand All @@ -89,7 +89,7 @@ jobs:
cp target/release/libwasmtime_bench_api.so /tmp/wasmtime_commit.so
- name: Checkout main from bytecodealliance/wasmtime
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: 'main'
repository: 'bytecodealliance/wasmtime'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-artifacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-latest
if: github.repository == 'bytecodealliance/wasmtime'
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- run: |
sha=${{ github.sha }}
run_id=$(
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-to-cratesio.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
if: github.repository == 'bytecodealliance/wasmtime'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: true
- run: rustup update stable && rustup default stable
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-process.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
name: Run the release process
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: true
- name: Setup
Expand Down
61 changes: 61 additions & 0 deletions RELEASES.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,69 @@ Unreleased.

### Added

* Add yielding support in `wasmtime_store_epoch_deadline_callback` in the C API.
[#7476](https://github.com/bytecodealliance/wasmtime/pull/7476)

* Support for the `wasi_unstable` module ("wasi preview0" canonically) has been
added to the `-Spreview2` support in the CLI.
[#7548](https://github.com/bytecodealliance/wasmtime/pull/7548)

* The original module can now be obtained from an "instance pre" in the C API.
[#7572](https://github.com/bytecodealliance/wasmtime/pull/7572)

* Usage of Mach ports on macOS can now be disabled in the C API.
[#7595](https://github.com/bytecodealliance/wasmtime/pull/7595)

### Changed

* The preview1-to-preview2 component adapters now import a smaller number of
interfaces by default.
[#7543](https://github.com/bytecodealliance/wasmtime/pull/7543)
[#7544](https://github.com/bytecodealliance/wasmtime/pull/7544)

* Wasmtime and Cranelift now require Rust 1.72.0 to build.
[#7554](https://github.com/bytecodealliance/wasmtime/pull/7554)

* The default `world` supported by `wasmtime serve` has been slimmed down to
exactly what `wasi:http/proxy` specifies by default. Support for other WASI
APIs can be included with the `-S common` command-line flag.
[#7597](https://github.com/bytecodealliance/wasmtime/pull/7597)

* The `wasmtime --version` CLI output will now include date/commit information
when Wasmtime is built from a git checkout.
[#7610](https://github.com/bytecodealliance/wasmtime/pull/7610)

### Fixed

* MPK support is now explicitly disabled on AMD-based CPUs since the
implementation does not currently support it.
[#7513](https://github.com/bytecodealliance/wasmtime/pull/7513)

* Initialization of a WebAssembly data segment with a negative offset is fixed
to zero-extend the offset instead of sign-extend.
[#7559](https://github.com/bytecodealliance/wasmtime/pull/7559)

* The reported offset of `O_APPEND` files in preview1 has been fixed.
[#7586](https://github.com/bytecodealliance/wasmtime/pull/7586)

* MPK support does a better job of compacting memories to minimize virtual
memory used.
[#7622](https://github.com/bytecodealliance/wasmtime/pull/7622)

### Cranelift

* Union node bitpacking has been fixed with egraph optimizations to ensure the
minimal cost node is selected.
[#7465](https://github.com/bytecodealliance/wasmtime/pull/7465)

* Equivalent-cost expressions now have ties broken with expression depth in
egraphs to prefer "shallow" expression trees.
[#7456](https://github.com/bytecodealliance/wasmtime/pull/7456)

* Long-and-narrow chains of expressions are now optimized into shallow-and-wide
trees.
[#7466](https://github.com/bytecodealliance/wasmtime/pull/7466)

--------------------------------------------------------------------------------

## 15.0.1
Expand Down
6 changes: 5 additions & 1 deletion cranelift/codegen/src/isa/aarch64/inst.isle
Original file line number Diff line number Diff line change
Expand Up @@ -1709,6 +1709,9 @@
(decl pure partial imm_logic_from_u64 (Type u64) ImmLogic)
(extern constructor imm_logic_from_u64 imm_logic_from_u64)

(decl pure partial imm_size_from_type (Type) u16)
(extern constructor imm_size_from_type imm_size_from_type)

(decl pure partial imm_logic_from_imm64 (Type Imm64) ImmLogic)
(extern constructor imm_logic_from_imm64 imm_logic_from_imm64)

Expand Down Expand Up @@ -2938,9 +2941,10 @@
;; we only match when we are zero-extending the value.
(rule 1 (imm (integral_ty ty) (ImmExtend.Zero) k)
(if-let n (imm_logic_from_u64 ty k))
(if-let m (imm_size_from_type ty))
(add_range_fact
(orr_imm ty (zero_reg) n)
64 k k))
m k k))

(decl load_constant64_full (Type ImmExtend u64) Reg)
(extern constructor load_constant64_full load_constant64_full)
Expand Down
10 changes: 9 additions & 1 deletion cranelift/codegen/src/isa/aarch64/lower/isle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,14 @@ impl Context for IsleContext<'_, '_, MInst, AArch64Backend> {
ImmLogic::maybe_from_u64(n, ty)
}

fn imm_size_from_type(&mut self, ty: Type) -> Option<u16> {
match ty {
I32 => Some(32),
I64 => Some(64),
_ => None,
}
}

fn imm_logic_from_imm64(&mut self, ty: Type, n: Imm64) -> Option<ImmLogic> {
let ty = if ty.bits() < 32 { I32 } else { ty };
self.imm_logic_from_u64(ty, n.bits() as u64)
Expand Down Expand Up @@ -395,7 +403,7 @@ impl Context for IsleContext<'_, '_, MInst, AArch64Backend> {
size,
});
if pcc {
running_value = !(imm16 << shift);
running_value = !(u64::from(imm.bits) << shift);
self.lower_ctx.add_range_fact(
rd.to_reg(),
64,
Expand Down
12 changes: 0 additions & 12 deletions cranelift/codegen/src/isle_prelude.rs
Original file line number Diff line number Diff line change
Expand Up @@ -734,18 +734,6 @@ macro_rules! isle_common_prelude_methods {
Imm64::new((x & self.ty_mask(ty)) as i64)
}

#[inline]
fn simm32(&mut self, x: Imm64) -> Option<i32> {
i64::from(x).try_into().ok()
}

#[inline]
fn uimm8(&mut self, x: Imm64) -> Option<u8> {
let x64: i64 = x.into();
let x8: u8 = x64.try_into().ok()?;
Some(x8)
}

#[inline]
fn offset32(&mut self, x: Offset32) -> i32 {
x.into()
Expand Down
12 changes: 12 additions & 0 deletions cranelift/codegen/src/machinst/isle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -562,6 +562,18 @@ macro_rules! isle_lower_prelude_methods {
Some(value)
}

#[inline]
fn simm32(&mut self, x: Imm64) -> Option<i32> {
i64::from(x).try_into().ok()
}

#[inline]
fn uimm8(&mut self, x: Imm64) -> Option<u8> {
let x64: i64 = x.into();
let x8: u8 = x64.try_into().ok()?;
Some(x8)
}

#[inline]
fn preg_to_reg(&mut self, preg: PReg) -> Reg {
preg.into()
Expand Down
3 changes: 1 addition & 2 deletions cranelift/codegen/src/machinst/pcc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ use crate::trace;

pub(crate) fn get_fact_or_default<I: VCodeInst>(vcode: &VCode<I>, reg: Reg, width: u16) -> Fact {
trace!(
"get_fact_or_default: reg v{} -> {:?}",
reg.to_virtual_reg().unwrap().index(),
"get_fact_or_default: reg {reg:?} -> {:?}",
vcode.vreg_fact(reg.into())
);
vcode
Expand Down
Loading

0 comments on commit 362e31c

Please sign in to comment.