Arm Community
Arm Community
  • Site
  • User
  • Site
  • Search
  • User
  • Groups
    • Arm Research
    • DesignStart
    • Education Hub
    • Innovation
    • Open Source Software and Platforms
  • Forums
    • AI and ML forum
    • Architectures and Processors forum
    • Arm Development Platforms forum
    • Arm Development Studio forum
    • Arm Virtual Hardware forum
    • Automotive forum
    • Compilers and Libraries forum
    • Graphics, Gaming, and VR forum
    • High Performance Computing (HPC) forum
    • Infrastructure Solutions forum
    • Internet of Things (IoT) forum
    • Keil forum
    • Morello Forum
    • Operating Systems forum
    • SoC Design and Simulation forum
    • 中文社区论区
  • Blogs
    • AI and ML blog
    • Announcements
    • Architectures and Processors blog
    • Automotive blog
    • Graphics, Gaming, and VR blog
    • High Performance Computing (HPC) blog
    • Infrastructure Solutions blog
    • Innovation blog
    • Internet of Things (IoT) blog
    • Mobile blog
    • Operating Systems blog
    • Research Articles
    • SoC Design and Simulation blog
    • Smart Homes
    • Tools, Software and IDEs blog
    • Works on Arm blog
    • 中文社区博客
  • Support
    • Open a support case
    • Documentation
    • Downloads
    • Training
    • Arm Approved program
    • Arm Design Reviews
  • Community Help
  • More
  • Cancel
Arm Community blogs
Arm Community blogs
Graphics, Gaming, and VR blog The Mali GPU: An Abstract Machine, Part 2 - Tile-based Rendering
  • Blogs
  • Mentions
  • Sub-Groups
  • Tags
  • Jump...
  • Cancel
More blogs in Arm Community blogs
  • AI and ML blog

  • Announcements

  • Architectures and Processors blog

  • Automotive blog

  • Embedded blog

  • Graphics, Gaming, and VR blog

  • High Performance Computing (HPC) blog

  • Infrastructure Solutions blog

  • Internet of Things (IoT) blog

  • Operating Systems blog

  • SoC Design and Simulation blog

  • Tools, Software and IDEs blog

Tell us what you think
Tags
  • Mali
  • performance analysis
  • gpu
  • rendering
  • Tutorial
  • Compute Shaders
Actions
  • RSS
  • More
  • Cancel
Related blog posts
Related forum threads

The Mali GPU: An Abstract Machine, Part 2 - Tile-based Rendering

Peter Harris
Peter Harris
February 20, 2014

Chinese version of this blog - thanks to vincent for the translation!

In my previous blog I started defining an abstract machine which can be used to describe the application-visible behaviors of the Mali GPU and driver software. The purpose of this machine is to give developers a mental model of the interesting behaviors beneath the OpenGL ES API, which can in turn be used to explain issues which impact their application’s performance. I will use this model in the future blogs of this series to explore some common performance pot-holes which developers encounter when developing graphics applications.

This blog continues the development of this abstract machine, looking at the tile-based rendering model of the Mali GPU family. I’ll assume you've read the first blog on pipelining; if you haven’t I would suggest reading that first.

The “Traditional” Approach

In a traditional mains-powered desktop GPU architecture — commonly called an immediate mode architecture — the fragment shaders are executed on each primitive, in each draw call, in sequence. Each primitive is rendered to completion before starting the next one, with an algorithm which approximates to:

    foreach( primitive )
         foreach( fragment )
              render fragment
          

 

As any triangle in the stream may cover any part of the screen the working set of data maintained by these renderers is large; typically at least a full-screen size color buffer, depth buffer, and possibly a stencil buffer too. A typical working set for a modern device will be 32 bits-per-pixel (bpp) color, and 32bpp packed depth/stencil. A 1080p display therefore has a working set of 16MB, and a 4k2k TV has a working set of 64MB. Due to their size these working buffers must be stored off-chip in a DRAM.

immediate-mode renderer data flow

Every blending, depth testing, and stencil testing operation requires the current value of the data for the current fragment’s pixel coordinate to be fetched from this working set. All fragments shaded will typically touch this working set, so at high resolutions the bandwidth load placed on this memory can be exceptionally high, with multiple read-modify-write operations per fragment, although caching can mitigate this slightly. This need for high bandwidth access in turn drives the need for a wide memory interface with lots of pins, as well as specialized high-frequency memory, both of which result in external memory accesses which are particularly energy intensive.

The Mali Approach

The Mali GPU family takes a very different approach, commonly called tile-based rendering, designed to minimize the amount of power hungry external memory accesses which are needed during rendering. As described in the first blog in this series, Mali uses a distinct two-pass rendering algorithm for each render target. It first executes all of the geometry processing, and then executes all of the fragment processing. During the geometry processing stage, Mali GPUs break up the screen into small 16x16 pixel tiles and construct a list of which rendering primitives are present in each tile. When the GPU fragment shading step runs, each shader core processes one 16x16 pixel tile at a time, rendering it to completion before starting the next one. For tile-based architectures the algorithm equates to:

    foreach( tile )
         foreach( primitive in tile )
              foreach( fragment in primitive in tile )
                    render fragment
          

As a 16x16 tile is only a small fraction of the total screen area it is possible to keep the entire working set (color, depth, and stencil) for a whole tile in a fast RAM which is tightly coupled with the GPU shader core.

Tile-based renderer data flow

This tile-based approach has a number of advantages. They are mostly transparent to the developer but worth knowing about, in particular when trying to understand bandwidth costs of your content:

  • All accesses to the working set are local accesses, which is both fast and low power. The power consumed reading or writing to an external DRAM will vary with system design, but it can easily be around 120mW for each 1GByte/s of bandwidth provided. Internal memory accesses are approximately an order of magnitude less energy intensive than this, so you can see that this really does matter.
  • Blending is both fast and power-efficient, as the destination color data required for many blend equations is readily available.
  • A tile is sufficiently small that we can actually store enough samples locally in the tile memory to allow 4x, 8x and 16x multisample antialising1. This provides high quality and very low overhead anti-aliasing. Due to the size of the working set involved (4, 8 or 16 times that of a normal single-sampled render target; a massive 1GB of working set data is needed for 16x MSAA for a 4k2k display panel) few immediate mode renderers even offer MSAA as a feature to developers, because the external memory footprint and bandwidth normally make it prohibitively expensive.
  • Mali only has to write the color data for a single tile back to memory at the end of the tile, at which point we know its final state. We can compare the block’s color with the current data in main memory via a CRC check — a process called Transaction Elimination — skipping the write completely if the tile contents are the same, saving SoC power. My colleague tomolson has written a great blog on this technology, complete with a real world example of Transaction Elimination (some game called Angry Birds; you might have heard of it). I’ll let Tom’s blog explain this technology in more detail, but here is a sneak peek of the technology in action (only the “extra pink” tiles were written by the GPU - all of the others were successfully discarded).

     Transaction Elimination Arm Mali GPU tiles

  • We can compress the color data for the tiles which survive Transaction Elimination using a fast, lossless, compression scheme — ARM Frame Buffer Compression (AFBC) — allowing us to lower the bandwidth and power consumed even further. This compression can be applied to offscreen FBO render targets, which can be read back as textures in subsequent rendering passes by the GPU, as well as the main window surface, provided there is an AFBC compatible display controller such as Mali-DP500 in the system.
  • Most content has a depth and stencil buffer, but doesn’t need to keep their contents once the frame rendering has finished. If developers tell the Mali drivers that depth and stencil buffers do not need to be preserved2 — ideally via a call to glDiscardFramebufferEXT (OpenGL ES 2.0) or glInvalidateFramebuffer (OpenGL ES 3.0), although it can be inferred by the drivers in some cases — then the depth and stencil content of tile is never written back to main memory at all. Another big bandwidth and power saving!

It is clear from the list above that tile-based rendering carries a number of advantages, in particular giving very significant reductions in the bandwidth and power associated with framebuffer data, as well as being able to provide low-cost anti-aliasing. What is the downside?

The principal additional overhead of any tile-based rendering scheme is the point of hand-over from the vertex shader to the fragment shader. The output of the geometry processing stage, the per-vertex varyings and tiler intermediate state, must be written out to main memory and then re-read by the fragment processing stage. There is therefore a balance to be struck between costing extra bandwidth for the varying data and tiler state, and saving bandwidth for the framebuffer data.

In modern consumer electronics today there is a significant shift towards higher resolution displays; 1080p is now normal for smartphones, tablets such as the Mali-T604 powered Google Nexus 10 are running at WQXGA (2560x1600), and 4k2k is becoming the new “must have” in the television market. Screen resolution, and hence framebuffer bandwidth, is growing fast. In this area Mali really shines, and does so in a manner which is mostly transparent to the application developer - you get all of these goodies for free with no application changes!

On the geometry side of things, Mali copes well with complexity. Many high-end benchmarks are approaching a million triangles a frame, which is an order of magnitude (or two) more complex than popular gaming applications on the Android app stores. However, as the intermediate geometry data does hit main memory there are some useful tips and tricks which can be applied to fine tune the GPU performance, and get the best out of the system. These are worth an entire blog by themselves, so we’ll cover these at a later point in this series.

Summary

In this blog I have compared and contrasted the desktop-style immediate mode renderer, and the tile-based approach used by Mali, looking in particular at the memory bandwidth implications of both.

Tune in next time and I’ll finish off the definition of the abstract machine, looking at a simple block model of the Mali shader core itself. Once we have that out of the way we can get on with the useful part of the series: putting this model to work and earning a living optimizing your applications running on Mali.

Note: The next blog in this series has now been published. You can read it by clicking on the button below.

Read next blog: The Midgard Shader Core

As always comments and questions more than welcome,

Pete

Footnotes

  1. Exactly which multisampling options are available depends on the GPU. The recently announced Mali-T760 GPU includes support for up to 16x MSAA.
  2. The depth and stencil discard is automatic for EGL window surfaces, but for offscreen render targets they may be preserved and reused in a future rendering operation.
Anonymous
Parents
  • Sean Lumly
    Offline Sean Lumly over 7 years ago

    peterharris , Thank you for this writeup, it was most informative and gives me a much better idea of the strengths and weaknesses of the Mali Tile Based Render solution. I now understand the memory cost of having to move the vertices 3x versus only 1x in an Immediate mode renderer. Of course, as resolutions increase and framebuffer counts grow, the IMR seems to be at an increasingly large disadvantage -- fragment count seems to be growing much faster than geometric complexity. The other benefits of the TBDR seem quite straight forward as well and are very welcome (eg. Power consumption, AA, Transaction Elimination, etc). With the ability to [now] access the contents of the tile (Shader Pixel Local Store), programmable blending can also be done 100% on chip for a wildly memory/speed efficient operations on many buffers. Forward Pixel Kill is yet another reason to love Mali's tiles!

    But I have a few questions:

    1) I notice that the latest Mali T760 description on the ARM site lists the the AA scheme is "4x FSAA, 8x FSAA, and 16x MSAA." I assume that FSAA and MSAA are both using rotated grid super-sampling, but is FSAA super-sampled over the entire triangle, or localized to the edges (as MSAA tends to be)? How is FSAA different than MSAA?

    2) What are the expected ballpark costs of implementing AA on the newest Mali T760 GPU? Are they still negligible at low sample density as was the case with the older Mali Utgard cores?

    3) Tiling seems a great fit for Multiple Render Target fragments that don't have to consider their neighbours. But for modern effects like SSAO (for example) that do consider their neighbours, how will tiling fare? Will such an operation have to be done in a second pass and with a bunch of dependent reads?

    Sean

    • Cancel
    • Up 0 Down
    • Reply
    • More
    • Cancel
Comment
  • Sean Lumly
    Offline Sean Lumly over 7 years ago

    peterharris , Thank you for this writeup, it was most informative and gives me a much better idea of the strengths and weaknesses of the Mali Tile Based Render solution. I now understand the memory cost of having to move the vertices 3x versus only 1x in an Immediate mode renderer. Of course, as resolutions increase and framebuffer counts grow, the IMR seems to be at an increasingly large disadvantage -- fragment count seems to be growing much faster than geometric complexity. The other benefits of the TBDR seem quite straight forward as well and are very welcome (eg. Power consumption, AA, Transaction Elimination, etc). With the ability to [now] access the contents of the tile (Shader Pixel Local Store), programmable blending can also be done 100% on chip for a wildly memory/speed efficient operations on many buffers. Forward Pixel Kill is yet another reason to love Mali's tiles!

    But I have a few questions:

    1) I notice that the latest Mali T760 description on the ARM site lists the the AA scheme is "4x FSAA, 8x FSAA, and 16x MSAA." I assume that FSAA and MSAA are both using rotated grid super-sampling, but is FSAA super-sampled over the entire triangle, or localized to the edges (as MSAA tends to be)? How is FSAA different than MSAA?

    2) What are the expected ballpark costs of implementing AA on the newest Mali T760 GPU? Are they still negligible at low sample density as was the case with the older Mali Utgard cores?

    3) Tiling seems a great fit for Multiple Render Target fragments that don't have to consider their neighbours. But for modern effects like SSAO (for example) that do consider their neighbours, how will tiling fare? Will such an operation have to be done in a second pass and with a bunch of dependent reads?

    Sean

    • Cancel
    • Up 0 Down
    • Reply
    • More
    • Cancel
Children
No Data
Graphics, Gaming, and VR blog
  • Style transfer for graphics post-processing on mobile

    Pavel Rudko
    Pavel Rudko
    This blog explains how developers can implement style transfer for graphics post-processing on mobile, in particular neural style transfer.
    • March 24, 2022
  • Analyzing ray traced content with Arm Mobile Studio

    Geraint North
    Geraint North
    This blog describes how Arm Mobile Studio can analyze ray traced content, with this being showcased via OPPO Find X5 pro smartphones at GDC 2022.
    • March 15, 2022
  • Using Adaptive Performance for the “Amazing Adventures of Dr. Arm”

    Joe Rozek
    Joe Rozek
    This blog explores Unity's Adaptive Performance and how it was applied to an internal Arm gaming title that will be showcased at GDC 2022.
    • March 14, 2022