-
Notifications
You must be signed in to change notification settings - Fork 326
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Vector_Operations.Partition
benchmark results in an infinite deopt loop
#11437
Comments
Another example of infinite deopt loop is in https://github.com/enso-org/enso/actions/runs/11564721429/job/32190462547#step:7:11096 in benchmark
|
Can be reproduced simply by running the benchmark directly in pure Enso via:
|
Running:
reveal a lot of
|
Apply this patch: diff --git a/engine/runtime/src/main/java/org/enso/interpreter/runtime/data/vector/ArrayBuilder.java b/engine/runtime/src/main/java/org/enso/interpreter/runtime/data/vector/ArrayBuilder.java
index 5da2ece85b..b8e2820345 100644
--- a/engine/runtime/src/main/java/org/enso/interpreter/runtime/data/vector/ArrayBuilder.java
+++ b/engine/runtime/src/main/java/org/enso/interpreter/runtime/data/vector/ArrayBuilder.java
@@ -13,9 +13,12 @@ import com.oracle.truffle.api.nodes.Node;
import java.util.Arrays;
import org.enso.interpreter.runtime.data.EnsoObject;
import org.enso.interpreter.runtime.warning.WarningsLibrary;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
@ExportLibrary(InteropLibrary.class)
final class ArrayBuilder extends EnsoObject {
+ private static final Logger LOGGER = LoggerFactory.getLogger(ArrayBuilder.class);
private static final String[] MEMBERS =
new String[] {"isEmpty", "add", "appendTo", "get", "getSize", "toArray"};
private final int initialCapacity;
@@ -79,6 +82,8 @@ final class ArrayBuilder extends EnsoObject {
if (e instanceof Double d) {
if (size == doubleArray.length) {
CompilerDirectives.transferToInterpreter();
+ LOGGER.debug("[ArrayBuilder@{}] double array capacity reached: {}, resizing to: {}",
+ Integer.toHexString(System.identityHashCode(this)), size, size * 2);
primitiveArray = doubleArray = Arrays.copyOf(doubleArray, size * 2);
}
doubleArray[size++] = d;
diff --git a/test/Benchmarks/src/Vector/Operations.enso b/test/Benchmarks/src/Vector/Operations.enso
index 58f9404add..7f1946209f 100644
--- a/test/Benchmarks/src/Vector/Operations.enso
+++ b/test/Benchmarks/src/Vector/Operations.enso
@@ -9,7 +9,7 @@ import project.Vector.Utils
polyglot java import java.util.Random as Java_Random
-options = Bench.options . set_warmup (Bench.phase_conf 5 5) . set_measure (Bench.phase_conf 1 5)
+options = Bench.options . set_warmup (Bench.phase_conf 3 3) . set_measure (Bench.phase_conf 1 1)
collect_benches = Bench.build builder-> And run:
Gives the output:
TL;DR; There are a lot of ArrayBuilders with a primitive double array that are resized up to the capacity of 10^6. When an ArrayBuilder is resized, there is |
Pavel Marek reports a new STANDUP for today (2025-02-25): Progress: - Revealed most probable cause of the indefinite deoptimizations in Vector.Partition benchmark:
|
Pavel Marek reports a new STANDUP for today (2025-02-26): Progress: - Discussion about engine/stdlib telemetry and logging.
|
Pavel Marek reports a new STANDUP for today (2025-02-27): Progress: - Trying the approach with methods behind
|
On 4898445, reproduce with:
The output is:
Note that because of the infinite deopt loop, the stddev is even bigger than score, so the result from the benchmark is not reliable.
Output on the CI: https://github.com/enso-org/enso/actions/runs/11564721429/job/32190462547#step:7:11505
The text was updated successfully, but these errors were encountered: