Source/Packages

Realization.Nvidia.SM86.RotaryTableSM86

packages/realizations/cooperative/nvidia-sm86/src/Realization/Nvidia/SM86/RotaryTableSM86.alpha

119 lines22 declarations7.8 KiBSHA-256 dc57d74ec7e7

def · lines 29–29

rotaryTableSM86CosineArgument

Full file
One column of the rotary tables: for the positions p of a block, the cosine and sine of p theta, stored at `cos + p stride` and `sin + p stride` -- a launch per frequency theta, a thread per position. The angle is carried in two words: theta = thetaHigh + thetaLow (the binary32 nearest theta, and the binary32 nearest what it misses), so p theta = p thetaHigh -- whose rounding error a fused multiply-add recovers exactly -- plus p thetaLow. It is reduced by whole turns, k = the nearest integer to p thetaHigh / (2 pi) (the magic-number rounding: adding 1.5 x 2^23 leaves the integer in the low bits), with 2 pi likewise in two words (Cody and Waite): r = ((a - k twoPiHigh) - k twoPiLow) + p thetaLow, which lies within a turn of zero. MUFU.COS and MUFU.SIN take their argument in turns (r / (2 pi)). Constant bank: 0x160 the cosine column's address, 0x168 the sine column's; scalars from 0x190: thetaHigh, thetaLow, 1 / (2 pi), twoPiHigh, twoPiLow, 1.5 x 2^23, the stride between positions in bytes.
29def rotaryTableSM86CosineArgument : Nat = 0

The compiler supplied declaration spans and resolved links from this source snapshot. This page does not assert that this file belongs to a checked closure.