Bump llvm-project to f4f8a67aaf13bc66a2b7d55561b14a3724a5e0de.

* Incorporates source fixes.
* Uses upstream pybind11 detection logic.
* Patches CI.
* This may break the CI, which will need to be fixed manually in a followup.
pull/124/head
Stella Laurenzo 2020-11-22 13:01:15 -08:00
parent 45ca371129
commit f03225b1f1
6 changed files with 42 additions and 18 deletions

View File

@ -15,12 +15,9 @@ jobs:
uses: actions/checkout@v2 uses: actions/checkout@v2
with: with:
submodules: 'true' submodules: 'true'
- name: Install pytest - name: Install python depends
run: | run: |
pip3 install pytest pip3 install pytest pybind11
- name: Install pybind11
run: |
sudo apt-get install python3-pybind11
- name: Get LLVM Hash - name: Get LLVM Hash
id: get-llvm-hash id: get-llvm-hash
run: echo "::set-output name=hash::$(git submodule status)" run: echo "::set-output name=hash::$(git submodule status)"
@ -50,12 +47,9 @@ jobs:
uses: actions/checkout@v2 uses: actions/checkout@v2
with: with:
submodules: 'true' submodules: 'true'
- name: Install pytest - name: Install python depends
run: | run: |
pip3 install pytest pip3 install pytest pybind11
- name: Install pybind11
run: |
sudo apt-get install python3-pybind11
- name: Get LLVM Hash - name: Get LLVM Hash
id: get-llvm-hash id: get-llvm-hash
run: echo "::set-output name=hash::$(git submodule status)" run: echo "::set-output name=hash::$(git submodule status)"

View File

@ -81,6 +81,7 @@ include(AddLLVM)
include(AddMLIR) include(AddMLIR)
include(AddNPCOMP) include(AddNPCOMP)
include(HandleLLVMOptions) include(HandleLLVMOptions)
include(NpcompDetectPythonEnv)
include(ConfigurePyTorch) include(ConfigurePyTorch)
include_directories(${LLVM_INCLUDE_DIRS}) include_directories(${LLVM_INCLUDE_DIRS})
include_directories(${MLIR_INCLUDE_DIRS}) include_directories(${MLIR_INCLUDE_DIRS})
@ -162,11 +163,9 @@ endif()
# Pybind11 Configuration # Pybind11 Configuration
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
find_package(pybind11 CONFIG REQUIRED) npcomp_detect_pybind11_install()
# TODO: pybind11 v2.6 switched from pybind11_INCLUDE_DIRS (plural) to find_package(pybind11 2.6 CONFIG REQUIRED)
# pybind11_INCLUDE_DIR (singular). A lot has changed in this area since this set(pybind11_INCLUDE_DIR ${pybind11_INCLUDE_DIR})
# was written and overall python config and pybind11 should be modernized.
set(pybind11_INCLUDE_DIR ${pybind11_INCLUDE_DIR} ${pybind11_INCLUDE_DIRS})
message(STATUS "Found pybind11 v${pybind11_VERSION}: ${pybind11_INCLUDE_DIR}") message(STATUS "Found pybind11 v${pybind11_VERSION}: ${pybind11_INCLUDE_DIR}")
message(STATUS "Python prefix = '${PYTHON_MODULE_PREFIX}', " message(STATUS "Python prefix = '${PYTHON_MODULE_PREFIX}', "
"suffix = '${PYTHON_MODULE_SUFFIX}', " "suffix = '${PYTHON_MODULE_SUFFIX}', "

View File

@ -0,0 +1,30 @@
# Forked and adapted from MLIRDetectPythonEnv.cmake upstream. The eventual
# goal is to use the upstream configuration but until that is ready, just
# move/adapt these facilities. Please try to not diverge.
# Macros and functions related to detecting details of the Python environment.
# Detects a pybind11 package installed in the current python environment
# and sets variables to allow it to be found. This allows pybind11 to be
# installed via pip, which typically yields a much more recent version than
# the OS install, which will be available otherwise.
function(npcomp_detect_pybind11_install)
if(pybind11_DIR)
message(STATUS "Using explicit pybind11 cmake directory: ${pybind11_DIR} (-Dpybind11_DIR to change)")
else()
message(CHECK_START "Checking for pybind11 in python path...")
execute_process(
COMMAND "${PYTHON_EXECUTABLE}"
-c "import pybind11;print(pybind11.get_cmake_dir(), end='')"
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
RESULT_VARIABLE STATUS
OUTPUT_VARIABLE PACKAGE_DIR
ERROR_QUIET)
if(NOT STATUS EQUAL "0")
message(CHECK_FAIL "not found (install via 'pip install pybind11' or set pybind11_DIR)")
return()
endif()
message(CHECK_PASS "found (${PACKAGE_DIR})")
set(pybind11_DIR "${PACKAGE_DIR}" PARENT_SCOPE)
endif()
endfunction()

@ -1 +1 @@
Subproject commit 703ef17e7a0a0f51e1d000bb1f71ad437a9933e4 Subproject commit f4f8a67aaf13bc66a2b7d55561b14a3724a5e0de

View File

@ -200,6 +200,7 @@ static FuncOp getATenFn(ModuleOp module, std::string mangledFunctionName,
if (!fn) { if (!fn) {
fn = FuncOp::create(builder.getUnknownLoc(), mangledFunctionName, fnTy); fn = FuncOp::create(builder.getUnknownLoc(), mangledFunctionName, fnTy);
fn.setVisibility(SymbolTable::Visibility::Private);
module.push_back(fn); module.push_back(fn);
} }

View File

@ -30,7 +30,7 @@ class DialectHelper(_BaseDialectHelper):
>>> h.builder.insert_block_start(m.first_block) >>> h.builder.insert_block_start(m.first_block)
>>> _ = h.basicpy_singleton_op(h.basicpy_NoneType) >>> _ = h.basicpy_singleton_op(h.basicpy_NoneType)
>>> m.to_asm().strip() >>> m.to_asm().strip()
'module {\n %0 = basicpy.singleton : !basicpy.NoneType\n}' 'module {\n %0 = basicpy.singleton : !basicpy.NoneType\n}'
slot_object ops: slot_object ops:
>>> m = c.new_module() >>> m = c.new_module()
@ -39,7 +39,7 @@ class DialectHelper(_BaseDialectHelper):
>>> slot_object = h.basicpy_slot_object_make_op("foobar", v0, v0).result >>> slot_object = h.basicpy_slot_object_make_op("foobar", v0, v0).result
>>> _ = h.basicpy_slot_object_get_op(slot_object, 0) >>> _ = h.basicpy_slot_object_get_op(slot_object, 0)
>>> print(m.to_asm().strip()) >>> print(m.to_asm().strip())
module { module {
%0 = basicpy.singleton : !basicpy.NoneType %0 = basicpy.singleton : !basicpy.NoneType
%1 = basicpy.slot_object_make(%0, %0) -> !basicpy.SlotObject<foobar, !basicpy.NoneType, !basicpy.NoneType> %1 = basicpy.slot_object_make(%0, %0) -> !basicpy.SlotObject<foobar, !basicpy.NoneType, !basicpy.NoneType>
%2 = basicpy.slot_object_get %1[0] : !basicpy.SlotObject<foobar, !basicpy.NoneType, !basicpy.NoneType> %2 = basicpy.slot_object_get %1[0] : !basicpy.SlotObject<foobar, !basicpy.NoneType, !basicpy.NoneType>