Title: Arbitrary Floating Points on GPU ? Post by: cKleinhuis on January 16, 2010, 03:15:09 AM i am thinking about how to implement arbitrary floating point on a gpu, and it all breaks down to
using fixed point numbers as pixel elements ( a number with 256 bits would use 16x16 Pixel ) and calculate the math on it ... so, the standard, like +,-,*,/ is in my sight and i have an idea how to implement it, but i am wondering how to implement the complicated stuff like exponentiation, squaring, rooting, sine and cosine and stuff .. :hmh: :hmh: :hmh: :hmh: :hmh: Title: Re: Arbitrary Floating Points on GPU ? Post by: Snakehand on January 16, 2010, 10:03:05 AM I think the main difficulty with arbitrary precision mathematics on the GPU is to organize streams (large datasets) and functions in such a way that you can pass these large values between them. FOr instance on ATI a function that doesn't write its output to a stream can at most return a 128 bits value. So you might have to use a C style preprocessor that inlines such functions call. For mandelbrot and mandelbulb the usual iterative approach will involv numbers that are small (ex < 2.0) so fixed point will be the most appropriate to use. DE will be much harder where you have to do logarithms. I can imagine that code will have to be rewritten so that you don't have a GPU function that marches a single ray, but instead calculates the the size of the next step for a single ray, and the call those repeatedly.
128 bits precision would be the "easiest" to do, more than that and your numbers will have to be placed in streams, and worked on in memory rather than in registers. Cached memory access is very fast, but since streams are generally the objects passed in CPU->GPU calls, and registers are used in GPU functions, more of program logic will have to be done by the CPU, and the GPU will just do the dumb crunching of the numbers. Title: Re: Arbitrary Floating Points on GPU ? Post by: cKleinhuis on January 16, 2010, 12:40:51 PM i think the unmbers could be represented as arbitrary long chunks on a bitmap stream input, and
ohne layer of those numbers would have to go through many steps on the gpu ... i want arbitrary depth ... fast Title: Re: Arbitrary Floating Points on GPU ? Post by: cbuchner1 on January 16, 2010, 01:30:26 PM Double precision can be emulated by combining two single precision floats, as detailed in this CUDA forum posting. http://forums.nvidia.com/index.php?showtopic=73067 You lose about factor 10-20 in speed, so much of the GPU's speed advantage is lost. ATI cards should do better with integers than nVidia cards, because these can only multiply two 24 bit precision numbers in 4 clock cycles (they are re-using the integer parts of the floating point ALU, which only requires 24 bits of mantissa to work with). So working with 32 bit ints is slower on nVidia than working with floats. Christian Title: Re: Arbitrary Floating Points on GPU ? Post by: cbuchner1 on January 16, 2010, 01:31:34 PM oops double posting
Title: Re: Arbitrary Floating Points on GPU ? Post by: Melancholyman on January 20, 2010, 04:10:39 AM i think the unmbers could be represented as arbitrary long chunks on a bitmap stream input, and ohne layer of those numbers would have to go through many steps on the gpu ... i want arbitrary depth ... fast ;D Title: Re: Arbitrary Floating Points on GPU ? Post by: hobold on February 05, 2010, 04:44:43 PM Don't try to fly before you can run. Take it step by step. Start with basic arithmetic for "arbitrarily" large integers. Once you are done, you will have learned how and why it works. The knowledge gained will enable you to extend your program to fixed point fractional numbers (which already suffice for a lot of fractal purposes). And this in turn will pave the way for the transition to floating point. And then, finally, you will implement trigonometric and transcendental functions. Don't look to far beyond the horizon or you will be discouraged by the vast distance still ahead of you. Take it step by step, and direct your attention to your immediate surroundings. The journey is a rewarding one. If you ever need to ask for directions, we'll be here. I am quite sure that some of us will know the way, even if we haven't taken the exact route that you are exploring. :-) |