This is an archive of the discontinued LLVM Phabricator instance.

[mlir] Add option to control python search priming
ClosedPublic

Authored by rkayaith on Mar 1 2022, 12:50 PM.

Details

Summary

This adds an option to configure the CMake python search priming
behaviour that was introduced in D118148. In some environments the
priming would cause the "real" search to fail. The default behaviour is
unchanged, i.e. the search will be primed.

Diff Detail

Event Timeline

rkayaith created this revision.Mar 1 2022, 12:50 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 1 2022, 12:50 PM

This works around an issues I was seeing with D118148:

I started rebuilding my dev environment to get around this, and it just ended up happening again.
Here's the steps to reproduce: https://gist.github.com/rkayaith/1368238ceabf5c0c255528a0eba2e0c0
I ran that script on a live Ubuntu 20.04 USB:

$ sudo add-apt-repository universe
$ sudo apt install -y curl
$ sudo -s
$ curl https://gist.githubusercontent.com/rkayaith/1368238ceabf5c0c255528a0eba2e0c0/raw/mlir_build_2004_pyenv.sh > build.sh
$ source build.sh

Which results in the following error:

-- Could NOT find Python3 (missing: Python3_INCLUDE_DIRS Development Development.Module Development.Embed) (found suitable version "3.8", minimum required is "3.6")
CMake Error at /usr/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find Python3 (missing: Development.Module NumPy) (found suitable
  version "3.7.10", minimum required is "3.6")
Call Stack (most recent call first):
  /usr/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
  /usr/share/cmake-3.22/Modules/FindPython/Support.cmake:3166 (find_package_handle_standard_args)
  /usr/share/cmake-3.22/Modules/FindPython3.cmake:490 (include)
  /home/ubuntu/llvm-project/mlir/cmake/modules/MLIRDetectPythonEnv.cmake:33 (find_package)
  /home/ubuntu/llvm-project/mlir/CMakeLists.txt:135 (mlir_configure_python_dev_packages)

I've confirmed that applying this patch and building with -DMLIR_DETECT_PYTHON_ENV_PRIME_SEARCH=0 can configure successfully in the environment mentioned above.

rkayaith published this revision for review.Mar 1 2022, 1:25 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 1 2022, 1:25 PM
stellaraccident accepted this revision.Mar 1 2022, 2:47 PM
stellaraccident added inline comments.
mlir/CMakeLists.txt
135

Can you extend the comment a bit with " (this is a temporary measure while we debug Python detection issues on different platforms)".

This revision is now accepted and ready to land.Mar 1 2022, 2:47 PM
This revision was automatically updated to reflect the committed changes.