numba_vulkan.probes#
Behaviour of a device that its reported features do not reveal.
Two kinds of float behaviour make libclc and kernels go wrong on some drivers, and both are found out by running small kernels on each device:
Vulkan lets a driver compute
Fmaas a multiplication followed by an addition, rounding twice. libclc assumes a fused operation; without it, itssin,cosandtanlose all accuracy beyond small arguments. llvmpipe does not fuse, in either precision. Kernels for such a device are compiled with a software version (numba_vulkan.legalize.emulate_fma).llvmpipe (Mesa 26.1) gets
TruncandRoundEvenofdoublevalues wrong in its vectorised code (values that differ between invocations); the scalar path is correct. Kernels for such a device compute both fromFloor(numba_vulkan.legalize.emulate_rounding64).
The probe therefore gives each invocation its own operands. Its results
depend only on the driver, so they are kept in probes.json in the
cache directory (~/.cache/numba-vulkan), per device and driver
version, unless NUMBA_VULKAN_CACHE=0.
The environment variables NUMBA_VULKAN_SOFT_FMA and
NUMBA_VULKAN_SOFT_ROUNDING override the probe: 1 applies the
workaround on every device, 0 on none.
Attributes#
Functions#
|
Which |
Module Contents#
- numba_vulkan.probes.FMA_ENV_VAR = 'NUMBA_VULKAN_SOFT_FMA'#
- numba_vulkan.probes.ROUNDING_ENV_VAR = 'NUMBA_VULKAN_SOFT_ROUNDING'#
- numba_vulkan.probes.workarounds(device)#
Which
float64workarounds kernels for a device need.- Parameters:
device (numba_vulkan.runtime.Device) – The device, which must not yet use any of them.
- Returns:
soft_fmaandsoft_rounding, as for numba_vulkan.narrowing.Mode.- Return type: