Thanks for using Compiler Explorer
Sponsors
Jakt
C++
Ada
Analysis
Android Java
Android Kotlin
Assembly
C
C3
Carbon
C++ (Circle)
CIRCT
Clean
CMake
CMakeScript
COBOL
C++ for OpenCL
MLIR
Cppx
Cppx-Blue
Cppx-Gold
Cpp2-cppfront
Crystal
C#
CUDA C++
D
Dart
Elixir
Erlang
Fortran
F#
GLSL
Go
Haskell
HLSL
Hook
Hylo
IL
ispc
Java
Julia
Kotlin
LLVM IR
LLVM MIR
Modula-2
Nim
Objective-C
Objective-C++
OCaml
OpenCL C
Pascal
Pony
Python
Racket
Ruby
Rust
Snowball
Scala
Solidity
Spice
Swift
LLVM TableGen
Toit
TypeScript Native
V
Vala
Visual Basic
WASM
Zig
Javascript
GIMPLE
mlir source #1
Output
Compile to binary object
Link to binary
Execute the code
Intel asm syntax
Demangle identifiers
Verbose demangling
Filters
Unused labels
Library functions
Directives
Comments
Horizontal whitespace
Debug intrinsics
Compiler
MLIR opt (trunk)
MLIR opt 14.0.0
MLIR opt 14.0.5
MLIR opt 16.0.0
MLIR translate (trunk)
MLIR translate 14.0.0
MLIR translate 14.0.5
MLIR translate 16.0.0
Options
Source code
// Example code of an affine reduction. // MLIR example code may not always work out of the box because the textual MLIR format is not stable. // The example tries to be compatible with the latest MLIR version, which may not work on previous versions. func.func @affine_parallel_with_reductions_i64(%arg0: memref<3x3xi64>, %arg1: memref<3x3xi64>) -> (i64, i64) { %0:2 = affine.parallel (%kx, %ky) = (0, 0) to (2, 2) reduce ("addi", "muli") -> (i64, i64) { %1 = affine.load %arg0[%kx, %ky] : memref<3x3xi64> %2 = affine.load %arg1[%kx, %ky] : memref<3x3xi64> %3 = arith.muli %1, %2 : i64 %4 = arith.addi %1, %2 : i64 affine.yield %3, %4 : i64, i64 } return %0#0, %0#1 : i64, i64 }
Become a Patron
Sponsor on GitHub
Donate via PayPal
Source on GitHub
Mailing list
Installed libraries
Wiki
Report an issue
How it works
Contact the author
CE on Mastodon
About the author
Statistics
Changelog
Version tree