Tensor of bools in MLIR TableGen

Hi Folks
I am bit new to MLIR and am trying to define in my TableGen operations that can deal with Tensors of bool type. For instance, for defining constant tensor of float type I used ‘FloatElementsAttr<32> ’ using the ‘class FloatElementsAttr’ defined in MLIR/IR/OpBase.td. I do not find BoolElementAttr so am wondering if I should just define my own sub-class of ElementsAttrBase’ to handle bool. Or is there a better way? Thanks, Javed.

A bool in mlir is usually represented as 1-bit integer. Is there something you need beyond that?


It seems as only have a bool ArrayAttr defined there, as Geoffrey mentioned you can use a I1 ElementsAttr and BoolAttr casting of elements etc will all work as it is the underlying type. Defining one as an alias also SGTM.

Thanks Geoffrey and Jacques for the replies. I think I am sorted for now.