Re: [PATCH v4 1/3] drm/sched: Eliminate NOP dependencies at insertion time

From: Boris Brezillon

Date: Thu Dec 03 2026 - 08:05:39 EST


On Thu, 3 Dec 2026 12:14:44 +0000
Tvrtko Ursulin <tursulin@xxxxxxxxxxx> wrote:

> On 03/12/2026 12:05, Boris Brezillon wrote:
> > On Thu, 3 Dec 2026 10:38:54 +0000
> > Xianzhong Li <xianzhong.li@xxxxxxx> wrote:
> >
> >> Hi Boris,
> >>
> >> I finished patch v4 patch verification with glmark2 on NXP i.MX952(GPU: Mali-G310-V2@1GHz, CPU: 4xA55@1.7GHz),
> >> There is 7.33% improvement with patch v4, a little better than patch v1 and v2, see per-scene improvement as below
> >>
> >> TOTAL: [1591,1596,1593.50] -> [1708,1712,1710.25], +7.33%
> >> [build] use-vbo=false: [1512,1544,1528.00] -> [1497,1523,1510.00], -1.18%
> >> [build] use-vbo=true: [2797,2818,2807.50] -> [2877,2945,2909.25], +3.62%
> >> [texture] nearest: [2813,2835,2824.00] -> [2907,2966,2941.75], +4.17%
> >> [texture] linear: [2794,2798,2796.00] -> [2905,2972,2947.00], +5.40%
> >> [texture] mipmap: [2848,2860,2854.00] -> [2931,3032,2977.50], +4.33%
> >> [shading] gouraud: [2131,2138,2134.50] -> [2416,2431,2423.00], +13.52%
> >> [shading] blinn-phong-inf: [1939,1941,1940.00] -> [2209,2211,2210.00], +13.92%
> >> [shading] phong: [1497,1502,1499.50] -> [1671,1676,1674.00], +11.64%
> >> [shading] cel: [1355,1358,1356.50] -> [1496,1501,1499.50], +10.54%
> >> [bump] high-poly: [873,874,873.50] -> [936,938,937.25], +7.30%
> >> [bump] normals: [2914,2950,2932.00] -> [3021,3084,3057.25], +4.27%
> >> [bump] height: [2773,2843,2808.00] -> [2880,2906,2893.25], +3.04%
> >> [effect2d] 3x3: [1115,1116,1115.50] -> [1214,1220,1217.75], +9.17%
> >> [effect2d] 5x5: [418,419,418.50] -> [433,434,433.75], +3.64%
> >> [pulsar]: [2392,2425,2408.50] -> [2507,2540,2521.00], +4.67%
> >> [desktop] blur: [326,326,326.00] -> [423,425,424.00], +30.06%
> >> [desktop] shadow: [1067,1073,1070.00] -> [1189,1219,1203.00], +12.43%
> >> [buffer] map (non-interleave): [204,208,206.00] -> [205,207,206.00], +0.00%
> >> [buffer] subdata (non-interleave): [202,206,204.00] -> [207,208,207.25], +1.59%
> >> [buffer] map (interleave): [324,330,327.00] -> [321,323,322.50], -1.38%
> >> [ideas]: [577,580,578.50] -> [559,563,560.75], -3.07%
> >> [jellyfish]: [760,760,760.00] -> [800,807,804.50], +5.86%
> >> [terrain]: [56,57,56.50] -> [58,61,60.25], +6.64%
> >> [shadow]: [1169,1175,1172.00] -> [1387,1395,1391.75], +18.75%
> >> [refract]: [163,163,163.00] -> [174,177,176.00], +7.98%
> >> [conditionals] 0/0: [2678,2702,2690.00] -> [2788,2863,2829.75], +5.20%
> >> [conditionals] 5/0: [1934,1934,1934.00] -> [2194,2201,2197.25], +13.61%
> >> [conditionals] 0/5: [2679,2705,2692.00] -> [2799,2842,2819.75], +4.75%
> >> [function] low: [2384,2387,2385.50] -> [2565,2596,2578.75], +8.10%
> >> [function] medium: [1501,1502,1501.50] -> [1669,1677,1674.25], +11.51%
> >> [loop] fragment-loop=false: [2351,2355,2353.00] -> [2558,2573,2565.75], +9.04%
> >> [loop] fragment-uniform=false: [2354,2359,2356.50] -> [2553,2576,2562.00], +8.72%
> >> [loop] fragment-uniform=true: [1562,1562,1562.00] -> [1746,1752,1749.50], +12.00%
> >>
> >
> > After a few more runs on my side, I can say that scenes with relatively
> > high scores are just too erratic to be a useful comparison point
> > (significant diffs between runs on the same setup). The most
> > interesting ones are probably the ones with lower FPS (terrain, refract,
> > ...), and on some of those, I can definitely see an improvement
> > (terrain, for instance, seems to get a 40+% boost on my rk3588 setup).
> > I've also run gfxbench(gl_manhattan), and got a reproducible 6-ish %
> > improvement there. So yeah, I confirm the container unwrapping is
> > helping some GL workloads, and for those which are not helped, I
> > couldn't spot a diff above the usual noise we see between runs.
>
> I am glad to hear this! Might be the smaller the CPU the bigger the gain.
>
> Do you know if the above benchamrks see a reduction in number of deps
> after unwrapping, or it is about dma-fence-array/chain signalling
> overheads?

After unwrapping+self-dep elimination, I sometimes end up with no deps.
Most of the time the relationship is 1:1, and occasionally 1:2 or 1:3,
but I've seen anything above that. I also don't think I've seen
reduction at all (like 2 containers being turned into a singular
fence), because it's quite rare to be passed more than one container.
The perf gain really comes from the advantageous pipelining we get by
eliminating entity self-deps. The proof is, if I'm unwrapping but
leaving the self-deps in place and forcing a
DRM_SCHED_FENCE_DONT_PIPELINE behavior, I end up with the same results
I have without unwrapping, which is expected because a container fence
is neither an entity self-dep nor a HW-queue/gpu_scheduler self-dep,
so it can't be eliminated in drm_sched_entity_add_dependency_cb().

> AFAIR at least the chain is quite bad in this respect, at
> least in the pathological case when fences signal one by one with large
> enough gaps.

I guess it really depends on what's in the timeline syncobj. If all deps
come from the same GPU queue, it should nicely map to a single fence at
unwrap time. If they come from different queues, you might get more
than one, but my understanding is that, as long as fences that are part
of the chain signal in a reasonable amount of time, the chain shouldn't
grow unexpectedly big, because signalled elements get collected each
time a walk happens.