[Mlir-commits] [mlir] [mlir][spirv] Enable (de)serialization of TensorARM to/from OpConstan… (PR #151485)
Jakub Kuderski
llvmlistbot at llvm.org
Thu Jul 31 05:31:50 PDT 2025
================
@@ -69,6 +69,22 @@ static Block *getPhiIncomingBlock(Block *block) {
return block;
}
+static bool isNull(Attribute attr) {
+ if (auto floatAttr = dyn_cast<FloatAttr>(attr)) {
+ return floatAttr.getValue().isZero();
+ }
+ if (auto boolAttr = dyn_cast<BoolAttr>(attr)) {
+ return !boolAttr.getValue();
+ }
+ if (auto intAttr = dyn_cast<IntegerAttr>(attr)) {
+ return intAttr.getValue().isZero();
+ }
+ if (auto denseElemAttr = dyn_cast<DenseElementsAttr>(attr)) {
+ return all_of(denseElemAttr.getValues<Attribute>(), isNull);
----------------
kuhar wrote:
We should specialize thit for `SplatElementsAttr` to avoid a linear check over a single value.
https://github.com/llvm/llvm-project/pull/151485
More information about the Mlir-commits
mailing list