From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Martijn Muijsers Date: Thu, 24 Nov 2022 01:19:12 +0100 Subject: [PATCH] SIMD support License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) Gale - https://galemc.org This patch is based on the following patch: "Add SIMD utilities" By: Kevin Raneri As part of: Pufferfish (https://github.com/pufferfish-gg/Pufferfish) Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) diff --git a/src/main/java/com/destroystokyo/paper/Metrics.java b/src/main/java/com/destroystokyo/paper/Metrics.java index c9c7590a5635d966a0ca262ed5985714d9e66598..c0255b4493cfcdd4b89f4002b731adaf57422f61 100644 --- a/src/main/java/com/destroystokyo/paper/Metrics.java +++ b/src/main/java/com/destroystokyo/paper/Metrics.java @@ -936,6 +936,40 @@ public class Metrics { metrics.addCustomChart(new Metrics.DrilldownPie("gale_semantic_version", () -> semanticVersionMap)); // Gale end - semantic version - include in metrics + // Gale start - SIMD support - include in metrics + Map> simdSupportMap = new HashMap<>(2); // Empty until initialized + metrics.addCustomChart(new Metrics.DrilldownPie("simd_support", () -> { + if (!gg.pufferfish.pufferfish.simd.SIMDDetection.isInitialized()) { + return null; + } + if (simdSupportMap.isEmpty()) { + // Initialize + boolean isEnabled = gg.pufferfish.pufferfish.simd.SIMDDetection.isEnabled(); + + // use details as lower dimension + Map entry = new HashMap<>(2); + String details; + if (isEnabled) { + details = "int " + gg.pufferfish.pufferfish.simd.SIMDDetection.intVectorBitSize() + "*" + gg.pufferfish.pufferfish.simd.SIMDDetection.intElementSize() + ", float " + gg.pufferfish.pufferfish.simd.SIMDDetection.floatVectorBitSize() + "*" + gg.pufferfish.pufferfish.simd.SIMDDetection.floatElementSize(); + } else { + if (!gg.pufferfish.pufferfish.simd.SIMDDetection.testRunCompleted()) { + details = "test failed"; + } else if (gg.pufferfish.pufferfish.simd.SIMDDetection.unsupportingLaneSize()) { + details = "no supporting lane size"; + } else { + details = "other reason"; + } + } + entry.put(details, 1); + + // use enabled or not as higher dimension + simdSupportMap.put(String.valueOf(isEnabled), entry); + + } + return simdSupportMap; + })); + // Gale end - SIMD support - include in metrics + } }