[Mlir-commits] [mlir] [mlir][Tosa] fix fp16/bf16 support for Clamp min/max attributes (PR #69192)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Wed Oct 18 00:58:41 PDT 2023


fabrizio-indirli wrote:

Thank you both for the reviews!
My understanding is that the storage class `mlir::FloatAttr ` accepts also Bf16, but in MLIR the restricted attribute `FloatAttrBase`  pre-defined in _CommonAttrConstraints.td_ (and used, for example, to define F32Attr etc.) does not support Bf16.
Thus we need to define our own attribute type. 
We can create a generic Float attribute if we want, though for now Tosa accepts only Fp16/Bf16/Fp32. We could do this:
- In the TOSA dialect (e.g. calling it Tosa_FloatAttr), as done here
- In _mlir/IR/CommonAttrConstrainst.td_, so that potentially other dialects could use this. However this may require other approvals as we would be modifying the generic IR? Moreover something similar already seems to exist with Builtin_FloatAttr, although I was not able to use it here.

Any thoughts on which solution would be better?

https://github.com/llvm/llvm-project/pull/69192


More information about the Mlir-commits mailing list