2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

NEONの逆数推定命令の精度 : Accuracy of NEON reciprocal estimation instruction

Last updated at Posted at 2018-11-07

#背景 / background
最近仕事で浮動小数点除算を含むフィルタ処理の高速化の需要があるらしく、精度もそんなに必要ない処理なので精度を落として高速化できそう。
ARMのNEON命令には除算命令がなく、除算したいときはVRECPE命令で逆数を推定しNewton-Raphson法で必要な精度まで補正するらしい。
精度要求を緩和することによる除算の高速化を目標に以下の項目について調べた。
There are demand for speedup of image filter which include division. The accuracy of filter does not need to meet full accuracy of single precision float. In ARM NEON ISA, there are no division instruction. When it is needed, we can estimate reciprocal value with VRECPE instruction and correct it by Newton-Raphson methods and then multiply. I set speedup of division by reducing its accuracy as the goal, and investigate below things.

  • VRECPEの精度 / accuracy of VRECPE
  • 初期逆数推定値の補正とその精度 / reciprocal value correction methods and its accuracy
  • それぞれの補正方式の速度 / speed of these method

この記事は最初のVRECPEの精度の評価に関して書く。
This article focussed on accuracy of VRECPE.

#調査 / investigation
raspberry pi 3 model b+を使って検証した。
1/2 ~ 1/1048576まで分母を増やしていって真値と推定値との相対誤差の最大値を計算してみた。
検証コードは
https://github.com/sanmanyannyan/neon_div_accuracy_analysis
に置いた。
I used raspberry pi 3 model b+.
I evaluated relative error of 1/2 ~ 1/1048576, and searched maximum relative error of these.

max relative difference:0.002853
true value:0.007299 = 1 / 137.000000
 est value:0.007278
true value:0 01110111 1101'1110'0101'1101'0110'111
 est value:0 01110111 1101'1101'0000'0000'0000'000

#結果 / result
暗黙の1が入っていることを考えると8bit弱といったところ。
VRECPEの命令仕様には精度に関する記述がなかったので実装ごとに精度が違ってるのかも。
知ってる人いたら教えてほしい。
With consideration of leading hidden bit of float, the accuracy is 7bit.
There are no mention about accuracy of VRECPE in ARM manual, so this result may differ from other CPUs.

2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?