Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Mesa (computer graphics)
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
=== Mesa's Intermediate Representations === One goal of Mesa is the optimization of code that is to be executed by the respective GPU. Another is the sharing of code. Instead of documenting the pieces of software, this article shall instead look at the Intermediate Representations used in the process of compiling and optimizing. See [[Abstract syntax tree]] (AST) and [[Static single assignment form]] (SSA form). ==== SPIR-V ==== SPIR-V is a certain version of the [[Standard Portable Intermediate Representation]]. The idea is, that graphics applications output SPIR-V instead of GLSL. In contrast to the latter, SPIR-V is binary to avoid implementation differences between GLSL compiler frontends of different driver implementations, as this has been a major source of application incompatibilities and bugs. Also SPIR-V binary usually also passed through some general optimizations. SPIR-V's binary representation also offers some degree of obfuscation, which might appeal to some software vendors as a form of intellectual property protection; however, SPIR-V contains ample information for reflection and [https://github.com/KhronosGroup/SPIRV-Cross tools exist that translate SPIR-V back into high quality, human readable high level code]. A UMD needs only apply optimizations, that are specific to the supported hardware. * [https://www.khronos.org/registry/spir-v/specs/1.0/SPIRV.html SPIR-V Specification (Provisional)] ==== GLSL IR ==== * [https://cgit.freedesktop.org/mesa/mesa/tree/src/compiler/glsl/README cgit.freedesktop.org/mesa/mesa/tree/src/compiler/glsl/README] * XDC2014, Matt Turner: {{YouTube|3C96NJeYAy4}}, [http://www.x.org/wiki/Events/XDC2014/XDC2014TurnerGLSL/ Matt Turner - GLSL compiler: Where we've been and where we're going] * XDC2015, Matt Turner: {{YouTube|Lxhrnudsrts}}, {{URL|http://www.x.org/wiki/Events/XDC2015/Program/turner_glsl_compiler.pdf}} ==== Mesa IR ==== ==== NIR ==== NIR (New Internal Representation) was introduced to overcome TGSI limitations.<ref>{{Cite web|url=https://people.freedesktop.org/~cwabbott0/nir-docs/intro.html|title = Introduction β NIR 0.0.1 documentation}}</ref><ref>{{Cite web|url=http://www.jlekstrand.net/jason/projects/mesa/nir-notes/|title = NIR: A new compiler IR for Mesa}}</ref> NIR was extended in last and actual releases as base of Spir-V support and is since 2016 main development area. LLVMpipe, i965, RadeonSI, Nouveau, freedreno, vc4 are changed to NIR from TGSI. RADV, Zink and other new drivers starts with NIR. All drivers with full OpenGL 4.6 support are related to NIR by SPIR-V support. Also AMD r600 has a fork with NIR for better support of HD5000 and HD6000 series. This option for r600 is default since Mesa 21.0. * [http://www.x.org/wiki/Events/XDC2014/XDC2014AbbotNIR/ Connor Abbott - NIR, or moving beyond GLSL IR in Mesa] XDC2014 ** [https://lists.freedesktop.org/archives/mesa-dev/2014-December/072761.html (Mesa-dev) 2014-12-15 Reintroducing NIR, a new IR for mesa] * [https://cgit.freedesktop.org/mesa/mesa/tree/src/compiler/nir/README cgit.freedesktop.org/mesa/mesa/tree/src/compiler/nir/README] * [https://fosdem.org/2016/schedule/event/i965_nir/attachments/slides/1113/export/events/attachments/i965_nir/slides/1113/nir_vec4_i965_fosdem_2016_rc1.pdf fosdem.org/2016/schedule/event/i965_nir/attachments/slides/1113/export/events/attachments/i965_nir/slides/1113/nir_vec4_i965_fosdem_2016_rc1.pdf] * [https://archive.fosdem.org/2018/schedule/event/radeonsi/attachments/slides/2253/export/events/attachments/radeonsi/slides/2253/fosdem2018_shaders.pdf NIR in RadeonSI] * [https://archive.fosdem.org/2018/schedule/event/nouveau/attachments/slides/2280/export/events/attachments/nouveau/slides/2280/nouveau.pdf Nouveau update 2018] *[https://archive.fosdem.org/2020/schedule/event/nouveau/attachments/slides/3884/export/events/attachments/nouveau/slides/3884/slides.pdf Nouveau with NIR in Mesa 19.3] ==== TGSI ==== {{Main|Tungsten Graphics Shader Infrastructure}} The Tungsten Graphics Shader Infrastructure (TGSI) was introduced in 2008 by Tungsten Graphics. All Gallium3D-style UMDs ingest TGSI. NIR is now Main development area, so TGSI is only for older driver like r300g default infrastructure and will be deprecated in some years. GLSL-To-TGSI code will be deleted in Mesa 22.2. Default is newer NIR-to-TGSI with GLSL-to-NIR for all native NIR drivers. Some older TGSI drivers are supported with this NIR Code path. Later NIR-To-TGSI will be deprecated for native NIR drivers only.<ref>{{cite web | url=https://www.phoronix.com/scan.php?page=news_item&px=Mesa-Stripping-GLSL-To-TGSI | title=Mesa Prepares to Drop Old GLSL-To-TGSI - Big Code Removal, Win for Performance & Fixes }}</ref> ==== LLVM IR ==== {{Main|LLVM Intermediate Representation}} The UMDs <code>radeonsi</code> and <code>llvmpipe</code> do not output machine code, but instead LLVM IR. From here on, LLVM does optimizations and the compilation to machine code. This does mean, that a certain minimum version of LLVM has to be installed as well. ==== RADV ACO IR ==== RADV ACO uses own IR that is close to NIR, for optimizing and generating end binary code for Vulkan SPIR-V shaders on top of Radeon GPUs (GCN 1+, aka GFX6+) GPUs. As of version 20.1.0 the ACO is only used in RADV (Vulkan driver) and not in RadeonSI yet.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)