mirror of
https://github.com/Winds-Studio/Leaf.git
synced 2025-12-19 15:09:25 +00:00
66 lines
3.5 KiB
Diff
66 lines
3.5 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Martijn Muijsers <martijnmuijsers@live.nl>
|
|
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 <kevin.raneri@gmail.com>
|
|
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..119d26ada18ad1451b893657a1c9fa3bc2be6be4 100644
|
|
--- a/src/main/java/com/destroystokyo/paper/Metrics.java
|
|
+++ b/src/main/java/com/destroystokyo/paper/Metrics.java
|
|
@@ -936,6 +936,46 @@ 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<String, Map<String, Integer>> 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<String, Integer> 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.supportingJavaVersion()) {
|
|
+ details = "unsupported Java";
|
|
+ try {
|
|
+ var javaVersion = gg.pufferfish.pufferfish.simd.SIMDDetection.getJavaVersion();
|
|
+ details += " (" + javaVersion + ")";
|
|
+ } catch (Throwable ignored) {}
|
|
+ } 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
|
|
+
|
|
}
|
|
|
|
}
|