Thanks for using Compiler Explorer
C
C++
LLVM IR
Julia
MLIR
CUDA C++
Rust
CMake
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
enzyme-opt trunk (<unknown>)
hlo-translate trunk (<unknown>)
Options
Source code
// add --enzyme to the compiler options to generate the derivative // Note that MLIR can't be directly executed, so make sure you open this as a "compiler", not "executor" view func.func @ppow(%x: f64) -> f64 { %cst = arith.constant 1.000000e+00 : f64 %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %n = arith.constant 10 : index %r = scf.for %iv = %c0 to %n step %c1 iter_args(%r_it = %cst) -> f64 { %r_next = arith.mulf %r_it, %x : f64 scf.yield %r_next : f64 } return %r : f64 } func.func @dppow(%x: f64, %dr: f64) -> f64 { %r = enzyme.autodiff @ppow(%x, %dr) { activity=[#enzyme<activity enzyme_active>], ret_activity=[#enzyme<activity enzyme_activenoneed>] } : (f64, f64) -> f64 return %r : f64 }
Become a Patron
Sponsor on GitHub
Donate via PayPal
Compiler Explorer Shop
Source on GitHub
Mailing list
Installed libraries
Wiki
Report an issue
How it works
Contact the author
CE on Mastodon
CE on Bluesky
Statistics
Changelog
Version tree