Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve Vector->AIEVec lowering strategy for arith.addi/addf/muli/mulf #585

Open
jamestcl-amd opened this issue Aug 17, 2023 · 0 comments
Open
Assignees
Labels
triaged This has been looked at and triaged

Comments

@jamestcl-amd
Copy link
Contributor

  • For input example (after vector canonicalization) like below, the arith.mulf and arith.addf will not be converted to aievec.mul_elem and aievec.add_elem. This is due to the FMA/Conv check that specifically leave these operations unconverted for the aievec.conv op lowering.
module {
  func.func @func1(%arg0: memref<1024xbf16>, %arg1: memref<1xbf16>, %arg2: memref<1024xbf16>) {
    %cst = arith.constant dense<0.000000e+00> : vector<16xbf16>
    %cst_0 = arith.constant 0.000000e+00 : bf16
    affine.for %arg3 = 0 to 1024 step 16 {
      %0 = vector.transfer_read %arg0[%arg3], %cst_0 {in_bounds = [true]} : memref<1024xbf16>, vector<16xbf16>
      %1 = vector.transfer_read %arg1[%arg3], %cst_0 : memref<1xbf16>, vector<16xbf16>
      %2 = vector.extract %1[0] : vector<16xbf16>
      %3 = vector.broadcast %2 : bf16 to vector<16xbf16>
      %4 = arith.minf %0, %cst : vector<16xbf16>
      %5 = arith.mulf %3, %4 : vector<16xbf16>
      %6 = arith.maxf %0, %cst : vector<16xbf16>
      %7 = arith.addf %6, %5 : vector<16xbf16>
      vector.transfer_write %7, %arg2[%arg3] {in_bounds = [true]} : vector<16xbf16>, memref<1024xbf16>
    }
    return
  }
}
@jsetoain jsetoain self-assigned this Aug 17, 2023
@makslevental makslevental self-assigned this Dec 20, 2023
@makslevental makslevental added the triaged This has been looked at and triaged label Dec 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triaged This has been looked at and triaged
Projects
None yet
Development

No branches or pull requests

3 participants