Panfrost A reverse engineered FOSS driver for Mali Midgard and - - PowerPoint PPT Presentation

panfrost
SMART_READER_LITE
LIVE PREVIEW

Panfrost A reverse engineered FOSS driver for Mali Midgard and - - PowerPoint PPT Presentation

Panfrost A reverse engineered FOSS driver for Mali Midgard and Bifrost GPUs Contributors Alyssa Rosenzweig Most of the Midgard RE/Driver development Connor Abbott Initial Midgard ISA RE Most of the Bifrost ISA RE Lyude


slide-1
SLIDE 1

Panfrost

A reverse engineered FOSS driver for Mali Midgard and Bifrost GPUs

slide-2
SLIDE 2

Contributors

  • Alyssa Rosenzweig

– Most of the Midgard RE/Driver development

  • Connor Abbott

– Initial Midgard ISA RE – Most of the Bifrost ISA RE

  • Lyude Paul & BiOpen

– Helped with Bifrost utilities (assembler+panwrap)

slide-3
SLIDE 3

Panfrost

  • Aiming to support the following lines of ARM GPUs

– Midgard (Mali Txxx) – Bifrost (Mali Gxx)

  • Reverse engineered from tracing ARM’s userspace 3D

drivers and the open source kernel driver from ARM

  • 3D only! Most of the variants of display hardware used

with Mali GPUs have mainline drivers

slide-4
SLIDE 4

Midgard

slide-5
SLIDE 5

Midgard

  • Codename for ARM’s Mali Txxx line of

embedded GPUs

  • In many, many devices
  • Especially Chromebooks
slide-6
SLIDE 6

Midgard

What’s done?

  • ISA reverse engineered

– NIR-based compiler supporting simple shaders

  • ES 2.0 command stream reverse-engineered

– Prototype Mesa driver

slide-7
SLIDE 7

Midgard ISA Architecture

  • Three unit types:

– ALU – Load/store unit – Texture unit

  • Limited parallelism
slide-8
SLIDE 8

Midgard

ALU unit

  • Both scalar and vector (SIMD) units

– VMUL, VADD, SMUL, SADD, VLUT

  • Pipelined, VLIW-packed, some parallelism

– VMUL, SADD concurrent – VADD, SMUL, VLUT concurrent

  • Various opcodes allowed on a given unit
  • Scheduler goal: minimize number of bundles and register

pressure

slide-9
SLIDE 9

Midgard Job chains

  • Unlike many other GPUs, Midgard+ use “job

chains” instead of true command streams

  • Chains contain pointers to each job’s

dependencies

  • Essentially acts as a HW level GPU scheduler
slide-10
SLIDE 10

Midgard Job chains

  • All configuration in nested memory structures

– Shader core descriptor, fragment descriptor, etc

  • Ideally, entire frame in memory and submitted at once
  • Tiled rendering
  • Types of jobs:

– Vertex: vertex shaders – Tiler: sorts triangles into tiles, passes down to fragment shader – Fragment: final rasterization over passed in tiles

  • Hardware internals generally hidden from driver
slide-11
SLIDE 11

Bifrost

slide-12
SLIDE 12

Bifrost

  • Codename for ARM’s Mali Gxx line of embedded

GPUs

  • Latest gen, not in many devices yet
  • Shader core completely redesigned since

Midgard

  • Shares a kernel driver with Midgard
slide-13
SLIDE 13

Bifrost What’s done?

  • Much of the ISA has been reverse engineered

and documented

  • Cmdstream partially RE’d, still more work to do
  • No mesa stub yet!
slide-14
SLIDE 14

Bifrost

Basic architecture

  • Clause based
  • Scheduler chooses clauses to run, not instructions
  • Clauses contain instructions and immediates,

unpacked by GPU at runtime

  • Scheduling uses scoreboard mechanism
  • No high latency instructions
slide-15
SLIDE 15

Bifrost

Basic architecture

  • Instructions have 3 stages

– Register read/write – FMA – ADD

  • Have 2 read ports, 1 read/write, 1 write, and one const port
  • Results of FMA/ADD can be passed through to next

instruction (skips register file, less power and spilling)

slide-16
SLIDE 16

Bifrost Basic architecture

  • Has four other units:

– Varying interpolation unit – Attribute fetching unit – Load/store unit – Texture unit

  • Execution unit interacts with other units through special variable-

latency instructions

  • Only one special instruction per clause

– Bypasses fixed-latency mechanism used for registers

slide-17
SLIDE 17

Bifrost Basic architecture

  • Clause packing is intense
  • 12 different formats used for instructions in clauses,

13 in total

  • Instructions usually end up split between multiple

quadwords

  • Constants sometimes packed in instruction

quadwords

slide-18
SLIDE 18

Current Tools

  • Panloader: main repo for utilities such as

– Panwrap: provides userspace tracing/recording/replay – Midgard&Bifrost assembler – Shader runner

  • ShaderProgramDisassembler

– Midgard&Bifrost disassembler

slide-19
SLIDE 19

Links

  • https://gitlab.freedesktop.org/panfrost
  • Build instructions for T8xx:

https://panfrost.freedesktop.org/building-panfros t-mesa.html

slide-20
SLIDE 20

Demo time!