llvm / llvm/Polygeist

MemRef type in interface

Open
#45 3 comments 0 reactions 1 assignee View on GitHub

@wsmoses is already working on this.

Since Apr 22, 2021.

enhancement
Dominant language
C++
Stars
624
Forks
170
PR merge metrics
No merged PRs in 30d

Description

It is a follow-up to #44, and maybe I've asked about this earlier: could we generate function interface that has MemRef types with explicit dimensionality? For example, take the code from #44:

module attributes {llvm.data_layout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128", llvm.target_triple = "x86_64-unknown-linux-gnu"}  {
  func @matmul(%arg0: memref<?x400xf32>, %arg1: memref<?x300xf32>, %arg2: memref<?x300xf32>) {
    affine.for %arg3 = 0 to 200 {
      affine.for %arg4 = 0 to 300 {
        affine.for %arg5 = 0 to 400 {
          %0 = affine.load %arg0[%arg3, %arg5] : memref<?x400xf32>
          %1 = affine.load %arg1[%arg5, %arg4] : memref<?x300xf32>
          %2 = mulf %0, %1 : f32
          %3 = affine.load %arg2[%arg3, %arg4] : memref<?x300xf32>
          %4 = addf %3, %2 : f32
          affine.store %4, %arg2[%arg3, %arg4] : memref<?x300xf32>
        }
      }
    }
    return
  }
}

How could we make the interface of @matmul to be:

func @matmul(%arg0: memref<200x400xf32>, %arg1: memref<400x300xf32>, %arg2: memref<200x300xf32>)

Thanks!

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.