summaryrefslogtreecommitdiff
path: root/libnativeloader/native_loader_test.cpp
diff options
context:
space:
mode:
authorUsama Arif <usama.arif@linaro.org>2019-10-30 16:23:26 +0000
committerHans Boehm <hboehm@google.com>2019-11-12 20:58:17 +0000
commit681692b6291008caaddf4971eab7ea9f9b25d9ca (patch)
treecad26b5b6016cc27baa480e5f4b83faac3317ef0 /libnativeloader/native_loader_test.cpp
parent665aac46784684dfb85fe999f6a566ed0cf173ef (diff)
ARM64: FP16.rint() intrinsic for ARMv8
This CL implements an intrinsic for rint() method with ARMv8.2 FP16 instructions. This intrinsic implementation achieves bit-level compatibility with the original Java implementation android.util.Half.rint(). The time required in milliseconds to execute the below code on Pixel3: - Java implementation android.util.Half.rint(): - big cluster only: 19828 - little cluster only: 61457 - arm64 Intrinisic implementation: - big cluster only: 14186 (~28% faster) - little cluster only: 54405 (~11% faster) Analysis of this function with simpleperf showed that approximately only 60-65% of the time is spent in libcore.util.FP16.rint. So the percentage improvement using intrinsics is likely to be more than the numbers stated above. Another reason that the performance improvement with intrinsic is lower than expected is because the java implementation for values between -1 and 1 (abs < 0x3c00) only requires a few instructions and should almost give a similar performance to the intrinsic in this case. In the benchmark function below, 46.8% of the values tested are between -1 and 1. public static short benchmarkrint(){ short ret = 0; long before = 0; long after = 0; before = System.currentTimeMillis(); for(int i = 0; i < 50000; i++){ for (short h = Short.MIN_VALUE; h < Short.MAX_VALUE; h++) { ret += FP16.rint(h); } } after = System.currentTimeMillis(); System.out.println("Time of FP16.rint (ms): " + (after - before)); System.out.println(ret); return ret; } Test: 580-fp16 Test: art/test/testrunner/run_build_test_target.py -j80 art-test-javac Change-Id: I075c3e85a36fd9bce14deee437c5b961bd667b5d
Diffstat (limited to 'libnativeloader/native_loader_test.cpp')
0 files changed, 0 insertions, 0 deletions