hexagonal storage scheme for interleaved frame buffers and...

8
Graphics Hardware (2005) M. Meissner, B.- O. Schneider (Editors) Hexagonal Storage Scheme for Interleaved Frame Buffers and Textures Yosuke Bando Takahiro Saito Masahiro Fujita TOSHIBA Corporation {yosuke1.bando, takahiro4.saito, masahiro1.fujita}@toshiba.co.jp Abstract This paper presents a storage scheme which statically assigns pixel/texel coordinates to multiple memory banks in order to minimize frame buffer and texture memory access load imbalance. In this scheme, the pixels stored in a particular memory bank are placed at the center and the vertices of hexagons packed in the frame buffer. By making these hexagons close to regular so that the pixel placement is uniform and isotropic, frame buffer and texture memory accesses are evenly distributed over the memory banks. The analysis of memory access patterns in rendering typical 3D graphics scenes shows that the hexagonal storage scheme can reduce rendering performance degradation due to bank conflicts by an average of 10% compared to the traditional rectangular storage scheme. Categories and Subject Descriptors (according to ACM CCS): I.3.1 [Computer Graphics]: Parallel Processing 1 23 89 45 67 1213 1617 1819 2021 2425 2627 2829 1213 1415 45 89 1011 1 2829 3031 2021 2425 2627 1617 1011141522233031 6 7 2 3 22231819 2829 3031 2425 2021 2223 1617 1 23 45 89 1011 1213 1617 1819 2021 2425 2627 2829 1213 1415 89 45 67 1 26271819 6 7 1415222330311011 2 3 1213 1415 45 89 1011 1 2829 3031 2021 2425 2627 1617 6 7 2 3 22231819 1 23 89 45 67 1213 1617 1819 2021 2425 2627 2829 1011141522233031 1617 1819 2021 2425 2627 2829 1213 1415 89 45 67 1 222330311011 2 3 2829 3031 2425 2021 2223 1617 1 23 45 89 1011 1213 26271819 6 7 1415 0 0 0 0 0 0 0 0 0 0 1 89 1617 23 1011 1819 45 1213 2021 67 1415 2223 2425262728293031 0 1 89 1617 23 1011 1819 45 1213 2021 67 1415 2223 2425262728293031 0 1 89 1617 23 1011 1819 45 1213 2021 67 1415 2223 2425262728293031 0 1 89 1617 23 1011 1819 45 1213 2021 67 1415 2223 2425262728293031 0 1 89 1617 23 1011 1819 45 1213 2021 67 1415 2223 2425262728293031 0 1 89 1617 23 1011 1819 45 1213 2021 67 1415 2223 2425262728293031 0 1 89 1617 23 1011 1819 45 1213 2021 67 1415 2223 2425262728293031 1 89 1617 23 1011 1819 45 1213 2021 67 1415 2223 2425262728293031 Figure 1: The presented storage scheme assigns pixel coordinates to multiple (in this case 32) memory banks, by permuting the bank IDs in each rectangle in a traditional rectangularly interleaved bank ID assignments (left), so that the pixels having the same bank ID are placed at the center and the vertices of nearly regular hexagons packed in the frame buffer (right). 1. Introduction Graphics processing units (GPU) have been endowed with increasing parallelism in order to meet the demand for greater graphics acceleration. Accordingly, the amounts of pixel and texel data transfer per unit time have also been increasing due to parallel updates of the frame buffer and parallel texture fetches. Typically, this high memory band- width requirement can be alleviated using multiple memory banks, each of which stores disjoint portions of the frame buffer or texture so that the multiple portions of the mem- ory can be accessed in parallel. However, this configuration incurs memory access load imbalance because each pixel is stored in a fixed memory bank depending on its coordinate on the 2D rectangular frame buffer, and therefore memory accesses cannot be dynamically distributed to the memory banks based on temporal load. This paper presents a storage scheme which statically as- signs pixel coordinates to memory banks in order to min- imize memory access load imbalance resulting from one- to-one correspondence between coordinates and banks. The strategy is to distribute the pixels stored in a particular mem- ory bank uniformly and isotropically on the frame buffer. The ideal placement is to locate the pixels at the center and the vertices of regular hexagons packed in the frame buffer. c The Eurographics Association 2005.

Upload: others

Post on 04-Aug-2020

0 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Hexagonal Storage Scheme for Interleaved Frame Buffers and ...web.media.mit.edu/~bandy/hexagon/GH05hexagon.pdf · Bando, Saito, Fujita / Hexagonal Storage Scheme for Interleaved Frame

Graphics Hardware (2005)M. Meissner, B.- O. Schneider (Editors)

Hexagonal Storage Scheme forInterleaved Frame Buffers and Textures

Yosuke Bando Takahiro Saito Masahiro Fujita

TOSHIBA Corporation{yosuke1.bando, takahiro4.saito, masahiro1.fujita}@toshiba.co.jp

AbstractThis paper presents a storage scheme which statically assigns pixel/texel coordinates to multiple memory banksin order to minimize frame buffer and texture memory access load imbalance. In this scheme, the pixels storedin a particular memory bank are placed at the center and the vertices of hexagons packed in the frame buffer.By making these hexagons close to regular so that the pixel placement is uniform and isotropic, frame buffer andtexture memory accesses are evenly distributed over the memory banks. The analysis of memory access patterns inrendering typical 3D graphics scenes shows that the hexagonal storage scheme can reduce rendering performancedegradation due to bank conflicts by an average of 10% compared to the traditional rectangular storage scheme.

Categories and Subject Descriptors (according to ACM CCS): I.3.1 [Computer Graphics]: Parallel Processing

12 38 9

4 56 71213

161718192021

242526272829

121314154 5

8 91011

1

282930312021

242526271617

1011141522233031 6 7 2 3 22231819282930312425

202122231617

12 34 5

8 910111213

161718192021

242526272829

121314158 9

4 56 7

126271819 6 7 1415222330311011 2 3121314154 5

8 91011

1

282930312021

242526271617

6 7 2 3 22231819

12 38 9

4 56 7

1213

161718192021

242526272829

1011141522233031161718192021

242526272829

121314158 9

4 56 7

1222330311011 2 3

282930312425

202122231617

12 34 5

8 910111213

26271819 6 7 1415

0

0

0

0

0

0

0

0

0

0 18 91617

2 310111819

4 512132021

6 714152223

2425262728293031

0 18 91617

2 310111819

4 512132021

6 714152223

2425262728293031

0 18 91617

2 310111819

4 512132021

6 714152223

2425262728293031

0 18 9

1617

2 310111819

4 512132021

6 714152223

2425262728293031

0 18 9

1617

2 310111819

4 512132021

6 714152223

2425262728293031

0 18 91617

2 310111819

4 512132021

6 714152223

2425262728293031

0 18 91617

2 310111819

4 512132021

6 714152223

2425262728293031

18 9

1617

2 310111819

4 512132021

6 714152223

2425262728293031

Figure 1: The presented storage scheme assigns pixel coordinates to multiple (in this case 32) memory banks, by permuting thebank IDs in each rectangle in a traditional rectangularly interleaved bank ID assignments (left), so that the pixels having thesame bank ID are placed at the center and the vertices of nearly regular hexagons packed in the frame buffer (right).

1. Introduction

Graphics processing units (GPU) have been endowed withincreasing parallelism in order to meet the demand forgreater graphics acceleration. Accordingly, the amounts ofpixel and texel data transfer per unit time have also beenincreasing due to parallel updates of the frame buffer andparallel texture fetches. Typically, this high memory band-width requirement can be alleviated using multiple memorybanks, each of which stores disjoint portions of the framebuffer or texture so that the multiple portions of the mem-ory can be accessed in parallel. However, this configurationincurs memory access load imbalance because each pixel is

stored in a fixed memory bank depending on its coordinateon the 2D rectangular frame buffer, and therefore memoryaccesses cannot be dynamically distributed to the memorybanks based on temporal load.

This paper presents a storage scheme which statically as-signs pixel coordinates to memory banks in order to min-imize memory access load imbalance resulting from one-to-one correspondence between coordinates and banks. Thestrategy is to distribute the pixels stored in a particular mem-ory bank uniformly and isotropically on the frame buffer.The ideal placement is to locate the pixels at the center andthe vertices of regular hexagons packed in the frame buffer.

c© The Eurographics Association 2005.

Page 2: Hexagonal Storage Scheme for Interleaved Frame Buffers and ...web.media.mit.edu/~bandy/hexagon/GH05hexagon.pdf · Bando, Saito, Fujita / Hexagonal Storage Scheme for Interleaved Frame

Bando, Saito, Fujita / Hexagonal Storage Scheme for Interleaved Frame Buffers and Textures

However, it is impossible to form regular hexagons bychoosing their vertices from a square grid of pixels. A trian-gular or hexagonal grid of pixels [Gla94, Tyt00] may not besubject to this problem, but GPUs with such shapes of pixelshave yet to become readily available commercially. There-fore, we present our approach to finding an assignment ofsquare grid pixel coordinates to the memory banks in whichthe pixels assigned to the same memory bank form nearlyregular hexagons. And we show the obtained assignmentsfor several variations of the number of memory banks. Byanalyzing memory access patterns in rendering several typ-ical 3D graphics scenes, we demonstrate that our storagescheme distributes both frame buffer and texture memoryaccesses over the memory banks more evenly than do othernon-hexagonal storage schemes.

2. Related Work

We focus on static storage schemes and do not cover adap-tive or dynamic memory assignments, such as the MAHDalgorithms [Mue95] and the demand-paging algorithm usedin the VC-1 [NK96].

Static assignments of regions of the frame buffers to mem-ory banks are often used in conjunction with sort-first andsort-middle architectures defined in [MCEF94], where eachgraphics processor is responsible for the regions of the framebuffer stored in the associated memory bank as shown inFigure 2(a). This configuration allows simple connectionsbetween the graphics processors and the memory, but loadbalancing of multiple graphics processors is directly affectedby the storage scheme in use.

In this context, two typical storage schemes are describedin [FvDFH90]: the one involves dividing the frame bufferinto N rectangular regions, and assigning each region toone of the N memory banks; the other involves dividing theframe buffer into many small regions and distributing themto the memory banks in a finely interleaved manner. As tes-sellations of 3D objects are getting finer [Dee93], the latterstorage scheme becomes preferable since it prevents primi-tives from being drawn to one region.

In most of the existing static and finely interleaved pat-terns found in literature [Fuc77, Par80, PH89, FvDFH90,Mue95], the distribution of the regions assigned to the samememory bank is aligned to the horizontal and vertical axesof the frame buffer. One such example for N = 8 is shown inthe left hand side of Figure 7. However, this rectangular dis-tribution somewhat lacks uniformity and isotropy [Gla94],which can increase chances of bank conflicts.

The storage scheme used in Multiaccess Frame Buffer(MFB) proposed by Harper [Har94] is one of a few exam-ples of non-axis-aligned bank assignments. In MFB scheme,pixels in any rectangle whose area is N/2 are assigned tomutually different memory banks (however, it was shownthat this property is not always satisfied [Wei96]). Although

the major intention of this assignment is to permit parallelframe buffer updates in units of constant area rectangles, thisstorage scheme can be viewed as a variation of finely in-terleaved patterns for memory access load balancing. How-ever, no analysis of the memory access patterns based onthis scheme in rendering typical 3D graphics scenes is pre-sented. This paper analyzes the memory access patterns re-sulting from various storage schemes including typical axis-aligned assignments, MFB scheme, and our hexagonal one,and evaluates their differences.

Our storage scheme is applicable to frame buffers in asort-last architecture [MCEF94] shown in Figure 2(b) andto textures in a shared texture memory architecture [IEH99]shown in Figure 2(c) as long as pixels/texels are stored in thememory banks in an interleaved manner as described above.We show results for both frame buffers and textures.

B

frame buffer

B B B

R

sorting network

R

F

R

F

R

F

primitives

Fsorting network

B

frame buffer

B B B

R

F

R

F

R

F

R

F

primitives

sorting network

B

memory

FIF

O

FIF

O

FIF

O

FIF

O

B B B

tile stream generator

sorting network

B

texture

B B B

T T T T

F F F F

(a) (b) (c) (d)

Figure 2: Graphics subsystems with multiple memory banks.R: rasterizer, F: fragment processor, T: texture unit, and B:memory bank. (a) Sort-middle architecture where each F isdirectly linked to one of the B’s. (b) Sort-last architecturewith a pixel sorting network between the F’s and the B’s. (c)Shared texture memory architecture with a texel sorting net-work between the T’s and the B’s. (d) A model for evaluatingperformance of storage schemes.

3. Hexagonal Storage Scheme

The following explanation is for the case of frame buffers,but it can be directly applied to the case of textures by sub-stituting “texture” for “frame buffer,” and “texel” for “pixel.”

3.1. Preliminaries

We consider a frame buffer memory system with N memorybanks. We assume that N is a power of two. Each memorybank has a serial number called bank ID ∈ {0,1, · · · ,N −1}, and the frame buffer is divided into a number of smalldisjoint square regions called tiles, each of which is assigneda fixed bank ID. The tile size can be equal to the pixel size,but pixels are often clustered into tiles for several reasons:e.g., alignment with the units of data transfer or with thecache line size; LOD calculation using adjacent fragments;SIMD operations on fragments; fast clear of buffers; and tile-based compression.

To simplify the calculation of a tile’s storage location

c© The Eurographics Association 2005.

Page 3: Hexagonal Storage Scheme for Interleaved Frame Buffers and ...web.media.mit.edu/~bandy/hexagon/GH05hexagon.pdf · Bando, Saito, Fujita / Hexagonal Storage Scheme for Interleaved Frame

Bando, Saito, Fujita / Hexagonal Storage Scheme for Interleaved Frame Buffers and Textures

within a memory bank, we cluster N tiles into a rectanglecalled block. These N tiles have mutually different bank IDs.In this configuration, a serial number for a block called blockID corresponds to the location within each of the memorybanks where the tile in that block is stored. Block IDs can beassigned in row-major order as shown in Figure 3. Alterna-tively, block IDs can be swizzled [AMH02] if it is acceptableto confine the buffer size to a power of two times the blocksize, which is often the case with textures. An example ofswizzling applied to the pixel order is shown in Figure 3.

We consider assigning a memory bank to each tile so thatthe tiles stored in a particular memory bank are distributeduniformly and isotropically over the frame buffer, since thisminimizes the chance that each bank is accessed multipletimes in a short period of time. Such distribution is achievedby placing the tiles at the center and the vertices of regu-lar hexagons packed in the frame buffer as shown in Fig-ure 4(a), which maximizes the distances between the neigh-boring tiles [CS98]. However, as Figure 4(b) shows, the tileswould not fit in the grid since the positions of the tiles do notfall on integer locations. Section 3.2 describes how we findan assignment of bank IDs to the grid of tiles by which thetiles labeled the same bank ID form nearly regular hexagons.

3

0 1 2 35 6 7 810 11 12 1315 16 17 18 19

frame buffer

5 blocks (80 pixels)

4 blocks(32 pixels)

914 0

213

46 7

block

0 1 46 7

9 121310111415

tile

5

4 tiles (16 pixels)

2 tiles(8 pixels)

4 pixels

28

4

5

Figure 3: Example of blocks and tiles. A frame buffer is di-vided into blocks, each of which is assigned a block ID. Ablock is divided into tiles, each of which is assigned a bankID. The pixels in a tile in this figure are in a swizzled order.

(a) (b)

Figure 4: Example of regular-hexagonal placement of tiles.16 tiles are stored in one memory bank for N = 16 with abuffer size of 16×16 tiles. (a) Tiles (shown as small squares)are placed at the vertices of regular hexagons. (b) The tilesat the same location as in (a) do not fit in a square grid.

3.2. Search for Hexagonal Bank ID Assignment

Currently, we obtain the desired bank ID assignments by abrute-force search. We evaluate uniformity of an assignmentby the side lengths of the Delaunay triangles formed by thetiles having the same ID. We adopt the assignment with thelargest minimum side length. If there are multiple such as-signments, we choose the assignment with the smallest av-

erage side length because it has sides of similar length andis therefore isotropic.

An exhaustive search of possible bank ID assignmentsis impractical due to combinatorial explosion: there are(N!)k−1 combinations of assignments where k is the num-ber of blocks. The reason for −1 in the exponent is becausewe can fix the assignment in one block in order to elimi-nate the redundant N! assignments resulting from bank IDpermutation. Unfortunately, we could not figure out whethera polynomial-time algorithm exists for this optimizationproblem. Therefore, we introduced the following three con-straints to reduce the search space.

First, we search recursively based on the solution for asmaller N. Given the assignment for N, we double its tilesize, and we consider placing four original size tiles labeled4i,4i+1,4i+2, and 4i+3 in the double size tile labeled i(∈{0,1, · · · ,N − 1}) in each block to obtain assignments for4N (see Figure 5). This reduces the number of combinationsto (4!)N(k−1). The base cases (N = 1,2) for this recursionare given in Figure 6. Since the block size is also doubled atevery step of the recursion, the block will always be a squarefor an even n(= log2 N), and half of a square for an odd n.

Second, we only accept assignments that are equitable toall memory banks: i.e., the pattern of the tiles with a partic-ular bank ID on the frame buffer should be congruent withthat of the tiles with any other bank ID. Existence of suchassignments is guaranteed because one such assignment canbe achieved by placing the four tiles 4i,4i + 1,4i + 2, and4i + 3 in the same order in the double size tile labeled i forall the blocks. So far, the number of combinations is reducedto (4!)k−1 since we have only to consider one quadruplet ofbanks (e.g., bank 0, 1, 2, and 3 if we choose i = 0) and applythe result to the other quadruplets.

Third, we reduce the number of blocks under consider-ation by assuming periodicity of assignments. Specifically,for an even n we search assignments that repeat every twoblocks both horizontally and vertically. For an odd n, wesearch assignments that repeat every two blocks horizontallyand four blocks vertically so that the both periods have thesame length in tiles. In this way, the number of bank ID as-signment combinations becomes (4!)3 or (4!)7 regardless ofthe size of the frame buffer. Assuming periodicity also yieldssome other advantages: the bank ID calculation is simplifiedas upper bits of a pixel coordinate become irrelevant to thebank ID; the equity property check and the uniformity eval-uation can be performed for a constant number of tiles.

Thanks to the three constraints above, the number of pos-sible bank ID assignments is at most (4!)7 ≈ 4G, which istractable and independent of N. And the total time complex-ity is O(n) due to recursion. Although the assignments ob-tained in this way are not guaranteed to be optimal, it is guar-anteed that uniformity of the assignment for a larger N isequal to or greater than that for a smaller N.

c© The Eurographics Association 2005.

Page 4: Hexagonal Storage Scheme for Interleaved Frame Buffers and ...web.media.mit.edu/~bandy/hexagon/GH05hexagon.pdf · Bando, Saito, Fujita / Hexagonal Storage Scheme for Interleaved Frame

Bando, Saito, Fujita / Hexagonal Storage Scheme for Interleaved Frame Buffers and Textures

Figure 6 shows the assignments obtained up to N = 32.The bank ID for N, denoted by bankIDN , is calculated fromtile coordinates (tx, ty) by the following equations, where tilecoordinates are pixel coordinates divided by the tile size.

bankID1 = 0 bankID2 = tx[0]⊕ty[0]

bankID4[1] = ty[0] bankID4[0] = tx[0]⊕ty[1]

bankID8[2] = tx[1]⊕ty[1]

bankID8[1] = ((ty[1]∧(tx[1]⊕tx[0]))∨(ty[1]∧ty[0]))⊕tx[2]⊕ty[2]

bankID8[0] = ((ty[1]∧(tx[1]⊕ty[0]))∨(ty[1]∧tx[0]))⊕tx[2]⊕ty[2]

bankID16[3] = ty[1] bankID16[2] = tx[1]⊕ty[2]

bankID16[1] = ty[0]⊕tx[2]⊕(ty[2]∧(tx[0]⊕tx[1]))

bankID16[0] = tx[0]⊕ty[2]

bankID32[4] = tx[2]⊕ty[2]

bankID32[3] = ((ty[2]∧(tx[2]⊕tx[1]))∨(ty[2]∧ty[1]))⊕tx[3]⊕ty[3]

bankID32[2] = ((ty[2]∧(tx[2]⊕ty[1]))∨(ty[2]∧tx[1]))⊕tx[3]⊕ty[3]

bankID32[1] = ty[0] bankID32[0] = tx[0]

where “ ·”, “∧”, “∨”, and “⊕” mean logical NOT, AND,OR, and XOR operations, respectively, and expression a[i]denotes the ith least significant bit of a. These equations canbe derived by logic reduction.

1

0

1

0

1

0 1

1 0

0 1

1 0

0 1

1 0

0 1

1 0

0

1

0

1

0 1 0 1 0

0 12 3

0 12 3

0 12 3

0 12 3

0 12 3

period period

perio

d

perio

d

tiles

fixed

also fixed due to periodicity

(a) (b)

Figure 5: Reduced search space for N = 8. (a) The assign-ment for N = 2 in double size. (b) In each of the tiles la-beled 0 in (a), we place four tiles 0-3. In each of the tileslabeled 1 in (a), we place four tiles 4-7. We have only toconsider either of these two quadruplets of tiles (we choose0-3). We fix the assignment in one block (in this figure theupper left block), and consider placing tiles in the paintedarea in seven blocks. The assignment for the other blocks isdetermined automatically thanks to the periodicity.

4. Evaluation Method

This section describes a method we adopt in order to evalu-ate performance of various storage schemes including ours.

4.1. Evaluation Model

Evaluating storage schemes based on numerous types ofgraphics system architectures and their possible combina-tions of parameters is impractical. Therefore, we use a

02

13

8 9

4612

02

13

810

911

461214

20

2022

46

57

1214

1315

810

1618

1618

1719

2022

2123

2426

2426

2527

2830

2931

2830

02

13

8 9

46

57

1213

1618

1719

2425

2022

2123

2829

2830

2931

0 14 5

810

911

1214

1315

16172021

2426

2527

810

911

02

13

46

57

1214

1315

02

13

810

911

46

57

1214

1315

1618

1719

2426

2527

2022

2123

2830

2931

02

2

20

0

1

1

13

3

3

4

4

5

5

6

6 7

712

12

141315

141315

2426

2527

2022

2123

2830

2931

02

13

20 1

346

57

810

911

810

911

46

57

1214

1315

1214

1315

1214

1315

1214

1315

46

57

20 1

3

46

57

810

911

810

911

810

911

810

911

1618

1719

1618

1719

1618

1719

1618

1719

1618

1719

1618

1719

1618

1719

2022

2123

2022

2123

2022

2123

2022

2123

2022

2123

2022

2123

2426

2527

2426

2527

2426

2527

2426

2527

2426

2527

2426

2527

2830

2931

2830

2931

2830

2931

2830

2931

2830

2931

2830

2931

012 23 3456 7

0

0

0

0

0

0

0

0

00

0

051

1

11

11

1

1

1

1

1

122

22

2

2

2

22

2

2

3

3

3

3

3

3

3

3

3

3

3

4

4

4

4

4

44

4

44

4

55

5

5

5

5

5

5

55

6

6

6

6

6

66

6

6

6

6

7

7

7

7

7

77

7

7

77

00 1 0 1

0101

0 11 0

0 11 0

0 11 0

0 11 0

0 00 00 0

000

N = 1

N = 2

N = 4

N = 8

N = 32 N = 16

47 1 231 2 06547

141215

13911 8

105 6

470

1 23

0

12

51

14

0213

3

15

24

10119

8

6

10

78

13

0

121

51

1415

0213

12

33

15

2

14

4

105

119

4

8

6

10

7

117

9

6

8

0

12

51

14

0213

3

15

24

10119

8

6

10

78

13

0

12

3

15

1

0

14

51

141

12 132

1502

1312

14

2

3

115

3

150

12

2

14

3

13

4

10

7

5

11

489

94

8

5

11

6

10

6

10

7

11

6

8 9

5

7

94

6

8

7

1110

5

151375

120

20

13

01101 0322 3 2 31

13

20

010 10

20

13

12 30 1

2 30

12 301

230

Figure 6: Bank ID assignments for up to N = 32. Hexagonalpatterns appear for N ≥ 4, though when N = 16 the patternalso appears pentagonal or heptagonal.

generic model shown in Figure 2(d). In this model, a streamof tiles is input, and each tile is sent, via the sorting network,to the appropriate memory bank depending on its tile coor-dinate. Each bank has a tile FIFO that can smooth out someof the imbalance in the number of input tiles.

For frame buffers, a tile stream is generated by the ras-terizer. From the viewpoint of the memory banks, it is onlythe order of input tiles that affects load balancing. Thereforewe set aside rasterization parallelism and types of architec-ture, and change the order of input tiles only by algorithmsused by a single rasterizer. For this purpose, we chose thefollowing three rasterization algorithms as representatives.The rasterization granularity is tiles rather than pixels.

• RowMajorOrder: This classical algorithm rasterizesfrom the top of a triangle toward right along a scanline,and returns to the left edge on the next scanline.

• BlockedOrder: This algorithm traverses blocks in row-major order and rasterizes within each block again in row-major order. This improves frame buffer and texture ac-cess locality [MM00].

• HilbertOrder: This algorithm rasterizes along a Hilbertcurve [MWM01], which has high spatial locality.

We evaluate performance of storage schemes with andwithout a frame buffer cache. When the cache is enabled,the tile stream generator outputs a tile only when a cachemiss occurs. The evaluation without a cache serves as ananalysis of load imbalance of multiple graphics processorsin sort-first and sort-middle architectures because a pair ofa graphics processor and a memory bank (R, F, and B) inFigure 2(a) can be collectively regarded as a memory bank(B) in Figure 2(d), and a cache does not exert a strong influ-ence over the graphics processors’ load when a heavy pixelshader is used.

c© The Eurographics Association 2005.

Page 5: Hexagonal Storage Scheme for Interleaved Frame Buffers and ...web.media.mit.edu/~bandy/hexagon/GH05hexagon.pdf · Bando, Saito, Fujita / Hexagonal Storage Scheme for Interleaved Frame

Bando, Saito, Fujita / Hexagonal Storage Scheme for Interleaved Frame Buffers and Textures

Sea Station Stegosaurus Mouth Tank Cave Waterfall

Figure 8: Scenes used to evaluate performance of storage schemes.

For textures, on the other hand, a tile stream is generatedby the texture unit. Similar to the case of frame buffers, wedo not deal with texturing parallelism. A single rasterizergenerates a stream of tiles of fragments, and each fragmentprovides a texture coordinate to the texture unit. The textureunit has a cache, and when a cache miss occurs, it fetchesthe tile containing the specified texel from the appropriatememory bank (in this sense we had better use the term “tilerequest stream”). Again, variations of the order of tiles in atile request stream is controlled by rasterization algorithms.

Based on the previous work [HG97, IEP98, IEH99], weuse a 16KB two-way set associative cache with an LRU re-placement policy and with a cache line size equal to the datasize of a tile. We calculate the address A of a tile as follows.

A = B+(blockID ·N +bankID) ·4T 2

where B is the base address, and T is the tile size. We set thedata size of a pixel/texel to be 4 bytes.

4.2. Counterpart Storage Schemes

In order to evaluate how much our hexagonal storage schemeimproves memory access load balance, we compare it withthe three storage schemes described below. An example ofthe assignments for each scheme is shown in Figure 7.

• Rectangular: In this commonly used storage scheme, theassignment does not change block to block, and the pat-tern is rectangular.

• MFB: The aim of the Multiaccess Frame Buffer [Har94]is to assign N banks so that no bank ID coincides in anyrectangle whose area is N/2. Though some pairs of tileshaving the same ID are close to each other contrary to thisaim [Wei96], the assignment is fairly uniform.

• Flipped: This storage scheme is based on Rectangularscheme, but it improves uniformity by simply flippingbank IDs in the left half of a block and those in the righthalf for every other row of blocks.

2 36 7

0512 3

46 7

051 2 3

4 6 754 6 7

0 1 2 32 3 0 1 6 7 546 7 54 2 3 0 11 0 3 2 5 4 675 4 67 1 0 3 23 2 1 0 67 5 4

67 5 4 3 2 1 00

51 2 3

4 6 754 6 7

0 1 2 3

051

42 36 71 05 43 2

670

51

4

051 2 3

4 6 70

51 2 3

4 6 70

51 2 3

4 6 70

51 2 3

4 6 70

51 2 3

4 6 70

51 2 3

4 6 70

51 2 3

4 6 70

51 2 3

4 6 70

51 2 3

4 6 70

51 2 3

4 6 7

051

40

51

40

51

40

51

40

51

4

051 2 3

4 6 70

51 2 3

4 6 70

512 3

46 70

51 2 3

4 6 70

51 2 3

4 6 7

051 2 3

4 6 70

51 2 3

4 6 7

051

4

051

4

051

4

2 36 7

0512 3

46 70

512 3

46 7

Rectangular MFB Flipped

Figure 7: Counterpart bank ID assignments for N = 8.

4.3. Scenes

We used the seven scenes shown in Figure 8. All primitivesare texture mapped with mipmaps. Thus each fragment re-quires eight texels under texture minification, and four texelsunder magnification. The frame buffer size is 512×512.

5. Results

In order to limit the number of combinations of parameters,we show the results for N = 8, 16, and 32 with a tile sizeof 4× 4 pixels. For N < 8, the assignments of our storagescheme are equivalent to those of Rectangular or Flippedscheme. A frame buffer cache is enabled for the followingresults if not otherwise specified. From experiment, both ofthe frame buffer and texture cache hit ratios are almost inde-pendent of storage schemes.

Figure 9 shows the overall imbalance of the number of ac-cesses to the memory banks for frame buffers and textures.Thanks to fine interleaving, frame buffer accesses are evenlydistributed to the banks regardless of storage schemes, al-though some variations can be seen for Stegosaurus scene.On the other hand, texture access load imbalance is relativelylarge, and is dependent on storage schemes for most of thescenes. This is because textures are accessed more irregu-larly. We can see that the overall imbalance of texture ac-cesses for Hexagonal scheme is almost always smaller thanthat for Flipped and Rectangular schemes, and it is compet-itive (smaller for some scenes, and larger for some scenes)with that for MFB scheme.

Even if the overall imbalance is small, there are possibili-ties of strong temporal imbalance. Thus we measure imbal-ance of the number of accesses to the memory banks duringsome period of time, assuming that the tile stream generatorprovides one tile per cycle. Figure 10 shows the time devel-opment of such imbalance for Mouth scene as an example.The temporal imbalance of the frame buffer accesses can ex-ceed 150% for all the storage schemes contrary to the overallbalanced memory accesses. For both frame buffers and tex-tures, we can see that the graph for Rectangular scheme hashigher peaks than those for the other storage schemes.

Since we cannot trace the whole time development of thetemporal imbalance for each scene, we count the intervalsin cycles between two consecutive tiles that a memory bankreceives. Figure 11 shows the histograms of such intervals.The histograms for the frame buffer have some spikes that

c© The Eurographics Association 2005.

Page 6: Hexagonal Storage Scheme for Interleaved Frame Buffers and ...web.media.mit.edu/~bandy/hexagon/GH05hexagon.pdf · Bando, Saito, Fujita / Hexagonal Storage Scheme for Interleaved Frame

Bando, Saito, Fujita / Hexagonal Storage Scheme for Interleaved Frame Buffers and Textures

correspond to the spatial intervals between the tiles havingthe same bank ID along the trace of a given rasterizer. Thehistograms for the textures are smoothed out since texturesare traversed more arbitrarily. For both frame buffers andtextures, the histogram for Rectangular scheme is stronglyshifted to the left, and those for MFB and Flipped schemesare slightly shifted to the left compared to that for Hexag-onal scheme. High occurrence of small intervals suggeststhere would be high peak memory access load imbalance.We take the standard deviation of the intervals as a mea-sure of the temporal imbalance for the entire scene, which isshown later.

We also estimate the performance degradation due to bankconflicts. We assume that each of the N memory banks isbusy for N cycles after receiving a tile. The system is bal-anced because the memory has potential ability to receiveN tiles in N cycles while the tile stream generator outputsN tiles. If another tile is sent to a busy memory bank, it isqueued in the tile FIFO of that bank. If the FIFO is full, thetile stream generator stalls. The performance measure is thetotal cycles required to render the entire scene divided by thenumber of tiles. Figure 12 shows the performance degrada-tion for Mouth scene. Naturally, the values decrease as thenumber of FIFO stages increases, but the ratio of the valuefor one storage scheme to that for another is approximatelymaintained. The graphs show that Hexagonal scheme has theleast performance degradation of the four schemes.

Figure 13 summarizes the standard deviation of the inter-vals and the performance degradation for all combinationsof the storage schemes, scenes, rasterization algorithms, andthe number of memory banks. The standard deviation is nor-malized by N for comparison. A graph of the standard devia-tion and the corresponding graph of the performance degra-dation are similar in shape, which supports the use of thestandard deviation of tile intervals as a measure of tempo-ral load imbalance. As the overall tendency, the lines in thegraphs slope upward from left to right, meaning that Hexag-onal scheme is less subject to temporal load imbalance thanthe other storage schemes are. The major exception to thistendency is the relationship between Hexagonal and MFBschemes when N = 16, which can be attributed to the factthat the assignment of Hexagonal scheme for N = 16 is notquite close to regular hexagons as shown in Figure 6.

Finally, Table 1 summarizes the performance gain ob-tained by using Hexagonal scheme over the other storageschemes. We evaluate the number of cycles reduced by us-ing Hexagonal scheme relative to the total cycles requiredby using a given storage scheme, and simply average thesevalues for all the scenes. These figures show that Hexago-nal scheme can improve performance by an average of 10%compared to Rectangular scheme, and that it is advantageousover MFB and Flipped schemes except for MFB for N = 16,though the differences may be small in some cases.

100%

120%

140%

160%

180%

200%

H M F R H M F R H M F R H M F R H M F R H M F R

Sea Station Stegosaurus Mouth Tank Cave Waterfall

frame buffer texture

N = 8 N = 16 N = 32 N = 8 N = 16 N = 32

H: Hexagonal M: MFB F: Flipped R: Rectangular

Figure 9: Overall imbalance of memory accesses. The y-axis shows the percentage of the maximum number of tilesgiven to a memory bank to the average number of tiles perbank. This graph is for a RowMajorOrder rasterizer, but thegraphs for the other two rasterizers have a similar tendency.

100%

150%

200%

0 20000 40000 60000

HexagonalMFB

FlippedRectangular

100%

150%

200%

0 20000 40000 60000cycles

HexagonalMFB

FlippedRectangular

1

Figure 10: Time development of temporal imbalance ofmemory accesses to the frame buffer (top) and to the tex-tures (bottom) for Mouth scene, N = 8, and HilbertOrder.Each data point is windowed by 128 cycles.

0

1000

2000

3000

4000

5000

6000

7000

8000

0 5 10 15 20interval

HexagonalMFB

FlippedRectangular

0 1000 2000 3000 4000 5000 6000 7000 8000 9000

0 5 10 15 20interval

HexagonalMFB

FlippedRectangular

1

Figure 11: Histograms of the intervals between two consec-utive tiles sent to the same memory bank of the frame buffer(left) and of the textures (right) for Mouth scene, N = 8, andHilbertOrder. The vertical lines show the ideal interval of 8.

100%

110%

120%

130%

140%

150%

32168421FIFO stages

HexagonalMFB

FlippedRectangular

100%

110%

120%

130%

140%

150%

160%

170%

32168421FIFO stages

HexagonalMFB

FlippedRectangular

1

Figure 12: Performance degradation due to imbalance ofmemory accesses to the frame buffer (left) and to the textures(right) for Mouth scene, N = 8, and HilbertOrder. Severalvariations of the number of FIFO stages are shown. The y-axis shows the percentage of the number of cycles requiredto render the entire scene to the total number of tiles.

c© The Eurographics Association 2005.

Page 7: Hexagonal Storage Scheme for Interleaved Frame Buffers and ...web.media.mit.edu/~bandy/hexagon/GH05hexagon.pdf · Bando, Saito, Fujita / Hexagonal Storage Scheme for Interleaved Frame

Bando, Saito, Fujita / Hexagonal Storage Scheme for Interleaved Frame Buffers and Textures

Table 1: Performance gain obtained by using the hexagonalstorage scheme over the other three storage schemes.

Compared to N = 8 N = 16 N = 32Frame MFB 1.1% −8.6% 0.2%buffer Flipped 6.3% 10.4% 8.2%

(with cache) Rectangular 11.5% 11.7% 14.4%Frame MFB 1.9% −3.6% 2.8%buffer Flipped 3.8% 7.4% 4.5%

(w/o cache) Rectangular 10.3% 9.3% 10.6%MFB 3.0% −0.3% 0.6%

Texture Flipped 3.1% 3.3% 1.6%Rectangular 11.2% 7.2% 11.9%

6. Conclusion

This paper has presented a storage scheme which staticallyassigns pixel/texel coordinates to multiple memory banks,conforming to the shape of nearly regular hexagons. Us-ing several typical 3D graphics scenes, we have shown thatour storage scheme distributes memory access load over thememory banks more evenly than the other representativeschemes. Although the performance gain is modest (evenmarginal compared to MFB scheme), the results support thevalidity of our strategy for reducing bank conflicts.

Our hexagonal bank ID assignment appears complex, butthanks to the power-of-two block size and repeat period,bank ID calculation can be simplified. It requirs only a fewadditional logical operations, if any, compared to the otherstorage schemes, which has a minimal impact upon siliconarea in hardware implementation.

In future work, we intend to ascertain whether better as-signments exist for large N. Also, we intend to considersome other possible applications of our hexagonal assign-ment, such as antialiasing.

Acknowledgments

We would like to thank Prof. Tomoyuki Nishita and ShigeoTakahashi (The University of Tokyo) for their useful sugges-tions. We would also like to thank Shingo Yanagawa, Kat-sundo Nagashima, and Satoyuki Inaba for the scenes.

References

[AMH02] AKENINE-MÖLLER T., HAINES E.: Real-TimeRendering (second edition). A K Peters, Ltd., 2002. 3

[CS98] CONWAY J. H., SLOANE N. J. A.: Sphere Pack-ings, Lattices and Groups (3rd edition). Springer-Verlag,New York, 1998. 3

[Dee93] DEERING M. F.: Data complexity for virtual real-ity: where do all the triangles go? In IEEE Virtual RealityAnnual International Symposium (1993), pp. 357–363. 2

[Fuc77] FUCHS H.: Distributing a visible surface algo-rithm over multiple processors. In the ACM Annual Con-ference (1977), pp. 449–451. 2

[FvDFH90] FOLEY J. D., VAN DAM A., FEINER S. K.,HUGHES J. F.: Computer Graphics: Principles and Prac-tice (2nd edition). Addison-Wesley, 1990. 2

[Gla94] GLASSNER A. S.: Principles of Digital ImageSynthesis. Morgan Kaufmann Publishers, Inc., 1994. 2

[Har94] HARPER, III D. T.: A multiaccess frame bufferarchitecture. IEEE Trans. Comput. 43, 5 (May 1994),618–622. 2, 5

[HG97] HAKURA Z. S., GUPTA A.: The design and anal-ysis of a cache architecture for texture mapping. In the24th Annual International Symposium on Computer Ar-chitecture (1997), pp. 108–120. 5

[IEH99] IGEHY H., ELDRIDGE M., HANRAHAN P.: Par-allel texture caching. In SIGGRAPH/Eurographics Work-shop on Graphics Hardware (1999), pp. 95–106. 2, 5

[IEP98] IGEHY H., ELDRIDGE M., PROUDFOOT K.:Prefetching in a texture cache architecture. In SIG-GRAPH/Eurographics Workshop on Graphics Hardware(1998), pp. 133–142. 5

[MCEF94] MOLNAR S., COX M., ELLSWORTH D.,FUCHS H.: A sorting classification of parallel rendering.IEEE CG&A 14, 4 (July 1994), 23–32. 2

[MM00] MCCORMACK J., MCNAMARA R.: Tiled poly-gon traversal using half-plane edge functions. In SIG-GRAPH/Eurographics Workshop on Graphics Hardware(2000), pp. 15–21. 4

[Mue95] MUELLER C.: The sort-first rendering architec-ture for high-performance graphics. In the Symposium onInteractive 3D Graphics (1995), pp. 75–85. 2

[MWM01] MCCOOL M. D., WALES C., MOULE K.:Incremental and hierarchical Hilbert order edge equa-tion polygon rasterization. In SIGGRAPH/EurographicsWorkshop on Graphics Hardware (2001), pp. 65–72. 4

[NK96] NISHIMURA S., KUNII T. L.: VC-1: A scalablegraphics computer with virtual local frame buffer. In SIG-GRAPH 96 (1996), pp. 365–372. 2

[Par80] PARKE F. I.: Simulation and expected perfor-mance analysis of multiple processor z-buffer systems.Computer Graphics 14, 3 (July 1980), 48–56. 2

[PH89] POTMESIL M., HOFFERT E. M.: The Pixel Ma-chine: A parallel image computer. Computer Graphics 23,3 (July 1989), 69–78. 2

[Tyt00] TYTKOWSKI K. T.: Hexagonal raster for com-puter graphic. In IEEE International Conference on In-formation Visualization 2000 (2000), pp. 69–73. 2

[Wei96] WEI B.: Comments on “a multiaccess framebuffer architecture”. IEEE Trans. Comput. 45, 7 (July1996), 862. 2, 5

c© The Eurographics Association 2005.

Page 8: Hexagonal Storage Scheme for Interleaved Frame Buffers and ...web.media.mit.edu/~bandy/hexagon/GH05hexagon.pdf · Bando, Saito, Fujita / Hexagonal Storage Scheme for Interleaved Frame

Bando, Saito, Fujita / Hexagonal Storage Scheme for Interleaved Frame Buffers and Textures

fram

e bu

ffer w

ithou

t cac

hete

xtur

est

anda

rd d

evia

tion

fram

e bu

ffer w

ith c

ache

stan

dard

dev

iatio

npe

rfor

man

ce d

egra

datio

npe

rfor

man

ce d

egra

datio

nst

anda

rd d

evia

tion

perf

orm

ance

deg

rada

tion

0

0.5

1

1.5

2

2.5

3

H M F R H M F R H M F R H M F R H M F R H M F R H M F R H M F R H M F R

N = 16N = 8 N = 32

RowMajor RowMajor RowMajorBlocked BlockedBlockedHilbert Hilbert Hilbert

100%

150%

200%

250%

300%

350%

H M F R H M F R H M F R H M F R H M F R H M F R H M F R H M F R H M F R

N = 16N = 8 N = 32

RowMajor

RowMajorRowMajor

Blocked BlockedBlockedHilbert Hilbert Hilbert

0

0.5

1

1.5

2

2.5

H M F R H M F R H M F R H M F R H M F R H M F R H M F R H M F R H M F R

N = 16N = 8 N = 32

RowMajor RowMajor RowMajorBlocked BlockedBlockedHilbert Hilbert Hilbert

100%

150%

200%

250%

300%

350%

400%

450%

500%

550%

H M F R H M F R H M F R H M F R H M F R H M F R H M F R H M F R H M F R

N = 16N = 8 N = 32

RowMajor RowMajor RowMajorBlocked BlockedBlockedHilbert Hilbert Hilbert

0

0.5

1

1.5

2

2.5

H M F R H M F R H M F R H M F R H M F R H M F R H M F R H M F R H M F R

N = 16N = 8 N = 32

RowMajor RowMajor RowMajorBlocked BlockedBlockedHilbert Hilbert Hilbert

100%

150%

200%

250%

300%

H M F R H M F R H M F R H M F R H M F R H M F R H M F R H M F R H M F R

Sea Station Stegosaurus Mouth Tank Cave Waterfall

N = 16N = 8N = 32

RowMajor RowMajor RowMajorBlocked BlockedBlockedHilbert Hilbert Hilbert

H: Hexagonal M: MFB F: Flipped R: Rectangular

Figure 13: Normalized standard deviation of the intervals between two consecutive tiles sent to the same memory bank, andthe performance degradation due to imbalance of memory accesses with one FIFO stage.

c© The Eurographics Association 2005.