AVX-512 recording portability

Starting with version 2.34, the GNU C Library (glibc) uses the AVX-512 family of CPU instructions (if available) to implement some of the the standard C library functions. These include:

  • functions declared in the <string.h> header, that is, memcmp(), memcpy(), strcmp(), strcpy(), and so on;

  • functions declared in the <wchar.h> header, that is, wcpcpy(), wcslen(), wcslen(), wmemset(), and so on; and

  • vectorized versions of the functions declared in the <math.h> header.

Replaying an Undo recording with UDB 6.12 or later

UDB versions 6.12 and later have support for the glibc functions defined in <string.h> and, from version 6.12.1 onwards, <wchar.h>, so that an Undo recording can be replayed even if AVX-512 was used by glibc, so long as the requirements in recording portability are met.

If the recorded program called other glibc functions implemented using AVX-512 such as those declared in <math.h>, or used AVX-512 in some other way, then you may see a message like this:

ERROR: 'example.undo' not loaded because CPU features required for replay are
       missing: avx512f.

       Recording portability is only partially supported for glibc 2.34+ when
       the recording CPU has AVX-512, but the replay machine does not. See
       https://docs.undo.io/GlibcAVX512.html for more information.

If you see this message, then the recording can only be replayed on a CPU which supports AVX-512. There are alternative approaches to allow the replay of recordings generated by machines with AVX-512 support on machines without it:

Replaying an Undo recording with UDB 6.11 or earlier

If you attempt to replay an Undo recording which was made on a machine with glibc version 2.34 or newer, and where the CPU supported the AVX-512 family of instructions, you may see a message from UDB such as:

ERROR: 'example.undo' not loaded because CPU features required for replay are
       missing: avx512f.

       Recording portability is not supported for glibc 2.34+ when the recording
       CPU has AVX-512. See https://docs.undo.io/GlibcAVX512.html for
       more information.

If you see this message, then the recording can only be replayed on a CPU which supports AVX-512. An alternative approach is to avoid the use of AVX-512 instructions when the program is being recorded, by Configuring glibc to avoid use of AVX-512 instructions.

Configuring glibc to avoid use of AVX-512 instructions

When making an Undo recording, glibc can be configured to suppress the use of AVX-512 instructions, so that (as long as there are no other uses of AVX-512 instructions in the program) the recording is replayable on machines that lack support for AVX-512. Do this by setting the GLIBC_TUNABLES environment variable as follows:

export GLIBC_TUNABLES=glibc.cpu.hwcaps=-AVX512F,-AVX512BW,-AVX512VL,-AVX512DQ

or as part of the command line when running the live-record tool:

GLIBC_TUNABLES=glibc.cpu.hwcaps=-AVX512F,-AVX512BW,-AVX512VL,-AVX512DQ live-record my-program

This makes an Undo recording that can be replayed on a CPU which does not support AVX-512 (subject to the other recording portability requirements).