[clang] [llvm] [X86] Add ACE v1 (AI Compute Extensions) support (PR #208408)

Evgenii Kudriashov via cfe-commits cfe-commits at lists.llvm.org
Sat Nov 21 03:28:46 PST 2026


e-kud wrote:

I played with the latest state for some time and found that BSR register is not restored automatically. E.g.
```c
int main(void) {
  __m512i one = _mm512_set1_epi8(1);
  __acetile t;
  __tile_ace_zero(&t);
  _bsr0_insertfull(_mm512_set1_epi8((char)0x81),
                   _mm512_set1_epi8((char)0x81));
  bar();
  __tile_ace_top4mxbssps(&t, one, one, 0);
}
```
```asm
ldtilecfg  8(%rsp)
tilezero   %tmm0
bsrmovf    %zmm0, %zmm0, %bsr0
callq      bar
ldtilecfg  8(%rsp)
tilezero   %tmm0
top4mxbssps $0, %zmm0, %zmm0, %tmm0
tilemovrow $0, %tmm0, %zmm0
```

We always reconfigure tiles after calls and this config resets `bsr0`. 
The same happens with loops and if-else but O1+ usually hoist configuration and can potentially avoid the problem.

@ganeshgit I remember initially there was two PRs: ACE + BSR support, does the second include the BSR fix for this scenario?

@rengolin @arun-thmn are you OK with merging initial ACEv1 support without efficient BSR support. I'm saying efficient because the workaround is just to always put `bsr` initialization before each scaled operation or a linear block of scaled operations.

https://github.com/llvm/llvm-project/pull/208408


More information about the cfe-commits mailing list