10 Commits

Author SHA1 Message Date
Smyth, Edward
563b161933 Standardize Python files to use Python 3
Python 2 is no longer maintained, and using python3 avoids accidental invocation of outdated interpreters.

AMD-Internal: [CPUPL-6579]
2025-08-06 12:04:26 +01:00
AngryLoki
ea93d2e2c9 Fix SyntaxWarning messages from python 3.12 (#809)
Details:
- When using regexes in Python, certain characters need backslash escaping, e.g.:
  ```python
  regex = re.compile( '^[\s]*#include (["<])([\w\.\-/]*)([">])' )
  ```
  However, technically escape sequences like `\s` are not valid and should actually be double-escaped: `\\s`.
  Python 3.12 now warns about such escape sequences, and in a later version these warning will be promoted
  to errors. See also: https://docs.python.org/dev/whatsnew/3.12.html#other-language-changes. The fix here
  is to use Python's "raw strings" to avoid double-escaping. This issue can be checked for all files in the current
  directory with the command `python -m compileall -d . -f -q .`
- Thanks to @AngryLoki for the fix.

AMD-Internal: [CPUPL-5895]
Change-Id: I7ab564beef1d1b81e62d985c5cb30ab6b9a937f2
(cherry picked from commit 729c57c15a)
2025-02-05 07:13:42 -05:00
Chandrashekara K R
9f7e5b7dbf CMake: Modified flatten-headers.py file to fix issue observed with ninja on windows.
While build blis library using ninja generator on windows, observed
ninja is randomly adding "|| '(set', 'FAIL_LINE=3&', 'goto', ':ABORT)'"
as extra arguments for add_custom_command. Due to this flatten-headers
python script was failing to create blis.h and cblas.h headers.
Modified the python script to fix above issue.

AMD-Internal: [CPUPL-2748]
Change-Id: I83b753d08e46f94b282176fcc661ce34e5eee3cf
2024-02-29 15:42:02 +05:30
Field G. Van Zee
f205eeab64 Applied forgotten variable rename from 89a70cc.
Details:
- Somehow the variable name change (root_file_name -> root_inputname)
  in flatten-headers.py mentioned in the commit log entry for 89a70cc
  didn't make it into the actual commit. This commit applies that
  change.
2019-08-23 14:18:08 +05:30
Field G. Van Zee
c5b447e785 Minor bugfix to flatten-headers.py.
Details:
- Fixed a minor bug in flatten-headers.py whereby the script, upon
  encountering a #include directive for the root header file, would
  erroneously recurse and inline the conents of that root header.
  The script has been modified to avoid recursion into any headers
  that share the same name as the root-level header that was passed
  into the script. (Note: this bug didn't actually manifest in BLIS,
  so it's merely a precaution for usage of flatten-headers.py in other
  contexts.)
2019-08-23 14:18:08 +05:30
Field G. Van Zee
0645f239fb Remove UT-Austin from copyright headers' clause 3.
Details:
- Removed explicit reference to The University of Texas at Austin in the
  third clause of the license comment blocks of all relevant files and
  replaced it with a more all-encompassing "copyright holder(s)".
- Removed duplicate words ("derived") from a few kernels' license
  comment blocks.
- Homogenized license comment block in kernels/zen/3/bli_gemm_small.c
  with format of all other comment blocks.
2018-12-04 14:31:06 -06:00
Field G. Van Zee
216a4cb9cb Minor update to flatten-headers.[py|sh] help text.
Details:
- Fixed a typo and removed some outdated language from the help text of
  flatten-headers.py and flatten-headers.sh.
2018-05-18 18:47:03 -05:00
Field G. Van Zee
0084531d3e Updated flatten-headers.py for python3.
Details:
- Modifed flatten-headers.py to work with python 3.x. This mostly
  amounted to removing print statements (which I replaced with calls
  to my_print(), a wrapper to sys.stdout.write()). Thanks to Stefan
  Husmann for pointing out the script's incompatibility with python 3.
- Other minor changes/cleanups.
2017-12-17 18:58:25 -06:00
Field G. Van Zee
90b11b79c3 Modest performance boost to flatten-headers.py.
Details:
- Updated flatten-headers.py to pre-compile the main regular expression
  used to isolate #include directives and the header filenames they
  reference. The compiled regex object is then used over and over on
  each header file in the tree of referenced headers. This appears to
  have provided a 1.7-2x performance increase in the best case.
- Other minor tweaks, such as renaming the main recursive function from
  replace_pass() to flatten_header().
2017-12-17 17:34:32 -06:00
Field G. Van Zee
99dee87f30 Reimplemented flatten-headers.sh in python.
Details:
- Added flatten-headers.py, a python implementation of the bash script
  flatten-headers.sh. The new script appears to be 25-100x faster,
  depending on the operating system, filesystem, etc. The python script
  abides by the same command line interface as its predecessor and
  targets python 2.7 or later. (Thanks to Devin Matthews for suggesting
  that I look into a python replacement for higher performance.)
- Activated use of flatten-headers.py in common.mk via the FLATTEN_H
  variable.
- Made minor tweaks to flatten-headers.sh such as spelling corrections
  in comments.
2017-12-17 16:47:27 -06:00