On 2/13/25 20:46, Jeff Law wrote: >> BTW what exactly is speculative scheduling ? As in what is it actually >> trying to >> schedule ahead ? > In simplest terms assume we have this kind of graph > > 0 > / \ > 1-->2 > > > The scheduler knows how to build scheduling regions, essentially > extended basic blocks. In this case we have two regions one with the > blocks 0,1 the other being just block 2. > > In the multi-block region 0,1 we allow insns from block 1 to speculate > into block 0. > > Let's assume we're on a simple 2-wide in order machine and somewhere in > bb0 we there's a slot available for an insn that we couldn't fill with > anything useful from bb0. In that case we may speculate an insn from > bb1 into bb0 to execute "for free" in that unused slot. > > That's the basic idea. It was particularly helpful for in-order cores > in the past. It's dramatically less important for an out of order core > since those are likely doing the speculation in hardware.
That is great info, super helpful. Given this background, I'd argue that Edwin's patch to barricade vsetvls in scheduling is the right thing to do anyways, this issue or otherwise. > Naturally if you're using icounts for evaluation this kind of behavior > is highly undesirable since that kind of evaluation says the > transformation is bad, but in reality on certain designs is quite helpful. Sure. Thx, -Vineet