diff --git a/test/benchmark/coremark/README.md b/test/benchmark/coremark/README.md new file mode 100644 index 0000000..0d67f18 --- /dev/null +++ b/test/benchmark/coremark/README.md @@ -0,0 +1,35 @@ +# CoreMark + +The `coremark` files in this directory were produced by: + +```sh +$ make compile PORT_DIR=linux CC=emcc EXE=.html XCFLAGS="-O3 --llvm-lto 3 --closure 1" +$ make compile PORT_DIR=linux CC=wasicc EXE=-wasi.wasm XCFLAGS="-Ofast -flto" +``` + + +### Running + +```sh +export ENGINES_PATH=/opt/wasm_engines + +# WAC => 101.895252 +$ENGINES_PATH/wac/wax coremark-wasi.wasm + +# wasm-micro-runtime => [fails] +#$ENGINES_PATH/wasm-micro-runtime/core/iwasm/products/linux/build/iwasm coremark-wasi.wasm + +# Wasmer => 7126.660188 +wasmer run coremark-wasi.wasm + +# V8 (Node.js) => 10962.508222 +node ./coremark.js + +# WAVM => 20273.009866 +$ENGINES_PATH/wasm-jit-prototype/_build/bin/wavm run coremark-wasi.wasm + +# Native on the same machine => 26704.052340 +make compile PORT_DIR=linux64 CC=gcc EXE=.elf XCFLAGS="-O3 -flto" +./coremark.elf +``` + diff --git a/test/benchmark/coremark/coremark-wasi.wasm b/test/benchmark/coremark/coremark-wasi.wasm new file mode 100755 index 0000000..309a948 Binary files /dev/null and b/test/benchmark/coremark/coremark-wasi.wasm differ diff --git a/test/benchmark/coremark/coremark.html b/test/benchmark/coremark/coremark.html new file mode 100644 index 0000000..1193b90 --- /dev/null +++ b/test/benchmark/coremark/coremark.html @@ -0,0 +1 @@ +Emscripten-Generated Codeimage/svg+xml
Downloading...
Resize canvasLock/hide mouse pointer    
\ No newline at end of file diff --git a/test/benchmark/coremark/coremark.js b/test/benchmark/coremark/coremark.js new file mode 100644 index 0000000..e53e04f --- /dev/null +++ b/test/benchmark/coremark/coremark.js @@ -0,0 +1,19 @@ +var b;b||(b=typeof Module !== 'undefined' ? Module : {});var l={},n;for(n in b)b.hasOwnProperty(n)&&(l[n]=b[n]);var p=[],r="./this.program";function t(a,c){throw c;}var u=!1,v=!1,w=!1,ca=!1,da=!1;u="object"===typeof window;v="function"===typeof importScripts;w=(ca="object"===typeof process&&"object"===typeof process.versions&&"string"===typeof process.versions.node)&&!u&&!v;da=!u&&!w&&!v;var x="",B,C; +if(w){x=__dirname+"/";var D,E;B=function(a,c){D||(D=require("fs"));E||(E=require("path"));a=E.normalize(a);a=D.readFileSync(a);return c?a:a.toString()};C=function(a){a=B(a,!0);a.buffer||(a=new Uint8Array(a));a.buffer||F("Assertion failed: undefined");return a};1=e&&(e=65536+((e&1023)<<10)|a.charCodeAt(++d)&1023);127>=e?++c:c=2047>=e?c+2:65535>=e?c+3:c+4}var g=c+1;c=ja(g);d=c;e=ka;if(0=f){var k=a.charCodeAt(++h);f=65536+((f&1023)<<10)|k&1023}if(127>=f){if(d>=g)break;e[d++]=f}else{if(2047>=f){if(d+1>=g)break;e[d++]=192|f>>6}else{if(65535>=f){if(d+2>=g)break;e[d++]=224|f>>12}else{if(d+3>=g)break; +e[d++]=240|f>>18;e[d++]=128|f>>12&63}e[d++]=128|f>>6&63}e[d++]=128|f&63}}e[d]=0}return c}var buffer,ka,M,N,O=b.TOTAL_MEMORY||16777216;b.wasmMemory?K=b.wasmMemory:K=new WebAssembly.Memory({initial:O/65536,maximum:O/65536});K&&(buffer=K.buffer);O=buffer.byteLength;var P=buffer;buffer=P;b.HEAP8=ka=new Int8Array(P);b.HEAP16=new Int16Array(P);b.HEAP32=N=new Int32Array(P);b.HEAPU8=M=new Uint8Array(P);b.HEAPU16=new Uint16Array(P);b.HEAPU32=new Uint32Array(P);b.HEAPF32=new Float32Array(P);b.HEAPF64=new Float64Array(P); +N[1292]=5248240;function Q(a){for(;0>2]=28),-1;N[c>>2]=a/1E3|0;N[c+4>>2]=a%1E3*1E6|0;return 0},b:function(a,c,d){M.set(M.subarray(c,c+d),a)},c:function(){F("OOM")},d:function(a,c,d,e){try{for(var g=0,h=0;h>2],k=N[c+(8*h+4)>>2],X=0;X=z);)++A;if(16m)z+=String.fromCharCode(m);else{var sa=m-65536;z+=String.fromCharCode(55296|sa>>10,56320|sa&1023)}}}else z+=String.fromCharCode(m)}qa=z}Da(qa);Z.length= +0}else Z.push(Y)}g+=k}N[e>>2]=g;return 0}catch(ba){return"undefined"!==typeof FS&&ba instanceof FS.l||F(ba),ba.m}},memory:K,table:fa},Aa=function(){function a(a){b.asm=a.exports;R--;b.monitorRunDependencies&&b.monitorRunDependencies(R);0==R&&(null!==S&&(clearInterval(S),S=null),T&&(a=T,T=null,a()))}function c(c){a(c.instance)}function d(a){return wa().then(function(a){return WebAssembly.instantiate(a,e)}).then(a,function(a){H("failed to asynchronously prepare wasm: "+a);F(a)})}var e={env:za,wasi_unstable:za}; +R++;b.monitorRunDependencies&&b.monitorRunDependencies(R);if(b.instantiateWasm)try{return b.instantiateWasm(e,a)}catch(g){return H("Module.instantiateWasm callback failed with error: "+g),!1}(function(){if(I||"function"!==typeof WebAssembly.instantiateStreaming||ta()||"function"!==typeof fetch)return d(c);fetch(U,{credentials:"same-origin"}).then(function(a){return WebAssembly.instantiateStreaming(a,e).then(c,function(a){H("wasm streaming compile failed: "+a);H("falling back to ArrayBuffer instantiation"); +d(c)})})})();return{}}();b.asm=Aa;var xa=b.___wasm_call_ctors=function(){return b.asm.e.apply(null,arguments)};b._main=function(){return b.asm.f.apply(null,arguments)};b.___errno_location=function(){return b.asm.g.apply(null,arguments)};var ja=b.stackAlloc=function(){return b.asm.h.apply(null,arguments)};b.asm=Aa;var W;function G(a){this.name="ExitStatus";this.message="Program terminated with exit("+a+")";this.status=a}T=function Ba(){W||Ca();W||(T=Ba)}; +function Ca(a){function c(){if(!W&&(W=!0,!L)){Q(ma);Q(na);if(b.onRuntimeInitialized)b.onRuntimeInitialized();if(Ea){var c=a;c=c||[];var e=c.length+1,g=ja(4*(e+1));N[g>>2]=ia(r);for(var h=1;h>2)+h]=ia(c[h-1]);N[(g>>2)+e]=0;try{var f=b._main(e,g);if(!J||0!==f){if(!J&&(L=!0,b.onExit))b.onExit(f);t(f,new G(f))}}catch(k){k instanceof G||("SimulateInfiniteLoop"==k?J=!0:((c=k)&&"object"===typeof k&&k.stack&&(c=[k,k.stack]),H("exception thrown: "+c),t(1,k)))}finally{}}if(b.postRun)for("function"== +typeof b.postRun&&(b.postRun=[b.postRun]);b.postRun.length;)c=b.postRun.shift(),oa.unshift(c);Q(oa)}}a=a||p;if(!(0