[foreign-memaccess+abi] RFR: Check for mixed access - remove mem barriers

Radoslaw Smogura github.com+7535718+rsmogura at openjdk.java.net
Mon Jul 26 21:49:48 UTC 2021


On Sat, 24 Jul 2021 16:07:09 GMT, Radoslaw Smogura <github.com+7535718+rsmogura at openjdk.org> wrote:

> That's for previous PR, which I destroyed with bad merge from master.
> 
> I wonder if this can look like this?
> 
> 
> Benchmark                               (size)  Mode  Cnt   Score    Error  Units
> ByteBufferVectorAccess.directBuffers      1024  avgt   10  27.119 ?  0.186  ns/op
> ByteBufferVectorAccess.heapBuffers        1024  avgt   10  28.501 ?  0.118  ns/op
> ByteBufferVectorAccess.pollutedBuffers    1024  avgt   10  64.354 ? 27.778  ns/op
> Finished running test 'micro:ByteBufferVectorAccess'
> 
> 
> https://github.com/openjdk/panama-foreign/pull/566

There's one "pollution" case I tested in ByteBufferVectorAccess.pollutedBuffers. I'm not sure if it's covered with MemorySegments - I created simillar test case, and it looks not. However I'm not sure maybe it's too extreme? [1]

>From the other hand null check in ScopedMemoryAccess.storeIntoByteBufferScoped (version [2]) did not improve performance (I think loop is not unswitched and not unrolled, even if I don't see mem bars there).

(And now I see what's wrong with vectorIntrinsics branch it's in different repo... ).

--

[1] https://github.com/rsmogura/panama-foreign/blob/pollute-mem-seg-var-handle/test/micro/org/openjdk/bench/jdk/incubator/foreign/MemorySegmentPolluteUnsafe.java

[2] https://github.com/openjdk/panama-foreign/compare/foreign-memaccess+abi...rsmogura:vector-buffers-closer-to-intrinsic?expand=1

Forget add benchmarks results for version with checks closer to intrinsic


Benchmark                               (size)  Mode  Cnt    Score    Error  Units
ByteBufferVectorAccess.directBuffers      1024  avgt   10   12.075 ?  0.178  ns/op
ByteBufferVectorAccess.heapBuffers        1024  avgt   10   15.840 ?  0.177  ns/op
ByteBufferVectorAccess.pollutedBuffers    1024  avgt   10  123.074 ? 34.672  ns/op

Generaly a + b < combined(a,b)

-------------

PR: https://git.openjdk.java.net/panama-foreign/pull/573


More information about the panama-dev mailing list