# heir

Published articles for heir.

This is one page of public article previews, not the complete archive. Follow Next page to continue. Summaries are not the original full articles.

## HEIR talk at FHE.org

DevFeed: [HEIR talk at FHE.org](<https://devfeed.tech/articles/heir-talk-at-fhe-org-40517.md>)

Original publisher: [Read original article](<https://www.jeremykun.com/shortform/2025-04-15-1239/>)

Published: 2025-04-15T19:39:13Z

Content type: release

Language: en

Sources: [Jeremy Kun](<https://devfeed.tech/sources/jeremy-kun.md>)

Topics: [Compiler](<https://devfeed.tech/topics/compiler.md>), [FHE](<https://devfeed.tech/topics/fhe.md>)

Tags: [article](<https://devfeed.tech/tags/article.md>), [compiler](<https://devfeed.tech/tags/compiler.md>), [fhe](<https://devfeed.tech/tags/fhe.md>), [heir](<https://devfeed.tech/tags/heir.md>), [shortform](<https://devfeed.tech/tags/shortform.md>)

### AI overview

The author announces that a talk about the HEIR compiler project, presented at the FHE.org conference in Sofia, Bulgaria, is now available on YouTube, with public slides. They also plan to write more about HEIR in the future.

### Source excerpt

Last month I gave a talk on the HEIR compiler project at the FHE.org conference in Sofia, Bulgaria. The video is on YouTube now, and the slides are public. I plan to write more about HEIR in the coming months, because it's been an exciting and fulfilling ride!

## Converting Between Packings in SIMD-Style FHE

DevFeed: [Converting Between Packings in SIMD-Style FHE](<https://devfeed.tech/articles/shift-networks-40486.md>)

Original publisher: [Read original article](<https://www.jeremykun.com/2024/09/02/shift-networks/>)

Published: 2024-09-02T21:01:03Z

Content type: tutorial

Language: en

Sources: [Jeremy Kun](<https://devfeed.tech/sources/jeremy-kun.md>)

Topics: [FHE](<https://devfeed.tech/topics/fhe.md>), [homomorphic encryption](<https://devfeed.tech/topics/homomorphic-encryption.md>), [data](<https://devfeed.tech/topics/data.md>), [Code](<https://devfeed.tech/topics/code.md>)

Tags: [compilers](<https://devfeed.tech/tags/compilers.md>), [encryption](<https://devfeed.tech/tags/encryption.md>), [fhe](<https://devfeed.tech/tags/fhe.md>), [github](<https://devfeed.tech/tags/github.md>), [graph-coloring](<https://devfeed.tech/tags/graph-coloring.md>), [heir](<https://devfeed.tech/tags/heir.md>), [homomorphic-encryption](<https://devfeed.tech/tags/homomorphic-encryption.md>), [mathematics](<https://devfeed.tech/tags/mathematics.md>), [optimization](<https://devfeed.tech/tags/optimization.md>), [packing](<https://devfeed.tech/tags/packing.md>), [permutation](<https://devfeed.tech/tags/permutation.md>), [programming](<https://devfeed.tech/tags/programming.md>), [rlwe](<https://devfeed.tech/tags/rlwe.md>), [simd](<https://devfeed.tech/tags/simd.md>)

### AI overview

This article explains packing in SIMD-style fully homomorphic encryption and focuses on converting between established packings. It introduces a computational model involving RLWE ciphertext vectors, elementwise operations, cyclic rotations, and differing operation costs.

### Source excerpt

In my recent overview of homomorphic encryption, I underemphasized the importance of data layout when working with arithmetic (SIMD-style) homomorphic encryption schemes. In the FHE world, the name given to data layout strategies is called "packing," because it revolves around putting multiple plaintext data into RLWE ciphertexts in carefully-chosen ways that mesh well with the operations you'd like to perform. By "mesh well" I mean it reduces the number of extra multiplications and rotations required merely to align data elements properly, rather than doing the actual computation you care about.

## MLIR -- Defining Patterns with PDLL

DevFeed: [MLIR -- Defining Patterns with PDLL](<https://devfeed.tech/articles/mlir-defining-patterns-with-pdll-40485.md>)

Original publisher: [Read original article](<https://www.jeremykun.com/2024/08/04/mlir-pdll/>)

Published: 2024-08-04T14:00:00Z

Content type: tutorial

Language: en

Sources: [Jeremy Kun](<https://devfeed.tech/sources/jeremy-kun.md>)

Topics: [LLVM](<https://devfeed.tech/topics/llvm.md>), [Tooling](<https://devfeed.tech/topics/tooling.md>)

Tags: [c-plus-plus](<https://devfeed.tech/tags/c-plus-plus.md>), [compilers](<https://devfeed.tech/tags/compilers.md>), [heir](<https://devfeed.tech/tags/heir.md>), [llvm](<https://devfeed.tech/tags/llvm.md>), [mathematics](<https://devfeed.tech/tags/mathematics.md>), [mlir](<https://devfeed.tech/tags/mlir.md>), [optimization](<https://devfeed.tech/tags/optimization.md>), [patterns](<https://devfeed.tech/tags/patterns.md>), [primer](<https://devfeed.tech/tags/primer.md>), [programming](<https://devfeed.tech/tags/programming.md>), [tablegen](<https://devfeed.tech/tags/tablegen.md>)

### AI overview

A tutorial on using PDLL to define MLIR patterns. It explains PDLL's relationship to PDL, its intended role as an alternative to TableGen pattern definitions, and how PDLL files are transformed into IR and then C++ code for compilation into a pass.

### Source excerpt

Table of Contents In this article I'll show how to use PDLL, a tool for defining MLIR patterns, which itself is built with MLIR. PDLL is intended to be a replacement for defining patterns in tablegen, though there are few public examples of its use. In fact, the main impetus for PDLL is that tablegen makes it difficult to express things like: Operations that return multiple results Operations with regions Operations with variadic operands Arithmetic on static values While not all these features are fully supported in PDLL yet, they are within scope of the language and tooling.

## MLIR -- A Global Optimization and Dataflow Analysis

DevFeed: [MLIR -- A Global Optimization and Dataflow Analysis](<https://devfeed.tech/articles/mlir-a-global-optimization-and-dataflow-analysis-40481.md>)

Original publisher: [Read original article](<https://www.jeremykun.com/2023/11/15/mlir-a-global-optimization-and-dataflow-analysis/>)

Published: 2023-11-15T11:20:52Z

Content type: article

Language: en

Sources: [Jeremy Kun](<https://devfeed.tech/sources/jeremy-kun.md>)

Topics: [Optimization](<https://devfeed.tech/topics/optimization.md>), [Code](<https://devfeed.tech/topics/code.md>), [Framework](<https://devfeed.tech/topics/framework.md>)

Tags: [analysis](<https://devfeed.tech/tags/analysis.md>), [code](<https://devfeed.tech/tags/code.md>), [compilers](<https://devfeed.tech/tags/compilers.md>), [framework](<https://devfeed.tech/tags/framework.md>), [heir](<https://devfeed.tech/tags/heir.md>), [mathematics](<https://devfeed.tech/tags/mathematics.md>), [mlir](<https://devfeed.tech/tags/mlir.md>), [optimization](<https://devfeed.tech/tags/optimization.md>), [primer](<https://devfeed.tech/tags/primer.md>), [programming](<https://devfeed.tech/tags/programming.md>), [pull-request](<https://devfeed.tech/tags/pull-request.md>)

### AI overview

This article explains how to implement a global optimization pass in MLIR for noisy integer arithmetic. It uses a dataflow analysis framework to verify the optimization and aims to keep noise within legal limits while minimizing program cost.

### Source excerpt

Table of Contents In this article we'll implement a global optimization pass, and show how to use the dataflow analysis framework to verify the results of our optimization. The code for this article is in this pull request, and as usual the commits are organized to be read in order. The noisy arithmetic problem This demonstration is based on a simplified model of computation relevant to the HEIR project. You don't need to be familiar with that project to follow this article, but if you're wondering why someone would ever want the kind of optimization I'm going to write, that project is why.

## MLIR -- Lowering through LLVM

DevFeed: [MLIR -- Lowering through LLVM](<https://devfeed.tech/articles/mlir-lowering-through-llvm-40480.md>)

Original publisher: [Read original article](<https://www.jeremykun.com/2023/11/01/mlir-lowering-through-llvm/>)

Published: 2023-11-01T07:00:00Z

Content type: tutorial

Language: en

Sources: [Jeremy Kun](<https://devfeed.tech/sources/jeremy-kun.md>)

Topics: [mlir](<https://devfeed.tech/topics/mlir.md>), [LLVM](<https://devfeed.tech/topics/llvm.md>), [x86](<https://devfeed.tech/topics/x86.md>)

Tags: [compilers](<https://devfeed.tech/tags/compilers.md>), [heir](<https://devfeed.tech/tags/heir.md>), [llvm](<https://devfeed.tech/tags/llvm.md>), [mathematics](<https://devfeed.tech/tags/mathematics.md>), [mlir](<https://devfeed.tech/tags/mlir.md>), [pipeline](<https://devfeed.tech/tags/pipeline.md>), [primer](<https://devfeed.tech/tags/primer.md>), [programming](<https://devfeed.tech/tags/programming.md>), [x86](<https://devfeed.tech/tags/x86.md>)

### AI overview

A tutorial on lowering a custom MLIR poly dialect through the LLVM dialect, exporting LLVM IR, and compiling it to x86 machine code. It explains how to construct and incrementally develop MLIR lowering pipelines.

### Source excerpt

Table of Contents In the last article we lowered our custom poly dialect to standard MLIR dialects. In this article we'll continue lowering it to LLVM IR, exporting it out of MLIR to LLVM, and then compiling to x86 machine code. The code for this article is in this pull request, and as usual the commits are organized to be read in order. Defining a Pipeline The first step in lowering to machine code is to lower to an "exit dialect.

## MLIR -- Dialect Conversion

DevFeed: [MLIR -- Dialect Conversion](<https://devfeed.tech/articles/mlir-dialect-conversion-40479.md>)

Original publisher: [Read original article](<https://www.jeremykun.com/2023/10/23/mlir-dialect-conversion/>)

Published: 2023-10-23T06:00:00Z

Content type: tutorial

Language: en

Sources: [Jeremy Kun](<https://devfeed.tech/sources/jeremy-kun.md>)

Topics: [Tutorial](<https://devfeed.tech/topics/tutorial.md>)

Tags: [article](<https://devfeed.tech/tags/article.md>), [code](<https://devfeed.tech/tags/code.md>), [heir](<https://devfeed.tech/tags/heir.md>), [mathematics](<https://devfeed.tech/tags/mathematics.md>), [mlir](<https://devfeed.tech/tags/mlir.md>), [polynomial-ring](<https://devfeed.tech/tags/polynomial-ring.md>), [polynomials](<https://devfeed.tech/tags/polynomials.md>), [primer](<https://devfeed.tech/tags/primer.md>), [programming](<https://devfeed.tech/tags/programming.md>)

### AI overview

This tutorial introduces MLIR dialect conversion and incremental lowering, explaining how a custom dialect can be lowered to standard MLIR dialects. It focuses on the type obstacle: changing value types can temporarily invalidate downstream users, requiring special handling during conversion.

### Source excerpt

Table of Contents In previous articles we defined a dialect, and wrote various passes to optimize and canonicalize a program using that dialect. However, one of the main tenets of MLIR is "incremental lowering," the idea that there are lots of levels of IR granularity, and you incrementally lower different parts of the IR, only discarding information when it's no longer useful for optimizations. In this article we'll see the first step of that: lowering the poly dialect to a combination of standard MLIR dialects, using the so-called dialect conversion infrastructure to accomplish it.

## MLIR -- Folders and Constant Propagation

DevFeed: [MLIR -- Folders and Constant Propagation](<https://devfeed.tech/articles/mlir-folders-and-constant-propagation-40474.md>)

Original publisher: [Read original article](<https://www.jeremykun.com/2023/09/11/mlir-folders/>)

Published: 2023-09-11T08:00:00Z

Content type: tutorial

Language: en

Sources: [Jeremy Kun](<https://devfeed.tech/sources/jeremy-kun.md>)

Topics: [Code](<https://devfeed.tech/topics/code.md>), [Computing](<https://devfeed.tech/topics/computing.md>), [Pull Request](<https://devfeed.tech/topics/pull-request.md>)

Tags: [article](<https://devfeed.tech/tags/article.md>), [c-plus-plus](<https://devfeed.tech/tags/c-plus-plus.md>), [canonicalization](<https://devfeed.tech/tags/canonicalization.md>), [code](<https://devfeed.tech/tags/code.md>), [compilers](<https://devfeed.tech/tags/compilers.md>), [folding](<https://devfeed.tech/tags/folding.md>), [heir](<https://devfeed.tech/tags/heir.md>), [invariant](<https://devfeed.tech/tags/invariant.md>), [mathematics](<https://devfeed.tech/tags/mathematics.md>), [mlir](<https://devfeed.tech/tags/mlir.md>), [process](<https://devfeed.tech/tags/process.md>), [programming](<https://devfeed.tech/tags/programming.md>)

### AI overview

This tutorial explains how MLIR folding supports sparse conditional constant propagation and canonicalization. It describes adding a constant operation, a materialization hook, and folders for each operation, while distinguishing local canonicalization from propagation through control flow.

### Source excerpt

Table of Contents Last time we saw how to use pre-defined MLIR traits to enable upstream MLIR passes like loop-invariant-code-motion to apply to poly programs. We left out -sccp (sparse conditional constant propagation), and so this time we'll add what is needed to make that pass work. It requires the concept of folding. The code for this article is in this pull request, and as usual the commits are organized to be read in order.

## MLIR -- Using Traits

DevFeed: [MLIR -- Using Traits](<https://devfeed.tech/articles/mlir-using-traits-40473.md>)

Original publisher: [Read original article](<https://www.jeremykun.com/2023/09/07/mlir-using-traits/>)

Published: 2023-09-07T08:00:00Z

Content type: tutorial

Language: en

Sources: [Jeremy Kun](<https://devfeed.tech/sources/jeremy-kun.md>)

Topics: [Compiler](<https://devfeed.tech/topics/compiler.md>), [toolchain](<https://devfeed.tech/topics/toolchain.md>), [optimize](<https://devfeed.tech/topics/optimize.md>), [Code](<https://devfeed.tech/topics/code.md>), [interface](<https://devfeed.tech/topics/interface.md>), [interfaces](<https://devfeed.tech/topics/interfaces.md>)

Tags: [c-plus-plus](<https://devfeed.tech/tags/c-plus-plus.md>), [compiler](<https://devfeed.tech/tags/compiler.md>), [heir](<https://devfeed.tech/tags/heir.md>), [interface](<https://devfeed.tech/tags/interface.md>), [interfaces](<https://devfeed.tech/tags/interfaces.md>), [mathematics](<https://devfeed.tech/tags/mathematics.md>), [mlir](<https://devfeed.tech/tags/mlir.md>), [optimize](<https://devfeed.tech/tags/optimize.md>), [programming](<https://devfeed.tech/tags/programming.md>), [toolchain](<https://devfeed.tech/tags/toolchain.md>)

### AI overview

This tutorial explains how to add predefined MLIR traits to operations in a polynomial-arithmetic dialect. It shows how traits and interfaces enable reuse of existing compiler passes, including loop-invariant code motion, and support operation verification and type inference.

### Source excerpt

Table of Contents Last time we defined a new dialect poly for polynomial arithmetic. This time we'll spruce up the dialect by adding some pre-defined MLIR traits, and see how the application of traits enables some general purpose passes to optimize poly programs. The code for this article is in this pull request, and as usual the commits are organized to be read in order. Traits and Loop Invariant Code Motion As a compiler toolchain, MLIR heavily emphasizes code reuse.