Skip to content

Register memref, linalg dialects#2844

Open
brian-kelley wants to merge 1 commit into
EnzymeAD:mainfrom
brian-kelley:RegisterDialects
Open

Register memref, linalg dialects#2844
brian-kelley wants to merge 1 commit into
EnzymeAD:mainfrom
brian-kelley:RegisterDialects

Conversation

@brian-kelley
Copy link
Copy Markdown

Register memref and linalg dialects eagerly in enzyme and enzyme-wrap passes.
The following is an example where this is needed (Enzyme explorer version).

module {
  func.func @memref_example(%arg0: f64) -> f64 attributes {llvm.linkage = #llvm.linkage<external>} {
    %c0 = arith.constant 0 : index
    %alloc = memref.alloc() : memref<10xf64>
    memref.store %arg0, %alloc[%c0] : memref<10xf64>
    %1 = memref.load %alloc[%c0] : memref<10xf64>
    return %1 : f64
  }
}

Command:

enzymemlir-opt "--enzyme-wrap=infn=memref_example outfn=grad_memref_example retTys=enzyme_active argTys=enzyme_dup mode=ReverseModeCombined"

Output with main branch:

<unknown>:0: error: 'linalg.yield' op created with unregistered dialect. If this is intended, please call allowUnregisteredDialects() on the MLIRContext, or use -allow-unregistered-dialect with the MLIR opt tool used
<unknown>:0: note: see current operation: "linalg.yield"(%arg3) : (f64) -> ()
Compiler returned: 1

With the changes in this PR enzyme-wrap succeeds.

in enzyme, enzyme-wrap passes

Signed-off-by: Brian Kelley <bmkelle@sandia.gov>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant