github / codeql

CodeQL: the libraries and queries that power security researchers around the world, as well as code scanning in GitHub Advanced Security
https://codeql.github.com
MIT License
7.51k stars 1.49k forks source link

CodeQL seems to produce many warnings when compiling source that includes AVX-512 extensions #16999

Open flowerhack opened 1 month ago

flowerhack commented 1 month ago

Hi there,

I'm filing this all as one bug in case they share a root cause, because it seems somewhat likely to me they all share the same root cause. Please let me know if that's not the case and I can parse these out into separate bug reports.

But: when compiling Chromium, we see a lot of warnings (on the order of ~190,000) related to the inclusion of the following Clang headers:

Some sample warnings include:

Warning[extractor-c++]: In construct_text_message: "/b/s/w/ir/x/w/src/third_party/llvm-build/Release+Asserts/lib/clang/19/include/avx512vlbf16intrin.h", line 41: error: invalid type conversion
    return (__m128bh)__builtin_ia32_cvtne2ps2bf16_128((__v4sf) __A,
           ^

and

Warning[extractor-c++]: In construct_text_message: "/b/s/w/ir/x/w/src/third_party/llvm-build/Release+Asserts/lib/clang/19/include/avx512vlbf16intrin.h", line 65: error: argument of type "__v8bf" is incompatible with parameter of type "__attribute((vector_size(32))) __bf16"
                                               (__v8bf)_mm_cvtne2ps_pbh(__A, __B),
                                               ^

and

Warning[extractor-c++]: In construct_text_message: "/b/s/w/ir/x/w/src/third_party/llvm-build/Release+Asserts/lib/clang/19/include/avx512vlfp16intrin.h", line 967: error: invalid type conversion
    return (__m128i)__builtin_ia32_vcvtph2udq128_mask(
           ^

and

Warning[extractor-c++]: In construct_text_message: "/b/s/w/ir/x/w/src/third_party/llvm-build/Release+Asserts/lib/clang/19/include/avx512fintrin.h", line 484: error: identifier "__builtin_nondeterministic_value" is undefined
    __m256i __B = __builtin_nondeterministic_value(__B);
                  ^

I'm wondering if this is already a known issue / something on the roadmap to support (perhaps SIMD-related code requires extra support)? If not, would it be helpful for me to provide a reproducer for one of these instances (as a representative sample), or do you think these in fact represent many different classes of issue and you'd like more of a breakdown than that?

Thanks very much!

jketema commented 1 month ago

Hi @flowerhack ,

The first three are definitely related, and seem related to float 16 support, which we should support, but the support might not be good enough for AVX512 (float 16 support is relatively new). The last one is different. We should support __builtin_nondeterministic_value, but it somehow not picked up here. A preprocessed file demonstrating these issues would help.