-
Notifications
You must be signed in to change notification settings - Fork 323
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
Implement and benchmark ArrowOperationPlus
node
#10150
Conversation
...ime-language-arrow/src/main/java/org/enso/interpreter/arrow/node/ArrowCastFixedSizeNode.java
Show resolved
Hide resolved
...time-language-arrow/src/main/java/org/enso/interpreter/arrow/runtime/ArrowOperationPlus.java
Outdated
Show resolved
Hide resolved
|
||
@BeforeClass | ||
public static void initEnsoContext() { | ||
ctx = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use ContextUtils and declare dependency runtime-language-arrow/Test
--> test-utils
. Being able to use context and project utils from test-utils
was the main motivation to move test-utils
into separate project in #10112
a157891
to
68d9306
Compare
...untime-language-arrow/src/main/java/org/enso/interpreter/arrow/runtime/ByteBufferDirect.java
Outdated
Show resolved
Hide resolved
With 68d9306 we are at
There is a bunch of computations related to That surprising as as they should be constant... but one has to tell the compiler a |
+
operation in the _Arrow language_+
operation in the _Arrow language_
+
operation in the _Arrow language_ArrowOperationPlus
node
...time-language-arrow/src/main/java/org/enso/interpreter/arrow/runtime/ArrowFixedArrayInt.java
Show resolved
Hide resolved
Runtime.assert ((column_arithmetic_plus_fitting data . to_vector) == (arrow_arithmetic_plus_fitting data)) "Column and arrow correctness check one" | ||
Runtime.assert ((column_arithmetic_plus_overflowing data . to_vector) == (arrow_arithmetic_plus_overflowing data)) "Column and arrow correctness check two" | ||
Runtime.assert ((column_arithmetic_plus_nothing data . to_vector) == (arrow_arithmetic_plus_nothing data)) "Column and arrow correctness check three" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I really miss . should_equal
& co. when writing benchmarks. How are we supposed to know it computes the right values?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess we could use should_equal
? It will just throw a panic if it fails.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since #8778 we probably could use should_equal
. Still I am not sure how to do write such tests properly to avoid:
- initialization overhead
- slowing down the benchmarks
This current Runtime.assert
relies on the fact that runEngineDistribution -run test/Benchmarks
runs with enabled assertions and thus it will check the assert. While when running benchmarks on the CI as well as std-benchmarks/bench
the assertions are disabled and thus this testing code isn't executed at all.
I think it works, but it is a bit fragile.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Enso benchmarks look good.
I don't really understand how the engine part works. I'm not sure if I have to, but maybe the interactive PR review you suggested in some discussion could work well in this kind of PR? As I imagine it would be useful to get a high-level explanation of the decisions here. Without it I'm guessing and I'm not really sure what is happening in this code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approving the Enso benchmark changes, assuming @hubertp will look over the engine part.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Arrow optimizations look really good. Thanks for doing the investigation
...ime-language-arrow/src/main/java/org/enso/interpreter/arrow/node/ArrowCastFixedSizeNode.java
Show resolved
Hide resolved
...time-language-arrow/src/main/java/org/enso/interpreter/arrow/runtime/ArrowFixedArrayInt.java
Show resolved
Hide resolved
Co-authored-by: Radosław Waśko <[email protected]>
37343e4
to
807fd6d
Compare
put.putNull(builder.buffer, cachedUnit); | ||
return; | ||
} | ||
var number = valueNode.executeAdjust(cachedUnit, value); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unlike the previous version that was converting and calling putXyz at once place the executeAdjust
just converts value
to appropriate java.lang.Number
and then we use the PutNode
to place that value into the buffer.
Truffle gives us a way to separate concerns for operations without loosing the speed - the whole switch
will be compiled away and at the end will look just like the old one, but in source it is more structured into individual nodes.
Pull Request Description
Prototype of #10056 showing
+
operation implemented in the Arrow language.Checklist
Please ensure that the following checklist has been satisfied before submitting the PR:
Java,