Performance core pools

- Generation pool sized to performance cores
- Pregen burst raise sized from performance cores
- Hydrology planner pool sized to performance cores, at least four
This commit is contained in:
Brian Neumann-Fopiano committed 2026-10-21 23:03:20 -04:00
1 parent 393ea10cdf
commit 35e4e30ecd
4 files changed
+23 -7

No files matched your search

@@ -26,7 +26,7 @@ public class MultiBurst extends MultiBurstSupport {
private final AtomicInteger parallelismBaseline = new AtomicInteger();
public MultiBurst() {
this("Iris");
this("Iris", Thread.MIN_PRIORITY, MultiBurstSupport::performanceProcessors);
}
public MultiBurst(String name) {
@@ -140,8 +140,15 @@ public class MultiBurst extends MultiBurstSupport {
static final class HydrologyBurst extends MultiBurst {
HydrologyBurst() {
super("Iris Hydrology", () -> Math.max(2,
IrisSettings.getThreadCount(IrisSettings.get().getConcurrency().getParallelism())));
super("Iris Hydrology", HydrologyBurst::plannerParallelism);
}
static int plannerParallelism() {
return plannerParallelism(MultiBurstSupport.performanceProcessors());
}
static int plannerParallelism(int performanceProcessors) {
return Math.max(4, performanceProcessors);
}
@Override
@@ -24,6 +24,7 @@ import art.arcane.iris.generation.runtime.Engine;
import art.arcane.iris.platform.generation.PlatformChunkGenerator;
import art.arcane.iris.spi.IrisLogging;
import art.arcane.iris.generation.concurrent.MultiBurst;
import art.arcane.volmlib.util.parallel.MultiBurstSupport;
import java.util.Objects;
import java.util.concurrent.atomic.AtomicInteger;
@@ -45,7 +46,7 @@ public final class PregenPerformanceProfile {
changed = true;
}
if (MultiBurst.burst.raiseParallelism(pregenBurstParallelism(Runtime.getRuntime().availableProcessors()))) {
if (MultiBurst.burst.raiseParallelism(pregenBurstParallelism(MultiBurstSupport.performanceProcessors()))) {
PARALLELISM_HOLDERS.incrementAndGet();
changed = true;
}
@@ -88,8 +89,8 @@ public final class PregenPerformanceProfile {
apply(generator == null ? null : generator.getEngine());
}
static int pregenBurstParallelism(int availableProcessors) {
return Math.max(4, availableProcessors * 2);
static int pregenBurstParallelism(int performanceProcessors) {
return Math.max(4, performanceProcessors * 2);
}
private static void prepareNoiseCacheInPlace(Engine engine) {
@@ -12,6 +12,7 @@ import java.util.concurrent.ForkJoinTask;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotSame;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
@@ -60,6 +61,13 @@ public class HydrologyBurstTest {
assertTrue(pool.isTerminated());
}
@Test
public void plannerPoolFollowsThePerformanceCores() {
assertEquals(12, MultiBurst.HydrologyBurst.plannerParallelism(12));
assertEquals(4, MultiBurst.HydrologyBurst.plannerParallelism(1));
assertEquals(32, MultiBurst.HydrologyBurst.plannerParallelism(32));
}
@Test
public void closedHydrologyWorkersTerminateAndReopenCreatesANewPool() throws Exception {
IrisSettings previousSettings = IrisSettings.settings;
@@ -99,7 +99,7 @@ public class PregenPerformanceProfileTest {
}
@Test
public void pregenerationWantsTwoBurstWorkersPerCore() {
public void pregenerationWantsTwoBurstWorkersPerPerformanceCore() {
assertEquals(32, PregenPerformanceProfile.pregenBurstParallelism(16));
assertEquals(4, PregenPerformanceProfile.pregenBurstParallelism(1));
}