From a891a305a34a59b93538164107538ceecea17338 Mon Sep 17 00:00:00 2001 From: Niklas Fiekas Date: Sat, 28 Nov 2020 00:28:36 +0100 Subject: [PATCH] server side analysis now using sf 12 nnue --- app/views/plan/features.scala | 8 +++----- conf/base.conf | 2 +- modules/fishnet/src/main/JsonApi.scala | 26 ++++++++++++++++++-------- ui/analyse/src/serverSideUnderboard.ts | 2 +- 4 files changed, 23 insertions(+), 15 deletions(-) diff --git a/app/views/plan/features.scala b/app/views/plan/features.scala index a51ae167d2..326e6ce413 100644 --- a/app/views/plan/features.scala +++ b/app/views/plan/features.scala @@ -43,10 +43,10 @@ object features { a(href := routes.Page.variantHome())("8 chess variants (Crazyhouse, Chess960, Horde, ...)") ), tr(custom("30 per day"))( - s"Deep $engineName server analysis" + "Deep Stockfish 12+ server analysis" ), tr(unlimited)( - s"Instant local $engineName analysis" + "Instant local Stockfish 11+ analysis" ), tr(unlimited)( a(href := "https://lichess.org/blog/WN-gLzAAAKlI89Xn/thousands-of-stockfish-analysers")( @@ -125,7 +125,7 @@ object features { a(href := routes.Tournament.home())("Arena tournaments") ), tr(check)( - s"Board editor and analysis board with $engineName" + "Board editor and analysis board with Stockfish 11+" ), tr(unlimited)( a(href := routes.Puzzle.home())("Tactics puzzles") @@ -196,6 +196,4 @@ object features { private def tr(value: Frag)(text: Frag*) = st.tr(th(text), all(value)) private val title = "Lichess features" - - private val engineName = "Stockfish 11+" } diff --git a/conf/base.conf b/conf/base.conf index 9539459483..59fe41855a 100644 --- a/conf/base.conf +++ b/conf/base.conf @@ -441,7 +441,7 @@ fishnet { } offline_mode = true # any client can provide moves and analysis actor.name = fishnet - analysis.nodes = 4000000 + analysis.nodes = 2250000 # nnue move.plies = 300 client_min_version = "1.15.10" } diff --git a/modules/fishnet/src/main/JsonApi.scala b/modules/fishnet/src/main/JsonApi.scala index b5b3bb2ef0..1647ffb8d4 100644 --- a/modules/fishnet/src/main/JsonApi.scala +++ b/modules/fishnet/src/main/JsonApi.scala @@ -47,8 +47,12 @@ object JsonApi { case class FullEngine( name: String, - options: EngineOptions - ) extends Engine + options: EngineOptions, + flavor: Option[String] + ) extends Engine { + // TODO: Monitor only nodes/nps from NNUE analysis + def isNnue = flavor.has("nnue") + } case class EngineOptions( threads: Option[String], @@ -90,7 +94,9 @@ object JsonApi { .flatMap(_.nodes) } - def strong = medianNodes.fold(true)(_ > Evaluation.acceptableNodes) + // fishnet 2.x analysis is never weak in this sense. It is either exactly + // the same as analysis provided by any other instance, or failed. + def strong = stockfish.flavor.isDefined || medianNodes.fold(true)(_ > Evaluation.legacyAcceptableNodes) def weak = !strong } @@ -128,10 +134,10 @@ object JsonApi { def invertIf(cond: Boolean) = if (cond) invert else this } - val npsCeil = 10 * 1000 * 1000 + val npsCeil = 10_000_000 - val desiredNodes = 3 * 1000 * 1000 - val acceptableNodes = desiredNodes * 0.9 + private val legacyDesiredNodes = 3_000_000 + val legacyAcceptableNodes = legacyDesiredNodes * 0.9 } } @@ -216,9 +222,13 @@ object JsonApi { Json.obj( "work" -> Json.obj( "type" -> "analysis", - "id" -> a.id + "id" -> a.id, + "nodes" -> Json.obj( + "nnue" -> a.nodes, + "classical" -> a.nodes * 18 / 10 + ) ), - "nodes" -> a.nodes, + "nodes" -> a.nodes * 18 / 10, // bc for fishnet 1.x clients without nnue "skipPositions" -> a.skipPositions ) }) ++ Json.toJson(work.game).as[JsObject] diff --git a/ui/analyse/src/serverSideUnderboard.ts b/ui/analyse/src/serverSideUnderboard.ts index f3416c0e37..ead336008a 100644 --- a/ui/analyse/src/serverSideUnderboard.ts +++ b/ui/analyse/src/serverSideUnderboard.ts @@ -75,7 +75,7 @@ export default function(element: HTMLElement, ctrl: AnalyseCtrl) { } function chartLoader() { - return `
Stockfish 11+
server analysis
${lichess.spinnerHtml}
`; + return `
Stockfish 12+
server analysis
${lichess.spinnerHtml}
`; } function startAdvantageChart() { if (lichess.advantageChart || lichess.AnalyseNVUI) return;