Skip to content

[mlir][vector] Narrow-type-emulation - incorrect result #131528

Open
@banach-space

Description

@banach-space

Hi,

I was experimenting with the narrow type emulation and noticed that this "unaligned" example:

func.func @experiment(%arg0: vector<4xi2>) {
    %src = memref.alloc() : memref<3x4xi2>
    %c0 = arith.constant 0 : index
    %c1 = arith.constant 1 : index
    vector.store %arg0, %src[%c0, %c1] : memref<3x4xi2>, vector<4xi2>
    return
}

is incorrectly rewritten as (note that the final index is %c0):

$ bin/mlir-opt --test-emulate-narrow-int="arith-compute-bitwidth=1 memref-load-bitwidth=8" file.mlir
  func.func @experiment(%arg0: vector<4xi2>) {
    %alloc = memref.alloc() : memref<3xi8>
    %0 = vector.bitcast %arg0 : vector<4xi2> to vector<1xi8>
    %c0 = arith.constant 0 : index
    vector.store %0, %alloc[%c0] : memref<3xi8>, vector<1xi8>
    return
  }

I think I know what needs updating, so will try to fix it whenever I get a chance. Unless there are volunteers in the meantime 😅

CC @lialan

-Andrzej

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions