[PATCH] D72478: [mlir] Use getDenseElementBitwidth instead of Type::getElementTypeBitWidth.
River Riddle via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 9 14:56:29 PST 2020
This revision was automatically updated to reflect the committed changes.
Closed by commit rG68c8b6c4cd11: [mlir] Use getDenseElementBitwidth instead of Type::getElementTypeBitWidth. (authored by rriddle).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D72478/new/
https://reviews.llvm.org/D72478
Files:
mlir/lib/IR/Attributes.cpp
mlir/unittests/IR/AttributeTest.cpp
Index: mlir/unittests/IR/AttributeTest.cpp
===================================================================
--- mlir/unittests/IR/AttributeTest.cpp
+++ mlir/unittests/IR/AttributeTest.cpp
@@ -135,4 +135,14 @@
testSplat(floatTy, value);
}
+
+TEST(DenseSplatTest, BF16Splat) {
+ MLIRContext context;
+ FloatType floatTy = FloatType::getBF16(&context);
+ // Note: We currently use double to represent bfloat16.
+ double value = 10.0;
+
+ testSplat(floatTy, value);
+}
+
} // end namespace
Index: mlir/lib/IR/Attributes.cpp
===================================================================
--- mlir/lib/IR/Attributes.cpp
+++ mlir/lib/IR/Attributes.cpp
@@ -676,7 +676,8 @@
static bool isValidIntOrFloat(ShapedType type, int64_t dataEltSize,
bool isInt) {
// Make sure that the data element size is the same as the type element width.
- if ((dataEltSize * CHAR_BIT) != type.getElementTypeBitWidth())
+ if (getDenseElementBitwidth(type.getElementType()) !=
+ static_cast<size_t>(dataEltSize * CHAR_BIT))
return false;
// Check that the element type is valid.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D72478.237214.patch
Type: text/x-patch
Size: 1121 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200109/ef77a021/attachment.bin>
More information about the llvm-commits
mailing list