<feed xmlns='http://www.w3.org/2005/Atom'>
<title>llvm-project.git/llvm/lib/CodeGen/ScheduleDAG.cpp, branch users/aaupov/spr/main.boltnfci-simplify-dataaggregator-using-traces-1</title>
<subtitle>Unnamed repository; edit this file 'description' to name the repository.
</subtitle>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/'/>
<entry>
<title>MachineScheduler: Improve instruction clustering (#137784)</title>
<updated>2025-06-05T07:28:04+00:00</updated>
<author>
<name>Ruiling, Song</name>
<email>ruiling.song@amd.com</email>
</author>
<published>2025-06-05T07:28:04+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=0487db1f130913d4fad18483e305b843636ec4ce'/>
<id>0487db1f130913d4fad18483e305b843636ec4ce</id>
<content type='text'>
The existing way of managing clustered nodes was done through adding
weak edges between the neighbouring cluster nodes, which is a sort of
ordered queue. And this will be later recorded as `NextClusterPred` or
`NextClusterSucc` in `ScheduleDAGMI`.

But actually the instruction may be picked not in the exact order of the
queue. For example, we have a queue of cluster nodes A B C. But during
scheduling, node B might be picked first, then it will be very likely
that we only cluster B and C for Top-Down scheduling (leaving A alone).

Another issue is:
```
   if (!ReorderWhileClustering &amp;&amp; SUa-&gt;NodeNum &gt; SUb-&gt;NodeNum)
      std::swap(SUa, SUb);
   if (!DAG-&gt;addEdge(SUb, SDep(SUa, SDep::Cluster)))
```
may break the cluster queue.

For example, we want to cluster nodes (order as in `MemOpRecords`): 1 3
2. 1(SUa) will be pred of 3(SUb) normally. But when it comes to (3, 2),
As 3(SUa) &gt; 2(SUb), we would reorder the two nodes, which makes 2 be
pred of 3. This makes both 1 and 2 become preds of 3, but there is no
edge between 1 and 2. Thus we get a broken cluster chain.

To fix both issues, we introduce an unordered set in the change. This
could help improve clustering in some hard case.

One key reason the change causes so many test check changes is: As the
cluster candidates are not ordered now, the candidates might be picked
in different order from before.

The most affected targets are: AMDGPU, AArch64, RISCV.

For RISCV, it seems to me most are just minor instruction reorder, don't
see obvious regression.

For AArch64, there were some combining of ldr into ldp being affected.
With two cases being regressed and two being improved. This has more
deeper reason that machine scheduler cannot cluster them well both
before and after the change, and the load combine algorithm later is
also not smart enough.

For AMDGPU, some cases have more v_dual instructions used while some are
regressed. It seems less critical. Seems like test `v_vselect_v32bf16`
gets more buffer_load being claused.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The existing way of managing clustered nodes was done through adding
weak edges between the neighbouring cluster nodes, which is a sort of
ordered queue. And this will be later recorded as `NextClusterPred` or
`NextClusterSucc` in `ScheduleDAGMI`.

But actually the instruction may be picked not in the exact order of the
queue. For example, we have a queue of cluster nodes A B C. But during
scheduling, node B might be picked first, then it will be very likely
that we only cluster B and C for Top-Down scheduling (leaving A alone).

Another issue is:
```
   if (!ReorderWhileClustering &amp;&amp; SUa-&gt;NodeNum &gt; SUb-&gt;NodeNum)
      std::swap(SUa, SUb);
   if (!DAG-&gt;addEdge(SUb, SDep(SUa, SDep::Cluster)))
```
may break the cluster queue.

For example, we want to cluster nodes (order as in `MemOpRecords`): 1 3
2. 1(SUa) will be pred of 3(SUb) normally. But when it comes to (3, 2),
As 3(SUa) &gt; 2(SUb), we would reorder the two nodes, which makes 2 be
pred of 3. This makes both 1 and 2 become preds of 3, but there is no
edge between 1 and 2. Thus we get a broken cluster chain.

To fix both issues, we introduce an unordered set in the change. This
could help improve clustering in some hard case.

One key reason the change causes so many test check changes is: As the
cluster candidates are not ordered now, the candidates might be picked
in different order from before.

The most affected targets are: AMDGPU, AArch64, RISCV.

For RISCV, it seems to me most are just minor instruction reorder, don't
see obvious regression.

For AArch64, there were some combining of ldr into ldp being affected.
With two cases being regressed and two being improved. This has more
deeper reason that machine scheduler cannot cluster them well both
before and after the change, and the load combine algorithm later is
also not smart enough.

For AMDGPU, some cases have more v_dual instructions used while some are
regressed. It seems less critical. Seems like test `v_vselect_v32bf16`
gets more buffer_load being claused.</pre>
</div>
</content>
</entry>
<entry>
<title>[ScheduleDAG] Dirty height/depth in addPred/removePred even for latency zero (#102915)</title>
<updated>2024-08-20T11:38:18+00:00</updated>
<author>
<name>Björn Pettersson</name>
<email>bjorn.a.pettersson@ericsson.com</email>
</author>
<published>2024-08-20T11:38:18+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=f321456e1aaff050a44698f1273da9589e74ebb4'/>
<id>f321456e1aaff050a44698f1273da9589e74ebb4</id>
<content type='text'>
A long time ago (back in 2009) there was a commit 52d4d8244b7c39c5cd
that changed the scheduler to not dirty height/depth when adding or
removing SUnit predecessors when the latency on the edge was zero. That
commit message is claiming that the depth or height isn't affected when
the latency is zero.

As a matter of fact, the depth/height can change even with a zero
latency on the edge. If for example adding a new SUnit A, with zero
latency, but as a predecessor to a SUnit B, then both height of A and
depth of B should be marked as dirty. If for example B has a greater
height than A, then the height of A needs to be adjusted even if the
latency is zero.

I think this has been wrong for many years. Downstream we have had
commit 52d4d8244b7c39c5cd reverted since back in 2016. There is no
motivating lit test for 52d4d8244b7c39c5cd (only an incomplete C level
reproducer in https://github.com/llvm/llvm-project/issues/3613).

After commit 13d04fa560e156797c21f1 there finally appeared an upstream
lit test that shows that we get better code if marking height/depth as
dirty (llvm/test/CodeGen/AArch64/abds.ll).</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
A long time ago (back in 2009) there was a commit 52d4d8244b7c39c5cd
that changed the scheduler to not dirty height/depth when adding or
removing SUnit predecessors when the latency on the edge was zero. That
commit message is claiming that the depth or height isn't affected when
the latency is zero.

As a matter of fact, the depth/height can change even with a zero
latency on the edge. If for example adding a new SUnit A, with zero
latency, but as a predecessor to a SUnit B, then both height of A and
depth of B should be marked as dirty. If for example B has a greater
height than A, then the height of A needs to be adjusted even if the
latency is zero.

I think this has been wrong for many years. Downstream we have had
commit 52d4d8244b7c39c5cd reverted since back in 2016. There is no
motivating lit test for 52d4d8244b7c39c5cd (only an incomplete C level
reproducer in https://github.com/llvm/llvm-project/issues/3613).

After commit 13d04fa560e156797c21f1 there finally appeared an upstream
lit test that shows that we get better code if marking height/depth as
dirty (llvm/test/CodeGen/AArch64/abds.ll).</pre>
</div>
</content>
</entry>
<entry>
<title>[llvm][ScheduleDAG] SUnit::biasCriticalPath() does not find the critical path consistently (#93001)</title>
<updated>2024-05-23T09:27:07+00:00</updated>
<author>
<name>csstormq</name>
<email>swust_xiaoqiangxu@163.com</email>
</author>
<published>2024-05-23T09:27:07+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=8a3537bfefa295e12ddbdb59cb8f76281ce302a0'/>
<id>8a3537bfefa295e12ddbdb59cb8f76281ce302a0</id>
<content type='text'>
Patch co-authored by AtariDreams (gfunni234@gmail.com).

Fixes #38037.

[AMDGPU] Update test results to fix build (#92982)</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Patch co-authored by AtariDreams (gfunni234@gmail.com).

Fixes #38037.

[AMDGPU] Update test results to fix build (#92982)</pre>
</div>
</content>
</entry>
<entry>
<title>Revert "[llvm][ScheduleDAG] SUnit::biasCriticalPath() does not find the critical path consistently (#92368)" (#92992)</title>
<updated>2024-05-22T05:16:03+00:00</updated>
<author>
<name>csstormq</name>
<email>swust_xiaoqiangxu@163.com</email>
</author>
<published>2024-05-22T05:16:03+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=7370b109b44a187e55d032d9628e41a7b94c3914'/>
<id>7370b109b44a187e55d032d9628e41a7b94c3914</id>
<content type='text'>
This reverts commit f0d1ae83b046ff0eeffc72a103f7c8b01ad33787.

This commit breaks tests: http://45.33.8.238/linux/138572/step_11.txt</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This reverts commit f0d1ae83b046ff0eeffc72a103f7c8b01ad33787.

This commit breaks tests: http://45.33.8.238/linux/138572/step_11.txt</pre>
</div>
</content>
</entry>
<entry>
<title>[llvm][ScheduleDAG] SUnit::biasCriticalPath() does not find the critical path consistently (#92368)</title>
<updated>2024-05-22T01:23:00+00:00</updated>
<author>
<name>csstormq</name>
<email>swust_xiaoqiangxu@163.com</email>
</author>
<published>2024-05-22T01:23:00+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=f0d1ae83b046ff0eeffc72a103f7c8b01ad33787'/>
<id>f0d1ae83b046ff0eeffc72a103f7c8b01ad33787</id>
<content type='text'>

Fix https://github.com/llvm/llvm-project/issues/38037</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>

Fix https://github.com/llvm/llvm-project/issues/38037</pre>
</div>
</content>
</entry>
<entry>
<title>[llvm] Stop including llvm/ADT/iterator_range.h (NFC)</title>
<updated>2023-10-22T22:41:18+00:00</updated>
<author>
<name>Kazu Hirata</name>
<email>kazu@google.com</email>
</author>
<published>2023-10-22T22:41:18+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=9c5a5a421d40399b4aee5d26fb0266f8261333ce'/>
<id>9c5a5a421d40399b4aee5d26fb0266f8261333ce</id>
<content type='text'>
Identified with misc-include-cleaner.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Identified with misc-include-cleaner.
</pre>
</div>
</content>
</entry>
<entry>
<title>[ScheduleDAG] Fix false assert target</title>
<updated>2023-09-27T08:30:16+00:00</updated>
<author>
<name>lennyxiao</name>
<email>lennyxiao@tencent.com</email>
</author>
<published>2023-09-27T03:43:29+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=13c603a41f13c2985e9cae43c6edbb96b3b2e42c'/>
<id>13c603a41f13c2985e9cae43c6edbb96b3b2e42c</id>
<content type='text'>
In SUnit::removePred, N-&gt;WeakSuccsLeft is reduced but WeakSuccsLeft is checked.

Reviewed By: kerbowa

Differential Revision: https://reviews.llvm.org/D151311
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
In SUnit::removePred, N-&gt;WeakSuccsLeft is reduced but WeakSuccsLeft is checked.

Reviewed By: kerbowa

Differential Revision: https://reviews.llvm.org/D151311
</pre>
</div>
</content>
</entry>
<entry>
<title>Reapply [Coverity] Fix explicit null dereferences</title>
<updated>2023-05-08T13:19:40+00:00</updated>
<author>
<name>Akshay Khadse</name>
<email>akshayskhadse@gmail.com</email>
</author>
<published>2023-05-08T13:17:51+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=5c7c3af1d022bfe69c2bf48761f7054206963023'/>
<id>5c7c3af1d022bfe69c2bf48761f7054206963023</id>
<content type='text'>
This change fixes static code analysis errors

Reviewed By: skan

Differential Revision: https://reviews.llvm.org/D149506
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This change fixes static code analysis errors

Reviewed By: skan

Differential Revision: https://reviews.llvm.org/D149506
</pre>
</div>
</content>
</entry>
<entry>
<title>Revert "[Coverity] Fix explicit null dereferences"</title>
<updated>2023-04-24T10:14:10+00:00</updated>
<author>
<name>Tom Weaver</name>
<email>Tom.Weaver@Sony.com</email>
</author>
<published>2023-04-24T10:14:10+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=b63c08c773a817be3600e8d76ac38d290eca8a69'/>
<id>b63c08c773a817be3600e8d76ac38d290eca8a69</id>
<content type='text'>
This reverts commit 22b23a5213b57ce1834f5b50fbbf8a50297efc8a.

This commit caused the following two build bots to start failing:
https://lab.llvm.org/buildbot/#/builders/216/builds/20322
https://lab.llvm.org/buildbot/#/builders/123/builds/18511
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This reverts commit 22b23a5213b57ce1834f5b50fbbf8a50297efc8a.

This commit caused the following two build bots to start failing:
https://lab.llvm.org/buildbot/#/builders/216/builds/20322
https://lab.llvm.org/buildbot/#/builders/123/builds/18511
</pre>
</div>
</content>
</entry>
<entry>
<title>[Coverity] Fix explicit null dereferences</title>
<updated>2023-04-23T04:07:11+00:00</updated>
<author>
<name>Akshay Khadse</name>
<email>akshayskhadse@gmail.com</email>
</author>
<published>2023-04-23T04:06:54+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=22b23a5213b57ce1834f5b50fbbf8a50297efc8a'/>
<id>22b23a5213b57ce1834f5b50fbbf8a50297efc8a</id>
<content type='text'>
This change fixes static code analysis errors

Reviewed By: skan

Differential Revision: https://reviews.llvm.org/D148912
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This change fixes static code analysis errors

Reviewed By: skan

Differential Revision: https://reviews.llvm.org/D148912
</pre>
</div>
</content>
</entry>
</feed>
