Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rtdjY-00GOxd-At for pgsql-hackers@arkaria.postgresql.org; Mon, 08 Apr 2024 01:23:40 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1rtdjX-00FCPC-Do for pgsql-hackers@arkaria.postgresql.org; Mon, 08 Apr 2024 01:23:39 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rtdjX-00FCN8-3B for pgsql-hackers@lists.postgresql.org; Mon, 08 Apr 2024 01:23:39 +0000 Received: from mail-io1-xd34.google.com ([2607:f8b0:4864:20::d34]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1rtdjU-001U3j-4C for pgsql-hackers@lists.postgresql.org; Mon, 08 Apr 2024 01:23:38 +0000 Received: by mail-io1-xd34.google.com with SMTP id ca18e2360f4ac-7d5e3fb7f2fso35205239f.0 for ; Sun, 07 Apr 2024 18:23:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712539415; x=1713144215; darn=lists.postgresql.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=+yiunSWc5vLb+epEU/gzgbaz69hv0crvvksOLQ3W93k=; b=VySDW2Lxzne0avlde8EAsCm0fhSA0BiErHGz4YxE76oAh8n1uTEmRJ3zOU5gpI4bvm wfUGjgO6x0pJb9qqbbemvycjBsZGj7zcA9Wk8BRcxfYK442p+b0mB1ejAKmYby8SQHSE x3Rx24QSUiCXLOVeVsgtuYme0BnFsqFAWKgJSssL8DwMHNIhiQPBwneRI4MP/01J66ol Nj6fy2j3aNc75ArtwOO9f0xuee6hiX0sKLCtyXL5rb8m6xLnsupBPyYC4wJWA0vAoU2y vrwI6UqNs2qw9a8MwZqLuPQs2Y39AFd+PSy1Qq/zNultHufs57A9ATH4FTRl6BnAnXS5 AamA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712539415; x=1713144215; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=+yiunSWc5vLb+epEU/gzgbaz69hv0crvvksOLQ3W93k=; b=ghWaSNaF7pMEsIBfka2i1Mv1tRrhLBUZYn4sHCpDKvYpRIxaE3s0UmfH1SS0O+PjUb Jc9DTsIB60QfDhVVdpE3guq0knpt68lsQA+I5tlZO1vc5Ebnul0PJ/qFbHeJSliTqEPJ tXoSuhkeA7ksAvWDUVQeFgvlCmxd+tBSQwqAkw/yzvCxNdF3V2lSsRl+rgJtnGaG3Xds O/2+oTzngDWXvneOXFBxoqzNTHzjbdaKga2sNTE4LQ0WaKsSqyvvT8MrWEhe4xg5xriW gUoFIEHkKKEMYDRbmbPXors2fAJ8W/Ds37rULCCIURPASEsmnRiCfZSa8bMX4ioK1omB r6gw== X-Forwarded-Encrypted: i=1; AJvYcCX6JpwrupIjZSS9gMfZ+APJpiagxESCSA7kAglDZYmfu7nQI7x8nCPmAMD/A5dSA6H/sVUADSy6qzs5slfBZhqhpq8T0QwNbvIoqm93RJWXeS/V X-Gm-Message-State: AOJu0YxsrwJvMarbJmQMkzAruakyjoJI3g9aXEfxl+BAUHDK2SyfZlsS IncfB0iW+n2yFAgYUg6Os99Z9MYtfOX0m1RXNhvqmJ0Rt3J+rX42 X-Google-Smtp-Source: AGHT+IGXriUwWMtCBFNYiWb+SoEFyYvslHch84CfGh/riM0O5wcmJr7Dt7g3aiuHwWbdP1Xf/iZRoA== X-Received: by 2002:a05:6602:4896:b0:7d5:ceed:87 with SMTP id ee22-20020a056602489600b007d5ceed0087mr8194739iob.11.1712539414761; Sun, 07 Apr 2024 18:23:34 -0700 (PDT) Received: from nathanxps13 (162-195-168-172.lightspeed.stlsmo.sbcglobal.net. [162.195.168.172]) by smtp.gmail.com with ESMTPSA id x26-20020a02971a000000b0047ec2b62deasm2172812jai.91.2024.04.07.18.23.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 07 Apr 2024 18:23:34 -0700 (PDT) Date: Sun, 7 Apr 2024 20:23:32 -0500 From: Nathan Bossart To: Tom Lane Cc: David Rowley , Ants Aasma , Alvaro Herrera , "Amonson, Paul D" , Andres Freund , "Shankaran, Akash" , Noah Misch , Matthias van de Meent , "pgsql-hackers@lists.postgresql.org" Subject: Re: Popcount optimization using AVX512 Message-ID: <20240408012332.GA1351547@nathanxps13> References: <20240404172840.GB3866970@nathanxps13> <20240405041543.GA4100924@nathanxps13> <20240405125844.GB4102502@nathanxps13> <20240405153811.GA9352@nathanxps13> <20240406011704.GB167028@nathanxps13> <20240406194101.GA533391@nathanxps13> <2999492.1712536932@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2999492.1712536932@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Sun, Apr 07, 2024 at 08:42:12PM -0400, Tom Lane wrote: > Today's Coverity run produced this warning, which seemingly was > triggered by one of these commits, but I can't make much sense > of it: > > *** CID 1596255: Uninitialized variables (UNINIT) > /usr/lib/gcc/x86_64-linux-gnu/10/include/avxintrin.h: 1218 in _mm256_undefined_si256() > 1214 extern __inline __m256i __attribute__((__gnu_inline__, __always_inline__, __artificial__)) > 1215 _mm256_undefined_si256 (void) > 1216 { > 1217 __m256i __Y = __Y; >>>> CID 1596255: Uninitialized variables (UNINIT) >>>> Using uninitialized value "__Y". > 1218 return __Y; > 1219 } > > I see the same code in my local copy of avxintrin.h, > and I quite agree that it looks like either an undefined > value or something that properly ought to be an error. > If we are calling this, why (and from where)? Nothing in these commits uses this, or even uses the 256-bit registers. avxintrin.h is included by immintrin.h, which is probably why this is showing up. I believe you're supposed to use immintrin.h for the intrinsics used in these commits, so I don't immediately see a great way to avoid this. The Intel documentation for _mm256_undefined_si256() [0] indicates that it is intended to return "undefined elements," so it seems like the use of an uninitialized variable might be intentional. > Anyway, we can certainly just dismiss this warning if it > doesn't correspond to any real problem in our code. > But I thought I'd raise the question. That's probably the right thing to do, unless there's some action we can take to suppress this warning. [0] https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm256_undefined_si256&ig_expand=6943 -- Nathan Bossart Amazon Web Services: https://aws.amazon.com