Skip to content
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

Add benchmark inference_tract #37

Merged

Conversation

jlb6740
Copy link
Collaborator

@jlb6740 jlb6740 commented Jun 12, 2024

No description provided.

@jlb6740
Copy link
Collaborator Author

jlb6740 commented Jun 12, 2024

Benchmark adds an AI subtest to Wasmscore through the additions of mobilenet inferencing with by onnx and tensorflow models. Results show Wasm performing at about 30% of native performance. Wasm performance for onnx is similar to what is seen in sightglass. Sightglass does not implement the tensorflow model inferencing.

@jlb6740 jlb6740 force-pushed the add-mobile-net-tract-inferencing branch from 9bc64cc to 6157300 Compare June 17, 2024 01:19
WORKDIR /usr/src/rust-benchmark
ENV CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse
RUN (cd mobile_net_v2_onnx; cargo build --release --target wasm32-wasi)
RUN cp target/wasm32-wasi/release/*benchmark.wasm /benchmark/mobile_net_v2_onnx_benchmark.wasm
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is the onnx model being brought in? I saw it in setup.sh which is called from build.rs but its not included here (similar to how tf frozen model is included in the section below)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

build.rs calls setup.sh

# Compile mobile_net_v2_tensorflow
ADD mobile_net_v2_tensorflow rust-benchmark
WORKDIR /usr/src/rust-benchmark
ENV CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NIT - repeated Env, first in line 9

build.sh Outdated
# Create docker image
echo "Building ${IMAGE_NAME}-${IMAGE_VERSION} for $ARCH."
echo ""
docker build -t ${IMAGE_NAME} --build-arg ARCH=$(uname -m) .
docker build --no-cache -t ${IMAGE_NAME} --build-arg ARCH=$(uname -m) .
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why no cache?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To force rebuild every time when certain artifacts change but the dockerfile doesn't. I can remove this.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these *expected files being used anywhere? I was going to comment that perhaps a range of probabilities would be acceptable instead of a precise one, since (maybe) hardware and other differences might change that slightly. But then I can't see this being used anywhere.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, good spot. By renaming this expected does not get checked. I did that because of slight variations in precision as you suggested. I planned a follow-up PR to do a check based on some supplied script that would do whatever check was needed. Note, the benchmark itself already does check for the the highest scoring match so a correctness check is taking place, it is just that this one would be more specific.

Copy link
Collaborator

@rahulchaphalkar rahulchaphalkar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've made a few comments, mostly nothing major and pretty much looks good.
I didn't see the onnx model being included in dockerfile, thats the only real one, maybe i missed it.
Another thing - I can't test these changes on my local system right now due to docker being unavailable.

@jlb6740 jlb6740 merged commit 9dfac06 into bytecodealliance:main Jul 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants