20 Commits

Author SHA1 Message Date
Aiden Grossman
99ea357f7b
[MLGO] Fix logging verbosity in scripts (#107818)
This patch fixes issues related to logging verbosity in the MLGO python
scripts. This was an oversight when converting from absl.logging to the
python logging API as absl natively supports a --verbosity flag to set
the desired logging level. This patch adds a flag to support similar
functionality in Python's logging library and additionally updates
docstrings where relevant to point to the new values.
2024-09-09 11:34:53 -07:00
Aiden Grossman
02fff933d0 [MLGO] Remove unused imports
Remove unused imports from python files in the MLGO library.
2024-09-09 18:28:59 +00:00
Aiden Grossman
d5f6f30664 [MLGO] Add spaces at the end of lines in multiline string
This patch adds spaces at the end of lines in multiline strings in the
extract_ir script. Without this patch, the warning/info messages will be
printed without spaces between words when there is a line break in the
source which looks/reads weird.
2024-09-09 07:49:54 +00:00
Aiden Grossman
eb90ac508b [MLGO] Bump MLGO utils version to 20
This patch bumps the MLGO utilities python package version to v20 in
sync with the rest of the project. This should be automated later in the
version update script, but this needs to be updated even while a patch
for that lands.
2024-07-23 19:21:42 +00:00
Aiden Grossman
0e986e395f [MLGO] Fix MLGO executable scripts
The MLGO executable scripts were previously set up incorrectly with the
entrypoints. This patch corrects the entrypoints so that the scripts
work as expected rather than throwing import errors in the wrapper.
2024-07-18 06:02:49 +00:00
Aiden Grossman
ceaaa19238 [MLGO] Adjust mlgo-utils versioning to match Pypi
This patch adjusts the versioning/package name for mlgo-utils to match
what is on Pypi. I did this before because we uploaded a package before
the 18 branch, but apparently never committed the changes.

We will have to special case actual releases in the future, but for now
development versions are fine.
2024-07-08 21:16:25 +00:00
Aiden Grossman
5c71f3017a [MLGO] Drop outdated comment in mlgo-utils README
The mlgo-utils README contained a comment about a deviation in the
python version requirement for itself and the rest of the project. Now
that the global LLVM minimum python version is 3.8, this comment is no
longer valid so remove it.
2024-07-08 20:53:28 +00:00
Aiden Grossman
96c61f4304 [MLGO] Drop Python version cap for mlgo-utils
This patch drops the python version cap for mlgo-utils. I have validated
that everything works as expected in Python 3.12, and we have no
dependencies when the library is used, so we should be fairly resiliant
against changes in Python.
2024-07-08 20:53:27 +00:00
Aiden Grossman
4134b33c6a
[MLGO] Add ability to extract IR from bazel using aquery (#96964)
This patch adds in support for extracting IR from binaries built with
bazel through querying the linker command line using bazel aquery.
2024-06-27 14:28:02 -07:00
Aiden Grossman
d3ca779d72
[MLGO] Remove python-38 flag from tests (#96961)
Previously, we had a python-38 flag for the mlgo-utils tests as they
needed a python version higher than what LLVM required by default due to
type annotations. Now that LLVM's default Python version minimum is 3.8,
we can remove this flag.
2024-06-27 13:52:11 -07:00
Michael Kruse
4ecbfacf9e
[llvm] Revise IDE folder structure (#89741)
Update the folder titles for targets in the monorepository that have not
seen taken care of for some time. These are the folders that targets are
organized in Visual Studio and XCode
(`set_property(TARGET <target> PROPERTY FOLDER "<title>")`)
when using the respective CMake's IDE generator.

 * Ensure that every target is in a folder
 * Use a folder hierarchy with each LLVM subproject as a top-level folder
 * Use consistent folder names between subprojects
 * When using target-creating functions from AddLLVM.cmake, automatically
deduce the folder. This reduces the number of
`set_property`/`set_target_property`, but are still necessary when
`add_custom_target`, `add_executable`, `add_library`, etc. are used. A
LLVM_SUBPROJECT_TITLE definition is used for that in each subproject's
root CMakeLists.txt.
2024-05-25 13:28:30 +02:00
Aiden Grossman
1f13203029 [MLGO] Bump mlgo-utils version to 19.0.0
This patch bumps the mlgo-utils version to 19.0.0 as 18.0.0 got branched
recently.
2024-01-27 00:24:28 -08:00
Aiden Grossman
2b25e40a88 [MLGO] Switch test to invoke pytype through python
Currently this test is assuming that ~/.local/bin (or wherever the
Python binaries are installed to) is on the path. This is not a valid
assumption in most cases, and it also means we might not find the
version of pytype associated with the Python interpreter being used to
test LLVM, which could create some inconsistencies. This patch fixes
that by invoking pytype through the Python interpreter passed to lit.
2024-01-26 21:46:21 +00:00
Aiden Grossman
e4afffbe8c
[MLGO] Add pytype test (#79558)
This patch adds a pytype test to the mlgo-utils lit test suite to
prevent regressions in typing while we wait to setup precommit CI for
this specific project.

This is somewhat hacky, but is a temporary fix and will be pulled out
soonish. It also should only impact the ML buildbots as they are the
only ones that should have `pytype` installed.
2024-01-26 12:24:15 -08:00
Aiden Grossman
b54e919573 [MLGO] Fix make_corpus_script.test
This test is currently failing as the order that the files end up in the
corpus description is somewhat dependent upon platform and the check is
checking for a specific order. This patch switches to using the
CHECK-DAG directive to make the checks order invariant to fix the broken
bots.
2024-01-21 23:20:56 +00:00
Aiden Grossman
120e062377
[MLGO] Remove absl dependency from scripts (#78880)
This patch removes the absl dependency from the mlgo-utils scripts. We
were only using absl.logging, and absl.flags, so this patch just
consists of mechanically converting the absl flags parsing to Python's
builtin argparse as Python's logging is a drop in replacement for
absl.logging.
2024-01-21 15:06:58 -08:00
Aiden Grossman
c71956d760
[MLGO] Add tests for scripts (#78878)
This patch adds integration tests for the script entry points. The tests
don't exercise all functionality, as that case is better covered by the
unit testing already checked in. This ensures that things like flag
parsing work and that the scripts are syntactically valid.
2024-01-21 14:49:45 -08:00
Aiden Grossman
a70d3101ba [MLGO] Disable mlgo-utils tests on Windows builders
This patch disables the mlgo-utils tests on Windows builders. MLGO is
not currently supported on Windows.

These tests were failing as some of them look for specific file paths
and the path conventions are different between Linux and Windows.
2024-01-21 03:54:25 +00:00
Aiden Grossman
39f1ca522b [MLGO] Remove absl dep from libraries
The library files in the new mlgo-utils utilities folder only depend on
absl.logging. The builtin Python logging library is a direct drop-in
replacement here, so we can just change the include and drop the test
dependency.
2024-01-21 03:33:15 +00:00
Aiden Grossman
a387bce4bc
[MLGO] Upstream the corpus extraction tooling (#72319)
This patch upstreams some of the MLGO utilities, particularly the corpus
extraction tooling, into LLVM proper. The motivation for this patch is
available in the RFC.


https://discourse.llvm.org/t/rfc-upstreaming-elements-of-the-mlgo-tooling/74939
2024-01-19 17:23:51 -08:00