Chrome Wasm Performance Regression

2018-02-09 Thread Gaurav Dewan
In Chrome 64, the wasm initialization time has increased by 300-400% as compared to Chrome 63 (easily reproducible on windows machine - other platforms are impacted too) The issue is reproducible in "Tanks Demo" too - is it a known issue ? Thanks Gaurav -- You received this message because

Re: I find a big problem(WebAssembly).

2017-09-22 Thread Gaurav Dewan
Hi ming_zhao, I am able to repro the issue with code generated by em++ 1.37.8 (version does not matter in this case) I have added this test case and wasm file to that bug. you can add subscribe to the bug (star the issue) to get updates. Thanks -- You received this message because you are

Re: I find a big problem(WebAssembly).

2017-09-22 Thread Gaurav Dewan
Wow !! I hit into somewhat similar issue but was not able to find that it would be so easy to repro !! Now that this easy repro is here, chrome team could solve this issue

Chrome Android webassembly Aw snap

2017-09-19 Thread Gaurav Dewan
On redmi note 4 4gb ram chrome canary and stable latest crashes with Aw snap on opening any medium sized webassembly like Websighjs FF works fine on same device. Maybe Chrome thinks there is less memory on mi environment Is Aw snap in webassembly common issue on Android Chrome ? Logged

out of memory exception and subsequent FF crash

2017-09-05 Thread Gaurav Dewan
Android FF runs out of memory on opening the wasm (or even asm.js) pages in multiple tabs; so does the 32 bit firefox on windows. Chrome on android is multi-process and is able to open many tabs with wasm open simultaneously. Safari is magically able to open many tabs(with asm.js) - maybe it

Re: Using custom C and CXX library with emscripten

2017-08-29 Thread Gaurav Dewan
EM_CACHE works well ! The use case is scenario where we need to optimize the footprints of wasm (or asm.js) for example to ensure that all script code in browser fits nicely in SRAM of mobile device (on chip cache) for maximum performance. For smaller projects like "hello world", (1) we can

Using custom C and CXX library with emscripten

2017-08-24 Thread Gaurav Dewan
We can ask emscripten(clang) to use custom C/cxx header in this way: set EMMAKEN_NO_SDK=1 em++ -Xclang -nobuiltininc -Xclang -nostdsysteminc -Xclang -isystemc:\em\emsdk-portable\emscripten\CUSTOM\system\include\libcxx -Xclang -isystemc:\em\emsdk-portable\emscripten\CUSTOM\system\include\libc

Re: ctor_evaller: not successful

2017-08-05 Thread Gaurav Dewan
using -s EVAL_CTORS=0 in command line em++ -Oz -s EVAL_CTORS=0 should work Refer settings.js On Saturday, August 5, 2017 at 6:49:39 PM UTC+5:30, awt wrote: > > Alon, is there a way in which we can turn off the constructor evaluator > even if we are using Oz or O3? -- You received this message

Debugging slow wasm compilation on MAC chrome

2017-08-01 Thread Gaurav Dewan
I observed that slow startup of webassembly on Mac chrome canary is due to large amount of time taken in up front compilation. As compared to Windows chrome, the compile time is very high on Mac chrome for small wasm module. Not sure if it is due to hardware or software limitations of Mac. Or

Re: WASM optimizations

2017-07-19 Thread Gaurav Dewan
I see f64 to int callback to js is fixed in latest emscripten. But unfortunately we are using emscripten 1.37.3 and unable to upgrade because of huge performance loss due to inlining strategy even after llvm lto. Any way we can port that fix to older version by cherry picking? -- You

-DNEDBUG causes a size bloat in emscripten

2017-07-18 Thread Gaurav Dewan
Testcase here(all bcs, js makefile and gcc/clang generated exes): https://github.com/gauravdewan007/ndebug using -DNDEBUG helps to get rid of the assert (and save size and prevent strings from getting into the code). Both clang and gcc generate smaller binary if -DNEDBUG option is used. But

Re: Libcxx update

2017-07-18 Thread Gaurav Dewan
> > This looks to be very interesting prospect. Could you write a wiki or > blog on how to update libcxx (and libc) ? > This could help in some of the optimizations(unneeded code getting added > to the generated asm.js binary) when nothing else work. > On a seprate note, I was

Re: WebAssembly status on chrome

2017-07-12 Thread Gaurav Dewan
I see that indexeddb is targeted for M62 canary so AOT time as of today makes sense. Maybe I should try response api in M61. I am concerned more about slowness like that on mac and specifically android phones? -- You received this message because you are subscribed to the Google Groups

WASM optimizations

2017-07-12 Thread Gaurav Dewan
Are there methods to optimize these calls out of wasm (change code or use compiler options or add to webassembly) (1) f64 to int - there is pattern (promote f64, and call 50 - f64 to int outside wasm) - BINARYEN imprecise option is removed. I see this is the only asm-wasm imports getting

WebAssembly status on chrome

2017-07-12 Thread Gaurav Dewan
Hi Derek, all, What is the WASM performance improvements roadmap for chrome canary? As per my observations: (1) Windows - latest Chrome canary is now fast (good throughput after 1 second of AOT - 20 to 50% slower than FF). It appears to be supporting indexeddb but there is no difference in

Re: Size bloat with option -Oz -s EVAL_CTORS=0 -s DISABLE_EXCEPTION_CATCHING=0

2017-05-11 Thread Gaurav Dewan
We use EVAL_CTORS=0 for asm.js and wasm (because of the issue described in the previous thread) - does it still call simplify-ifs optimizations (leading to crash) ? > Thanks > -- You received this message because you are subscribed to the Google Groups "emscripten-discuss" group. To

Profiling workflow

2017-05-11 Thread Gaurav Dewan
I have few queries regarding profiling workflow of asm.js and wasm: (1) What is the ideal profiling workflow for asm.js now ? - using -Oz --llvm-lto --profiling-funcs options, I see a lot of one line functions end up as top bottleneck (like functions that just add two numbers). These functions

Re: WebAssembly Regression in Safari TP 27

2017-05-04 Thread Gaurav Dewan
Thanks. The hang issue is fixed in Safari Technical preview 29. And I noticed that WASM startup time is now much faster that Safari TP 26. For crash while opening debug console, I have logged webkit bug and added jj to cc list: https://bugs.webkit.org/show_bug.cgi?id=171651 >> -- You

Re: Understanding contents of Mem file (asm.js)

2017-04-27 Thread Gaurav Dewan
Interesting: to use -fno-rtti, I only need to get rid of dynamic_cast and typeid. If I am removing exception code at time of linking bc file (using -s DISABLE_EXCEPTION_.. em++ option), will using -fno-rtti compile time option still help with significant size reduction (other than symbol names

Re: WebAssembly Regression in Safari TP 27

2017-04-27 Thread Gaurav Dewan
Both the bugs are still happening in Safari TP 28: (1) hang in WebAssembly.instantiate method invoked in WebWorker (which goes away if console is opened and we pause the javascript and continue both the threads). Not sure if this is due to use of webassembly in webWorker or some instructions in

Re: indexeddb in chrome

2017-04-27 Thread Gaurav Dewan
This is strange. On OSX with even with latest chrome canary, I get error that "wasm module was not found in indexedDB" - The wasm binary I am testing is less than 5mb. And on windows chrome 32 bit (7 days old build of canary), wasm module is loaded from indexeddb but there is no difference in

Re: Understanding contents of Mem file (asm.js)

2017-04-21 Thread Gaurav Dewan
I noticed that names of these functions are very big and occupy space in mem file.-These are essential artifacts of RTTI - which is required for c++ projects (dyn cast , virtual functions etc) - typeid is used less. In fact removing these can help in upto 1% size reduction in a fully optimized

Re: Size bloat with option -Oz -s EVAL_CTORS=0 -s DISABLE_EXCEPTION_CATCHING=0

2017-04-21 Thread Gaurav Dewan
Yes this happens only on this branch - i re-verified it with original and branch binaryen. Interestingly, this did not happen with 1.37.3 when I replace the binaryen there with this branch version - so perhaps the complex interaction between these tools (optimizer) is causing this issue to

Re: Is there some fundamental bug in 32 bit Chrome with regard to WebAssembly ?

2017-04-21 Thread Gaurav Dewan
I am able to pinpoint the point of failure in my program - at one place I am calling a function (passing it 6 floating points and int as last argument). Inside that function, second last argument comes out to be garbage (unexpected) while it is okay from where I am calling it (it all happens

Re: Size bloat with option -Oz -s EVAL_CTORS=0 -s DISABLE_EXCEPTION_CATCHING=0

2017-04-20 Thread Gaurav Dewan
That would be really nice (lto) Regarding exception Invalid function pointer '3044' called with signature 'vi'. Perhaps this is an invalid value (e.g. caused by calling a virtual method on a NULL pointer)? Or calling a function with an incorrect type, which will fail? (it is worth building your

indexeddb in chrome

2017-04-20 Thread Gaurav Dewan
Today I noticed indexeddb caching in chrome canary - but I did not notice any performance gain - Is it work in progress (module is stored in cache - but not used - right?) -- You received this message because you are subscribed to the Google Groups "emscripten-discuss" group. To unsubscribe

Re: Size bloat with option -Oz -s EVAL_CTORS=0 -s DISABLE_EXCEPTION_CATCHING=0

2017-04-18 Thread Gaurav Dewan
Now that it appears llvm-lto helps a lot with size reduction with latest clang(this was not the case earlier), does it make sense to include in regression test suite and make it on by default on Oz build ? -- You received this message because you are subscribed to the Google Groups

Re: Size bloat with option -Oz -s EVAL_CTORS=0 -s DISABLE_EXCEPTION_CATCHING=0

2017-04-18 Thread Gaurav Dewan
> > Crash is fixed now during build(latest code of inline-small). The > generated wasm using newtool(and this new binaryen) throws an exception 6 > during runtime(and asks to build with -s ASSERTIONS); while the generated > wasm using oldtool(and this new binaryen) seems to be working fine. >

Re: Size bloat with option -Oz -s EVAL_CTORS=0 -s DISABLE_EXCEPTION_CATCHING=0

2017-04-13 Thread Gaurav Dewan
> > I have update the repo bug1 with bc and JS(--profiling) > I have added another test case: https://github.com/gauravdewan007/bug2 --llvm-lto 1 help in both the testcases. (1) In the (bigger) actual program, I am still seeing size increase of about 10% (after llvm-lto) with new tool as

Re: Size bloat with option -Oz -s EVAL_CTORS=0 -s DISABLE_EXCEPTION_CATCHING=0

2017-04-12 Thread Gaurav Dewan
(1) Firstly with exceptions enabled, 1.37.9(new tool) generates lots of functions as compared to 1.37.3(old tool). I will check if those are really dead functions which would mean new tool is not able to do dead code elimination effectively. (2) With exceptions disabled: new tool generates

Re: Enhancement in preamble.js

2017-04-12 Thread Gaurav Dewan
I modified preamble.js "locally" to include wasm_utils.js under binaryen async macro and found this issue (uglify step had issue with ES6 syntax). So as a workaround, I used babel on wasm_utils(indexeddb loading code) before adding it to preamble.js which works fine. (I did not test whether

WebAssembly Regression in Safari TP 27

2017-04-11 Thread Gaurav Dewan
Anyone else seeing the same issue (the WebAssembly application which worked in TP 26 does not work in TP 27 ) ? On showing console, the browser crashes. In some instances, I can show the console without crashing (It does not crash if I try to show the console at just the right time when it is

Re: Enhancement in preamble.js

2017-04-10 Thread Gaurav Dewan
1.37.9 portable installer > -- You received this message because you are subscribed to the Google Groups "emscripten-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to emscripten-discuss+unsubscr...@googlegroups.com. For more options, visit

Size bloat with option -Oz -s EVAL_CTORS=0 -s DISABLE_EXCEPTION_CATCHING=0

2017-04-10 Thread Gaurav Dewan
from em++ 1.37.3 to 1.37.9 there is massive increase in size (but with exceptions disabled it is not so) There are lots of these symbols which are getting added (and doing same thing - static boost exception pointer initalization): ___cxx_global_var_init_495() ___cxx_global_var_init_5_960() Is

Enhancement in preamble.js

2017-04-10 Thread Gaurav Dewan
Making changes in Preamble.js, we cannot use => ES6 arrow function Workaround: Use older syntax: return fetch(url).then(function(response) { return response.arrayBuffer(); } ) instead of return fetch(url).then(response => response.arrayBuffer ) Due to this we cannot directly use FF

Re: Is there some fundamental bug in 32 bit Chrome with regard to WebAssembly ?

2017-03-29 Thread Gaurav Dewan
> > I was trying the demo on 32 bit chrome - What does this demo do? It just > keeps showing downloading spinner on chrome 32 bit > http://mzl.la/webassemblydemo > > It built shaders(23

Is there some fundamental bug in 32 bit Chrome with regard to WebAssembly ?

2017-03-23 Thread Gaurav Dewan
Is there some known bug in wasm pages opened in 32 bit chrome ? My Wasm based application is working fine in 32 bit firefox and all 64 bit browsers. But on 32 bit Chrome, I get black patches all over the canvas(cpu rendering only) -- You received this message because you are subscribed to the

Impact of big functions on WebAssembly

2017-03-15 Thread Gaurav Dewan
Is it true that big functions have no impact on runtime performance in WebAssembly in first load and load of module from indexeddb cache ? In asm.js big functions hurt the JIT since they needed to be compiled (O(n^2) in terms of AST nodes) -- You received this message because you are

Documentation issue on MDN regd WASM

2017-03-14 Thread Gaurav Dewan
Refer https://developer.mozilla.org/en-US/docs/WebAssembly/C_to_wasm#Using_a_custom_HTML_template There is confustion regarding -o hello2.js vs -o hello2.html Is -o hello2.js discouraged ? (it is working pretty fine if wasmBinary contains wasm files. Ofcourse wasm is currently downloaded fully

WebAssembly browsers

2017-03-06 Thread Gaurav Dewan
Hi How can I get prerelease build of Safari and Edge which support Webassembly ? Do I need to build those ? Is WebAssembly supported in the below browsers: · - Microsoft Edge included with Insider >=15019 · - Safari Technology Preview Release 22 (Safari 10.2, WebKit

Re: Status of WebAssembly with emscripten after the version bump to 0x1

2017-03-03 Thread Gaurav Dewan
> > It's working now > Thanks -- You received this message because you are subscribed to the Google Groups "emscripten-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to emscripten-discuss+unsubscr...@googlegroups.com. For more options, visit

Status of WebAssembly with emscripten after the version bump to 0x1

2017-03-02 Thread Gaurav Dewan
Anybody able to compile hello world program to webassembly now(after the version bump) ? I deleted ~/.emscripten_cache and ~/.emscripten_ports folder and tried to build hello world program with emcc -s WASM=1 (which fetched and build binaryen tag 28 succesfully). While tag 27 binaryen was

Profiling asm.js WebWorker

2017-02-27 Thread Gaurav Dewan
I am profiling asm.js WebWorker in Chrome (without automatic compilation to wasm) with --profiling-funcs option. I noticed that for my application, "Record Allocation Profile"(memory allocation from JS functions) shows similar bottleneck as "Record JS CPU profile". How to interpret "Allocation

Understanding contents of Mem file (asm.js)

2017-02-27 Thread Gaurav Dewan
(1) Mem file seems to contain mangled c++ symbols and "some" filepaths of sourcecode even in fully optimized build as seen using "strings" utility on memfile. Why ? Is there any utility or trick by which these symbols can be stripped ? I am not sure if I am using __FILE__ and func macro

Issue with EVAL_CTORS option

2017-01-19 Thread Gaurav Dewan
During initialization time in asm.js build, it tries to call global initializer of file (which should have been stripped by dead code removal, I guess) With "-s EVAL_CTORS=1 -s DISABLE_EXCEPTION_CATCHING=1", no error is issued at build time; but generated asm file fails to run with error:

Optimization options in em++

2017-01-03 Thread Gaurav Dewan
I was investigation various optimization options by referring to here: https://kripken.github.io/emscripten-site/docs/optimizing/Optimizing-Code.html https://github.com/kripken/emscripten/blob/master/src/settings.js (1) Is there any way to debug and find the culprits which cause failure with

Re: Webassembly status

2016-11-16 Thread Gaurav Dewan
Thanks Charles about (3) - is there any emscripten flag to generate wasm with "grow memory" capabilities (or is the total memory size fixed at build time) to reduce browser memory footprints (and not over-guess the size) ? -- You received this message because you are subscribed to the Google

Webassembly status

2016-11-15 Thread Gaurav Dewan
I have Couple of questions about latest WebAssembly status (1) I have seen that WASM works like charm in Chrome and FireFox and believe check-ins are happening in Chakra(Edges). What is the state (and any indicator of release readiness) in Safari; especially all (webkit based)* iOS

Power Consumption of Webassembly/asm.js

2016-09-06 Thread Gaurav Dewan
Being natively built into javascript engine, WebAssembly is expected to be power efficient. Has anybody done analysis on power efficiency of webassembly and asm.js ? CPU consumption/energy rating of idle asm.js tab indeed shows up as zero(<1); but are there any precise

Allocating large memory in ASM.JS

2016-08-12 Thread Gaurav Dewan
What is the recommended method of allocating and reallocation large memory size buffers in ASM.JS build ? We are allocating large memory (40MB and more) and on reallocation (as seen in memoryprofiler) the buffers keep jumping to higher location leading to fragmentation. Sometimes

Re: how to debug wasm compile error in firefox - works fine in chrome

2016-08-04 Thread Gaurav Dewan
Thanks Issue found to be fixed in today's fireforx canary build - 51.0a1(2016-08-03) -- You received this message because you are subscribed to the Google Groups "emscripten-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to

Re: how to debug wasm compile error in firefox - works fine in chrome

2016-08-01 Thread Gaurav Dewan
> > Indeed it is issue with size limit of table in firefox as I can confirm > with wast: > > table $b0 $b0 .(same funcname repeated 2000 times) $b1 $b1 ... > > Chrome is able to handle atleast 500k table size (maybe there is no limit). I also verified that when devtools are not open, chrome

Re: how to debug wasm compile error in firefox - works fine in chrome

2016-07-28 Thread Gaurav Dewan
Using 1.36.5 emscripten. em++ -O3 -s TOTAL_MEMORY=201326592 -s ALIASING_FUNCTION_POINTERS=0 -s BINARYEN=1 -s 'BINARYEN_METHOD="native-wasm"' -s 'BINARYEN_SCRIPTS="spidermonkify.py"' -s GLOBAL_BASE=1000 -s ALIASING_FUNCTION_POINTERS=0 Updating JS-shell used for compilation and recompiling

Re: Exception Handling in ASM.JS & Webassembly

2016-07-27 Thread Gaurav Dewan
> > 2(b) > > Seems to be quote error on Windows cmdline. > It prints success when following is inside makefile em++ whitelist.cpp -O1 -s DISABLE_EXCEPTION_CATCHING=2 -s EXCEPTION_CATCHING_WHITELIST='["_main"]' -o whitelist.js For windows cmd line following worked (it does not work in

Re: std::chrono::high_resolution_clock::now throwing exception in Safari (when ASM.JS is run in webworker)

2016-07-27 Thread Gaurav Dewan
> > To reproduce, on emscripten 1.36.5 (incoming branch) > (1) here is simple test case (c.cpp) #include #include int main() { std::cout << "before" << std::endl; auto now = std::chrono::high_resolution_clock::now(); std::cout << "after" << std::endl; return 0; } (2)

Exception Handling in ASM.JS & Webassembly

2016-07-25 Thread Gaurav Dewan
Currently enabling exception handling support lead to increase in size of optimized build (asm.js as well as wasm) by about 33% in our codebase. (1) Will the planned Zero cost exception support in wasm shave off a significant size from the wasm file ? (2) With regard to asm.js, are there ways

std::chrono::high_resolution_clock::now throwing exception in Safari (when ASM.JS is run in webworker)

2016-07-25 Thread Gaurav Dewan
Based on quick read of C++ specs (although more thorough reading of C++ specs would be required), (1) std::chrono::high_resolution_clock::now is declared to be no-except(cannot throw exceptions). (2) high_resolution_-clock may be a synonym for system_clock or steady_clock When calling this

Re: Bug in source map generation of emcc?

2016-04-28 Thread Gaurav Dewan
I have seen 3 kinds of issues with source map facility here: (1) "Unable to find original file" issue and file path in asm.js are not rel. To workaround this, I would make multiple copies of directory in local server(bring nested directories nearer to the root path) while debugging in chrome.

Re: Webassembly Startup Time too high

2016-04-28 Thread Gaurav Dewan
> > Thanks for comprehensive explanation. I now reckon that we will see > browser improvements in startup time. > I will look at the timing data of webassembly based webpage startup to verify there is no other surprise angle here.The main thread cannot do much more than showing progressbar

Webassembly Startup Time too high

2016-04-26 Thread Gaurav Dewan
I have noticed that webassembly application startup time is too slow as compared to ASM.JS application(even when the whole wasm file is loaded from cache. The slow startup is not due to network download.). Once the webpage has loaded fully then the webpage interaction with user is very fast.

Re: Unable to compile asm.js to webassembly

2016-04-13 Thread Gaurav Dewan
/modules giving meaningful information on how to spot such code and correct it. On Wednesday, April 13, 2016 at 7:15:31 PM UTC+5:30, Gaurav Dewan wrote: > > Lack of SIMD support in asm2Wasm (or webassembly specs & implementation) - > is it a bug ? > -- You received this mes

Re: Unable to compile asm.js to webassembly

2016-04-13 Thread Gaurav Dewan
Lack of SIMD support in asm2Wasm (or webassembly specs & implementation) - is it a bug ? -- You received this message because you are subscribed to the Google Groups "emscripten-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to

Re: Unable to compile asm.js to webassembly

2016-04-13 Thread Gaurav Dewan
> > EMCC_DEBUG=1 showed emcc output but did not logged any output from > asm2wasm internals(asm2wasm -d option did that). > I found abort was called in asm2wasm because it appears that only float, double,int, none datatype are supported in asm.js module currently(function AsmType

Unable to compile asm.js to webassembly

2016-04-12 Thread Gaurav Dewan
I have a large C++ project. I am able to compile it to asm.js and load it in browser. But I am unable to compile it to web assembly ( I am linking multiple libraries(bc files) ) I get following error in make: (Basically asm2wasm is failing with error 6 or -6). Any idea what it means and how to