Text archives Help
- From: "Steven G. Parker" <sparker@cs.utah.edu>
- To: Shreekanth Pavar <shreekanth.pavar@ucl.ac.uk>
- Cc: MANTA <manta@sci.utah.edu>
- Subject: Re: [MANTA] MANTA : Questions about how the rendering stack works
- Date: Tue, 20 Mar 2007 20:41:52 -0600
It looks like you understand a great deal about the Manta
architecture. I have a few comments below in an attempt to clarify
and fill in the gaps:
[Trimmed description, all of which is a good summary].
TiledImageTraverser (default) splits a 512x512 image (the default
resolution)
into 256 (16x16) tiles each containing 1024 (32v32) pixels. These
tiles are
then converted into fragments. SingleSampler (default) puts these
fragments
into RayPackets which are then passed to RayTracer (the default
renderer) which
traces 32 rays through each packet.
Could you confirm if the above summary is correct ?
Correct so far.
Firstly, I'm unclear how a fragment is created from a tile.
Line 164 in TiledImageTraverser::renderImage is a comment:
// Create a Fragment that is consecutive in X pixels".
After which a 'shape' variable (default=LineShape) is used to
determine how to
create the fragment. I think this means the tiles are subdivided
into 'rows' of
constant Y which are passed to the Pixel Sampler as fragments.
The TIledImageTraverser has two modes in which to create packets.
The first (LineShape) is to take each tile and create a fragment out
of a row of consecutive pixels (constant y and consecutive in x).
The TileShape breaks the tile into smaller tiles, which are sometimes
better for ray coherence but are not yet as highly optimized.
The reason for the two different tilings is to have the unit of load
balance (the top level tile) different from the unit of packetizing,
which is designed more for cache coherence and amortization of
overheads.
Secondly, I'm also unclear how a ray packet is created from a
fragment.
By default, SingleSampler receives '32-pixel' sized fragments from
TiledImageTraverser but the RayPacket::MaxSize is also 32 so each
fragment
creates a single ray packet.
The SingleSampler will produce one ray per pixel. Therefore, the
size of the fragment (group of pixels) will map directly to the size
of the packet (group of rays). There is a little extra logic in case
RayPacket::MaxSize is smaller than Fragment::MaxSize, but otherwise
it is a direct mapping. For multi-sampling, the fragment will
result in multiple raypackets.
Lastly, I'm aware that dynamic load balancing is carried out using
(default)
WQLoadBalancer, but I'm unclear how it works.
Line 138 in TiledImageTraverser::renderImage calls the load
balancer to obtain a
range of tiles:
while(context.loadBalancer->getNextAssignment(context, s, e)){
I noticed that the number of 'assignments' returned varies each
time so I think
this is the load balancing in action.
Correct. The default (and only so far) load balancer gives the
caller a range of "assignments" (which in this case the
TiledImageTravserser maps directly to tiles). The idea is that
large ranges are given at the beginning of the frame reducing to
smaller assignments near the end. Assignments are given on a first-
come, first served basis which implements the dynamic load balance.
This technique avoids synchronization collisions at the beginning and
allows processors to finish at nearly the same time.
We have implemented a task stealing load balancer for distributed
systems but have never adapted one for Manta. This would probably be
preferred at the ultra high end (100+ CPUs) but the simple workqueue
works amazingly well.
I think some of my confusion results from being unfamiliar with how
Manta
defines tiles, fragments and ray packets.
A tile is a rectangular region of screen space. A fragment is a set
of pixel locations - it can be a square, a line, or an arbitrary set
of pixels. A ray packet is a group of rays - they can have multiple
roles such as primary rays (from the camera), secondary rays
(reflections/refractions), or shadow rays. Ray packets are more
efficient if they are "coherent", meaning that the rays start at
similar locations and travel in similar directions. Manta will split
the raypackets into smaller packets as they diverge from that ideal.
Let us know if you have any more questions. If it would make sense
to have a conference call at some point, we would be willing to set
one up.
Take care,
Steve
Archive powered by MHonArc 2.6.16.