[Mlir-commits] [mlir] [TOSA] Add StatefulOps to TOSA Dialect (PR	#66843)
    Tai Ly 
    llvmlistbot at llvm.org
       
    Fri Sep 22 09:15:22 PDT 2023
    
    
  
================
@@ -427,6 +437,83 @@ LogicalResult TosaValidation::applyLevelCheck(Operation *op) {
   return success();
 }
 
+inline bool CompatibleTypes(const mlir::Type &type,
+                            const mlir::Type &declared_type) {
+  // for now, simply use type equality comparison
+  return type == declared_type;
+}
+
+bool TosaValidation::CheckVariable(Operation *op) {
+  if (isa<mlir::tosa::VariableOp>(op)) {
+    auto name_attr = dyn_cast<mlir::StringAttr>(op->getAttr("name"));
+    if (!name_attr) {
+      op->emitOpError() << "Name attribute is not StringAttr";
+      return false;
+    }
+    std::string name = name_attr.getValue().str();
+
+    if (variables_map.count(name)) {
+      op->emitOpError() << "name has already been declared";
+      return false;
+    }
+
+    auto type_attr = dyn_cast<mlir::TypeAttr>(op->getAttr("type"));
+    if (!type_attr) {
+      op->emitOpError() << "type attribute is not TypeAttr";
+      return false;
+    }
----------------
Tai78641 wrote:
removed
https://github.com/llvm/llvm-project/pull/66843
    
    
More information about the Mlir-commits
mailing list