Closed Bug 1749788 Opened 2 years ago Closed 2 years ago

Make wasm simd lichess/stockfish fast with AVX2

Categories

(Core :: JavaScript: WebAssembly, enhancement, P3)

enhancement

Tracking

()

RESOLVED FIXED
100 Branch
Tracking Status
firefox100 --- fixed

People

(Reporter: yury, Assigned: yury)

References

Details

Attachments

(2 files)

The wasm version source code of lichess engine is available at https://github.com/hi-ogawa/Stockfish . Unfortunately, it relies on threads to be present, means it needs to be run and benchmarked in browser context. After my preliminary runs, the enabling AVX does not provides meaningful win in performance (~1%). Here is the list of SIMD ops used in the code minus ops we already implemented for AVX, or irrelevant:

  • f64x2.mul
  • f64x2.replace_lane
  • i16x8.add, i16x8.sub
  • i16x8.extend_high_i8x16_s, i16x8.extend_low_i8x16_s
  • i16x8.max_s, i16x8.min_s
  • i32x4.abs, i32x4.sub
  • i32x4.dot_i16x8_s
  • i32x4.max_s, i32x4.max_u, i32x4.min_s
  • i32x4.replace_lane
  • i32x4.shl, i32x4.shr_s, i32x4.shr_u w/const
  • i64x2.add, i64x2.sub
  • i64x2.shl, i64x2.shr_s w/const
  • i8x16.narrow_i16x8_u
  • i8x16.replace_lane
  • i8x16.shuffle
  • v128.bitselect
Depends on: 1750049
  • Implement {i8x16,i16x8,i32x4,f32x4,f64x2}.replace_lane
  • Fix i64x2.splat for AVX2 and make it faster for non-AVX2

Depends on D139051

Attachment #9264439 - Attachment description: WIP: Bug 1749788 - Implement simple binary SIMD operations for AVX encoding. → Bug 1749788 - Implement simple binary SIMD operations for AVX encoding. r?jseward
Attachment #9264476 - Attachment description: WIP: Bug 1749788 - Fix replace_lane and i64x2.splat for AVX. → Bug 1749788 - Fix replace_lane and i64x2.splat for AVX. r?jseward
Pushed by ydelendik@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/ae6d99fecf42
Implement simple binary SIMD operations for AVX encoding. r=jseward
https://hg.mozilla.org/integration/autoland/rev/99317db06b7c
Fix replace_lane and i64x2.splat for AVX. r=jseward
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 100 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: