Array addition and array sum Panama benchmarks
Roland Westrelin
rwestrel at redhat.com
Fri Mar 22 10:10:45 UTC 2024
> .vectorArrayArray 7252565.080 ops/s
> .vectorArraySegment 6938948.826 ops/s
> .vectorSegmentArray 4953042.042 ops/s
> .vectorSegmentSegment 4606278.152 ops/s
I think some of the vector API tests are buggy. Shouldn't
vectorArraySegment be something like:
public void vectorArraySegment(Data state) {
final double[] input = state.inputArray;
final MemorySegment output = state.outputSegment;
for (int i = 0; i < input.length; i+=SPECIES.length()) {
DoubleVector a = DoubleVector.fromArray(SPECIES, input, i);
long offset = ((long)i) * (SPECIES.vectorByteSize() / SPECIES.length());
DoubleVector b = DoubleVector.fromMemorySegment(SPECIES, output, offset, ByteOrder.nativeOrder());
a = a.add(b);
a.intoMemorySegment(output, offset, ByteOrder.nativeOrder());
}
}
because intoMemorySegment() and fromMemorySegment() take an offset and
not an index as input?
With that fixed (assuming I got this right), all vector API tests
perform about the same.
Roland.
More information about the panama-dev
mailing list