wasmx is no longer experimental, use new stockfish-mv.wasm (closes #5719)
Originally the X was for eXperiment. Could change it, now, or lets just say it's for eXtension.pull/7068/head
parent
7ef2ca4bdb
commit
1e5543eac7
|
@ -63,13 +63,13 @@
|
|||
}
|
||||
}
|
||||
|
||||
.native {
|
||||
.wasmx {
|
||||
margin-left: 5px;
|
||||
text-transform: uppercase;
|
||||
color: $c-good;
|
||||
}
|
||||
|
||||
.asmjs {
|
||||
.asmjs, .wasm {
|
||||
margin-left: 5px;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ function is64Bit(): boolean {
|
|||
}
|
||||
|
||||
function sharedWasmMemory(initial: number, maximum: number): WebAssembly.Memory | undefined {
|
||||
// In theory 32 bit should be supported just the same, but some 32 bit
|
||||
// TODO: In theory 32 bit should be supported just the same, but some 32 bit
|
||||
// browser builds seem to have trouble with WASMX. So for now detect and
|
||||
// require a 64 bit platform.
|
||||
if (!is64Bit()) return;
|
||||
|
@ -62,20 +62,19 @@ export default function(opts: CevalOpts): CevalCtrl {
|
|||
const source = Uint8Array.of(0x0, 0x61, 0x73, 0x6d, 0x01, 0x00, 0x00, 0x00);
|
||||
if (typeof WebAssembly === 'object' && typeof WebAssembly.validate === 'function' && WebAssembly.validate(source)) {
|
||||
technology = 'wasm'; // WebAssembly 1.0
|
||||
if (officialStockfish(opts.variant.key)) {
|
||||
const sharedMem = sharedWasmMemory(8, 16);
|
||||
if (sharedMem) {
|
||||
technology = 'wasmx';
|
||||
if (!defined(window['crossOriginIsolated'])) window['crossOriginIsolated'] = true; // polyfill
|
||||
try {
|
||||
sharedMem.grow(8);
|
||||
growableSharedMem = true;
|
||||
} catch (e) { }
|
||||
}
|
||||
const sharedMem = sharedWasmMemory(8, 16);
|
||||
if (sharedMem) {
|
||||
technology = 'wasmx';
|
||||
if (!defined(window['crossOriginIsolated'])) window['crossOriginIsolated'] = true; // polyfill
|
||||
try {
|
||||
sharedMem.grow(8);
|
||||
growableSharedMem = true;
|
||||
} catch (e) { }
|
||||
}
|
||||
}
|
||||
|
||||
const maxThreads = Math.min(Math.max((navigator.hardwareConcurrency || 1) - 1, 1), growableSharedMem ? 16 : 2);
|
||||
const initialAllocationMaxThreads = officialStockfish(opts.variant.key) ? 2 : 1;
|
||||
const maxThreads = Math.min(Math.max((navigator.hardwareConcurrency || 1) - 1, 1), growableSharedMem ? 16 : initialAllocationMaxThreads);
|
||||
const threads = storedProp(storageKey('ceval.threads'), Math.min(Math.ceil((navigator.hardwareConcurrency || 1) / 4), maxThreads));
|
||||
|
||||
const maxHashSize = Math.min((navigator.deviceMemory || 0.25) * 1024 / 8, growableSharedMem ? 1024 : 16);
|
||||
|
|
|
@ -71,9 +71,9 @@ function engineName(ctrl: CevalCtrl): VNode[] {
|
|||
const version = ctrl.engineName();
|
||||
return [
|
||||
h('span', version ? { attrs: { title: version } } : {}, ctrl.technology == 'wasmx' ? 'Stockfish 11+' : 'Stockfish 10+'),
|
||||
ctrl.technology == 'wasmx' ? h('span.native', { attrs: { title: 'Multi-threaded WebAssembly (experimental)' } }, 'wasmx') :
|
||||
(ctrl.technology == 'wasm' ? h('span.native', { attrs: { title: 'WebAssembly' } }, 'wasm') :
|
||||
h('span.asmjs', { attrs: { title: 'JavaScript fallback' } }, 'asmjs'))
|
||||
ctrl.technology == 'wasmx' ? h('span.wasmx', { attrs: { title: 'Multi-threaded WebAssembly (fastest)' } }, 'wasmx') :
|
||||
(ctrl.technology == 'wasm' ? h('span.wasm', { attrs: { title: 'Single-threaded WebAssembly fallback (second fastest)' } }, 'wasm') :
|
||||
h('span.asmjs', { attrs: { title: 'Single-threaded JavaScript fallback (very slow)' } }, 'asmjs'))
|
||||
];
|
||||
}
|
||||
|
||||
|
|
|
@ -79,9 +79,8 @@ const stockfishWasm = () => gulp.src([
|
|||
|
||||
const stockfishMvWasm = () => gulp.src([
|
||||
require.resolve('stockfish-mv.wasm/stockfish.js'),
|
||||
require.resolve('stockfish-mv.wasm/stockfish.js.mem'),
|
||||
require.resolve('stockfish-mv.wasm/stockfish.wasm'),
|
||||
require.resolve('stockfish-mv.wasm/pthread-main.js')
|
||||
require.resolve('stockfish-mv.wasm/stockfish.worker.js')
|
||||
]).pipe(gulp.dest('../../public/vendor/stockfish-mv.wasm/'));
|
||||
|
||||
const prodSource = () => browserify(browserifyOpts('src/index.ts', false))
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
"highcharts": "=4.2.5",
|
||||
"hopscotch": "^0.3.1",
|
||||
"jquery-bar-rating": "^1.2.2",
|
||||
"stockfish-mv.wasm": "^0.2.0",
|
||||
"stockfish-mv.wasm": "^0.3.0",
|
||||
"stockfish.js": "^10.0.2",
|
||||
"stockfish.wasm": "^0.7.2",
|
||||
"tablesort": "^5.1"
|
||||
|
|
16
yarn.lock
16
yarn.lock
|
@ -4607,20 +4607,20 @@ stdout-stream@^1.4.0:
|
|||
dependencies:
|
||||
readable-stream "^2.0.1"
|
||||
|
||||
stockfish-mv.wasm@^0.2.0:
|
||||
version "0.2.0"
|
||||
resolved "https://registry.yarnpkg.com/stockfish-mv.wasm/-/stockfish-mv.wasm-0.2.0.tgz#b402050ccca5455ed4419ffe2ad96d52a19c5f34"
|
||||
integrity sha512-a2E/J0kBJIfoKdC8KPNy+xGQ4hvT/E10THMxjqmy1aHCgoV0pvOY+lgcLqvm6Q4c5IyFX5iDiY59ZrrtHedbEg==
|
||||
stockfish-mv.wasm@^0.3.0:
|
||||
version "0.3.0"
|
||||
resolved "https://registry.yarnpkg.com/stockfish-mv.wasm/-/stockfish-mv.wasm-0.3.0.tgz#c357cd9178628fafc85534b73e36552a887afb31"
|
||||
integrity sha512-SFusEHLncx4CKTL56rwdOUkH9zdvgsl0vXvkwLNZmk8hLyCVYgjIxaNDjC3X8yXitG9wKFrzA6CWDDIKI5VYRQ==
|
||||
|
||||
stockfish.js@^10.0.2:
|
||||
version "10.0.2"
|
||||
resolved "https://registry.yarnpkg.com/stockfish.js/-/stockfish.js-10.0.2.tgz#c8206aa3b0290171ace52b463a74112ea1f83989"
|
||||
integrity sha512-treB3AYcdvRJ9SDPOyL0R2NcEAtQgG432nStfRzR4wzVELGQ6iVoeBHwvirHTfocNOTims7XNkK3SADaocsJmQ==
|
||||
|
||||
stockfish.wasm@^0.7.1:
|
||||
version "0.7.1"
|
||||
resolved "https://registry.yarnpkg.com/stockfish.wasm/-/stockfish.wasm-0.7.1.tgz#651f22558089efc15bdff1e2c202f77bb0141a10"
|
||||
integrity sha512-wHtfbGPX6pZELeLhyvCAS8Fz3se6MoKANSEuZ1PIX9ZnKh9yS6PVP5zBuoY3cOS9Ku9RmyVBzFG8eIiBjJwlcA==
|
||||
stockfish.wasm@^0.7.2:
|
||||
version "0.7.2"
|
||||
resolved "https://registry.yarnpkg.com/stockfish.wasm/-/stockfish.wasm-0.7.2.tgz#9e224f8f48318746afaf44b633910408cfe8bf3e"
|
||||
integrity sha512-LTpLu81hD5wig9cOXfFy4NRrKfx2O6rY5MMOIYQCUh8sPZztxVv+Ru388GTql1rFH3kNLIo6mnwNtI4etIO7zQ==
|
||||
|
||||
stream-browserify@^2.0.0:
|
||||
version "2.0.2"
|
||||
|
|
Loading…
Reference in New Issue