<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/55984>55984</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Pass timing does not track properly thread ID
</td>
</tr>
<tr>
<th>Labels</th>
<td>
mlir:core
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
joker-eph
</td>
</tr>
</table>
<pre>
This simple patch should have no effect:
```
diff --git a/mlir/lib/IR/Verifier.cpp b/mlir/lib/IR/Verifier.cpp
index 96364bd81b9f..ca400ecf864d 100644
--- a/mlir/lib/IR/Verifier.cpp
+++ b/mlir/lib/IR/Verifier.cpp
@@ -74,6 +74,9 @@ private:
LogicalResult OperationVerifier::verifyOpAndDominance(Operation &op) {
// Verify the operation first, collecting any IsolatedFromAbove operations.
+ if (op.getContext()->isMultithreadingEnabled()) {
+ llvm::ThreadPoolTaskGroup tasksGroup(op.getContext()->getThreadPool());
+ }
if (failed(verifyOperation(op)))
return failure();
```
However this is enough to confuse our thread tracking for the pass timing:
```
Command Output (stderr):
--
mlir/test/Pass/pass-timing.mlir:45:22: error: MT_PIPELINE-NEXT: is not on the line after the previous match
// MT_PIPELINE-NEXT: CSE
^
<stdin>:13:32: note: 'next' match was here
0.0006 ( 7.7%) 0.0006 ( 9.5%) CSE
^
<stdin>:11:47: note: previous match ended here
0.0014 ( 17.8%) 0.0010 ( 15.9%) Canonicalizer
^
<stdin>:12:1: note: non-matching line after previous match is here
0.0007 ( 9.8%) 0.0007 ( 10.8%) 'func.func' Pipeline
^
Input file: <stdin>
Check file: mlir/test/Pass/pass-timing.mlir
-dump-input=help explains the following input dump.
Input was:
<<<<<<
.
.
.
8: 0.0016 ( 20.4%) 0.0011 ( 18.3%) 'func.func' Pipeline
9: 0.0001 ( 1.8%) 0.0001 ( 1.9%) CSE
10: 0.0000 ( 0.2%) 0.0000 ( 0.2%) (A) DominanceInfo
11: 0.0014 ( 17.8%) 0.0010 ( 15.9%) Canonicalizer
12: 0.0007 ( 9.8%) 0.0007 ( 10.8%) 'func.func' Pipeline
13: 0.0006 ( 7.7%) 0.0006 ( 9.5%) CSE
next:45 !~~ error: match on wrong line
14: 0.0000 ( 0.2%) 0.0000 ( 0.2%) (A) DominanceInfo
15: 0.0001 ( 0.9%) 0.0000 ( 0.6%) Canonicalizer
16: 0.0000 ( 0.2%) 0.0000 ( 0.1%) CSE
17: 0.0000 ( 0.0%) 0.0000 ( 0.0%) (A) DominanceInfo
18: 0.0000 ( 0.2%) 0.0000 ( 0.1%) CSE
.
.
.
>>>>>>
```
The `NestedMatcher` is also broken right now by this:
```
mlir-opt: mlir/include/mlir/Dialect/Affine/Analysis/NestedMatcher.h:162: mlir::NestedPatternContext::NestedPatternContext(): Assertion `NestedMatch::allocator() == nullptr && "Only a single NestedPatternContext is supported"' failed.
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy1V1tv2zYU_jXyCyGBulnygx_c2NkMNI3RBsPeBkqiLDY0KZBUUu_X75CSbVlNF3fFDIKUefnOx3PTUSGr4_KpYRppdmg5RS0xZYN0IzteoYa8UCQkonVNS-PFKw-vPTz0yJvjobn_Fatr5Pt7ZhDxovsDZwoGzgrot5-h-4MqVjOqgrJtUfHulh6ViYp-Q4t5PE-KKg-LRR0EJUkwpmWdz5MKhRjPk6Tf7Pv-DbKHS0Qf-nYzFS_B0JCfJV50N0dw1D0t0LDQKvZCDD2rCQ3DR7lnJeGfqe64QY8tVcQwKU4C7P549WL_HR_blajW8sAEESX1ovy8G8TNZetFIC37MAAjmLyHhhzUEZmGInk-UDOlDfBDpeQczMfEHhFxRFstOdCs7pU8rAr5Mjqjg7NuEGI1wOeyDfbU3Elh6DdAy4GB78Ubph_gMsw0ipIKkDeCFJxW_YYrlg4LIc5fDv1Nn9yZnZT8iejn35TsWmTgSbvHH4uEucvRsyAvHsvxsvVZNz3_mrCe10nBw1WdnAEC2ukQQoqaToH24Fyn6CDnJG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