[Mlir-commits] [mlir] [mlir][spirv] Add support for SPV_ARM_tensors (PR #144667)
Igor Wodiany
llvmlistbot at llvm.org
Wed Jun 18 06:46:32 PDT 2025
================
@@ -1203,11 +1236,94 @@ void MatrixType::getCapabilities(
llvm::cast<SPIRVType>(getColumnType()).getCapabilities(capabilities, storage);
}
+//===----------------------------------------------------------------------===//
+// TensorArmType
+//===----------------------------------------------------------------------===//
+
+struct spirv::detail::TensorArmTypeStorage final : TypeStorage {
+ using KeyTy = std::tuple<ArrayRef<int64_t>, Type>;
+
+ static TensorArmTypeStorage *construct(TypeStorageAllocator &allocator,
+ const KeyTy &key) {
+ auto shape = std::get<0>(key);
+ auto elementType = std::get<1>(key);
+ shape = allocator.copyInto(shape);
+ return new (allocator.allocate<TensorArmTypeStorage>())
+ TensorArmTypeStorage(std::move(shape), std::move(elementType));
+ }
+
+ static llvm::hash_code hashKey(const KeyTy &key) {
+ return llvm::hash_combine(std::get<0>(key), std::get<1>(key));
+ }
+
+ bool operator==(const KeyTy &key) const {
+ return key == KeyTy(shape, elementType);
+ }
+
+ TensorArmTypeStorage(ArrayRef<int64_t> shape, Type elementType)
+ : shape(std::move(shape)), elementType(std::move(elementType)) {}
+
+ ArrayRef<int64_t> shape;
----------------
IgWod-IMG wrote:
This looks suspicious to me. I don't think an `ArrayRef` should be a storage type, since the `ArrayRef` itself doesn't keep any data - it's only "pointer" to data. I think this should be a `SmallVector`or something similar. But please wait for someone to confirm that I’m not wrong :)
https://github.com/llvm/llvm-project/pull/144667
More information about the Mlir-commits
mailing list