9
0
mirror of https://github.com/Winds-Studio/Leaf.git synced 2025-12-19 15:09:25 +00:00
Files
Leaf/leaf-server/paper-patches/features/0010-SIMD-support.patch
Dreeam c8ba5fedc8 Updated Upstream (Paper)
Upstream has released updates that appear to apply and compile correctly

Paper Changes:
PaperMC/Paper@9b1798d6 Simplify custom payload handling (#12347)
PaperMC/Paper@2552abf0 fix message mutation in PlayerSetSpawnEvent
PaperMC/Paper@ae99e24f fix deprecated bungee chat api methods
PaperMC/Paper@dca4aab8 add util methods to CraftChatMessage
PaperMC/Paper@87c9d9b0 be more lenient on url parsing for legacy format
PaperMC/Paper@4a9bd2e3 Correctly clear items in PlayerDeathEvent
PaperMC/Paper@a70f7745 fix unsaveable launched trident
PaperMC/Paper@41a094cf move block data/state impl
PaperMC/Paper@6b26b219 remove hardcoded durability from material
PaperMC/Paper@db8c646d Merge remote-tracking branch 'origin/main' into update/1.21.5
2025-03-31 09:53:16 -04:00

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 612eacf43f8b6b92354fa43479bd0ead728dd7b9..a35c0af0c53bab4c1b3623e903d3057c816e5d3b 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
+
}
}