Skip to content

Commit b56a767

Browse files
authored
Fixes FP rounding issue, adds tests and uses cargo hyperlight for building wasm_runtime (#166)
* Fixes FP rounding issue and adds tests The issue was caused becuase cranelift compilation assume SSE2 even for the where as rust compiler doesn't include these instructions by default. This means when transitioning through wasmtime libcalls the parameters are lost since wasm is using SSE2 instructions and wasmtime isn't. The more advance SSE intructions require a seperate pr in HL core that is needed to enable them. Signed-off-by: James Sturtevant <jsturtevant@gmail.com> * Updates for cargo plugin Signed-off-by: James Sturtevant <jsturtevant@gmail.com> * Update to use the new hyperlight cargo lib Signed-off-by: James Sturtevant <jsturtevant@gmail.com> * Fix left over debugging artifacts Signed-off-by: James Sturtevant <jsturtevant@gmail.com> * Update to lastest Hyperlight Signed-off-by: James Sturtevant <jsturtevant@gmail.com> * Use latest hyperlight cargo Signed-off-by: James Sturtevant <jsturtevant@gmail.com> --------- Signed-off-by: James Sturtevant <jsturtevant@gmail.com>
1 parent 92f1071 commit b56a767

File tree

17 files changed

+613
-458
lines changed

17 files changed

+613
-458
lines changed

.github/workflows/Benchmarks.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,6 @@ jobs:
3838
with:
3939
rust-toolchain: "1.89"
4040

41-
- name: Build Wasm Runtime Binary
42-
working-directory: ./src/hyperlight_wasm
43-
run: just build-wasm-runtime ${{ matrix.config }}
44-
4541
- uses: dtolnay/rust-toolchain@1.89
4642
with:
4743
components: clippy, rustfmt

.github/workflows/dep_rust.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,6 @@ jobs:
6767
if: runner.os == 'Windows'
6868
run: rustup component add --toolchain nightly-x86_64-pc-windows-msvc rustfmt
6969

70-
- name: Build Wasm Runtime Binary
71-
working-directory: ./src/hyperlight_wasm
72-
run: just build-wasm-runtime ${{ matrix.config }}
73-
7470
- name: Download Wasm Modules
7571
uses: actions/download-artifact@v5
7672
with:

.vscode/settings.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,10 @@
33
// This is needed to allow tests to find files when running under the debugger
44
"rust-analyzer.runnables.extraEnv": {
55
"RUST_DIR_FOR_DEBUGGING_TESTS": "${workspaceFolder}/src/hyperlight_wasm"
6-
}
6+
},
7+
8+
// Include wasm_runtime directory for rust-analyzer support
9+
"rust-analyzer.linkedProjects": [
10+
"${workspaceFolder}/src/wasm_runtime/Cargo.toml"
11+
]
712
}

Cargo.lock

Lines changed: 117 additions & 18 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
@@ -13,4 +13,4 @@ repository = "https://github.com/hyperlight-dev/hyperlight-wasm"
1313
readme = "README.md"
1414

1515
[workspace.dependencies]
16-
hyperlight-host = { version = "0.11.0", default-features = false, features = ["executable_heap", "init-paging"] }
16+
hyperlight-host = { version = "0.12.0", default-features = false, features = ["executable_heap", "init-paging"] }

Justfile

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,9 @@ ensure-tools:
1818
cargo install wasm-tools --locked --version 1.235.0
1919
cargo install cargo-component --locked --version 0.21.1
2020
cargo install wit-bindgen-cli --locked --version 0.43.0
21+
cargo install cargo-hyperlight --locked
2122

22-
build-all target=default-target features="": (build target features) (build-wasm-examples target features) (build-rust-wasm-examples target features) (build-rust-component-examples target) (build-wasm-runtime target features)
23+
build-all target=default-target features="": (build target features) (build-examples target features)
2324

2425
build target=default-target features="": (fmt-check)
2526
cargo build {{ if features =="" {''} else if features=="no-default-features" {"--no-default-features" } else {"--no-default-features -F " + features } }} --verbose --profile={{ if target == "debug" {"dev"} else { target } }}
@@ -32,10 +33,9 @@ compile-wit:
3233
wasm-tools component wit ./src/wasmsamples/components/runcomponent.wit -w -o ./src/wasmsamples/components/runcomponent-world.wasm
3334
wasm-tools component wit ./src/component_sample/wit/example.wit -w -o ./src/component_sample/wit/component-world.wasm
3435

35-
build-wasm-runtime target=default-target features="":
36-
cd ./src/wasm_runtime && cargo build --verbose {{ if features =="" {''} else if features=="no-default-features" {"--no-default-features" } else {"--features " + features } }} --profile={{ if target == "debug" {"dev"} else { target } }} && rm -R target
36+
build-examples target=default-target features="": (build-wasm-examples target features) (build-rust-wasm-examples target features) (build-rust-component-examples target features)
3737

38-
build-wasm-examples target=default-target features="": (compile-wit)
38+
build-wasm-examples target=default-target features="": (compile-wit)
3939
{{ build-wasm-examples-command }} {{target}} {{features}}
4040

4141
build-rust-wasm-examples target=default-target features="": (mkdir-redist target)
@@ -54,7 +54,7 @@ check target=default-target:
5454
cargo check --profile={{ if target == "debug" {"dev"} else { target } }}
5555
cd src/rust_wasm_samples && cargo check --profile={{ if target == "debug" {"dev"} else { target } }}
5656
cd src/component_sample && cargo check --profile={{ if target == "debug" {"dev"} else { target } }}
57-
cd src/wasm_runtime && cargo check --profile={{ if target == "debug" {"dev"} else { target } }}
57+
cd src/wasm_runtime && cargo hyperlight check --profile={{ if target == "debug" {"dev"} else { target } }}
5858
cd src/hyperlight_wasm_macro && cargo check --profile={{ if target == "debug" {"dev"} else { target } }}
5959

6060
fmt-check:
@@ -79,7 +79,7 @@ clippy target=default-target: (check target)
7979
cargo clippy --profile={{ if target == "debug" {"dev"} else { target } }} --all-targets --all-features -- -D warnings
8080
cd src/rust_wasm_samples && cargo clippy --profile={{ if target == "debug" {"dev"} else { target } }} --all-targets --all-features -- -D warnings
8181
cd src/component_sample && cargo clippy --profile={{ if target == "debug" {"dev"} else { target } }} --all-targets --all-features -- -D warnings
82-
cd src/wasm_runtime && cargo clippy --profile={{ if target == "debug" {"dev"} else { target } }} --all-targets --all-features -- -D warnings
82+
cd src/wasm_runtime && cargo hyperlight clippy --profile={{ if target == "debug" {"dev"} else { target } }} --all-targets --all-features -- -D warnings
8383
cd src/hyperlight_wasm_macro && cargo clippy --profile={{ if target == "debug" {"dev"} else { target } }} --all-targets --all-features -- -D warnings
8484

8585
# TESTING
@@ -100,7 +100,8 @@ examples-ci target=default-target features="": (build-rust-wasm-examples target)
100100
cargo run {{ if features =="" {"--no-default-features --features kvm,mshv3"} else {"--no-default-features -F function_call_metrics," + features } }} --profile={{ if target == "debug" {"dev"} else { target } }} --example metrics
101101

102102
examples-components target=default-target features="": (build-rust-component-examples target)
103-
{{ wit-world }} cargo run {{ if features =="" {''} else {"--no-default-features -F " + features } }} --profile={{ if target == "debug" {"dev"} else { target } }} --example component_example
103+
{{ wit-world }} cargo run {{ if features =="" {''} else {"--no-default-features -F kvm -F " + features } }} --profile={{ if target == "debug" {"dev"} else { target } }} --example component_example
104+
{{ wit-world-c }} cargo run {{ if features =="" {''} else {"--no-default-features -F kvm -F " + features } }} --profile={{ if target == "debug" {"dev"} else { target } }} --example c-component
104105

105106
# warning, compares to and then OVERWRITES the given baseline
106107
bench-ci baseline target="release" features="":

src/hyperlight_wasm/Cargo.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ hyperlight-host = { workspace = true }
6464
libc = { version = "0.2.178" }
6565
once_cell = "1.21.3"
6666
tracing = "0.1.43"
67-
log = "0.4.29"
67+
log = "0.4"
6868
cfg-if = { version = "1" }
6969
metrics = "0.24.3"
7070
env_logger = "0.11.8"
@@ -74,7 +74,7 @@ windows = { version = "0.62", features = ["Win32_System_Threading"] }
7474
page_size = "0.6.0"
7575

7676
[dev-dependencies]
77-
hyperlight-component-macro = { version = "0.11.0" }
77+
hyperlight-component-macro = { version = "0.12.0" }
7878
examples_common = { path = "../examples_common" }
7979
criterion = { version = "0.8.1", features = ["html_reports"] }
8080
crossbeam-queue = "0.3"
@@ -101,6 +101,7 @@ built = { version = "0.8.0", features = ["chrono", "git2"] }
101101
anyhow = { version = "1.0" }
102102
goblin = "0.10.4"
103103
tar = "0.4.44"
104+
cargo-hyperlight = "0.1.4"
104105

105106
[target.'cfg(windows)'.build-dependencies]
106107
junction = "1"

0 commit comments

Comments
 (0)