34 Commits
Author SHA1 Message Date
William Douglas 013a989f5a Add new python pypi dependency replacement tool
Add tooling to remove version dependencies for a given list of python
modules found in a subset of files in a given directory. This is
useful for cases where packages in pypi have out of date dependencies
relative to the test of the ecoysystem.

Signed-off-by: William Douglas <william.douglas@intel.com>
v21
2021-10-19 11:42:45 -07:00
William Douglas 7dfbf641ad elf-move: Include filepath in hash
Because miltiple binaries might share the same exact contents, include
the filepath as part of the hash.

Signed-off-by: William Douglas <william.douglas@intel.com>
v20
2021-10-14 12:30:27 -07:00
William Douglas 7c60cf719a elf-move: Fix --path behavior and crash
If --path was not passed previously elf-move would crash, it also was
incorrectly handling the filepath instead of the virtpath (only care
about the path after the DESTDIR for --path, makes handling easier
too).

Finally make --path override the --skip behavior so they can work
together to append new content to a file.
v19
2021-10-12 15:45:35 -07:00
William Douglas bbb7ff5e70 elf-move: Add option to always process a given path 2021-10-12 15:20:55 -07:00
William Douglas 4dccdcf2f5 Fixup whitespace, cleanup wording+typos 2021-10-12 15:04:29 -07:00
Arjan van de Ven 669f9fc54c add installed tests as a subset v18 2021-10-12 15:06:35 +00:00
Patrick McCarty 0bdb80f76b Make sure first 4096 bytes factor into the sha256
The first 4096 bytes were not being accounted for, resulting in any ELF
content with size <= 4096 having the same sha256.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
v17
2021-10-11 12:40:04 -07:00
Arjan van de Ven 5f2fa9bf1c add an other bucket v16 2021-10-10 23:35:38 +00:00
Arjan van de Ven 9a9122555d fix indent v15 2021-10-08 14:37:11 +00:00
Arjan van de Ven 0bc5cbc31d flag lib v14 2021-10-08 14:24:02 +00:00
Arjan van de Ven bcaaa0c300 also libexec v13 2021-10-08 14:12:45 +00:00
Arjan van de Ven 3853f800ac prefix files from /usr/bin with "bin" in the target file to help autospec v12 2021-10-08 13:56:37 +00:00
William Douglas e808020407 elf-move: Only create folders when there is content
Only create the filemap when there is elf binary content and create
the path to the filemap file as needed.
v11
2021-10-07 22:49:44 -07:00
William Douglas f3bec7a82a Add elf binary handling utility
Add a new utility that will moving elf binaries to an alternate
location (renamed to their sha256 hash) and create a mapping file of
the binaries moved.

Signed-off-by: William Douglas <william.douglas@intel.com>
v10
2021-10-07 17:33:07 -07:00
Arjan van de Ven 33b73ec3e9 add some more avx512 detection v9 2021-04-24 14:16:03 +00:00
Patrick McCarty b129932f1a Improve instruction detection for lines with xmm/ymm/zmm
In `objdump -d` output, lines with instructions may list function names
that have "xmm", "ymm", or "zmm" in their names.

Avoid detecting lines like this as sse/avx2/avx512 by searching the
instruction argument field for "%xmm", "%ymm", or "%zmm" instead.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
v8
2020-06-22 11:21:38 -07:00
Ethan Zhao e2063c676e avxjudge.py: fix duplicate counting of AVX2&AVX512 or SSE&AVX2
There is duplicate counting of AVX2&AVX512 or SSE&AVX2 with original
matching order:

 ...

 sse_score = is_sse(ins, arg)
 avx2_score = is_avx2(ins, arg)
 avx512_score = is_avx512(ins, arg)
 ...

 with -d command line applied, we could see following output:

 python3 avxjudge.py -d /tmp/libopenblas_skylakexp-r0.3.3.so

 ...
 duplicate count for sse & avx2 ? vfmadd213ss (%r12,%r15,4),%xmm2,%xmm0 102
 duplicate count for sse & avx2 ? vfmadd213ss -0x4(%r12),%xmm1,%xmm0 103
 duplicate count for sse & avx2 ? vinsertf128 $0x1,%xmm3,%ymm0,%ymm0 104
 ...
 duplicate count for avx2 & avx512 ? vmovups 0x60(%rdx),%ymm16 5
 duplicate count for sse & avx2 ? vinsertf128 $0x1,%xmm1,%ymm0,%ymm0 115
 duplicate count for avx2 & avx512 ? vmovups 0x80(%rdx),%ymm17 6
 duplicate count for sse & avx2 ? vinsertf128 $0x1,%xmm1,%ymm0,%ymm0 116
 duplicate count for avx2 & avx512 ? vmovups 0xa0(%rdx),%ymm18 7
 duplicate count for sse & avx2 ? vinsertf128 $0x1,%xmm1,%ymm0,%ymm0 117
 duplicate count for avx2 & avx512 ? vmovups 0xc0(%rdx),%ymm19 8
 ...
 File total (SSE):  542451 instructions with score 126060
 File total (AVX2):  114279 instructions with score 112833
 File total (AVX512):  80538 instructions with score 30653

 File duplicate count of sse&avx2 66813 , duplicate count of avx2&avx512 11502

 So we should do is_avx512() matching first and trust it's result,
 only do is_avx2() when is_avx512() fails, then the matching is
 re-ordered as:

        avx512_score = is_avx512(ins, arg)
        if avx512_score <= 0:
            avx2_score = is_avx2(ins, arg)
        if avx2_score <= 0 and avx512_score <= 0:
            sse_score = is_sse(ins, arg)

 Though is_avx512(), is_avx2() and is_sse() are not accurate 100%, but we
should trust their result and assume they could match accurately.

 Then the duplicate counting issue is fixed in a simple way.

Signed-off-by: Ethan Zhao <haifeng1.zhao@intel.com>
2018-11-13 18:18:32 -08:00
Ethan Zhao cd960c5a1b avxjudge.py: Add -d debug command line option
To debug duplicate counting issue, add a glabal var 'debug' and
a new command line option '-d'.

Signed-off-by: Ethan Zhao <haifeng1.zhao@intel.com>
2018-11-13 18:18:32 -08:00
Victor Rodriguez 2196dd68b7 Add short description of avxjudge tool
Signed-off-by: Victor Rodriguez <victor.rodriguez.bahena@intel.com>
2018-10-03 10:02:36 -07:00
William Douglas d84da2e1c9 Exit early when in delete mode and file is going to be kept
Check if being run in delete mode (and quiet) and exit early when the
file being judged would be kept. This allows improved speed when
processing files for deletion rather than gathering statistics.
v6 v7
2018-08-22 18:43:46 -07:00
William Douglas 690b6122d6 Stream objdump parsing
This is actually a large rewrite to avoid mutable globals cleverly
disguised as parsing objdump output as a stream rather than waiting
for all the content to finish loading in the python buffer. The
functionality should *not* have changed as this is just a speculative
performance patch.
2018-08-22 18:43:46 -07:00
Thiago Macieira 3037904971 Use GNU Make as a way to do parallel runs of avxjudge.py
The script is not really fast on big libraries, so parallelising the run
should sorten considerably the post-install procedures, especially on
build servers with a lot of cores.

Signed-off-by: Thiago Macieira <thiago.macieira@intel.com>
2018-08-22 13:53:36 -07:00
Thiago Macieira f3ec990d83 Fix moving when there are symlinks to symlinks
That's the usual case with libraries:
  libfoo.so -> libfoo.so.1 -> libfoo.so.1.2.3

We prepended the symlinks so we did readelf on them first, before
moving. But there was a problem in case moved the middle symlink, such
that the first one became broken.

So instead of building a file list to scan, then scan and move in one
go, we scan while building the file list, doing all the moves at the
end.

Signed-off-by: Thiago Macieira <thiago.macieira@intel.com>
v5
2018-07-13 15:00:23 -07:00
Thiago Macieira 15942d9bbc clr-avx-move.pl: Avoid renaming what we've already renamed
If a package is built with both AVX512 and AVX2, when the
%make_install_avx2 target is run, we'll already have AVX512 files in
/usr/bin/haswell, /usr/lib64/haswell and plugins named *.so.avx512. So
don't recurse into the libsubdir and don't rename anything called
*.so.avx*.

This patch is a little bigger than necessary so we don't recurse at all
for binary directories.

Note: this only works if AVX512 is run first, because it depends on the
AVX512 directory being a subdir of the AVX2 directory.

Signed-off-by: Thiago Macieira <thiago.macieira@intel.com>
v4
2018-07-11 09:26:57 -07:00
Thiago Macieira 84d00a33d2 clr-avx-move: Don't abort execution if mkdir fails
make_path() by default aborts if the creating the target (that didn't
exist) fails.

Signed-off-by: Thiago Macieira <thiago.macieira@intel.com>
2018-07-10 21:51:24 -07:00
Thiago Macieira 883153d63d avxjudge.py: fix run with report
Traceback (most recent call last):
  File "/usr/bin/avxjudge.py", line 344, in <module>
    main()
  File "/usr/bin/avxjudge.py", line 315, in main
    do_file(args.filename)
  File "/usr/bin/avxjudge.py", line 231, in do_file
    print(function,"\t",ratio(sse_count/instructions),"\t", ratio(avx2_count / instructions), "\t", ratio(avx512_count/instructions), "\t", avx2_score,"\t", avx512_score)
NameError: name 'ratio' is not defined

Signed-off-by: Thiago Macieira <thiago.macieira@intel.com>
v3
2018-07-04 11:12:19 -07:00
Thiago Macieira 468d8e5bd0 Fix creating the haswell/avx512_1 subdir
The original shell script was mkdir -p. The perl function mkdir()
doesn't do that, though, so we have to use File::Path::make_path().

Signed-off-by: Thiago Macieira <thiago.macieira@intel.com>
v2
2018-06-30 10:48:39 -07:00
Thiago Macieira e08b27e18c Correct mistaken crediting of FMA instructions to AVX512
VFMADD132SS is an FMA instruction, which was added to Haswell
architecture at the same time it got AVX2. This was correct prior to the
patch in PR #1.

Signed-off-by: Thiago Macieira <thiago.macieira@intel.com>
2018-06-29 23:19:38 -07:00
Thiago Macieira b48a8636cf Perform the directory scanning in clr-avs2-move.pl itself
Simplifies macros in the .spec files.

Signed-off-by: Thiago Macieira <thiago.macieira@intel.com>
2018-06-29 21:31:17 -07:00
Leandro Pereira e97531c2ba avxjudge: Simplify report generation
Refactor report generation function to reduce amount of copy-paste.

Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2018-06-29 15:19:15 -07:00
William Douglas e91e112d61 Merge pull request #1 from lpereira/master
Clean up/optimize avxjudge
2018-06-29 14:09:29 -07:00
Leandro Pereira 9c04fe6028 avxjudge: Use more efficient method to determine if reg is a high register
Use the `endswith()` from string objects to determine if any of the
register names ends with `mm16`..`mm31`.

Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2018-06-29 13:59:09 -07:00
Leandro Pereira be7a4d7566 avxjudge: Speed up instruction lookup by using sets instead of lists
Python's `in` operator are translated to a hash table lookup in Python;
it's more efficient than using it with lists or tuples.  Modify the
instruction tables to use sets instead.

Also changes how the instruction tables are initialized; initializing
them using this syntax is slighly more efficient.

Analyzing the libc library on my system went from 3.40s to 2.61s with
this change alone.

Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2018-06-29 13:58:43 -07:00
Thiago Macieira 3ef098476e Initial import of the Clear Linux set of AVX build tools
avxjudge.py: used automatically by the RPM scripts to heuristically
determine whether a library or plugin created with AVX2 or AVX512
support is worth keeping.

clr-avx-move.pl: inserted into RPM builds by Autospec to move the
libraries and plugins to their correct locations.

clr-python-avx2 and clr-python-avx512: wrappers for avxjudge.py.

Signed-off-by: Thiago Macieira <thiago.macieira@intel.com>
v1
2018-06-29 13:16:44 -07:00