9
0
mirror of https://github.com/BX-Team/DivineMC.git synced 2025-12-20 15:29:15 +00:00

update simd impl

This commit is contained in:
NONPLAYT
2025-07-20 18:01:15 +03:00
parent e0e76be411
commit 156b3bd7cf
5 changed files with 33 additions and 25 deletions

View File

@@ -4,25 +4,25 @@
// Purpur end - Purpur config files
com.destroystokyo.paper.VersionHistoryManager.INSTANCE.getClass(); // Paper - load version history now
+ // DivineMC start - Pufferfish SIMD
+ // DivineMC start - Pufferfish: SIMD Support
+ try {
+ gg.pufferfish.pufferfish.simd.SIMDDetection.isEnabled = gg.pufferfish.pufferfish.simd.SIMDDetection.canEnable(LOGGER);
+ gg.pufferfish.pufferfish.simd.SIMDDetection.versionLimited = gg.pufferfish.pufferfish.simd.SIMDDetection.getJavaVersion() < 17 || gg.pufferfish.pufferfish.simd.SIMDDetection.getJavaVersion() > 21;
+ } catch (NoClassDefFoundError | Exception ignored) {
+ gg.pufferfish.pufferfish.simd.SIMDDetection.versionLimited = gg.pufferfish.pufferfish.simd.SIMDDetection.getJavaVersion() < gg.pufferfish.pufferfish.simd.SIMDDetection.MIN_JAVA_VERSION || gg.pufferfish.pufferfish.simd.SIMDDetection.getJavaVersion() > gg.pufferfish.pufferfish.simd.SIMDDetection.MAX_JAVA_VERSION;
+ } catch (final NoClassDefFoundError | Exception ignored) {
+ ignored.printStackTrace();
+ }
+
+ if (gg.pufferfish.pufferfish.simd.SIMDDetection.isEnabled) {
+ LOGGER.info("SIMD operations detected as functional. Will replace some operations with faster versions.");
+ } else if (gg.pufferfish.pufferfish.simd.SIMDDetection.versionLimited) {
+ LOGGER.warn("Will not enable SIMD! These optimizations are only safely supported on Java 17 and higher.");
+ LOGGER.warn("Will not enable SIMD! These optimizations are only safely supported on Java {}-{}", gg.pufferfish.pufferfish.simd.SIMDDetection.MIN_JAVA_VERSION, gg.pufferfish.pufferfish.simd.SIMDDetection.MAX_JAVA_VERSION);
+ } else {
+ LOGGER.warn("SIMD operations are available for your server, but are not configured!");
+ LOGGER.warn("To enable additional optimizations, add \"--add-modules=jdk.incubator.vector\" to your startup flags, BEFORE the \"-jar\".");
+ LOGGER.warn("If you have already added this flag, then SIMD operations are not supported on your JVM or CPU.");
+ LOGGER.warn("Debug: Java: {}, test run: {}", System.getProperty("java.version"), gg.pufferfish.pufferfish.simd.SIMDDetection.testRun);
+ }
+ // DivineMC end - Pufferfish SIMD
+ // DivineMC end - Pufferfish: SIMD Support
+
this.setPvpAllowed(properties.pvp);
this.setFlightAllowed(properties.allowFlight);