RSSAmplifier

Blog

Min Hsu's Homepage

Recent content on Min Hsu's Homepage

myhsu.xyzRSS feed ↗9 posts

Latest posts

Machine Scheduler in LLVM - Part II

In the first part of this series, we covered the basic workflow of Machine Scheduler – LLVM’s predominated instruction scheduling framework – and learned that an instruction could go through three phases of checks before it finally got scheduled: legality check, feasibility check, and profitibility check. The first two phases – which were explained in details in that post…

Machine Scheduler in LLVM - Part I

By this point it’s evidently that I won’t shut up talking about scheduling model in LLVM.1 I found the fact that it encodes so many low-level details pretty facinated. It has so much potential and could arguably be used in more places – but the latter is probably a story for another day, because there is still an elephant in the room: What about instruction scheduler, which…

Calculate Throughput with LLVM's Scheduling Model

From Cambridge Dictionary: Throughput /ˈθruː.pʊt/ (noun) an amount of work done in a particular period of time. In architecture-level performance analysis, throughput is usually measured by IPC – Instruction Per Cycle. The inverse of this property, namely, inverse or reciprocal throughput, is also commonly used to describe the performance characteristics of a sinlge instruction. It’s…

Visualize RISC-V Vector Memory Instructions

RISC-V Vector (RVV) extension has several kinds of load / store instructions which access memory in different ways. Just as the memory access pattern might take a little more time to fully understand, it gets even more tricky when multiplexing with RVV’s own concepts like variable element size (SEW), register groups (LMUL), number of elements (VL), masks and mask / tail policies. Personally…

Scheduling Model in LLVM - Part II

In the previous post, we covered the basics of scheduling model in LLVM. Specifically, per-operand tokens that connect an instruction with models that spell out processor-specific scheduling properties like instruction latency, and the concept of processor resources with different sizes of buffer. While I was planning to write how scheduling models are used in this post – namely, covering…

When LLVM scalable vector meets RISC-V

There is a nice page about how LLVM handles RISC-V Vector Extension (RVV). It primarily covers how the RISC-V backend lowers vector types and vector operations. Right at the beginning of the page lies this table: It shows the LLVM IR types we use to represent RVV’s dynamically sized vectors: each row is an element type, while each column is a LMUL – the register grouping factor, or…

Scheduling Model in LLVM - Part I

Instruction scheduling is essential to modern compilers. It tries to hide latencies and increases the throughput of a straight line code by reordering the enclosing instructions. In order to do that, compilers have to know a whole bunch of information, ranging from individual instruction’s latency to microarchitecture details. The system that describes these is called a scheduling model. In…

Legalizations in LLVM Backend

Ideally, compilers can build a program for a wide variety of hardware without the need to change a single line of its source code. While there are exceptions and corner cases, this holds in the majority of cases. Which means that if the input code uses something that is not directly available on the hardware, the compiler has to figure out a way to effectively emulate those features. This might…

Publications

Book Min-Yih Hsu. “LLVM Techniques, Tips, and Best Practices Clang and Middle-End Libraries: Design Powerful and Reliable Compilers Using the Latest Libraries and Tools from LLVM”. Packt Publishing (2021). Amazon Link. Paper and Talk Min-Yih Hsu. “Scheduling Model in LLVM: Past, Present, and Future”. LLVM Developers’ Meeting (2025). [Slides] Min-Yih Hsu. “New llvm-exegesis…