POV-Ray : Newsgroups : povray.off-topic : Suggestion: OpenCL Server Time
26 Nov 2026 01:59:42 EST (-0500)
  Suggestion: OpenCL (Message 23 to 72 of 72)  
<<< Previous 22 Messages Goto Initial 50 Messages
From: clipka
Subject: Re: Suggestion: OpenCL
Date: 14 Aug 2009 20:59:48
Message: <4a860884@news.povray.org>
Saul Luizaga schrieb:
> So, you assume that is just a huge amount of hype, and even if it works 
> for other apps., won't for POV-Ray. I think there are more to analyze 
> than just simple generalizations.

I didn't see much analyzing on your side - only enthusiasm about what 
they write in the introduction. It appears to me that you don't know 
much about POV-Ray's architecture or GPU architecture, and are actually 
not too familiar with the OpenCL framework either.

I'm not generalizing. I did have a look at the paper, and analyzed it 
(and POV-Ray's program structure) in enough detail to present hard facts 
why POV-Ray and OpenCL won't mix, at least not at the time being.


 > Anyway, is a POV/TAG-Team decision, we can merely speculate.

No, we can say for sure that they will /not/ go for OpenCL anytime near.


>> I had actually and honestly hoped to discourage you with my initial 
>> groaning. I guess the POV-Ray dev team is better informed about GPU 
>> computing than you expect.
> 
> And you know what I expect the POV/TAG-Team to know... you assume too 
> much...

 From your postings, it is quite obvious that you assumed OpenCL to be 
something brand new, with you being the first in all the POV-Ray 
community to discover it.

FYI: OpenCL has been mentioned in the POV-Ray NGs half a year ago already.


> groaning is an emotional response and as such, irrational: I haven't 
> been  reading this NG for a long time and the first line of text I read 
> was your groaning, besides of the rudeness, it explains nothing, and 

And that's exactly why I issued this loud groan: You /obviously/ didn't 
even bother to check whether anyone ever brought up the topic of GPU 
usage any time recently, or you would have noticed that it had just been 
on the agenda again, in the incarnation of CUDA.

Even after you were informed that the topic had been discussed just 
recently, you also obviously haven't bothered to check the thread on 
that topic, to get yourself updated on the problems of using GPUs with 
POV-Ray, and compare how that applies to OpenCL.

You just came stumbling in, hollering "hey, I got this great perfect 
idea for POV-Ray...", as if the people developing POV-Ray would never 
have heard of it otherwise. Even upon receiving a not-so-positive 
reaction indicating that you /might/ be wrong, you stuck to that 
attitude, hollering right away again in p.programming in the same style. 
There's rudeness in that, too.


Post a reply to this message

From: clipka
Subject: Re: Suggestion: OpenCL
Date: 14 Aug 2009 21:13:35
Message: <4a860bbf$1@news.povray.org>
Saul Luizaga schrieb:
> Well instead of groaning you can make a small .txt file in your PC: 
> "Alrady discussed, conclusions were:
> 1)....
> 2)...
> 3)..."
> or something like that, to avoid frustration and redundancy.

What, and have it clutter my hard disk, and three months later when it's 
really needed I don't remember where I put it?

Furthermore, as is just being demonstrated, people don't take the 
explanations and leave it be, but start discussions about it. Or they 
don't understand the explanations and ask. Or...


> I don't think my ideas are revolutionary, nor new, nor ingenious, I'm 
> just suggesting something that MAY or MAY NOT have not been discussed 
> before.

Next time you're in that situation, you might as well /check/ if it has 
been discussed before.

> Also I assume everyone here knows more than me, including the 
> POV/TAG-Team, so this is more of a hint than a suggestion. Sometimes 
> smart people forget about simple things.

Reread your original post. It doesn't sound like what you describe now.


> I see, I know POV-Ray source code is HUGE and any minor changes 
> represent big efforts.

Not really. Major changes represent major efforts. As of now, GPU 
support would be a more-than-major effort.

/Some/ changes that look like minor ones do require big efforts due to 
how the internal structure happens to be. Others appear like a major one 
  but are actually a piece of cake to implement.


> Maybe there is a use for it, not as another main processor but as 
> secondary one. I posted about it in another post.

Maybe it's worth reconsidering in a year or so.


Post a reply to this message

From: Chambers
Subject: Re: Suggestion: OpenCL
Date: 14 Aug 2009 23:57:45
Message: <4a863239$1@news.povray.org>
clipka wrote:
> If your work packages are large enough, then these are no issues. But in 
> a raytracer, be prepared for rather small work packages.

And that's another problem.  While a GPU has *hundreds* of cores that 
all work in parallel, in raytracing you're unlikely to encounter more 
than a few dozen rays which require the same test.  It's just not 
efficient to solve this problem with GPUs.

Note that, while GPGPU has come a long way in recent years, the only way 
to make it more useful for POV is to make it more like a CPU and less 
like a GPU.  While GPUs in general may go this route in the future (Tim 
Sweeney thinks so), really GPUs will focus first and foremost on what 
games need... and games don't need raytracing yet.

...Chambers


Post a reply to this message

From: Chambers
Subject: Re: Suggestion: OpenCL
Date: 15 Aug 2009 00:01:59
Message: <4a863337$1@news.povray.org>
Saul Luizaga wrote:
> So, you assume that is just a huge amount of hype, and even if it works 
> for other apps., won't for POV-Ray.

NB: There are some apps, which theoretically *should* benefit massively 
from GPGPU, which are actually hurt by it.

Case in point: TMPGEnc, using CUDA.  Video encoding has long been touted 
as one of the best areas for improvement via GPGPU.

On a GeForce 260, it's actually *slower* than a Core 2 Quad 6600 (2.4gHz).

Imagine a dual-processor six-core Xeon system (12 cores, 24 threads) and 
you'd need a few dozen GPUs (running literally *thousands* of threads) 
to match the performance.

...Chambers


Post a reply to this message

From: Orchid XP v8
Subject: Re: Suggestion: OpenCL
Date: 15 Aug 2009 02:07:42
Message: <4a8650ae@news.povray.org>
clipka wrote:

> Note that although the approach /may/ (!) work, it is a /fundamentally/ 
> different approach from what POV-Ray is doing.
> 
> Changing POV-Ray to use that approach would imply virtually a complete 
> rewrite of the render engine.

Agreed. It's no small task, by any stretch of the imagination...

-- 
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*


Post a reply to this message

From: Orchid XP v8
Subject: Re: Suggestion: OpenCL
Date: 15 Aug 2009 02:10:58
Message: <4a865172@news.povray.org>
>> If your work packages are large enough, then these are no issues. But 
>> in a raytracer, be prepared for rather small work packages.
> 
> And that's another problem.  While a GPU has *hundreds* of cores that 
> all work in parallel, in raytracing you're unlikely to encounter more 
> than a few dozen rays which require the same test.  It's just not 
> efficient to solve this problem with GPUs.

I'm not sure I agree with these statements.

Tracing a scene involves shooting thousands, or even tens of thousands 
of rays at the top-level geometry. While there may be some objects which 
are quite small, most objects will be hit by hundreds and hundreds of rays.

Now, whether it's efficient to run the entire rendering engine on the 
GPU is debatable, but it would seem to be that it should be possible to 
achieve *some* speedup by running at least part of the tracing process 
on the GPU. (The only question is bandwidth.)

> Note that, while GPGPU has come a long way in recent years, the only way 
> to make it more useful for POV is to make it more like a CPU and less 
> like a GPU.  While GPUs in general may go this route in the future (Tim 
> Sweeney thinks so), really GPUs will focus first and foremost on what 
> games need... and games don't need raytracing yet.

More to the point, if a GPU was more like a CPU, it wouldn't be faster 
than a CPU.

-- 
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*


Post a reply to this message

From: Chambers
Subject: Re: Suggestion: OpenCL
Date: 15 Aug 2009 04:03:15
Message: <4a866bc3$1@news.povray.org>
Orchid XP v8 wrote:
>>> If your work packages are large enough, then these are no issues. But 
>>> in a raytracer, be prepared for rather small work packages.
>>
>> And that's another problem.  While a GPU has *hundreds* of cores that 
>> all work in parallel, in raytracing you're unlikely to encounter more 
>> than a few dozen rays which require the same test.  It's just not 
>> efficient to solve this problem with GPUs.
> 
> I'm not sure I agree with these statements.
> 
> Tracing a scene involves shooting thousands, or even tens of thousands 
> of rays at the top-level geometry. While there may be some objects which 
> are quite small, most objects will be hit by hundreds and hundreds of rays.

Let's say a scene rendered for display on a 1080p TV has approximately 
300 objects in it, each one covering a similar portion of the display 
(for simplicity's sake).

That's a total of 1,920x1,080=2,073,600 pixels, or 6,912 for each 
object.  Admittedly, this is more than my statement of "a few dozen" :) 
  However, each level of recursion will split the groups rays - let's 
say into 4 groups (I honestly think they would be grouped in more, 
smaller, groups, but this will make the math easier).  After only 4 
levels of recursion (a value entirely common in scenes) the rays are 
bundled in groups of 25 (assuming an even distribution, of course).

With a smaller image, more objects, and less tight grouping, you'd get 
such small groups after only one or two levels of recursion.

> More to the point, if a GPU was more like a CPU, it wouldn't be faster 
> than a CPU.

True ;)

...Chambers


Post a reply to this message

From: Orchid XP v8
Subject: Re: Suggestion: OpenCL
Date: 15 Aug 2009 04:16:09
Message: <4a866ec9$1@news.povray.org>
> After only 4 levels of 
> recursion (a value entirely common in scenes) the rays are bundled in 
> groups of 25 (assuming an even distribution, of course).
> 
> With a smaller image, more objects, and less tight grouping, you'd get 
> such small groups after only one or two levels of recursion.

That seems small enough that it might be worth transferring back to the CPU.

But if you think about common scenes where you have walls and floors and 
so forth, it might be worth using the GPU to test ray intersections 
against these, and against bounding volumes (if you're using them). Huge 
numers of rays need to be run through these tests, so the GPU can fire 
those off quite quickly. It might also be worth running the "so what the 
hell is the colour of this surface?" calculation on the GPU - what with 
texturing, normal maps, multiple light rays of different angles and 
colours, etc.

Also, let's clear this up: My understanding is that the GPU does not 
require *all* cores to run an identical kernel. IIRC, the cores are 
grouped into (fairly large) bundles, each bundle runs a single kernel, 
but different bundles can run completely different kernels. So you don't 
need a ray queue with enough rays for the entire GPU, just for a whole 
bundle of cores.

-- 
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*


Post a reply to this message

From: Chambers
Subject: Re: Suggestion: OpenCL
Date: 15 Aug 2009 12:49:01
Message: <4a86e6fd$1@news.povray.org>
Orchid XP v8 wrote:
> But if you think about common scenes where you have walls and floors and 
> so forth, it might be worth using the GPU to test ray intersections 
> against these, and against bounding volumes (if you're using them). Huge 
> numers of rays need to be run through these tests, so the GPU can fire 
> those off quite quickly.

But those tests are also quite simple, so would benefit the least from 
the GPU.  If isosurfaces could be translated efficiently into shaders, 
then those would show the most benefit (and Julia fractals, of course).

> It might also be worth running the "so what the 
> hell is the colour of this surface?" calculation on the GPU - what with 
> texturing, normal maps, multiple light rays of different angles and 
> colours, etc.

Possibly.  In fact, using the GPU for GI might be an option.  For 
instance, we could run a single extremely high resolution pass with no 
lighting or texturing, just intersections, and cache all the 
intersection locations.  Then, feed these intersections to the GPU, and 
have it calculate lighting for those points.  Feed the lighting data 
back to the CPU for radiosity, and voila!  Fast GI :)  (Of course, 
implementing it would be a b*tch, but that's beside the point).

> Also, let's clear this up: My understanding is that the GPU does not 
> require *all* cores to run an identical kernel. IIRC, the cores are 
> grouped into (fairly large) bundles, each bundle runs a single kernel, 
> but different bundles can run completely different kernels. So you don't 
> need a ray queue with enough rays for the entire GPU, just for a whole 
> bundle of cores.

True, I think the shaders are in blocks of 4, and you have to have 
groups of 32 blocks running the same shader or something like that 
(which would be 128 shaders per program).  I don't remember the exact 
numbers, though, and in fact it's probably GPU dependent.

...Chambers


Post a reply to this message

From: Saul Luizaga
Subject: clipka I'll answer you here...
Date: 15 Aug 2009 13:07:11
Message: <4a86eb3f$1@news.povray.org>
clipka wrote:
> Saul Luizaga schrieb:
>>> Another possibility is to run the main renderer on the CPU, adding 
>>> rays to queues, and sending any "sufficiently large" queues to the 
>>> GPU for processing. I don't know if bandwidth limitations between the 
>>> two would make this viable...
>>
>> Exactly, that is why I asked: "Are absolutely sure there isn't a case 
>> where a GPU can help? maybe in the middle of a rendering/parsing?".
> 
> Note that although the approach /may/ (!) work, it is a /fundamentally/ 
> different approach from what POV-Ray is doing.
> 
> Changing POV-Ray to use that approach would imply virtually a complete 
> rewrite of the render engine.
> 
>> As you can see, maybe bandwidth it isn't much of an issue since The 
>> transfer between the PCIe video card and the Main memory can me made 
>> at 5 GT/s. Is this still insufficient for POV-Ray peak performance?
> 
> So you're looking at peak data transfer rate limits and from them can 
> infer that transfer between CPU and GPU memory space is not an issue?
> 
> Did you consider latency issues, or the overhead created by the OpenCL 
> framework itself? How about the latency for a "function call"?
> 
> If your work packages are large enough, then these are no issues. But in 
> a raytracer, be prepared for rather small work packages.

You just don't like to be corrected due to your intellectual vanity and 
arrogance, leave those aside for good, they don't do anybody any good.

I made a search on p.o-t on the subject and found nothing. The question 
was: "are you ABSOLUTELY SURE it won't work...?" First you say NO. then 
MAY (!) work. Obvious contradiction. Then you made a number of 
assumptions (againg) about me, all of them WRONG and this is for sure 
rude. Posting on p.p was only the right thing to do, since it was a 
suggestion I didn't started a discussion there, but here.

On my first post in this thread: get some perspective dude, it was for 
everyone, from little tech knowledge to the most advanced, of course 
most advanced readers can obvious the explanation/clarification I made 
about OpenCL.

To the subject: I don't know much about GPUs, POV-Ray internals, 
programming, nor OpenCL, but I do know a little about Computer 
electronic architecture. Some of the questions I made are not meant for 
this NG readers not even the TAG-Team but to the POV-Team, so they can 
made calculations about OpenCL.

I think they may have a structured and classified diagram of ALL POV-Ray 
programming structures, knowing approximately how much each structure 
would take in the CPU, so from the data I provided they could see:

1) What GPU capable structures.
2) The amount of time that the selected GPU capable structures could 
take to do a given process.
3) And this should be first, see if it is worth it, to consider the GPU 
aid, if not possible through OpenCL, make a custom framework. If it is, 
calculate how many GPU capable structures there are to have a second 
evaluation, and see if that number is worth the effort.
4) ETC.

So I'm analyzing to the best of my abilities as everyone here, including 
you, but you're taking this too emotional and going for personal attacks 
on me trying to discredit me. I'm just trying to see all possibilities 
of GPU acceleration and have a discussion and maybe lighten up the 
analysis a little for the POV-Team, but maybe is not me place nor even 
non POV-TAG-Team people, so maybe I should just had this addressed to 
the POV-Team for their consideration only and avoid so much "bothering" 
people here. But as you can see there are somethings to say about it 
still...


Post a reply to this message

From: Chambers
Subject: Re: clipka I'll answer you here...
Date: 15 Aug 2009 13:51:51
Message: <4a86f5b7$1@news.povray.org>
Saul Luizaga wrote:
> You just don't like to be corrected

This sounds more like you.

Believe it or not, this subject is an official Dead Horse.  Please stop 
beating it, you'll only get a bloody mess.

> I made a search on p.o-t on the subject

First, p.o-t is the wrong forum.
Second, posts here expire.

> was: "are you ABSOLUTELY SURE it won't work...?"

No, you didn't even ask a question.  You made a statement: "I have just 
learned about it and I think this could be a great improvement for POV-ray"

This is something which, by your own words, you have just heard about. 
You then quoted a whole bunch of marketing blurbs about it.

Trust me.  We have not just heard about it, but have been looking at the 
idea for more than *10 years* now.  I haven't specifically looked at 
OpenCL, but I have CUDA, and the underlying hardware hasn't changed 
enough yet to overcome the inherent limitations in the system.

> To the subject: I don't know much about GPUs, POV-Ray internals, 
> programming, nor OpenCL,

Then why is it so hard for you to accept that this isn't a good idea at 
this time?

If you really want to help make POV-Ray better, the source code is 
available.  Please, dig in!  Start reading the p.p group, and look at 
some of the outstanding bugs!  That would surely be appreciated more 
than your parroting some random marketing blurbs.

...Chambers


Post a reply to this message

From: Saul Luizaga
Subject: Re: clipka I'll answer you here...
Date: 15 Aug 2009 14:09:04
Message: <4a86f9c0@news.povray.org>
Chambers wrote:
> Saul Luizaga wrote:
>> You just don't like to be corrected
> 
> This sounds more like you.

right...

> 
> Believe it or not, this subject is an official Dead Horse.  Please stop 
> beating it, you'll only get a bloody mess.
> 
>> I made a search on p.o-t on the subject
> 
> First, p.o-t is the wrong forum.
> Second, posts here expire.
> 
>> was: "are you ABSOLUTELY SURE it won't work...?"
> 
> No, you didn't even ask a question.

news://news.povray.org:119/4a850da7@news.povray.org, check the last 
paragraph, proves you wrong. Did you liked to be corrected?

> 
> This is something which, by your own words, you have just heard about. 
> You then quoted a whole bunch of marketing blurbs about it.
> 
> Trust me.  We have not just heard about it, but have been looking at the 
> idea for more than *10 years* now.  I haven't specifically looked at 
> OpenCL, but I have CUDA, and the underlying hardware hasn't changed 
> enough yet to overcome the inherent limitations in the system.
> 
>> To the subject: I don't know much about GPUs, POV-Ray internals, 
>> programming, nor OpenCL,
> 
> Then why is it so hard for you to accept that this isn't a good idea at 
> this time?
> 
> If you really want to help make POV-Ray better, the source code is 
> available.  Please, dig in!  Start reading the p.p group, and look at 
> some of the outstanding bugs!  That would surely be appreciated more 
> than your parroting some random marketing blurbs.
> 
> ....Chambers

So open minded... thanks, I out of here for good.


Post a reply to this message

From: Chambers
Subject: Re: clipka I'll answer you here...
Date: 15 Aug 2009 16:08:03
Message: <4a8715a3$1@news.povray.org>
Saul Luizaga wrote:
>> No, you didn't even ask a question.
> 
> news://news.povray.org:119/4a850da7@news.povray.org, check the last 
> paragraph, proves you wrong. Did you liked to be corrected?

Yes, I do as a matter of fact.  I don't like being wrong.

...Chambers


Post a reply to this message

From: clipka
Subject: Re: clipka I'll answer you here...
Date: 15 Aug 2009 17:36:54
Message: <4a872a76$1@news.povray.org>
Saul Luizaga schrieb:
> I made a search on p.o-t on the subject and found nothing.

This may be because p.o-t is actually not the best place for such a 
posting, as it is intended for topics /not/ related to POV-Ray.


 > The question
> was: "are you ABSOLUTELY SURE it won't work...?" First you say NO. then 
> MAY (!) work. Obvious contradiction.

You're quoting me out of context, and out of chronological order.

You proposed OpenCL for POV-Ray. If you go back to my first reply, 
you'll find that my answer was manifold back then already - but not 
contradictory (nor were my follow-ups):


(I) *NO*, OpenCL will *not* be an option for POV-Ray, because (a) it is 
written in a different language (namely C++), and (b) the internal 
architecture makes heavy use of constructs not available in OpenCL (most 
particularly recursions).

Both of this still stands. If you have any substantial information that 
make both of these arguments moot (other than wishful thinking about 
where the OpenCL project /may/ be heading some time in the future 
according to your imagination), then go ahead and correct me.

There is another point in which I might be mistaken: My argument is 
based on assumptions that (a) POV-Ray will not go back to C again, and 
(b) the fundamental architecture will not change anytime soon. However, 
given that POV-Ray has /just been/ ported from C to C++, and the feat of 
adding SMP support has /already/ taken something like 3 years, I don't 
expect any strong urge to introduce even more fundamental changes in the 
underlying architecture.

This urge /might/ be greater if there was a clear promise of benefit. 
However, even /that/ is still doubtful.


(II) Yes, it *MIGHT* be possible to run a full-fledged independent 
POV-Ray thread on a GPU; however, this would require some conditions to 
be fulfilled first:

(1) POV-Ray would /first/ have to be brought to the point where it can 
run distributed renders on multiple machines.

The reason here is that in order to run a separate thread on the GPU, 
POV-Ray would need to be enabled to run render threads in fully separate 
(or at least non-synchronized) address spaces. As this is also /the/ 
main prerequisite for distrubuted rendering on multiple machines (in 
this multiprocessing model, communication bandwidth and latency are 
likely to pose not so much of a problem even in the network, let alone 
between CPU and GPU), and network rendering is already a goal POV-Ray is 
committed to, I do /not/ expect GPU support to be tackled any time 
earler: Network rendering comes with a clear promise of a fair gain in 
render speed and usability, while the benefit of GPU rendering is still 
carrying a big question mark.

(2) Someone would have to come up with a GPU programming framework much 
better suited to POV-Ray, which eliminates all the issues in (I), i.e. 
supports C++ and recursions.


(III) With the intention of elaborating on (I), I noted that yes, it 
*MIGHT* be possible to include GPU support via OpenCL use in POV-Ray 
even without changing the fundamental structure of the application, 
*BUT* this would /very/ likely lead to worse performance than without 
the GPU support, due to (a) the inability of POV-Ray to supply the GPU 
with a large enough and parallelizable work package, and (b) the 
inability of POV-Ray to continue while the GPU is processing that work 
package.


As a resume, I still am perfectly sure that OpenCL is *not* currently an 
option to speed up POV-Ray.

Plus, I am perfectly sure that OpenCL will be further revisited now and 
then, and reconsidered as an option, should it be improved to the point 
where it appears to make some sense.


> To the subject: I don't know much about GPUs, POV-Ray internals, 
> programming, nor OpenCL, but I do know a little about Computer 
> electronic architecture. Some of the questions I made are not meant for 
> this NG readers not even the TAG-Team but to the POV-Team, so they can 
> made calculations about OpenCL.

There's not much that can be calculated from your figures, except the 
peak memory transfer rate of some - presumably - representative graphics 
hardware. Program execution speed, however, also depends on the 
particular compiler (and optimizer!) - which are not even available yet.

> I think they may have a structured and classified diagram of ALL POV-Ray 
> programming structures, knowing approximately how much each structure 
> would take in the CPU, so from the data I provided they could see:

That would help in no way, because these structures all rely on an 
architecture that, as already pointed out, is fundamentally incompatible 
with OpenCL-based GPU computing.

> 3) And this should be first, see if it is worth it, to consider the GPU 
> aid, if not possible through OpenCL, make a custom framework. If it is, 
> calculate how many GPU capable structures there are to have a second 
> evaluation, and see if that number is worth the effort.

I don't think that the POV-Ray dev team should even be bothered with 
this, because from all I see, current GPU architectures would appear to 
either require a /monstrous/ amount of framework development to make it 
work for /POV-Ray/ (again, most particularly due to the lack of support 
for recursion, which apparently is a hardware limitation, not a 
framework thing), or provide /very small/ gain or even a disadvantage 
(due to the small size of work packages POV-Ray could supply to the GPU, 
and the lack of POV-Ray to do anything else while waiting for the 
results), or require a /monstrous/ amount of POV-Ray architecture changes.

I don't think the POV-Ray dev team /want/ to be bothered (once again) 
with this anyway.

And even /if/ they wanted to be bothered, /I/ as a POV-Ray user wouldn't 
want them to, because I think there are plenty of features which are 
more important to invest time into, where a gain is clearly visible, 
while the gain of GPU support is still /very/ questionable, for all the 
reasons I (and others) have presented by now.


Post a reply to this message

From: clipka
Subject: Re: clipka I'll answer you here...
Date: 15 Aug 2009 17:53:08
Message: <4a872e44$1@news.povray.org>
Saul Luizaga schrieb:
>>> was: "are you ABSOLUTELY SURE it won't work...?"
>>
>> No, you didn't even ask a question.
> 
> news://news.povray.org:119/4a850da7@news.povray.org, check the last 
> paragraph, proves you wrong. Did you liked to be corrected?

Are you actually aware that Chambers and CLipka are two totally 
different persons? That there are actually /two/ persons trying to 
convince you that OpenCL will get POV-Ray nowhere (with others having 
joined in occasionally)?

Maybe you should re-read all the replies you got, and have a look at who 
actually wrote them, and what you replied to whom.


And Chambers is right: There wasn't a question to start with. You only 
went for a more questioning style some postings into the discussion.


Post a reply to this message

From: Orchid XP v8
Subject: Re: Suggestion: OpenCL
Date: 16 Aug 2009 04:12:41
Message: <4a87bf79$1@news.povray.org>
>> But if you think about common scenes where you have walls and floors 
>> and so forth, it might be worth using the GPU to test ray 
>> intersections against these, and against bounding volumes (if you're 
>> using them). Huge numers of rays need to be run through these tests, 
>> so the GPU can fire those off quite quickly.
> 
> But those tests are also quite simple, so would benefit the least from 
> the GPU.

How do you figure that?

The benefit of the GPU isn't the complexity of the kernels it executes 
(usually quite the converse), it's more the fact that it can do the same 
operations many, many times over simultaneously.

> If isosurfaces could be translated efficiently into shaders, 
> then those would show the most benefit (and Julia fractals, of course).

No arguments here.

>> It might also be worth running the "so what the hell is the colour of 
>> this surface?" calculation on the GPU - what with texturing, normal 
>> maps, multiple light rays of different angles and colours, etc.
> 
> Possibly.  In fact, using the GPU for GI might be an option.

Yes, there's a couple of ways you might implement this, with varying 
degrees of accuracy. For example, you could feed the GPU a polygon mesh 
approximating the scene. (There are already known algorithms for doing 
GI on a polygon mesh.) Or you could just use the GPU to accelerate the 
insane number of ray intersection tests required during GI.

>> Also, let's clear this up: My understanding is that the GPU does not 
>> require *all* cores to run an identical kernel. IIRC, the cores are 
>> grouped into (fairly large) bundles, each bundle runs a single kernel, 
>> but different bundles can run completely different kernels. So you 
>> don't need a ray queue with enough rays for the entire GPU, just for a 
>> whole bundle of cores.
> 
> True, I think the shaders are in blocks of 4, and you have to have 
> groups of 32 blocks running the same shader or something like that 
> (which would be 128 shaders per program).  I don't remember the exact 
> numbers, though, and in fact it's probably GPU dependent.

Yeah, I'm pretty sure the batch sizes vary by GPU model. But the main 
point is, you don't have to assign *all* cores to the same kernel; just 
sufficiently large bunches of them.

-- 
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*


Post a reply to this message

From: Chambers
Subject: Re: Suggestion: OpenCL
Date: 16 Aug 2009 11:33:22
Message: <4a8826c2$1@news.povray.org>
Orchid XP v8 wrote:
>> But those tests are also quite simple, so would benefit the least from 
>> the GPU.
> 
> How do you figure that?

Because you need to look at the ratio of computation time to 
transmission time.  The simpler something is, the lower the ratio, and 
the less worthwhile offloading is (after all, it messes with the cache, 
the bus, the memory system, etc).  Ideally, whatever you offload will be 
computationally intensive, so the transmission time is justifiable.

> Yeah, I'm pretty sure the batch sizes vary by GPU model. But the main 
> point is, you don't have to assign *all* cores to the same kernel; just 
> sufficiently large bunches of them.

The key, of course, being "sufficiently large bunches."  There's a 
strong likelihood that POV wouldn't be able to consistently create 
batches that are sufficiently large.

...Chambers


Post a reply to this message

From: Invisible
Subject: Re: Suggestion: OpenCL
Date: 17 Aug 2009 04:26:16
Message: <4a891428$1@news.povray.org>
Chambers wrote:

> The key, of course, being "sufficiently large bunches."  There's a 
> strong likelihood that POV wouldn't be able to consistently create 
> batches that are sufficiently large.

This is the key question, yes.


Post a reply to this message

From: scott
Subject: Re: Suggestion: OpenCL
Date: 17 Aug 2009 08:34:35
Message: <4a894e5b@news.povray.org>
> 1) Recursion.  As clipka (Christian?) wrote, it is absolutely essential 
> for POV.
>
> 2) Data parallelization versus code parallelization (this is related to 
> the first, but is not strictly the same).
>
> The ray tracing algorithm follows drastically different code branches on a 
> single set of data, based on recursion (reflections & refractions), as 
> well as the other various computations needed (texture calculation, light 
> source occlusion, etc) which almost all need access to the entire scene.

Often you need to drastically change your algorithm to get it running well 
on a GPU.  It's quite trivial to rewrite the raytracing algorithm to work on 
masses of rays in parallel with no branching or ray spawning, and then do 
the branching/spawning for the rays all in one go.  After this you can 
efficiently use the GPU and CPU in parallel.


Post a reply to this message

From: scott
Subject: Re: Suggestion: OpenCL
Date: 17 Aug 2009 08:42:06
Message: <4a89501e@news.povray.org>
> The solution in both cases is to put rays into "queues", such that all the 
> rays in a given queue take the same code path [for a while]. When you need 
> to spawn a secondary ray, you add it to a queue rather than recursively 
> tracing it. When some rays hit an object and others don't, you add them to 
> different queues.

Why add it to a different queue?  All rays that still need to be traced 
(whether they are reflection, refraction, primary or shadow rays) simply 
need to be intersected with the scene geometry.  If you like you could keep 
a flag in the queue for each ray to say what type it is, but the GPU part 
that does the ray-scene intersection probably doesn't care what sort of ray 
it is.

In that way the GPU will just process as many rays as it can in batches 
until the scene is complete.  The CPU would handle preparing the queue at 
each step, ie removing rays that have terminated and inserting new rays for 
shadows and reflections etc.

Of course to be able to do efficient scene intersection on the GPU it would 
probably be best to only allow triangle-based scenes, and figure out some 
way to store a Kd-tree of triangles efficiently in a texture.  Sounds like 
the sort of thing someone has already done a PhD on :-)


Post a reply to this message

From: Invisible
Subject: Re: Suggestion: OpenCL
Date: 17 Aug 2009 09:05:29
Message: <4a895599$1@news.povray.org>
scott wrote:
>> When some rays hit an object and others don't, 
>> you add them to different queues.
> 
> Why add it to a different queue?  All rays that still need to be traced 
> (whether they are reflection, refraction, primary or shadow rays) simply 
> need to be intersected with the scene geometry.

I was thinking more along the lines of each surface possibly having a 
different code path for computing illumination. Rays in the same bundle 
can't take different code paths.

> In that way the GPU will just process as many rays as it can in batches 
> until the scene is complete.  The CPU would handle preparing the queue 
> at each step, ie removing rays that have terminated and inserting new 
> rays for shadows and reflections etc.

Depends on whether you're thinking of running the whole computation on 
the GPU, or just the ray intersection tests, or what.

> Of course to be able to do efficient scene intersection on the GPU it 
> would probably be best to only allow triangle-based scenes

I see no especial reason why you can't do arbitrary intersection tests 
on a GPU. The math isn't that complicated. The only real problem is 
going to be trying to run something like isosurfaces, which use adaptive 
space division; a GPU probably won't like that. But something like a 
Newton iteration should be fine. [That obviously isn't applicable to 
general isosurfaces though...]

> and figure 
> out some way to store a Kd-tree of triangles efficiently in a texture.

Also depends on whether you're trying to write your code as a shaper, or 
use a real GPGPU system. (Such as the OpenCL in the title.)

> Sounds like the sort of thing someone has already done a PhD on :-)

Indeed, that's where I read about the render queue approach. (No, I 
don't remember where *exactly*.)


Post a reply to this message

From: scott
Subject: Re: Suggestion: OpenCL
Date: 17 Aug 2009 10:07:07
Message: <4a89640b$1@news.povray.org>
> I was thinking more along the lines of each surface possibly having a 
> different code path for computing illumination. Rays in the same bundle 
> can't take different code paths.

Sure they can, you just have an "if" in the shader code based on some flag 
in the ray data.

> Depends on whether you're thinking of running the whole computation on the 
> GPU, or just the ray intersection tests, or what.

Some things I think the CPU still needs to do, like preparing the ray data 
to put on the GPU at each step. It is quite hard to write a shader that does 
anything other than return one "output value" per "pixel", ie you can't 
write a shader that returns a veriable number of rays, the only thing you 
can do is return a flag set that means "spawn another ray".

> I see no especial reason why you can't do arbitrary intersection tests on 
> a GPU. The math isn't that complicated.

I was thinking more about how to store the scene on the GPU efficiently, if 
you just have a triangle list it is relatively simple.

> The only real problem is going to be trying to run something like 
> isosurfaces, which use adaptive space division; a GPU probably won't like 
> that.

Nah it's no problem :-)  Modern GPUs don't have any limit on loops or number 
of instructions or anything like that.

> Also depends on whether you're trying to write your code as a shaper, or 
> use a real GPGPU system. (Such as the OpenCL in the title.)

I think something like a raytracer will be too complicated for a computer to 
try and figure out how to put it on the GPU the best way, needs to be hand 
coded by an intelligent person :-)

> Indeed, that's where I read about the render queue approach. (No, I don't 
> remember where *exactly*.)

Damn.  If you think up *anything* you think is new, you can be guaranteed 
that someone else somewhere has already thought of it :-)  The internet just 
makes it easy to find that person!


Post a reply to this message

From: Invisible
Subject: Re: Suggestion: OpenCL
Date: 17 Aug 2009 10:44:09
Message: <4a896cb9$1@news.povray.org>
>> I was thinking more along the lines of each surface possibly having a 
>> different code path for computing illumination. Rays in the same 
>> bundle can't take different code paths.
> 
> Sure they can, you just have an "if" in the shader code based on some 
> flag in the ray data.

I was under the impression that all cores in the bunch would have to 
take the same branch of the if - you can't have half go one way and half 
go the other. (That's what makes it a SIMD architecture.)

I was also under the impression you can have predicated instructions, 
however. (I.e., a single instruction that executes or doesn't based on a 
condition. But not a whole alternate execution path.)

> Some things I think the CPU still needs to do, like preparing the ray 
> data to put on the GPU at each step. It is quite hard to write a shader 
> that does anything other than return one "output value" per "pixel", ie 
> you can't write a shader that returns a veriable number of rays, the 
> only thing you can do is return a flag set that means "spawn another ray".

> I was thinking more about how to store the scene on the GPU efficiently, 
> if you just have a triangle list it is relatively simple.

Again, depends on whether you're writing a shader, or using a GPGPU system.

>> The only real problem is going to be trying to run something like 
>> isosurfaces, which use adaptive space division; a GPU probably won't 
>> like that.
> 
> Nah it's no problem :-)  Modern GPUs don't have any limit on loops or 
> number of instructions or anything like that.

But they don't allow recursion. That's the issue.

>> Also depends on whether you're trying to write your code as a shaper, 
>> or use a real GPGPU system. (Such as the OpenCL in the title.)
> 
> I think something like a raytracer will be too complicated for a 
> computer to try and figure out how to put it on the GPU the best way, 
> needs to be hand coded by an intelligent person :-)

...and?

All GPGPU does is allow you to run programs on a GPU which don't 
necessarily have to be shaped like shaders. You still have to write the 
code yourself. It's just that you don't have to pretend it's 
graphics-related even if it isn't.

> Damn.  If you think up *anything* you think is new, you can be 
> guaranteed that someone else somewhere has already thought of it :-)  
> The internet just makes it easy to find that person!

I've had the same problem with mathematics my entire life.

Do you know how hard it is to draw a cube made of 8 cubes and measure 
all their sides? Do you know how long it takes to expand (x+y)^9 
manually, by hand? Do you have any idea how long it takes to figure out 
what the pattern is and where it's coming from?

...and then I discover some entry-level textbook that tells me how some 
dead guy already figured all this out several centuries ago. AND FOR 
ARBITRARY EXPONENTS!! >_<

Why do I bother?


Post a reply to this message

From: Saul Luizaga
Subject: Re: clipka I'll answer you here...
Date: 17 Aug 2009 12:10:45
Message: <4a898105$1@news.povray.org>
keep diluting/lying yourself, you're doing a great job, keep it up!


Post a reply to this message

From: Saul Luizaga
Subject: Re: clipka I'll answer you here...
Date: 17 Aug 2009 12:13:41
Message: <4a8981b5$1@news.povray.org>
Chambers wrote:
> Saul Luizaga wrote:
>>> No, you didn't even ask a question.
>>
>> news://news.povray.org:119/4a850da7@news.povray.org, check the last 
>> paragraph, proves you wrong. Did you liked to be corrected?
> 
> Yes, I do as a matter of fact.  I don't like being wrong.
> 
> ....Chambers
yeah, right.... hahaha


Post a reply to this message

From: Darren New
Subject: Re: clipka I'll answer you here...
Date: 17 Aug 2009 12:27:34
Message: <4a8984f6$1@news.povray.org>
Saul Luizaga wrote:
> keep diluting/lying yourself, you're doing a great job, keep it up!

That would be "deluding", not "diluting".  :-)

-- 
   Darren New, San Diego CA, USA (PST)
   "We'd like you to back-port all the changes in 2.0
    back to version 1.0."
   "We've done that already. We call it 2.0."


Post a reply to this message

From: Stephen
Subject: Re: clipka I'll answer you here...
Date: 17 Aug 2009 12:50:42
Message: <ei2j85prd9nij7psofehqd05jhpaqc3e3k@4ax.com>
On Mon, 17 Aug 2009 09:27:31 -0700, Darren New <dne### [at] sanrrcom> wrote:

>Saul Luizaga wrote:
>> keep diluting/lying yourself, you're doing a great job, keep it up!
>
>That would be "deluding", not "diluting".  :-)

Like it makes any difference? Just show him where the fluoride lake is.
-- 

Regards
     Stephen


Post a reply to this message

From: Darren New
Subject: Re: clipka I'll answer you here...
Date: 17 Aug 2009 13:41:20
Message: <4a899640$1@news.povray.org>
Stephen wrote:
>> That would be "deluding", not "diluting".  :-)
> Like it makes any difference? 

Most speakers of english-as-a-second-language around here seem to appreciate 
learning the right words, is all.

-- 
   Darren New, San Diego CA, USA (PST)
   "We'd like you to back-port all the changes in 2.0
    back to version 1.0."
   "We've done that already. We call it 2.0."


Post a reply to this message

From: Jim Henderson
Subject: Re: clipka I'll answer you here...
Date: 17 Aug 2009 14:30:53
Message: <4a89a1dd$1@news.povray.org>
On Mon, 17 Aug 2009 17:50:30 +0100, Stephen wrote:

> On Mon, 17 Aug 2009 09:27:31 -0700, Darren New <dne### [at] sanrrcom> wrote:
> 
>>Saul Luizaga wrote:
>>> keep diluting/lying yourself, you're doing a great job, keep it up!
>>
>>That would be "deluding", not "diluting".  :-)
> 
> Like it makes any difference? Just show him where the fluoride lake is.

LOL


Post a reply to this message

From: Stephen
Subject: Re: clipka I'll answer you here...
Date: 17 Aug 2009 14:34:02
Message: <uj8j859007galva686s9584t6bpc80fvtf@4ax.com>
On Mon, 17 Aug 2009 10:41:17 -0700, Darren New <dne### [at] sanrrcom> wrote:

>Stephen wrote:
>>> That would be "deluding", not "diluting".  :-)
>> Like it makes any difference? 
>
>Most speakers of english-as-a-second-language around here seem to appreciate 
>learning the right words, is all.

Sorry, I thought that you were stoking the fire.
-- 

Regards
     Stephen


Post a reply to this message

From: clipka
Subject: Re: clipka I'll answer you here...
Date: 17 Aug 2009 17:34:36
Message: <4a89ccec$1@news.povray.org>
Stephen schrieb:
>> Saul Luizaga wrote:
>>> keep diluting/lying yourself, you're doing a great job, keep it up!
>> That would be "deluding", not "diluting".  :-)
> 
> Like it makes any difference? Just show him where the fluoride lake is.

That would be a different guy... or at least I'd think so.


Post a reply to this message

From: clipka
Subject: Re: clipka I'll answer you here...
Date: 17 Aug 2009 17:45:30
Message: <4a89cf7a$1@news.povray.org>
Saul Luizaga schrieb:
> keep diluting/lying yourself, you're doing a great job, keep it up!

Given up on the OpenCL topic entirely?

Maybe I was right to start the discussion with a loud groan after all.

So long.


Post a reply to this message

From: Jim Henderson
Subject: Re: clipka I'll answer you here...
Date: 17 Aug 2009 17:58:33
Message: <4a89d289@news.povray.org>
On Mon, 17 Aug 2009 23:34:29 +0200, clipka wrote:

> Stephen schrieb:
>>> Saul Luizaga wrote:
>>>> keep diluting/lying yourself, you're doing a great job, keep it up!
>>> That would be "deluding", not "diluting".  :-)
>> 
>> Like it makes any difference? Just show him where the fluoride lake is.
> 
> That would be a different guy... or at least I'd think so.

It is.  I'm quite surprised by Saul in this subthread, because this type 
of response isn't what I recall being typical of him.

Jim


Post a reply to this message

From: Stephen
Subject: Re: clipka I'll answer you here...
Date: 17 Aug 2009 18:13:28
Message: <bflj85dr2tors6j8341njr6ngpgs7392vt@4ax.com>
On Mon, 17 Aug 2009 23:34:29 +0200, clipka <ano### [at] anonymousorg> wrote:

>Stephen schrieb:
>>> Saul Luizaga wrote:
>>>> keep diluting/lying yourself, you're doing a great job, keep it up!
>>> That would be "deluding", not "diluting".  :-)
>> 
>> Like it makes any difference? Just show him where the fluoride lake is.
>
>That would be a different guy... or at least I'd think so.

Company?
-- 

Regards
     Stephen


Post a reply to this message

From: Chambers
Subject: Re: clipka I'll answer you here...
Date: 17 Aug 2009 22:04:58
Message: <4a8a0c4a$1@news.povray.org>
Saul Luizaga wrote:
> Chambers wrote:
>> Saul Luizaga wrote:
>>>> No, you didn't even ask a question.
>>>
>>> news://news.povray.org:119/4a850da7@news.povray.org, check the last 
>>> paragraph, proves you wrong. Did you liked to be corrected?
>>
>> Yes, I do as a matter of fact.  I don't like being wrong.
>>
>> ....Chambers
> yeah, right.... hahaha

Now you're just being insulting, assuming that I'm making a joke or 
something.

I mean, sure it hurts my pride when I'm wrong, but that's a price I'm 
able and willing to pay.  Quite simply, I'm trying to be the best 
possible version of myself.  I know I have several flaws, many of which 
I'm not even aware, so it helps me overall when they're brought to my 
attention.

Obviously, I hope that people bring my flaws to my attention in the 
kindest possible way, but even if they don't I try to make the most of it ;)

...Chambers


Post a reply to this message

From: Chambers
Subject: Re: clipka I'll answer you here...
Date: 17 Aug 2009 22:06:13
Message: <4a8a0c95@news.povray.org>
Stephen wrote:
> Like it makes any difference? Just show him where the fluoride lake is.

You can lead a nut* to fluoride, but you can't make him drink until you 
take his tinfoil hat away ;)

*Not directed at anyone here.

...Chambers


Post a reply to this message

From: Chambers
Subject: Re: Suggestion: OpenCL
Date: 17 Aug 2009 22:10:40
Message: <4a8a0da0$1@news.povray.org>
scott wrote:
>> I was thinking more along the lines of each surface possibly having a 
>> different code path for computing illumination. Rays in the same 
>> bundle can't take different code paths.
> 
> Sure they can, you just have an "if" in the shader code based on some 
> flag in the ray data.

Problem: when you come to a branch, all units in that block have to take 
the same branch.

Thus, branching is discouraged.

>> Indeed, that's where I read about the render queue approach. (No, I 
>> don't remember where *exactly*.)
> 
> Damn.  If you think up *anything* you think is new, you can be 
> guaranteed that someone else somewhere has already thought of it :-)  
> The internet just makes it easy to find that person!

I know I saw a whitepaper on the render queue method back in the 90s, 
but I don't remember the author.  In fact, most of the work done on 
computers with graphics was theorized back in the 70s and 80s, but is 
only in the last 5 or 10 years being widely implemented due to 
sufficient hardware support now being available.

...Chambers


Post a reply to this message

From: Chambers
Subject: Re: Suggestion: OpenCL
Date: 17 Aug 2009 22:16:21
Message: <4a8a0ef5$1@news.povray.org>
Invisible wrote:
>>> I was thinking more along the lines of each surface possibly having a 
>>> different code path for computing illumination. Rays in the same 
>>> bundle can't take different code paths.
>>
>> Sure they can, you just have an "if" in the shader code based on some 
>> flag in the ray data.
> 
> I was under the impression that all cores in the bunch would have to 
> take the same branch of the if - you can't have half go one way and half 
> go the other. (That's what makes it a SIMD architecture.)

In fact, I think NVidia does allow alternate code paths - but the unit 
executes both code paths, and then discards the one you don't need.

> Again, depends on whether you're writing a shader, or using a GPGPU system.

Same thing nowadays, its just the shaders are written in a dialect of C 
that's more capable than the ones used for graphics.

>> Nah it's no problem :-)  Modern GPUs don't have any limit on loops or 
>> number of instructions or anything like that.
> 
> But they don't allow recursion. That's the issue.

To be precise, they don't allow indefinite recursion.  You can actually 
have recursion where you specify the number of levels at compile time. 
After that, however, you can't change it without compiling a new shader.

> Do you know how hard it is to draw a cube made of 8 cubes and measure 
> all their sides? Do you know how long it takes to expand (x+y)^9 
> manually, by hand? Do you have any idea how long it takes to figure out 
> what the pattern is and where it's coming from?
> 
> ...and then I discover some entry-level textbook that tells me how some 
> dead guy already figured all this out several centuries ago. AND FOR 
> ARBITRARY EXPONENTS!! >_<

Isn't that what Pascal's triangle is for?

> Why do I bother?

Be honest, it's because you enjoy it :)

Heck, I expanded the evaluation of a bezier patch to give cubic 
functions by hand.  A bicubic equation fully expanded takes about half 
of a standard sheet of notebook paper, but then there's the derivation 
which takes a few pages ;)

...Chambers


Post a reply to this message

From: scott
Subject: Re: Suggestion: OpenCL
Date: 18 Aug 2009 03:04:26
Message: <4a8a527a@news.povray.org>
>> I was thinking more about how to store the scene on the GPU efficiently, 
>> if you just have a triangle list it is relatively simple.
>
> Again, depends on whether you're writing a shader, or using a GPGPU 
> system.

It still runs on the same hardware though, which is highly optimised for 
graphics operations, you need to be aware of this no matter how you shape 
your code.

> But they don't allow recursion.

Yes that was what I said earlier, for something like raytracing to unlimited 
depths I think the CPU needs to step in every so often to process the 
current set of rays (ie kill and spawn rays where appropriate).

Of course if you want to limit yourself to a fixed depth (ie a max trace 
level of 8 or whatever) then you can "unroll" the recursion so it works on 
the GPU.  Might not be as efficient as letting the CPU do it though.


Post a reply to this message

From: Mike Raiford
Subject: Re: Suggestion: OpenCL
Date: 18 Aug 2009 08:44:43
Message: <4a8aa23b$1@news.povray.org>
Invisible wrote:

> I was under the impression that all cores in the bunch would have to 
> take the same branch of the if - you can't have half go one way and half 
> go the other. (That's what makes it a SIMD architecture.)

I'm sorry for jumping in, here, but surely you mean SMP, not SIMD?

SIMD is single-instruction multiple data.. e.g. performing an add on 4 
WORD values simultaneously with one instruction.

-- 
~Mike


Post a reply to this message

From: Invisible
Subject: Re: Suggestion: OpenCL
Date: 18 Aug 2009 09:20:34
Message: <4a8aaaa2$1@news.povray.org>
>> I was under the impression that all cores in the bunch would have to 
>> take the same branch of the if - you can't have half go one way and 
>> half go the other. (That's what makes it a SIMD architecture.)
> 
> I'm sorry for jumping in, here, but surely you mean SMP, not SIMD?
> 
> SIMD is single-instruction multiple data.. e.g. performing an add on 4 
> WORD values simultaneously with one instruction.

Indeed. And on the GPU, you can say "for all these thirty pixels you're 
processing, multiply each one by the corresponding texture pixel". For 
example. One instruction, executed on 30 different pairs of data values. 
SIMD.


Post a reply to this message

From: Invisible
Subject: Re: Suggestion: OpenCL
Date: 18 Aug 2009 09:24:20
Message: <4a8aab84$1@news.povray.org>
>> I was under the impression that all cores in the bunch would have to 
>> take the same branch of the if - you can't have half go one way and 
>> half go the other. (That's what makes it a SIMD architecture.)
> 
> In fact, I think NVidia does allow alternate code paths - but the unit 
> executes both code paths, and then discards the one you don't need.

That also seems plausible. (I'd think sorting the data into two seperate 
queues would be more efficient. But obviously I haven't measured it...)

>> Again, depends on whether you're writing a shader, or using a GPGPU 
>> system.
> 
> Same thing nowadays, its just the shaders are written in a dialect of C 
> that's more capable than the ones used for graphics.

More like, if you use GPGPU, you don't have to pretend that your program 
is a "shader" that takes "pixels" and generates other "pixels". You can 
structure it more freely.

>> But they don't allow recursion. That's the issue.
> 
> To be precise, they don't allow indefinite recursion.  You can actually 
> have recursion where you specify the number of levels at compile time. 
> After that, however, you can't change it without compiling a new shader.

In other words, the compiler can unroll the loops for you. ;-)

>> Do you know how hard it is to draw a cube made of 8 cubes and measure 
>> all their sides? Do you know how long it takes to expand (x+y)^9 
>> manually, by hand? Do you have any idea how long it takes to figure 
>> out what the pattern is and where it's coming from?
>>
>> ...and then I discover some entry-level textbook that tells me how 
>> some dead guy already figured all this out several centuries ago. AND 
>> FOR ARBITRARY EXPONENTS!! >_<
> 
> Isn't that what Pascal's triangle is for?

Yes, I realise that *now*. :-P

>> Why do I bother?
> 
> Be honest, it's because you enjoy it :)

Partly. But also because I keep hoping somebody will be impressed. 
(Stupid, I know...)


Post a reply to this message

From: Invisible
Subject: Re: Suggestion: OpenCL
Date: 18 Aug 2009 09:25:35
Message: <4a8aabcf@news.povray.org>
scott wrote:
>>> I was thinking more about how to store the scene on the GPU 
>>> efficiently, if you just have a triangle list it is relatively simple.
>>
>> Again, depends on whether you're writing a shader, or using a GPGPU 
>> system.
> 
> It still runs on the same hardware though, which is highly optimised for 
> graphics operations, you need to be aware of this no matter how you 
> shape your code.

Sure. I'm just saying GPGPU gives you a little more freedom (at the cost 
of, currently, being manufacturer-specific).

>> But they don't allow recursion.
> 
> Yes that was what I said earlier, for something like raytracing to 
> unlimited depths I think the CPU needs to step in every so often to 
> process the current set of rays (ie kill and spawn rays where appropriate).
> 
> Of course if you want to limit yourself to a fixed depth (ie a max trace 
> level of 8 or whatever) then you can "unroll" the recursion so it works 
> on the GPU.  Might not be as efficient as letting the CPU do it though.

I'm just thinking that if the CPU has to intervine that much, the PCI 
bus is rapidly going to become a bottleneck to the whole system.


Post a reply to this message

From: scott
Subject: Re: Suggestion: OpenCL
Date: 18 Aug 2009 09:51:32
Message: <4a8ab1e4$1@news.povray.org>
> Indeed. And on the GPU, you can say "for all these thirty pixels you're 
> processing, multiply each one by the corresponding texture pixel". For 
> example. One instruction, executed on 30 different pairs of data values. 
> SIMD.

If you've ever done a array processing with eg MatLab you will be familiar 
with how to restructure algorithms to work in this sort of environment.

Things like doing "OUTPUT = A * B + (1-A) * C" is a single instruction that 
can operate on every value of the array, but essentially lets you choose 
output B or C based on the value of A.  This is often very useful and fast 
for converting typical one-value-at-a-time algorithms.

Reminds me of a built-in MatLab function to convert an RGB image to HSV. 
The function was actually looping through every pixel and calling the 
convert function (which had several if's in it).  I rewrote the conversion 
function to work on whole arrays at a time and it was orders of magnitude 
faster.  That's what you need to do for GPU programming too.


Post a reply to this message

From: Invisible
Subject: Re: Suggestion: OpenCL
Date: 18 Aug 2009 09:57:56
Message: <4a8ab364$1@news.povray.org>
>> Indeed. And on the GPU, you can say "for all these thirty pixels 
>> you're processing, multiply each one by the corresponding texture 
>> pixel". For example. One instruction, executed on 30 different pairs 
>> of data values. SIMD.
> 
> If you've ever done a array processing with eg MatLab you will be 
> familiar with how to restructure algorithms to work in this sort of 
> environment.

Indeed, this is part of what I hated about Matlab; If it isn't an array, 
you can't do anything with it. (That and the absurd syntax...)

> Things like doing "OUTPUT = A * B + (1-A) * C" is a single instruction 
> that can operate on every value of the array, but essentially lets you 
> choose output B or C based on the value of A.  This is often very useful 
> and fast for converting typical one-value-at-a-time algorithms.

Me being me, I would have expected a conditional statement to be faster 
than a redundant computation.

I guess back in the days before FPUs, when the RAM was faster than the 
CPU, that might even have been true. But today it seems it doesn't 
matter how inefficient an algorithm is, just so long as it has good 
cache behaviour and doesn't stall the pipeline. *sigh*

> Reminds me of a built-in MatLab function to convert an RGB image to HSV. 
> The function was actually looping through every pixel and calling the 
> convert function (which had several if's in it).  I rewrote the 
> conversion function to work on whole arrays at a time and it was orders 
> of magnitude faster.  That's what you need to do for GPU programming too.

Whenever you have a system like MatLab or SQL which is inherantly 
designed to do parallel processing, letting the intensively-tuned 
parallel engine do its stuff rather than explicitly looping yourself is 
always, always goig to be faster. ;-)


Post a reply to this message

From: Darren New
Subject: Re: Suggestion: OpenCL
Date: 18 Aug 2009 11:26:21
Message: <4a8ac81d$1@news.povray.org>
scott wrote:
> That's what you need to do for GPU programming too.

And APL, and J. :-) I did the same thing with APL graphics the professor had 
written, and dropped the time from 15 minutes to 20 seconds.

-- 
   Darren New, San Diego CA, USA (PST)
   "We'd like you to back-port all the changes in 2.0
    back to version 1.0."
   "We've done that already. We call it 2.0."


Post a reply to this message

From: andrel
Subject: Re: Suggestion: OpenCL
Date: 18 Aug 2009 14:51:34
Message: <4A8AF83A.6050503@hotmail.com>
On 18-8-2009 15:57, Invisible wrote:
>>> Indeed. And on the GPU, you can say "for all these thirty pixels 
>>> you're processing, multiply each one by the corresponding texture 
>>> pixel". For example. One instruction, executed on 30 different pairs 
>>> of data values. SIMD.
>>
>> If you've ever done a array processing with eg MatLab you will be 
>> familiar with how to restructure algorithms to work in this sort of 
>> environment.
> 
> Indeed, this is part of what I hated about Matlab; If it isn't an array, 
> you can't do anything with it. (That and the absurd syntax...)

Sometimes I wished you did stop flaunting your ignorance, this might be 
one of those.

>> Things like doing "OUTPUT = A * B + (1-A) * C" is a single instruction 
>> that can operate on every value of the array, but essentially lets you 
>> choose output B or C based on the value of A.  This is often very 
>> useful and fast for converting typical one-value-at-a-time algorithms.
> 
> Me being me, I would have expected a conditional statement to be faster 
> than a redundant computation.
> 
> I guess back in the days before FPUs, when the RAM was faster than the 
> CPU, that might even have been true. But today it seems it doesn't 
> matter how inefficient an algorithm is, just so long as it has good 
> cache behaviour and doesn't stall the pipeline. *sigh*

Actually it is a different way of thinking. Remember battlechess? The PC 
did not have a language or paradigm that would make something like that 
seem feasible. The Amiga had, with its combined CPU and blitter 
architecture. Having seen the Amiga example it is easy to see how you 
can simulate that in software. So battlechess on the PC could not have 
been developed, not because it was technically impossible, but because 
it would have been too slow if you had designed it using the 
conventional un-parallelized paradigms.

I have probably mentioned it here before, but I once wrote an Ising 
model simulation on an Amiga 256 by 256 (IIRC) at 7 frames per second 
(in 1988 +-1), using almost exclusively the blitter. For that I had to 
implement my own bitwise addition and subtraction, easy, just a number 
of AND and XOR blit operations (if you don't know how to do it, I know 
just the course for you ;) ). I also had to have a chance of flipping a 
spin that is for each spin a fraction that depends on the temperature. I 
even solved that with almost only the blitter. (left as an exercise to 
the reader/mascot) I think it was several orders of magnitude faster 
than what I could have accomplished if I did it the traditional way with 
loops, IFs and floating point comparisons to random numbers.

>> Reminds me of a built-in MatLab function to convert an RGB image to 
>> HSV. The function was actually looping through every pixel and calling 
>> the convert function (which had several if's in it).  I rewrote the 
>> conversion function to work on whole arrays at a time and it was 
>> orders of magnitude faster.  That's what you need to do for GPU 
>> programming too.
> 
> Whenever you have a system like MatLab or SQL which is inherantly 
> designed to do parallel processing, letting the intensively-tuned 
> parallel engine do its stuff rather than explicitly looping yourself is 
> always, always goig to be faster. ;-)
If only because the interpreter is rather slow because of the complexity 
of the language.


Post a reply to this message

From: scott
Subject: Re: Suggestion: OpenCL
Date: 19 Aug 2009 02:58:41
Message: <4a8ba2a1@news.povray.org>
> I guess back in the days before FPUs, when the RAM was faster than the 
> CPU, that might even have been true. But today it seems it doesn't matter 
> how inefficient an algorithm is, just so long as it has good cache 
> behaviour and doesn't stall the pipeline. *sigh*

See to me if an algorithm has good cache behaviour and doesn't stall the 
pipeline that would seem like an efficient algorithm *for modern PCs*.  Of 
course if you use "how fast would it run on my Amiga" as your indicator of 
efficiency then no, it doesn't need to be an "efficient" algorithm to be 
efficient on a modern PC.


Post a reply to this message

From: scott
Subject: Re: Suggestion: OpenCL
Date: 20 Aug 2009 06:02:59
Message: <4a8d1f53@news.povray.org>
> I'm just thinking that if the CPU has to intervine that much, the PCI bus 
> is rapidly going to become a bottleneck to the whole system.

It seems that current GPU raytracers are 5-6x slower than CPU ones:

http://graphics.stanford.edu/papers/gpu_kdtree/gpu_kdtree.ppt

So there doesn't seem to be much benefit, even if you could easily utilise 
the GPU from POV.


Post a reply to this message

From: Invisible
Subject: Re: Suggestion: OpenCL
Date: 20 Aug 2009 06:35:40
Message: <4a8d26fc$1@news.povray.org>
scott wrote:

> It seems that current GPU raytracers are 5-6x slower than CPU ones:
> 
> http://graphics.stanford.edu/papers/gpu_kdtree/gpu_kdtree.ppt
> 
> So there doesn't seem to be much benefit, even if you could easily 
> utilise the GPU from POV.

I vaguely recall this came up on one of the Haskell lists recently. 
Discussion along the lines of

- Team X wrote a raytracer and it was 5x slower on the GPU than on the CPU.

- Team Y write another raytracer with was 2x faster on the GPU than on 
the CPU. Team X just did the job badly.

I don't have any references tho...


Post a reply to this message

<<< Previous 22 Messages Goto Initial 50 Messages

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.