Aidan and JJ,
Thanks for your reply. I believed that I have overwritten the optimizer.exe
in the correct location according to .emscripten. This is part of the log
that I got before the crash in Aidan's optimizer. Unfortunately, I cannot
share my project but I will copy this log to an issue in ayzim.
thread 'main' has overflowed its stack
DEBUG:root:EMCC_WASM_BACKEND tells us to use asm.js backend
splitting up js optimization into 124 chunks, using 40 cores (total:
301.94 MB)
Traceback (most recent call last):
File "E:\emsdk\emscripten\1.36.3\\em++", line 13, in <module>
emcc.run()
File "E:\emsdk\emscripten\1.36.3\emcc.py", line 1731, in run
JSOptimizer.flush()
File "E:\emsdk\emscripten\1.36.3\emcc.py", line 1643, in flush
run_passes(chunks[i], 'js_opts_' + str(i), just_split='receiveJSON' in
chunks[i], just_concat='emitJSON' in chunks[i])
File "E:\emsdk\emscripten\1.36.3\emcc.py", line 1613, in run_passes
final = shared.Building.js_optimizer(final, passes, debug_level >= 4,
JSOptimizer.extra_info, just_split=just_split, just_concat=just_concat)
File "E:\emsdk\emscripten\1.36.3\tools\shared.py", line 1741, in
js_optimizer
ret = js_optimizer.run(filename, passes, NODE_JS, debug, extra_info,
just_split, just_concat)
File "E:\emsdk\emscripten\1.36.3\tools\js_optimizer.py", line 544, in run
return temp_files.run_and_clean(lambda: run_on_js(filename, passes,
js_engine, source_map, extra_info, just_split, just_concat))
File "E:\emsdk\emscripten\1.36.3\tools\tempfiles.py", line 64, in
run_and_clean
return func()
File "E:\emsdk\emscripten\1.36.3\tools\js_optimizer.py", line 544, in
<lambda>
return temp_files.run_and_clean(lambda: run_on_js(filename, passes,
js_engine, source_map, extra_info, just_split, just_concat))
File "E:\emsdk\emscripten\1.36.3\tools\js_optimizer.py", line 446, in
run_on_js
filenames = pool.map(run_on_chunk, commands, chunksize=1)
File "E:\emsdk\python\2.7.5.3_64bit\lib\multiprocessing\pool.py", line
250, in map
return self.map_async(func, iterable, chunksize).get()
File "E:\emsdk\python\2.7.5.3_64bit\lib\multiprocessing\pool.py", line
557, in get
raise self._value
AssertionError: Error in optimizer (return code 255):
ninja: build stopped: subcommand failed.
On Sunday, December 4, 2016 at 9:25:18 AM UTC+8, jj wrote:
>
> opt.exe is LLVM's own optimizer, and optimizer.exe is the asm.js optimizer
> that Ayzim intends to replace.
>
> Emsdk has two separate directory structures for precompiled and
> compile-from-source installations. In precompiled installations, these
> opt.exe and optimizer.exe live in the same directory (== LLVM binaries
> directory). In from-source compiled installations, optimizer.exe lives in
> its own CMake build directory. Like Aidan mentions, you can check out the
> .emscripten file to see where the current Emscripten environment is looking
> up for that tool.
>
> It might be preferable to install ayzim not by replacing the
> optimizer.exe, but having it as separate file optimizer-ayzim.exe or
> similar, and editing the .emscripten file to point to this location. This
> way it will be easier to revert back to the original asm.js optimizer.
>
> When using emsdk, editing the .emscripten file that emsdk generates is ok
> to do. The only thing here is to remember that it's the "emsdk activate"
> step which writes the .emscripten file, so if you have any manual
> modifications to .emscripten file, then if you later call "emsdk activate",
> the manual modifications will be lost, so calling "emsdk activate" will
> revert back to using the original emscripten optimizer.
>
> If you do replace optimizer.exe, then there should not be any need to
> change .emscripten file. So I suppose it's whichever way feels simpler.
>
>
> 2016-12-03 11:30 GMT+02:00 Aidan Hobson Sayers <[email protected]
> <javascript:>>:
>
>> Hmm, I'm not sure those are right. You double check as follows:
>>
>> When you've entered the emscripten environment (with the emsdk.bat, so
>> emcc is now runnable from the command line), try printing out the EM_CONFIG
>> variable - it should be a path to a file. Inside this file should be
>> a EMSCRIPTEN_NATIVE_OPTIMIZER variable, which tells emscripten where the
>> optimizer is.
>>
>> If you get through all this have replaced that file and it still crashes
>> (or it's the same file), if you run with EMCC_DEBUG=1 and paste it into a
>> github issue on ayzim then I'm eager to take a look. Or, if it's possible
>> to share any part of the project (either so I can build from source, or
>> just the final objects before the link -> .js step), then that's great too.
>>
>> On 2 December 2016 at 03:43, awt <[email protected] <javascript:>>
>> wrote:
>>
>>> Hi,
>>>
>>> This looks very promising and I am interested to try it out. I am
>>> currently on emsdk 1.36.3 so where should I place ayzim-opt.exe? The only
>>> optimizers that I see in my build are in emsdk\clang\e1.36.3_64bit where I
>>> have opt.exe and optimizer.exe.
>>>
>>> I tried to replace optimizer.exe with ayzim-opt.exe and it crashes after
>>> a while.
>>>
>>> On Saturday, November 5, 2016 at 11:09:02 AM UTC+8, Aidan Hobson Sayers
>>> wrote:
>>>>
>>>> Using Ayzim as a drop-in replacement for the Emscripten asm.js native
>>>> optimizer when compiling an asm.js project of moderate or large size on
>>>> `-O2` or `-O3` should result in a ~50-75% reduction in memory usage and a
>>>> ~25-50% speedup when running asm.js native optimizer passes (i.e. most of
>>>> the "js opts" stage as seen in in EMCC_DEBUG output).
>>>>
>>>> To get it, download the compiled releases for Linux and Windows from the
>>>> ayzim releases page <https://github.com/aidanhs/ayzim/releases>,
>>>> extract them and replace (after backing up!) the existing optimizer(.exe)
>>>> binary in `emsdk/emscripten/incoming_optimizer_64bit/` (if you're not on
>>>> `incoming` but still feel brave, take a look at your emscripten config
>>>> file, usually at `$HOME/.emscripten`, which should point you to the right
>>>> place).
>>>>
>>>> --
>>>>
>>>> Some background: when I was trying to port a large application to
>>>> asm.js about 6 months ago I had serious problems with the Emscripten
>>>> asm.js
>>>> optimizer - it would split the 750MB .js file into chunks and promptly
>>>> consume all 8GB of my RAM by trying to optimize the chunks in parallel,
>>>> swapping everything else out of memory and grinding the machine to a halt.
>>>> I tackled this problem by taking a brief(!) diversion to rewrite the
>>>> optimizer in Rust to be more memory efficient. Along the way I added a few
>>>> speedups.
>>>>
>>>> Ayzim is probably an entry in the "well this might have been useful two
>>>> years ago" section of software (since asm.js is 'shortly' going to be made
>>>> redundant by wasm) but someone may find a use for it. For example, people
>>>> wanting to understand the structure of the Emscripten optimizer ast may
>>>> want to look at this code
>>>> <https://github.com/aidanhs/ayzim/blob/0.1.2/src/cashew.rs#L141>
>>>> and/or ask me since I'm very familiar with it now :)
>>>>
>>>> In time I may extend Ayzim to support wasm optimizations and move it to
>>>> being more of a library, but that's for the future.
>>>>
>>>> Aidan
>>>>
>>> --
>>> 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 [email protected]
>>> <javascript:>.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>> --
>> 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 [email protected] <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.