-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
47 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 | ||
From: foss-mc <[email protected]> | ||
Date: Wed, 4 Sep 2024 18:54:39 +1200 | ||
Subject: [PATCH] enable SIMD on java 17 and later | ||
|
||
|
||
diff --git a/src/main/java/gg/pufferfish/pufferfish/simd/SIMDChecker.java b/src/main/java/gg/pufferfish/pufferfish/simd/SIMDChecker.java | ||
index ab5fea0b03224bf249352ce340e94704ff713345..7024a47b0de5083c3ba49c8e45b4c4b1369ab2c5 100644 | ||
--- a/src/main/java/gg/pufferfish/pufferfish/simd/SIMDChecker.java | ||
+++ b/src/main/java/gg/pufferfish/pufferfish/simd/SIMDChecker.java | ||
@@ -15,7 +15,7 @@ public class SIMDChecker { | ||
@Deprecated | ||
public static boolean canEnable(Logger logger) { | ||
try { | ||
- if (SIMDDetection.getJavaVersion() != 17 && SIMDDetection.getJavaVersion() != 18 && SIMDDetection.getJavaVersion() != 19) { | ||
+ if (SIMDDetection.getJavaVersion() < 17) { | ||
return false; | ||
} else { | ||
SIMDDetection.testRun = true; |
28 changes: 28 additions & 0 deletions
28
patches/server/0020-enable-SIMD-on-java-17-and-later.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 | ||
From: foss-mc <[email protected]> | ||
Date: Wed, 4 Sep 2024 18:53:37 +1200 | ||
Subject: [PATCH] enable SIMD on java 17 and later | ||
|
||
|
||
diff --git a/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java b/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java | ||
index 1ca25529245ed369b8705075a8c2e32fa4d9b1d1..7c6820b1320c40ef17f1c327bb7f49f8dfc02674 100644 | ||
--- a/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java | ||
+++ b/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java | ||
@@ -94,7 +94,7 @@ public class PufferfishConfig { | ||
// Attempt to detect vectorization | ||
try { | ||
SIMDDetection.isEnabled = SIMDDetection.canEnable(PufferfishLogger.LOGGER); | ||
- SIMDDetection.versionLimited = SIMDDetection.getJavaVersion() != 17 && SIMDDetection.getJavaVersion() != 18 && SIMDDetection.getJavaVersion() != 19; | ||
+ SIMDDetection.versionLimited = SIMDDetection.getJavaVersion() < 17; | ||
} catch (NoClassDefFoundError | Exception ignored) { | ||
ignored.printStackTrace(); | ||
} | ||
@@ -102,7 +102,7 @@ public class PufferfishConfig { | ||
if (SIMDDetection.isEnabled) { | ||
PufferfishLogger.LOGGER.info("SIMD operations detected as functional. Will replace some operations with faster versions."); | ||
} else if (SIMDDetection.versionLimited) { | ||
- PufferfishLogger.LOGGER.warning("Will not enable SIMD! These optimizations are only safely supported on Java 17, Java 18, and Java 19."); | ||
+ PufferfishLogger.LOGGER.warning("Will not enable SIMD! These optimizations are only safely supported on Java 17 or later"); | ||
} else { | ||
PufferfishLogger.LOGGER.warning("SIMD operations are available for your server, but are not configured!"); | ||
PufferfishLogger.LOGGER.warning("To enable additional optimizations, add \"--add-modules=jdk.incubator.vector\" to your startup flags, BEFORE the \"-jar\"."); |