From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 5B4D0A0032; Fri, 12 Nov 2021 22:48:52 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 107B041148; Fri, 12 Nov 2021 22:48:42 +0100 (CET) Received: from mail-lj1-f171.google.com (mail-lj1-f171.google.com [209.85.208.171]) by mails.dpdk.org (Postfix) with ESMTP id 865B5410EF for ; Fri, 12 Nov 2021 22:48:39 +0100 (CET) Received: by mail-lj1-f171.google.com with SMTP id e11so21029786ljo.13 for ; Fri, 12 Nov 2021 13:48:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=r4mkvLrIYV1y4BSvz1udZoK1bETCCS4sF3IPeImxftA=; b=ipKwEbGnjvi5PKQ0VmD6ewXSVEUo2Nu4+C370FHEwB2WK9pYFzz7WM0vscbBRHl1eN FsAAY1O+CHmzHz33V4Zq4BpEpLCDxB/YZeNhvjLspZHDEZc8HA+47qier15mvoIf9UkW 1yjKmIW4VGQ3nYk+N0oEYFMHz8jjNU82lqPiXXKODsmsZuFrheC+JYETLC3SJJmX5hJI n/0PanE7x3DTB+QtT0oPc3dwXgSV3YgwlaLEG8qPhXZyGwVdqQsSJTOKLSDi946SZcd3 5cpWCWO0DsQ02bwSX6/BtD0wWoPjv5gvBFhpR6+s4nR4ekscBXk6DYMs7cb4oc27EGhP z3Rg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=r4mkvLrIYV1y4BSvz1udZoK1bETCCS4sF3IPeImxftA=; b=Xgye+G79IyAjIHoakUhB96DnxAABthl+1f9SOl7m4ghDTCi5mcvIKhf3qkSF59OQaH 0i+20tv+4jq7il5LziUl9GYsJ5nZO1UdbZiOTfccnHE/WBwYyuH2OTLxT4jpq4bETQFW m0Axv/jOIAtaClCrTtGOS4XiBHqO7P452Y0Rdo89GBJpk4rpCiALo8jjKMXoOJedPpou J1KL31Myy0VxfFbwwLMbQi5A/PNwO+Bs/RNOLqdxwvIRO29xik+Wi3vMAgo+Wk96+xmp WUmU9kk9lvwCqiLkOgjhldP/kcFD46YwIenmC7Ey4nUFgg2AtgzSj6/YuY1n9EOjdKKh bovg== X-Gm-Message-State: AOAM533Q0cNdTcLMQUbu0Atgc5mBzQUuCBO3NyMduxeMjBjhlVV0nPHF 4DJhLcFMOSzLHKvHZTMz+yNoFg6TE2c= X-Google-Smtp-Source: ABdhPJzDBQHwwcFpHFzAwizCaFrp5aRupCM6muVeW4QI/lbBz7VlZFb2f7YhIDhkiyxrexQTYlxKDg== X-Received: by 2002:a2e:bba1:: with SMTP id y33mr18395203lje.263.1636753718970; Fri, 12 Nov 2021 13:48:38 -0800 (PST) Received: from sovereign.. (broadband-37-110-65-23.ip.moscow.rt.ru. [37.110.65.23]) by smtp.gmail.com with ESMTPSA id l5sm647917ljh.66.2021.11.12.13.48.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Nov 2021 13:48:38 -0800 (PST) From: Dmitry Kozlyuk To: dev@dpdk.org Cc: Dmitry Kozlyuk , Bruce Richardson , Konstantin Ananyev Subject: [PATCH 2/3] buildtools: make AVX512 check script portable Date: Sat, 13 Nov 2021 00:48:25 +0300 Message-Id: <20211112214826.333853-3-dmitry.kozliuk@gmail.com> X-Mailer: git-send-email 2.29.3 In-Reply-To: <20211112214826.333853-1-dmitry.kozliuk@gmail.com> References: <20211112214826.333853-1-dmitry.kozliuk@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org buildtools/binutils-avx512-check.sh was Unix-only and could not be used in cross builds: 1) written in shell; 2) used the assembler binary that may be missing, e.g. when building on Windows with LLVM; 3) located the assembler as ${AS:-as} and referenced objdump, but those binaries may be overridden via --cross-file. Rewrite the script in Python. Use the C compiler for the check. Locate objdump and the C compiler using Meson. Signed-off-by: Dmitry Kozlyuk --- buildtools/binutils-avx512-check.py | 21 +++++++++++++++++++++ buildtools/binutils-avx512-check.sh | 16 ---------------- buildtools/meson.build | 4 +++- 3 files changed, 24 insertions(+), 17 deletions(-) create mode 100644 buildtools/binutils-avx512-check.py delete mode 100755 buildtools/binutils-avx512-check.sh diff --git a/buildtools/binutils-avx512-check.py b/buildtools/binutils-avx512-check.py new file mode 100644 index 0000000000..a4e14f3593 --- /dev/null +++ b/buildtools/binutils-avx512-check.py @@ -0,0 +1,21 @@ +#! /usr/bin/env python3 +# SPDX-License-Identitifer: BSD-3-Clause +# Copyright(c) 2020 Intel Corporation + +import subprocess +import sys +import tempfile + +objdump, *cc = sys.argv[1:] +with tempfile.NamedTemporaryFile() as obj: + # On Windows, the file is opened exclusively and is not writable. + obj.close() + # from https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90028 + gather_params = '0x8(,%ymm1,1),%ymm0{%k2}' + src = '__asm__("vpgatherqq {}");'.format(gather_params).encode('utf-8') + subprocess.run(cc + ['-c', '-xc', '-o', obj.name, '-'], input=src, check=True) + asm = subprocess.run([objdump, '-d', '--no-show-raw-insn', obj.name], + capture_output=True, check=True).stdout.decode('utf-8') + if gather_params not in asm: + print('vpgatherqq displacement error with as') + sys.exit(1) diff --git a/buildtools/binutils-avx512-check.sh b/buildtools/binutils-avx512-check.sh deleted file mode 100755 index 2a833b64b7..0000000000 --- a/buildtools/binutils-avx512-check.sh +++ /dev/null @@ -1,16 +0,0 @@ -#! /bin/sh -# SPDX-License-Identifier: BSD-3-Clause -# Copyright(c) 2020 Intel Corporation - -AS=${AS:-as} -OBJFILE=$(mktemp -t dpdk.binutils-check.XXXXXX) -trap 'rm -f "$OBJFILE"' EXIT -# from https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90028 -GATHER_PARAMS='0x8(,%ymm1,1),%ymm0{%k2}' - -# assemble vpgather to file and similarly check -echo "vpgatherqq $GATHER_PARAMS" | $AS --64 -o $OBJFILE - -objdump -d --no-show-raw-insn $OBJFILE | grep -q $GATHER_PARAMS || { - echo "vpgatherqq displacement error with as" - exit 1 -} diff --git a/buildtools/meson.build b/buildtools/meson.build index f776316da1..22ea0ba375 100644 --- a/buildtools/meson.build +++ b/buildtools/meson.build @@ -4,7 +4,7 @@ pkgconf = find_program('pkg-config', 'pkgconf', required: false) check_symbols = find_program('check-symbols.sh') ldflags_ibverbs_static = find_program('options-ibverbs-static.sh') -binutils_avx512_check = find_program('binutils-avx512-check.sh') +objdump = find_program('objdump', 'llvm-objdump') python3 = import('python').find_installation(required: false) if python3.found() @@ -18,6 +18,8 @@ map_to_win_cmd = py3 + files('map_to_win.py') sphinx_wrapper = py3 + files('call-sphinx-build.py') get_cpu_count_cmd = py3 + files('get-cpu-count.py') get_numa_count_cmd = py3 + files('get-numa-count.py') +binutils_avx512_check = (py3 + files('binutils-avx512-check.py') + + [objdump] + cc.cmd_array()) # select library and object file format pmdinfo = py3 + files('gen-pmdinfo-cfile.py') + [meson.current_build_dir()] -- 2.29.3