Skip to content

Commit

Permalink
Use wasm32-wasip1 instead of wasm32-wasi target for rust code (#4057)
Browse files Browse the repository at this point in the history
Rust compiler previously deprecated, and now removed the wasm32-wasi target and replaced it with wasm32-wasip1. This
change updates all the occurrences of wasm32-wasi in the context of Rust compilation.

covers the wasi-nn/test.
  • Loading branch information
loganek authored Feb 5, 2025
1 parent 7f1e612 commit b2c7cb2
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/compilation_on_android_ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -675,7 +675,7 @@ jobs:
test_option: $MEMORY64_TEST_OPTIONS
- running_mode: "multi-tier-jit"
test_option: $MEMORY64_TEST_OPTIONS
# aot, fast-interp, fast-jit, llvm-jit, multi-tier-jit don't support Multi Memory
# aot, fast-interp, fast-jit, llvm-jit, multi-tier-jit don't support Multi Memory
- running_mode: "aot"
test_option: $MULTI_MEMORY_TEST_OPTIONS
- running_mode: "fast-interp"
Expand Down
18 changes: 9 additions & 9 deletions core/iwasm/libraries/wasi-nn/test/Dockerfile.wasi-nn-smoke
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ RUN apt-get update \
&& apt-get upgrade -y \
&& apt-get install -y --no-install-recommends cmake

RUN rustup target add wasm32-wasi
RUN rustup target add wasm32-wasip1

#
# Openvino
Expand All @@ -37,10 +37,10 @@ WORKDIR /workspaces/wasi-nn
RUN git clone --depth 1 https://github.com/bytecodealliance/wasi-nn.git .

WORKDIR /workspaces/wasi-nn/rust/examples/classification-example/
RUN cargo build --target=wasm32-wasi
RUN cargo build --target=wasm32-wasip1

WORKDIR /workspaces/wasi-nn/rust/examples/classification-example/build
RUN cp ../target/wasm32-wasi/debug/wasi-nn-example.wasm . \
RUN cp ../target/wasm32-wasip1/debug/wasi-nn-example.wasm . \
&& wget -q --no-clobber https://github.com/intel/openvino-rs/raw/main/crates/openvino/tests/fixtures/mobilenet/mobilenet.xml \
&& wget -q --no-clobber https://github.com/intel/openvino-rs/raw/main/crates/openvino/tests/fixtures/mobilenet/mobilenet.bin
# There are model files(mobilenet*) and wasm files(wasi-nn-example.wasm) in the directory,
Expand All @@ -67,30 +67,30 @@ RUN git apply ./bump_wasi_nn_to_0_6_0.patch
# recompile with wasi-nn 0.6.0
WORKDIR /workspaces/wasmedge-wasinn-examples/openvino-mobilenet-image/
RUN pushd rust \
&& cargo build --target=wasm32-wasi \
&& cargo build --target=wasm32-wasip1 \
&& popd \
&& ./download_mobilenet.sh . \
&& ls -l mobilenet.xml mobilenet.bin

WORKDIR /workspaces/wasmedge-wasinn-examples/openvino-mobilenet-raw/
RUN pushd rust \
&& cargo build --target=wasm32-wasi \
&& cargo build --target=wasm32-wasip1 \
&& popd \
&& ./download_mobilenet.sh . \
&& ls -l mobilenet.xml mobilenet.bin tensor-1x224x224x3-f32.bgr

WORKDIR /workspaces/wasmedge-wasinn-examples/openvino-road-segmentation-adas/
RUN pushd openvino-road-seg-adas \
&& cargo build --target=wasm32-wasi
&& cargo build --target=wasm32-wasip1

WORKDIR /workspaces/wasmedge-wasinn-examples/tflite-birds_v1-image/
RUN pushd rust \
&& cargo build --target=wasm32-wasi
&& cargo build --target=wasm32-wasip1

# mount models when running
WORKDIR /workspaces/wasmedge-wasinn-examples/wasmedge-ggml/qwen
RUN wget --progress=dot:giga https://www.modelscope.cn/models/qwen/Qwen1.5-0.5B-Chat-GGUF/resolve/master/qwen1_5-0_5b-chat-q2_k.gguf
RUN cargo build --target=wasm32-wasi
RUN cargo build --target=wasm32-wasip1

#
# iwasm. build from source
Expand All @@ -107,7 +107,7 @@ RUN OpenVINO_DIR=/usr/lib/openvino-2023.2.0 \
-DWAMR_BUILD_WASI_NN_LLAMACPP=1 \
&& cmake --build build \
&& cmake --install build

ENV LD_LIBRARY_PATH=/usr/local/lib

# add smoke test script
Expand Down
10 changes: 5 additions & 5 deletions core/iwasm/libraries/wasi-nn/test/run_smoke_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def execute_openvino_road_segmentation_adas_once(
"""

wasm_file = (
"./openvino-road-seg-adas/target/wasm32-wasi/debug/openvino-road-seg-adas.wasm"
"./openvino-road-seg-adas/target/wasm32-wasip1/debug/openvino-road-seg-adas.wasm"
)
wasm_args = [
"./model/road-segmentation-adas-0001.xml",
Expand All @@ -70,7 +70,7 @@ def execute_openvino_mobilenet_raw_once(
execute openvino-mobilenet-image with iwasm and wasmedge
"""

wasm_file = "./rust/target/wasm32-wasi/debug/wasmedge-wasinn-example-mobilenet.wasm"
wasm_file = "./rust/target/wasm32-wasip1/debug/wasmedge-wasinn-example-mobilenet.wasm"
wasm_args = [
"mobilenet.xml",
"mobilenet.bin",
Expand All @@ -87,7 +87,7 @@ def execute_openvino_mobilenet_image_once(
"""

wasm_file = (
"./rust/target/wasm32-wasi/debug/wasmedge-wasinn-example-mobilenet-image.wasm"
"./rust/target/wasm32-wasip1/debug/wasmedge-wasinn-example-mobilenet-image.wasm"
)
wasm_args = [
"mobilenet.xml",
Expand All @@ -105,7 +105,7 @@ def execute_tflite_birds_v1_image_once(
"""

wasm_file = (
"rust/target/wasm32-wasi/debug/wasmedge-wasinn-example-tflite-bird-image.wasm"
"rust/target/wasm32-wasip1/debug/wasmedge-wasinn-example-tflite-bird-image.wasm"
)
wasm_args = ["lite-model_aiy_vision_classifier_birds_V1_3.tflite", "bird.jpg"]
return execute_once(runtime_bin, runtime_args, wasm_file, wasm_args, cwd)
Expand Down Expand Up @@ -262,7 +262,7 @@ def filter_output(output: str) -> str:

def execute_wasmedge_ggml_qwen(iwasm_bin: str, wasmedge_bin: str, cwd: Path):
iwasm_args = ["--dir=."]
wasm_file = ["./target/wasm32-wasi/debug/wasmedge-ggml-qwen.wasm"]
wasm_file = ["./target/wasm32-wasip1/debug/wasmedge-ggml-qwen.wasm"]
wasm_args = ["./qwen1_5-0_5b-chat-q2_k.gguf"]

cmd = [iwasm_bin]
Expand Down

0 comments on commit b2c7cb2

Please sign in to comment.