

[RFC] MDL: A Micro-Architecture Description Language for LLVM
source link: https://discourse.llvm.org/t/rfc-mdl-a-micro-architecture-description-language-for-llvm/66409/9
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

[RFC] MDL: A Micro-Architecture Description Language for LLVM
TL;DR:
We’ve created a DSL and compiler for modeling micro-architecture that handles a very broad class of architectures - CPU, GPUs, VLIWs, DSPs, ML accelerators, and embedded devices. This effort grew out of a need to quickly develop and experiment with high-quality compilers and tools to facilitate rapid architecture exploration. We named the DSL “MDL” for “Microarchitecture Description Language”.
While being significantly more expressive than TableGen’s Schedules and Itineraries used in LLVM, MDL is also more concise, and simpler to read and write while supporting a much broader class of embedded and accelerator architectures. We currently can automatically _generate _MDL descriptions for all upstream targets which are in many cases 1/10 the size of the equivalent TableGen descriptions. We’ve integrated this with LLVM, and are sending out this RFC because we believe it could be valuable to the larger LLVM community. \
The MDL compiler, associated tools, and documentation are available as open source (at GitHub - MPACT-ORG/llvm-project at work 115), and we would like to explore adding this to the LLVM project, and encourage contributions from others.
Background
Over the last few years, we have been using LLVM to develop a compiler backend for Google’s TPU machine learning accelerators. TPUs have complex microarchitectures and pose a number of challenges that are not seen in in typical LLVM targets:
- Clustered VLIW with partitioned register files.
- Extremely deep pipelines with complex hazard conditions
- Instructions with functional-unit-specific and/or cluster-specific behaviors
- Non-trivial and/or instance-specific latencies
- Complex resource usage
- Functional-unit-specific register constraints
- Shared/allocated encoding resources (instructions need 1…M of N resources)
- Explicitly managed hardware resources (register ports, internal datapaths, busses, etc)
While some of these problems manifest in a few upstream targets, this collection of problems is a superset of the problems directly addressed by LLVM - Schedules and Itineraries are simply not sufficient to model everything. Supporting this class of architecture is therefore code-intensive - it takes around 20,000 lines of C++ code to model the TPU sub-targets. This is brittle, hard to write, debug, test, and evolve over time. In contrast, the MDL description for these sub-targets is ~2,000 lines of text.
Status
- We’ve created the MDL language and compiler for describing microarchitecture details, a methodology for integrating it with TableGen files for any target, and a set of APIs that can be used in a machine-independent way to inform back-end passes such as bundle-packing, instruction scheduling, and register allocation.
- To facilitate integration with LLVM, we built a tool which scrapes architectural information from TableGen files, and produces our MDL language for all upstream targets.
- We’ve modified the CodeGen and MC libraries to (optionally) use our methodology for latency management.
There is a lot more to do. For example, we plan to enhance existing back-end scheduling passes and register allocation passes to cleanly handle a larger class of embedded and accelerator architectures, based on MDL-generated information.
We welcome feedback on the language design and associated tools and use model. You can find the MDL design documentation in our github repo in llvm/docs/Mdl.
-Reid
Recommend
-
52
weberc2/tdl master Go to file
-
67
README.md
-
78
MySQL为了保护数据字典元数据,使用了metadata lock,即MDL锁,保证在并发的情况下,结构变更的一致性。本文基于spider3.x(MySQL5.7)从代码实现角度分析了常用SQL语句的MDL加锁实现。 一. 基本概念
-
22
Inpart 2, we completed the user facing part of the compiler with semantic analysis. Now we're free to focus on the backend, generating LLVM. To do so, we'll use the
-
7
Strong GC References in LLVM[llvm-dev] RFC: Strong GC References in LLVM Sanjoy Das via llvm-dev
-
10
React Fiber Architecture Introduction React Fiber is an ongoing reimplementation of React's core algorithm. It is the culmination of over two years of research by the React team. The goal of React Fiber is to increase...
-
24
bazel_rules_hdl Hardware Description Language (Verilog, VHDL, Chisel, nMigen, etc) with open tools (Yosys, Verilator, OpenROAD, etc) rules for Bazel (https://bazel.build) Project Vision...
-
3
WSDL is short for Web Service Description Language. WSDL is used to describe the interface of a web service. If you do not know the interface of a web service, how could you call it? This WSDL tutorial is an introductio...
-
7
一步步搞懂MySQL元数据锁(MDL) 精选 原创 京东云官方 2022-09-16 11:22:05
-
2
一步步搞懂MySQL元数据锁(MDL) 某日,路上收到用...
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK