MrNeRF / gaussian-splatting-cuda

3D Gaussian Splatting, reimagined: Unleashing unmatched speed with C++ and CUDA from the ground up!
Other
909 stars 74 forks source link

Missing 1 in accumulating T? #16

Closed qliang88 closed 1 year ago

qliang88 commented 1 year ago

https://github.com/MrNeRF/gaussian-splatting-cuda/blob/928a1518703b21d4de4a80c60555faaadc3cad28/cuda_rasterizer/forward.cu#L333

float test_T = __fmaf_rn(T, -alpha, T); is different from float test_T = T * (1 - alpha); in original implementation.

Maybe a typo?

MrNeRF commented 1 year ago

Hi, you have T (1 - alpha) = T - T alpha = -T alpha + T as integer addition is commutative. With __fmaf_rn() you can compute three instructions in one cycle. __fmaf_rn() represent a b + c that is __fmaf_rn(-T, alpha,T) which also equals __fmaf_rn(T, -alpha,T). Hope this helps!