From: James Darnley <jdarnley@obe.tv> To: ffmpeg-devel@ffmpeg.org Subject: [FFmpeg-devel] Discrepancy between comments for AVX512 flags Date: Sat, 27 Aug 2022 00:01:52 +0200 Message-ID: <6002a350-e0cc-288d-85b0-5189a7647a53@obe.tv> (raw) While cherry-picking some stuff for avx512 I have noticed that ffmpeg has a discrepancy in the comments for the two avx512 flags. Lets start with the public header > libavutil/cpu.h > 56│ #define AV_CPU_FLAG_AVX512 0x100000 ///< AVX-512 functions: requires OS support even if YMM/ZMM registers aren't used > 57│ #define AV_CPU_FLAG_AVX512ICL 0x200000 ///< F/CD/BW/DQ/VL/VNNI/IFMA/VBMI/VBMI2/VPOPCNTDQ/BITALG/GFNI/VAES/VPCLMULQDQ This seem to imply the first only detects ZMM support and the second groups all instruction sets together. This appears to be different to what we imply in internal code > libavutil/x86/cpu.c > 151│ #if HAVE_AVX512 /* F, CD, BW, DQ, VL */ > libavutil/x86/x86inc.asm > 840│ %assign cpuflags_avx512 (1<<20)| cpuflags_avx2 ; F, CD, BW, DQ, VL The detection code itself has > libavutil/x86/cpu.c > 151│ #if HAVE_AVX512 /* F, CD, BW, DQ, VL */ > 152│ if ((xcr0_lo & 0xe0) == 0xe0) { /* OPMASK/ZMM state */ > 153│ if ((rval & AV_CPU_FLAG_AVX2) && (ebx & 0xd0030000) == 0xd0030000) { > 154│ rval |= AV_CPU_FLAG_AVX512; > 155│ #if HAVE_AVX512ICL > 156│ if ((ebx & 0xd0200000) == 0xd0200000 && (ecx & 0x5f42) == 0x5f42) > 157│ rval |= AV_CPU_FLAG_AVX512ICL; If you decode the bits being checked you'll see that the base avx512 checks ebx for F DQ CD BW VL and avx512icl checks ebx for IFMA CD BW VL and ecx for VBMI VBMI2 GFNI VAES VPCLMULQDQ VNNI BITALG VPOPCNTDQ. The first matches what the internal comments imply. Part of the difference is my fault and dates from when the flag was first added. Has there been a discussion about which features should go with which flag? _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
next reply other threads:[~2022-08-26 22:04 UTC|newest] Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-08-26 22:01 James Darnley [this message] 2022-08-27 0:14 ` Hendrik Leppkes 2022-08-27 12:15 ` Henrik Gramner
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=6002a350-e0cc-288d-85b0-5189a7647a53@obe.tv \ --to=jdarnley@obe.tv \ --cc=ffmpeg-devel@ffmpeg.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel This inbox may be cloned and mirrored by anyone: git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \ ffmpegdev@gitmailbox.com public-inbox-index ffmpegdev Example config snippet for mirrors. AGPL code for this site: git clone https://public-inbox.org/public-inbox.git