Coder Social home page Coder Social logo

Comments (7)

rossberg avatar rossberg commented on July 2, 2024 1

Also, not to forget that web engines are rather special beasts, and the drawbacks of multiple tiers usually do not apply to non-web use cases.

from wabt.

SoniEx2 avatar SoniEx2 commented on July 2, 2024

Probably the best way to display these would be to list the opcodes and, for each of those, what opcodes they're followed by. Something along the lines of:

(local.get 1) 150
- (global.put 1) 50%
- (global.put 2) 30%
- ...

Probably better to avoid showing the matrix form of the markov chain. Those can get really big...

from wabt.

sbc100 avatar sbc100 commented on July 2, 2024

Out of curiosity, where does you claim come from that "inlining isn't actually helpful with wasm"?

As far as I know on the producer side in both llvm and binaryen we do a bunch of inlining and/or provide ways to increase of the decease the amount of inlining, and this has historically be valuable.

from wabt.

SoniEx2 avatar SoniEx2 commented on July 2, 2024

we believe this is the paper that argues inlining is considered harmful https://alan-romano.github.io/When_Function_Inlining_Meets_WebAssembly__Counterintuitive_Impacts_on_Runtime_Performance.pdf

we find inlining particularly harmful when targeting the JVM, because it has such tight restrictions on function size and whatnot. but that's (mostly) unrelated to performance. (except code size can prevent compilation, in particular the JVM JIT never kicks in for functions greater than 8kb in size.)

from wabt.

sbc100 avatar sbc100 commented on July 2, 2024

I see.. I've not seen that paper, thanks for the link.

The notable thing about targeting the JVM is that it itself will do a bunch of inlining, which I'm not sure that web engines do (or at least they maybe didn't historically).

from wabt.

kripken avatar kripken commented on July 2, 2024

It is true that on-stack replacement (OSR) is a serious known issue (see last paragraph in this section of the V8 docs), and so it is definitely possible to find benchmarks that regress by a lot without OSR, as the paper found. But often you find the opposite effect, because inlining is just so useful.

For comparison, the emscripten benchmark suite has cases that become many times slower without inlining. So we really cannot disable inlining in the toolchain.

Note that cases where OSR is needed are rare on the web, since you need to break up execution into short events anyhow (to avoid blocking the responsiveness of the browser). That gives a chance for lower-tiered code to be replaced. OSR may be more of an issue off the web; in those places, if you run code in one big execution then you do need to be aware of OSR, and you can work around it, e.g. by doing nodejs --no-liftoff which disables tiering and goes straight into the fastest tier; other VMs have similar flags.

from wabt.

SoniEx2 avatar SoniEx2 commented on July 2, 2024

that makes sense, but:

we mean the whole motivation for adding things to wasm-stats (formerly opcodecnt) in the first place is because we wanna make wasm2kotlin work better, by introducing something like a wasm-deopt tool. like maybe this is ultimately useless for everyone else but we feel like deoptimization passes like "demacro" (aka "#defines to functions") could be useful outside of just wasm2kotlin...

we also get to learn a bit about optimization passes (despite this being a deoptimizer) so that's cool.

from wabt.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.