[Mlir-commits] [mlir] 64bcb27 - [mlir][spirv] Make gen_spirv_dialect.py more precise when finding inst_category (#111777)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Fri Oct 11 09:35:43 PDT 2024


Author: Caio Oliveira
Date: 2024-10-11T12:35:40-04:00
New Revision: 64bcb27d97137a1fd4f2f85025d414201c67b2d2

URL: https://github.com/llvm/llvm-project/commit/64bcb27d97137a1fd4f2f85025d414201c67b2d2
DIFF: https://github.com/llvm/llvm-project/commit/64bcb27d97137a1fd4f2f85025d414201c67b2d2.diff

LOG: [mlir][spirv] Make gen_spirv_dialect.py more precise when finding inst_category (#111777)

Use a word boundary, current code was currently failing when parsing the
definition of because it would also match
`CooperativeMatrixOp` from a later mention of
`SPIRV_KHR_CooperativeMatrixOperandsAttr`.

Added: 
    

Modified: 
    mlir/utils/spirv/gen_spirv_dialect.py

Removed: 
    


################################################################################
diff  --git a/mlir/utils/spirv/gen_spirv_dialect.py b/mlir/utils/spirv/gen_spirv_dialect.py
index 6d82c012158196..2fb540ef103250 100755
--- a/mlir/utils/spirv/gen_spirv_dialect.py
+++ b/mlir/utils/spirv/gen_spirv_dialect.py
@@ -979,7 +979,8 @@ def extract_td_op_info(op_def):
     # Get instruction category
     prefix = "SPIRV_"
     inst_category = [
-        o[len(prefix) :] for o in re.findall(prefix + r"\w+Op", op_def.split(":", 1)[1])
+        o[len(prefix) :]
+        for o in re.findall(prefix + r"\w+Op\b", op_def.split(":", 1)[1])
     ]
     assert len(inst_category) <= 1, "more than one ops in the same section!"
     inst_category = inst_category[0] if len(inst_category) == 1 else "Op"


        


More information about the Mlir-commits mailing list