Commit 8b4522d
PoCL 7.2: vectorize OpenCL math builtins via SLEEF_jll (libsleefgnuabi) (#14098)
Wire a vector-math library into the CPU kernel compiler so transcendental builtins
(sin/exp/log/...) vectorize to packed _ZGV* calls, resolved at run time by the in-process
JIT (dynamic, no redistributed .so beyond the SLEEF_jll dependency).
- Bump pocl to e344b0f02c2c (adds a configurable libmvec SONAME for the JIT to dlopen,
instead of the hardcoded libmvec.so.1, so it can use a shipped lib on musl/old-glibc).
- common.jl: on x86_64 use LLVM's libmvec veclib (_ZGVdN*); on aarch64 use the SLEEF veclib
(_ZGVnN*); point both at SLEEF's libsleefgnuabi (a drop-in libmvec-ABI lib).
- Add a SLEEF_jll dependency on x86_64/aarch64 for Linux+FreeBSD -- the ELF targets where
LLVM maps a veclib AND SLEEF_jll ships libsleefgnuabi (not macOS: no GNUABI on Mach-O;
not Windows: no SLEEF_jll).
Validated locally via OpenCL.jl: a transcendental kernel compiles to <8 x float>
@llvm.sin.v8f32 and the object calls _ZGVdN8v_sinf, resolved against libsleefgnuabi, with
correct results. NB: on AVX-512 hosts the work-item loop picks width 16, which LLVM's x86
veclib tables don't cover (max width 8), so math scalarizes there; AVX2 (8) and aarch64
NEON (4) get packed calls.
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent c48f1d2 commit 8b4522d
3 files changed
Lines changed: 42 additions & 16 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
289 | 289 | | |
290 | 290 | | |
291 | 291 | | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
292 | 315 | | |
293 | 316 | | |
294 | 317 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
| 24 | + | |
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| |||
93 | 93 | | |
94 | 94 | | |
95 | 95 | | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
101 | 104 | | |
102 | | - | |
103 | | - | |
104 | 105 | | |
105 | 106 | | |
106 | 107 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
| 28 | + | |
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| |||
96 | 96 | | |
97 | 97 | | |
98 | 98 | | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
104 | 108 | | |
105 | | - | |
106 | | - | |
107 | 109 | | |
108 | 110 | | |
109 | 111 | | |
| |||
0 commit comments