Comments (7)
Unfortunately browsers aren't quite ready for this, with restrictions on the number of web workers for threads and allocated memory. (And it does make some sense that vendors are careful, not allowing random websites to allocate 4GB of RAM and run extremely CPU intensive tasks.) Will raise the limits, when it becomes possible in mainstream browsers.
A browser extension to make native Stockfish available might be a good approach, though: lichess-org/lila#7909
from stockfish.wasm.
@niklasf @apetresc
Well some browsers for sure arent but you could always check if you are running chrome 80+ no?
Chromium has no thread limit as far as i am aware of. No such mention in the Documentation
from stockfish.wasm.
Ok, I guess we can consider it a bit more carefully.
Is there a way to feature test that, rather than checking browser versions? What's navigator.hardwareConcurrency
for you in Firefox and Chrome?
The memory limit is harder. 4 GiB is the maximum for wasm32, but we can't use all memory for hashtables. So 2 GiB would be the only feasible power of two. But even for that, it's not clear, that there will always be I continguous slice of 2 GiB available, especially when resizing the hashtable. navigator.deviceMemory
for feature detection is only available in Chrome, and it goes to a maximum of 8 GiB, which is not a lot of margin for other stuff on the system (including perhaps even a second multi-variant instance, as used on Lichess when switching between study chapters). Overall, I don't think it's worth the small strength gain.
from stockfish.wasm.
Oh, also let's not forget about the memory overhead of threads. Extrapolating #4 (comment), we'd need more than 1 GiB of memory for threads alone. A mitigating factor is that someone with 64 threads will very likely also have a bit of RAM to go with it.
from stockfish.wasm.
Memory is not the issue. Going in hashtable size from 1 to 4GiB does not yield great increase so 1gb is ok i think. (only few percentage after 256mb in my experience)
Keep in mind Firefox has 3.77% market share and is declining - and Microsoft just switched to Chromium.
[16 Cores] AMD Ryzen 9 5950X
[Chrome] navigator.hardwareConcurrency = 32
[Firefox] navigator.hardwareConcurrency = 16
[12 Cores] AMD Ryzen 9 3900X
[Chrome] navigator.hardwareConcurrency = 24
[Firefox] navigator.hardwareConcurrency = 16
I think you could savely allow up to navigator.hardwareConcurrency for stockfish.wasm - chess scales very well with cores
So the max_threads is not const but a readonly variable initialized once.
from stockfish.wasm.
Oh, that's great! I was expecting Firefox to give 32 or 64, and then fail when allocating more than 20.
from stockfish.wasm.
Increase to 32 published as v0.9.1, and deployed to the Lichess testing site https://lichess.dev/analysis (via lichess-org/lila@2703beb). Can you please confirm that it works in Chrome and Firefox?
from stockfish.wasm.
Related Issues (20)
- pthread sent an error! undefined:undefined: undefined HOT 3
- Reuse(?) Stockfish HOT 2
- LDFLAGS duplicate code HOT 1
- Max memory for analysis on Firefox = 32MB HOT 3
- position move and position fen messages generate different stockfish output HOT 1
- wasmThreadSupported returns false in node HOT 5
- How do I set the HTTP headers HOT 9
- compile c++ to wasm via Emscripten HOT 4
- compile c++ to wasm (old version) HOT 3
- compile c++ to .js.mem & .wasm HOT 1
- Multi Threads limitations Problem HOT 1
- stockfish.js.mem lost file in version 5 HOT 1
- convert c++ to javascript
- How to kill process created by Stockfish()? HOT 2
- How do I receive the engine output in my code?
- How to handle errors when "set position IMPOSSIBLE_FEN" HOT 2
- In vanilla stockfish you can use UCL_LimitStrength and UCL_Elo to weaken stockfish, can this be achieved in the wasm port somehow? HOT 1
- pthread sent an error HOT 5
- error when building with em++ HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from stockfish.wasm.