Skip to content

[mlir][vector] Masked loads and stores of i4 only work with create_mask masks #25203

Open

Description

@roberto-laudani

getCompressedMaskOp in VectorEmulateNarrowType.cpp only supports masks defined by vector.create_mask, vector.constant_mask or arith.constant. For any other mask, the narrow-type emulation of vector.maskedload and vector.maskedstore on i4 fails with failed to legalize operation 'vector.maskedload'. Examples are a mask passed as a function argument and a mask from arith.cmpi on a vector.step, the lowered form of vector.create_mask.

func.func @maskedload(%i: index, %j: index, %mask: vector<8xi1>, %passthru: vector<8xi4>) -> vector<8xi4> {
  %0 = memref.alloc() : memref<3x8xi4>
  %1 = vector.maskedload %0[%i, %j], %mask, %passthru : memref<3x8xi4>, vector<8xi1>, vector<8xi4> into vector<8xi4>
  return %1 : vector<8xi4>
}
mlir-opt --test-emulate-narrow-int="arith-compute-bitwidth=1 memref-load-bitwidth=8" repro.mlir

In IREE, vector.create_mask is lowered before narrow-type emulation, so i4 loops with a dynamic trip count do not compile.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions