# MLIR -- Verifiers

DevFeed: [MLIR -- Verifiers](<https://devfeed.tech/articles/mlir-verifiers-40475.md>)

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

Published: 2023-09-13T09: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>), [Code](<https://devfeed.tech/topics/code.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>), [mathematics](<https://devfeed.tech/tags/mathematics.md>), [mlir](<https://devfeed.tech/tags/mlir.md>), [operations](<https://devfeed.tech/tags/operations.md>), [pass](<https://devfeed.tech/tags/pass.md>), [primer](<https://devfeed.tech/tags/primer.md>), [programming](<https://devfeed.tech/tags/programming.md>), [pull-request](<https://devfeed.tech/tags/pull-request.md>), [safety](<https://devfeed.tech/tags/safety.md>), [types](<https://devfeed.tech/tags/types.md>)

## AI overview

This tutorial explains how to add verifiers to an MLIR dialect. Verifiers check that types and operations are well-formed before and after passes, enforcing operation invariants and allowing passes to avoid repeated edge-case checks. It also describes trait-based verification, generated type-checking and inference support, assembly-format simplification, builders, and related test updates.

## Source excerpt

Table of Contents Last time we defined folders and used them to enable some canonicalization and the sccp constant propagation pass for the poly dialect. This time we'll add some additional safety checks to the dialect in the form of verifiers. The code for this article is in this pull request, and as usual the commits are organized to be read in order. Purpose of a verifier Verifiers ensure the types and operations in a concrete MLIR program are well-formed.