Skip to content

Move llvm-external-projects/iree-compiler-api -> iree/compiler/API. - #8911

Merged
stellaraccident merged 7 commits into
iree-org:mainfrom
stellaraccident:apireorg
Apr 18, 2022
Merged

stellaraccident merged 7 commits into
iree-org:mainfrom
stellaraccident:apireorg

Conversation

@stellaraccident

@stellaraccident stellaraccident commented Apr 18, 2022 •

Copy link
Copy Markdown
Collaborator

Non-functional changes:

  • Relayers the build so that we can simply delegate to the LLVM macros for C/Python API building.
  • Various escalation of include hack battle.
  • Brings the compile_sample_module.py test from a sample which did not run to a real test.
  • Reworks tests to be based on IREE macros (as possible). No more magic.
  • Retired the old build/install locations for this piece: PYTHONPATH=${iree_build}/bindings/python gets everything now.

Functional changes:

  • Since this is "in-tree" now, includes are laid out per the rest of the project. So:
    • #include <iree-compiler-c/Compiler.h> -> #include <iree/compiler/Api/Compiler.h>
  • Adds iree.compiler.transforms.ireec.register_all_dialects(context), needed to make the compile_sample_module.py test work (Fixes IREE Python API does not register LLVMIR translations #8604).
  • iree/compiler/setup.py should now work from both the source and build dir. If using from the latter, it will use in-situ artifacts (will not rebuild).

In a subsequent change, I will do a similar refactoring for the Python runtime API and update user docs. For now the iree/compiler/README.md has instructions for building/installing a Python package from source (we've never had documentation for this, so something > nothing and we can move it around later).

This also opens a path for us to test packaging as part of presubmit, without doing another build. Likewise, we can now generate installable Python binary artifacts and use them in subsequent build/test steps (without another build).

For integration into internal Google, this shouldn't require more than some path changes from llvm-external-projects/iree-compiler-api -> `iree/compiler/API in BUILD files.

Fixes #8597
Progress on #6958
Progress on #3817

Non-functional changes:

* Relayers the build so that we can simply delegate to the LLVM macros for C/Python API building.
* Various escalation of include hack battle.
* Brings the compile_sample_module.py test from a sample which did not run to a real test.
* Reworks tests to be based on IREE macros (as possible). No more magic.
* Retired the old build/install locations for this piece: PYTHONPATH=${iree_build}/bindings/python gets everything now.

Functional changes:

* Since this is "in-tree" now, includes are laid out per the rest of the project. So:
  * `#include <iree-compiler-c/Compiler.h>` -> `#include <iree/compiler/Api/Compiler.h>
* Adds `iree.compiler.transforms.ireec.register_all_dialects(context)`, needed to make the `compile_sample_module.py` test work (Fixes iree-org#8604).
* iree/compiler/setup.py should now work from both the source and build dir. If using from the latter, it will use in-situ artifacts (will not rebuild).

In a subsequent change, I will do a similar refactoring for the Python runtime API and update user docs. For now the iree/compiler/README.md has instructions for building/installing a Python package from source (we've never had documentation for this, so something > nothing and we can move it around later).

For integration into internal Google, this shouldn't require more than some path changes from `llvm-external-projects/iree-compiler-api` -> `iree/compiler/Api` in BUILD files.

Fixes iree-org#8597
Progress on iree-org#6958
Progress on iree-org#3817
@stellaraccident

Copy link
Copy Markdown
Collaborator Author

@powderluv This should make some things easier for you wrt Python building. Now you can use setup.py from the source or build dir to build wheels, etc. Once this is in, I'll do a similar surgery on the runtime wheel.

@benvanik

Copy link
Copy Markdown
Collaborator

Can this please be API to match our existing style in the compiler?

@stellaraccident

Copy link
Copy Markdown
Collaborator Author

Can this please be API to match our existing style in the compiler?

Yeah, np. I never remember how we capitalize acronyms... thought I got it right...

@stellaraccident stellaraccident changed the title Move llvm-external-projects/iree-compiler-api -> iree/compiler/Api. Move llvm-external-projects/iree-compiler-api -> iree/compiler/API. Apr 18, 2022
@stellaraccident

Copy link
Copy Markdown
Collaborator Author

PTAL

@jpienaar jpienaar left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Partial scan/haven't gotten to last couple of files here yet but wanted to send interim feedback to pipeline it.

Comment thread iree/compiler/.gitignore Resolved
Comment thread iree/compiler/Api/BUILD Resolved
Comment thread iree/compiler/Api/CMakeLists.txt Resolved
Comment thread iree/compiler/Api/CMakeLists.txt Resolved
Comment thread iree/compiler/README.md Resolved
Comment thread iree/compiler/setup.py Resolved
@stellaraccident
stellaraccident merged commit 6012859 into iree-org:main Apr 18, 2022
@stellaraccident
stellaraccident deleted the apireorg branch April 18, 2022 04:52
ScottTodd added a commit that referenced this pull request Jun 6, 2022
This list of CMake options was moved into their own file in #8423, for inclusion in `llvm-external-projects/iree-compiler-api/CMakeLists.txt`, which used an "out of tree" build setup. The `llvm-external-projects/iree-compiler-api/` directory was then moved back "in tree" to `iree/compiler/API` in #8911. We can now move the options back into the root file, where they will be easier to read alongside other high level project options.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

IREE Python API does not register LLVMIR translations More llvm-external-projects/iree-compiler-api into the main part of the project

3 participants