diff --git a/mlir/cmake/modules/AddMLIRPython.cmake b/mlir/cmake/modules/AddMLIRPython.cmake index dd5b7093c143..cc9770001ea7 100644 --- a/mlir/cmake/modules/AddMLIRPython.cmake +++ b/mlir/cmake/modules/AddMLIRPython.cmake @@ -35,7 +35,6 @@ function(declare_mlir_python_sources name) if(NOT ARG_ROOT_DIR) set(ARG_ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR}") endif() - set(_install_destination "src/python/${name}") # Process the glob. set(_glob_sources) @@ -51,44 +50,21 @@ function(declare_mlir_python_sources name) # We create a custom target to carry properties and dependencies for # generated sources. - add_library(${name} INTERFACE) + add_custom_target(${name}) set(_file_depends "${ARG_SOURCES}") list(TRANSFORM _file_depends PREPEND "${ARG_ROOT_DIR}/") set_target_properties(${name} PROPERTIES - # Yes: Leading-lowercase property names are load bearing and the recommended - # way to do this: https://gitlab.kitware.com/cmake/cmake/-/issues/19261 - # Note that ROOT_DIR and FILE_DEPENDS are not exported because they are - # only relevant to in-tree uses. - EXPORT_PROPERTIES "mlir_python_SOURCES_TYPE;mlir_python_DEST_PREFIX;mlir_python_DEST_PREFIX;mlir_python_SOURCES;mlir_python_DEPENDS" - mlir_python_SOURCES_TYPE pure - mlir_python_ROOT_DIR "${ARG_ROOT_DIR}" - mlir_python_DEST_PREFIX "${ARG_DEST_PREFIX}" - mlir_python_SOURCES "${ARG_SOURCES}" - mlir_python_FILE_DEPENDS "${_file_depends}" - mlir_python_DEPENDS "" - ) - # Note that an "include" directory has no meaning to such faux targets, - # but it is a CMake supported way to specify a directory search list in a - # way that works both in-tree and out. It has some super powers which are - # not possible to emulate with custom properties (because of the prohibition - # on using generator expressions in exported custom properties and the - # special dispensation for $). - target_include_directories(${name} INTERFACE - "$" - "$" + PYTHON_SOURCES_TYPE pure + PYTHON_ROOT_DIR "${ARG_ROOT_DIR}" + PYTHON_DEST_PREFIX "${ARG_DEST_PREFIX}" + PYTHON_SOURCES "${ARG_SOURCES}" + PYTHON_FILE_DEPENDS "${_file_depends}" + PYTHON_DEPENDS "" ) # Add to parent. if(ARG_ADD_TO_PARENT) - set_property(TARGET ${ARG_ADD_TO_PARENT} APPEND PROPERTY mlir_python_DEPENDS ${name}) - endif() - - # Install. - if(NOT LLVM_INSTALL_TOOLCHAIN_ONLY) - _mlir_python_install_sources( - ${name} "${ARG_ROOT_DIR}" "${_install_destination}" - ${ARG_SOURCES} - ) + set_property(TARGET ${ARG_ADD_TO_PARENT} APPEND PROPERTY PYTHON_DEPENDS ${name}) endif() endfunction() @@ -96,8 +72,6 @@ endfunction() # Declares a buildable python extension from C++ source files. The built # module is considered a python source file and included as everything else. # Arguments: -# ROOT_DIR: Root directory where sources are interpreted relative to. -# Defaults to CMAKE_CURRENT_SOURCE_DIR. # MODULE_NAME: Local import name of the module (i.e. "_mlir"). # ADD_TO_PARENT: Same as for declare_mlir_python_sources. # SOURCES: C++ sources making up the module. @@ -110,75 +84,25 @@ endfunction() function(declare_mlir_python_extension name) cmake_parse_arguments(ARG "" - "ROOT_DIR;MODULE_NAME;ADD_TO_PARENT" + "MODULE_NAME;ADD_TO_PARENT" "SOURCES;PRIVATE_LINK_LIBS;EMBED_CAPI_LINK_LIBS" ${ARGN}) - if(NOT ARG_ROOT_DIR) - set(ARG_ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR}") - endif() - set(_install_destination "src/python/${name}") - - add_library(${name} INTERFACE) + add_custom_target(${name}) set_target_properties(${name} PROPERTIES - # Yes: Leading-lowercase property names are load bearing and the recommended - # way to do this: https://gitlab.kitware.com/cmake/cmake/-/issues/19261 - # Note that ROOT_DIR and FILE_DEPENDS are not exported because they are - # only relevant to in-tree uses. - EXPORT_PROPERTIES "mlir_python_SOURCES_TYPE;mlir_python_EXTENSION_MODULE_NAME;mlir_python_CPP_SOURCES;mlir_python_PRIVATE_LINK_LIBS;mlir_python_EMBED_CAPI_LINK_LIBS;mlir_python_DEPENDS" - mlir_python_SOURCES_TYPE extension - mlir_python_ROOT_DIR "${ARG_ROOT_DIR}" - mlir_python_EXTENSION_MODULE_NAME "${ARG_MODULE_NAME}" - mlir_python_CPP_SOURCES "${ARG_SOURCES}" - mlir_python_PRIVATE_LINK_LIBS "${ARG_PRIVATE_LINK_LIBS}" - mlir_python_EMBED_CAPI_LINK_LIBS "${ARG_EMBED_CAPI_LINK_LIBS}" - mlir_python_FILE_DEPENDS "" - mlir_python_DEPENDS "" - ) - # Note that an "include" directory has no meaning to such faux targets, - # but it is a CMake supported way to specify an install-prefix relative - # directory. It has some super powers which are not possible to emulate - # with custom properties (because of the prohibition on using generator - # expressions in exported custom properties and the special dispensation - # for $ and $). On imported targets, - # this is used as a single value, not as a list, so it must only have one - # item in it. - target_include_directories(${name} INTERFACE - "$" + PYTHON_SOURCES_TYPE extension + PYTHON_EXTENSION_MODULE_NAME "${ARG_MODULE_NAME}" + PYTHON_CPP_SOURCES "${ARG_SOURCES}" + PYTHON_PRIVATE_LINK_LIBS "${ARG_PRIVATE_LINK_LIBS}" + PYTHON_EMBED_CAPI_LINK_LIBS "${ARG_EMBED_CAPI_LINK_LIBS}" + PYTHON_FILE_DEPENDS "" + PYTHON_DEPENDS "" ) # Add to parent. if(ARG_ADD_TO_PARENT) - set_property(TARGET ${ARG_ADD_TO_PARENT} APPEND PROPERTY mlir_python_DEPENDS ${name}) + set_property(TARGET ${ARG_ADD_TO_PARENT} APPEND PROPERTY PYTHON_DEPENDS ${name}) endif() - - # Install. - if(NOT LLVM_INSTALL_TOOLCHAIN_ONLY) - _mlir_python_install_sources( - ${name} "${ARG_ROOT_DIR}" "src/python/${name}" - ${ARG_SOURCES} - ) - endif() -endfunction() - -function(_mlir_python_install_sources name source_root_dir destination) - foreach(source_relative_path ${ARGN}) - # Transform "a/b/c.py" -> "${install_prefix}/a/b" for installation. - get_filename_component( - dest_relative_path "${source_relative_path}" DIRECTORY - BASE_DIR "${source_root_dir}" - ) - install( - FILES "${source_root_dir}/${source_relative_path}" - DESTINATION "${destination}/${dest_relative_path}" - COMPONENT "${name}" - ) - endforeach() - get_target_export_arg(${name} MLIR export_to_mlirtargets UMBRELLA mlir-libraries) - install(TARGETS ${name} - COMPONENT ${name} - ${export_to_mlirtargets} - ) endfunction() # Function: add_mlir_python_modules @@ -204,26 +128,12 @@ function(add_mlir_python_modules name) ${ARGN}) # Helper to process an individual target. function(_process_target modules_target sources_target) - get_target_property(_source_type ${sources_target} mlir_python_SOURCES_TYPE) - - # The root directory differs based on whether it is IMPORTED (installed - # dep). - get_target_property(_is_imported ${sources_target} IMPORTED) - if(NOT _is_imported) - # In-tree. - get_target_property(_python_root_dir ${sources_target} mlir_python_ROOT_DIR) - else() - # Imported. - # Note: We only populate a single directory in - # INTERFACE_INCLUDE_DIRECTORIES, so we can get away with just using it - # as a single value. - get_target_property(_python_root_dir ${sources_target} INTERFACE_INCLUDE_DIRECTORIES) - endif() - + get_target_property(_source_type ${sources_target} PYTHON_SOURCES_TYPE) if(_source_type STREQUAL "pure") # Pure python sources to link into the tree. - get_target_property(_python_sources ${sources_target} mlir_python_SOURCES) - get_target_property(_specified_dest_prefix ${sources_target} mlir_python_DEST_PREFIX) + get_target_property(_python_root_dir ${sources_target} PYTHON_ROOT_DIR) + get_target_property(_python_sources ${sources_target} PYTHON_SOURCES) + get_target_property(_specified_dest_prefix ${sources_target} PYTHON_DEST_PREFIX) foreach(_source_relative_path ${_python_sources}) set(_dest_relative_path "${_source_relative_path}") if(_specified_dest_prefix) @@ -252,11 +162,9 @@ function(add_mlir_python_modules name) endforeach() elseif(_source_type STREQUAL "extension") # Native CPP extension. - get_target_property(_module_name ${sources_target} mlir_python_EXTENSION_MODULE_NAME) - get_target_property(_cpp_sources ${sources_target} mlir_python_CPP_SOURCES) - get_target_property(_private_link_libs ${sources_target} mlir_python_PRIVATE_LINK_LIBS) - # Transform relative source to based on root dir. - list(TRANSFORM _cpp_sources PREPEND "${_python_root_dir}/") + get_target_property(_module_name ${sources_target} PYTHON_EXTENSION_MODULE_NAME) + get_target_property(_cpp_sources ${sources_target} PYTHON_CPP_SOURCES) + get_target_property(_private_link_libs ${sources_target} PYTHON_PRIVATE_LINK_LIBS) set(_extension_target "${name}.extension.${_module_name}.dso") add_mlir_python_extension(${_extension_target} "${_module_name}" INSTALL_COMPONENT ${modules_target} @@ -279,10 +187,8 @@ function(add_mlir_python_modules name) # Collect dependencies. set(_depends) foreach(sources_target ${_flat_targets}) - get_target_property(_local_depends ${sources_target} mlir_python_FILE_DEPENDS) - if(_local_depends) - list(APPEND _depends ${_local_depends}) - endif() + get_target_property(_local_depends ${sources_target} PYTHON_FILE_DEPENDS) + list(APPEND _depends ${_local_depends}) endforeach() # Build the modules target. @@ -428,7 +334,7 @@ function(add_mlir_python_common_capi_library name) set(_embed_libs ${ARG_EMBED_LIBS}) _flatten_mlir_python_targets(_all_source_targets ${ARG_DECLARED_SOURCES}) foreach(t ${_all_source_targets}) - get_target_property(_local_embed_libs ${t} mlir_python_EMBED_CAPI_LINK_LIBS) + get_target_property(_local_embed_libs ${t} PYTHON_EMBED_CAPI_LINK_LIBS) if(_local_embed_libs) list(APPEND _embed_libs ${_local_embed_libs}) endif() @@ -466,8 +372,8 @@ endfunction() function(_flatten_mlir_python_targets output_var) set(_flattened) foreach(t ${ARGN}) - get_target_property(_source_type ${t} mlir_python_SOURCES_TYPE) - get_target_property(_depends ${t} mlir_python_DEPENDS) + get_target_property(_source_type ${t} PYTHON_SOURCES_TYPE) + get_target_property(_depends ${t} PYTHON_DEPENDS) if(_source_type) list(APPEND _flattened "${t}") if(_depends) diff --git a/mlir/cmake/modules/MLIRConfig.cmake.in b/mlir/cmake/modules/MLIRConfig.cmake.in index 9f70647b6a00..93ca16230c85 100644 --- a/mlir/cmake/modules/MLIRConfig.cmake.in +++ b/mlir/cmake/modules/MLIRConfig.cmake.in @@ -10,7 +10,6 @@ set(MLIR_CMAKE_DIR "@MLIR_CONFIG_CMAKE_DIR@") set(MLIR_INCLUDE_DIRS "@MLIR_CONFIG_INCLUDE_DIRS@") set(MLIR_TABLEGEN_EXE "@MLIR_TABLEGEN_EXE@") set(MLIR_INSTALL_AGGREGATE_OBJECTS "@MLIR_INSTALL_AGGREGATE_OBJECTS@") -set(MLIR_ENABLE_BINDINGS_PYTHON "@MLIR_ENABLE_BINDINGS_PYTHON@") # For mlir_tablegen() set(MLIR_INCLUDE_DIR "@MLIR_INCLUDE_DIR@") diff --git a/mlir/examples/standalone/CMakeLists.txt b/mlir/examples/standalone/CMakeLists.txt index 3c6d5d0e7be8..fc42e3e5aba4 100644 --- a/mlir/examples/standalone/CMakeLists.txt +++ b/mlir/examples/standalone/CMakeLists.txt @@ -20,12 +20,6 @@ include(TableGen) include(AddLLVM) include(AddMLIR) include(HandleLLVMOptions) -include(MLIRDetectPythonEnv) - -if(MLIR_ENABLE_BINDINGS_PYTHON) - include(MLIRDetectPythonEnv) - mlir_configure_python_dev_packages() -endif() include_directories(${LLVM_INCLUDE_DIRS}) include_directories(${MLIR_INCLUDE_DIRS}) @@ -36,10 +30,6 @@ add_definitions(${LLVM_DEFINITIONS}) add_subdirectory(include) add_subdirectory(lib) -if(MLIR_ENABLE_BINDINGS_PYTHON) - message(STATUS "Enabling Python API") - add_subdirectory(python) -endif() add_subdirectory(test) add_subdirectory(standalone-opt) add_subdirectory(standalone-translate) diff --git a/mlir/examples/standalone/include/Standalone/StandaloneOps.td b/mlir/examples/standalone/include/Standalone/StandaloneOps.td index 3cf0310bcab0..19c7dab3d801 100644 --- a/mlir/examples/standalone/include/Standalone/StandaloneOps.td +++ b/mlir/examples/standalone/include/Standalone/StandaloneOps.td @@ -9,7 +9,7 @@ #ifndef STANDALONE_OPS #define STANDALONE_OPS -include "Standalone/StandaloneDialect.td" +include "StandaloneDialect.td" include "mlir/Interfaces/SideEffectInterfaces.td" def Standalone_FooOp : Standalone_Op<"foo", [NoSideEffect, diff --git a/mlir/examples/standalone/python/CMakeLists.txt b/mlir/examples/standalone/python/CMakeLists.txt deleted file mode 100644 index 014d6061f7f0..000000000000 --- a/mlir/examples/standalone/python/CMakeLists.txt +++ /dev/null @@ -1,58 +0,0 @@ -include(AddMLIRPython) - -# Specifies that all MLIR packages are co-located under the `mlir_standalone` -# top level package (the API has been embedded in a relocatable way). -# TODO: Add an upstream cmake param for this vs having a global here. -add_compile_definitions("MLIR_PYTHON_PACKAGE_PREFIX=mlir_standalone.") - - -################################################################################ -# Sources -################################################################################ - -declare_mlir_python_sources(StandalonePythonSources) - -declare_mlir_dialect_python_bindings( - ADD_TO_PARENT StandalonePythonSources - ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/mlir_standalone" - TD_FILE dialects/StandaloneOps.td - SOURCES - dialects/standalone.py - DIALECT_NAME standalone) - -declare_mlir_python_extension(StandalonePythonSources.Extension - MODULE_NAME _standaloneDialects - ADD_TO_PARENT StandalonePythonSources - SOURCES - StandaloneExtension.cpp - EMBED_CAPI_LINK_LIBS - StandaloneCAPI -) - -################################################################################ -# Common CAPI -################################################################################ - -add_mlir_python_common_capi_library(StandalonePythonCAPI - INSTALL_COMPONENT StandalonePythonModules - INSTALL_DESTINATION python_packages/standalone/mlir_standalone/_mlir_libs - OUTPUT_DIRECTORY "${MLIR_BINARY_DIR}/python_packages/standalone/mlir_standalone/_mlir_libs" - RELATIVE_INSTALL_ROOT "../../../.." - DECLARED_SOURCES - StandalonePythonSources - MLIRPythonSources.Core -) - -################################################################################ -# Instantiation of all Python modules -################################################################################ - -add_mlir_python_modules(StandalonePythonModules - ROOT_PREFIX "${MLIR_BINARY_DIR}/python_packages/standalone/mlir_standalone" - INSTALL_PREFIX "python_packages/standalone/mlir_standalone" - DECLARED_SOURCES - StandalonePythonSources - MLIRPythonSources - COMMON_CAPI_LINK_LIBS - StandalonePythonCAPI - ) diff --git a/mlir/examples/standalone/python/StandaloneExtension.cpp b/mlir/examples/standalone/python/StandaloneExtension.cpp deleted file mode 100644 index 4c2043ad0aa7..000000000000 --- a/mlir/examples/standalone/python/StandaloneExtension.cpp +++ /dev/null @@ -1,31 +0,0 @@ -//===- StandaloneExtension.cpp - Extension module -------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#include "Standalone-c/Dialects.h" -#include "mlir/Bindings/Python/PybindAdaptors.h" - -namespace py = pybind11; -using namespace mlir::python::adaptors; - -PYBIND11_MODULE(_standaloneDialects, m) { - //===--------------------------------------------------------------------===// - // standalone dialect - //===--------------------------------------------------------------------===// - auto standalone_m = m.def_submodule("standalone"); - - standalone_m.def( - "register_dialect", - [](MlirContext context, bool load) { - MlirDialectHandle handle = mlirGetDialectHandle__standalone__(); - mlirDialectHandleRegisterDialect(handle, context); - if (load) { - mlirDialectHandleLoadDialect(handle, context); - } - }, - py::arg("context") = py::none(), py::arg("load") = true); -} diff --git a/mlir/examples/standalone/python/mlir_standalone/dialects/StandaloneOps.td b/mlir/examples/standalone/python/mlir_standalone/dialects/StandaloneOps.td deleted file mode 100644 index 6cfa6b7aba3e..000000000000 --- a/mlir/examples/standalone/python/mlir_standalone/dialects/StandaloneOps.td +++ /dev/null @@ -1,15 +0,0 @@ -//===-- StandaloneOps.td - Python bindings for standalone --*- tablegen -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===---------------------------------------------------------------------===// - -#ifndef PYTHON_BINDINGS_STANDALONE_OPS -#define PYTHON_BINDINGS_STANDALONE_OPS - -include "mlir/Bindings/Python/Attributes.td" -include "Standalone/StandaloneOps.td" - -#endif diff --git a/mlir/examples/standalone/python/mlir_standalone/dialects/standalone.py b/mlir/examples/standalone/python/mlir_standalone/dialects/standalone.py deleted file mode 100644 index c958b2ac1936..000000000000 --- a/mlir/examples/standalone/python/mlir_standalone/dialects/standalone.py +++ /dev/null @@ -1,6 +0,0 @@ -# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -# See https://llvm.org/LICENSE.txt for license information. -# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - -from ._standalone_ops_gen import * -from .._mlir_libs._standaloneDialects.standalone import * diff --git a/mlir/examples/standalone/test/CMakeLists.txt b/mlir/examples/standalone/test/CMakeLists.txt index 1405c981efa4..50327ffef21e 100644 --- a/mlir/examples/standalone/test/CMakeLists.txt +++ b/mlir/examples/standalone/test/CMakeLists.txt @@ -1,7 +1,3 @@ -llvm_canonicalize_cmake_booleans( - MLIR_ENABLE_BINDINGS_PYTHON -) - configure_lit_site_cfg( ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.py.in ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg.py diff --git a/mlir/examples/standalone/test/lit.cfg.py b/mlir/examples/standalone/test/lit.cfg.py index 96dbd3159263..1f600a611845 100644 --- a/mlir/examples/standalone/test/lit.cfg.py +++ b/mlir/examples/standalone/test/lit.cfg.py @@ -56,12 +56,7 @@ tool_dirs = [config.standalone_tools_dir, config.llvm_tools_dir] tools = [ 'standalone-capi-test', 'standalone-opt', - 'standalone-translate', - ToolSubst('%PYTHON', config.python_executable, unresolved='ignore'), + 'standalone-translate' ] llvm_config.add_tool_substitutions(tools, tool_dirs) - -llvm_config.with_environment('PYTHONPATH', [ - os.path.join(config.mlir_binary_dir, 'python_packages', 'standalone'), -], append_path=True) diff --git a/mlir/examples/standalone/test/lit.site.cfg.py.in b/mlir/examples/standalone/test/lit.site.cfg.py.in index f2c9e76f46ea..26fb8aab87f6 100644 --- a/mlir/examples/standalone/test/lit.site.cfg.py.in +++ b/mlir/examples/standalone/test/lit.site.cfg.py.in @@ -12,9 +12,7 @@ config.llvm_shlib_dir = "@SHLIBDIR@" config.llvm_shlib_ext = "@SHLIBEXT@" config.llvm_exe_ext = "@EXEEXT@" config.lit_tools_dir = "@LLVM_LIT_TOOLS_DIR@" -config.mlir_binary_dir = "@MLIR_BINARY_DIR@" -config.python_executable = "@Python3_EXECUTABLE@" -config.enable_bindings_python = @MLIR_ENABLE_BINDINGS_PYTHON@ +config.python_executable = "@PYTHON_EXECUTABLE@" config.gold_executable = "@GOLD_EXECUTABLE@" config.ld64_executable = "@LD64_EXECUTABLE@" config.enable_shared = @ENABLE_SHARED@ diff --git a/mlir/examples/standalone/test/python/lit.local.cfg b/mlir/examples/standalone/test/python/lit.local.cfg deleted file mode 100644 index b70b9d7a34fd..000000000000 --- a/mlir/examples/standalone/test/python/lit.local.cfg +++ /dev/null @@ -1,4 +0,0 @@ -config.suffixes.add('.py') - -if not config.enable_bindings_python: - config.unsupported = True diff --git a/mlir/examples/standalone/test/python/smoketest.py b/mlir/examples/standalone/test/python/smoketest.py deleted file mode 100644 index 29d1e3b5e4ef..000000000000 --- a/mlir/examples/standalone/test/python/smoketest.py +++ /dev/null @@ -1,17 +0,0 @@ -# RUN: %PYTHON %s | FileCheck %s - -from mlir_standalone.ir import * -from mlir_standalone.dialects import ( - builtin as builtin_d, - standalone as standalone_d -) - -with Context(): - standalone_d.register_dialect() - module = Module.parse(""" - %0 = constant 2 : i32 - %1 = standalone.foo %0 : i32 - """) - # CHECK: %[[C:.*]] = constant 2 : i32 - # CHECK: standalone.foo %[[C]] : i32 - print(str(module)) diff --git a/mlir/python/CMakeLists.txt b/mlir/python/CMakeLists.txt index 644530f0e379..6a49c773e8fe 100644 --- a/mlir/python/CMakeLists.txt +++ b/mlir/python/CMakeLists.txt @@ -174,26 +174,18 @@ set(PYTHON_SOURCE_DIR "${MLIR_SOURCE_DIR}/lib/Bindings/Python") declare_mlir_python_extension(MLIRPythonExtension.Core MODULE_NAME _mlir ADD_TO_PARENT MLIRPythonSources.Core - ROOT_DIR "${PYTHON_SOURCE_DIR}" SOURCES - DialectLinalg.cpp # TODO: Break this out. - DialectSparseTensor.cpp # TODO: Break this out. - MainModule.cpp - IRAffine.cpp - IRAttributes.cpp - IRCore.cpp - IRInterfaces.cpp - IRModule.cpp - IRTypes.cpp - PybindUtils.cpp - Pass.cpp - - # Headers must be included explicitly so they are installed. - Dialects.h - Globals.h - IRModule.h - Pass.h - PybindUtils.h + ${PYTHON_SOURCE_DIR}/DialectLinalg.cpp # TODO: Break this out. + ${PYTHON_SOURCE_DIR}/DialectSparseTensor.cpp # TODO: Break this out. + ${PYTHON_SOURCE_DIR}/MainModule.cpp + ${PYTHON_SOURCE_DIR}/IRAffine.cpp + ${PYTHON_SOURCE_DIR}/IRAttributes.cpp + ${PYTHON_SOURCE_DIR}/IRCore.cpp + ${PYTHON_SOURCE_DIR}/IRInterfaces.cpp + ${PYTHON_SOURCE_DIR}/IRModule.cpp + ${PYTHON_SOURCE_DIR}/IRTypes.cpp + ${PYTHON_SOURCE_DIR}/PybindUtils.cpp + ${PYTHON_SOURCE_DIR}/Pass.cpp PRIVATE_LINK_LIBS LLVMSupport EMBED_CAPI_LINK_LIBS @@ -210,9 +202,8 @@ declare_mlir_python_extension(MLIRPythonExtension.Core declare_mlir_python_extension(MLIRPythonExtension.AllPassesRegistration MODULE_NAME _mlirAllPassesRegistration - ROOT_DIR "${PYTHON_SOURCE_DIR}" SOURCES - AllPassesRegistration.cpp + ${PYTHON_SOURCE_DIR}/AllPassesRegistration.cpp PRIVATE_LINK_LIBS LLVMSupport EMBED_CAPI_LINK_LIBS @@ -223,9 +214,8 @@ declare_mlir_python_extension(MLIRPythonExtension.AllPassesRegistration declare_mlir_python_extension(MLIRPythonExtension.AsyncDialectPasses MODULE_NAME _mlirAsyncPasses ADD_TO_PARENT MLIRPythonSources.Dialects.async_dialect - ROOT_DIR "${PYTHON_SOURCE_DIR}" SOURCES - AsyncPasses.cpp + ${PYTHON_SOURCE_DIR}/AsyncPasses.cpp PRIVATE_LINK_LIBS LLVMSupport EMBED_CAPI_LINK_LIBS @@ -235,9 +225,8 @@ declare_mlir_python_extension(MLIRPythonExtension.AsyncDialectPasses declare_mlir_python_extension(MLIRPythonExtension.Conversions MODULE_NAME _mlirConversions ADD_TO_PARENT MLIRPythonSources.Passes - ROOT_DIR "${PYTHON_SOURCE_DIR}" SOURCES - Conversions/Conversions.cpp + ${PYTHON_SOURCE_DIR}/Conversions/Conversions.cpp PRIVATE_LINK_LIBS LLVMSupport EMBED_CAPI_LINK_LIBS @@ -247,9 +236,8 @@ declare_mlir_python_extension(MLIRPythonExtension.Conversions declare_mlir_python_extension(MLIRPythonExtension.ExecutionEngine MODULE_NAME _mlirExecutionEngine ADD_TO_PARENT MLIRPythonSources.ExecutionEngine - ROOT_DIR "${PYTHON_SOURCE_DIR}" SOURCES - ExecutionEngineModule.cpp + ${PYTHON_SOURCE_DIR}/ExecutionEngineModule.cpp PRIVATE_LINK_LIBS LLVMSupport EMBED_CAPI_LINK_LIBS @@ -259,9 +247,8 @@ declare_mlir_python_extension(MLIRPythonExtension.ExecutionEngine declare_mlir_python_extension(MLIRPythonExtension.GPUDialectPasses MODULE_NAME _mlirGPUPasses ADD_TO_PARENT MLIRPythonSources.Dialects.gpu - ROOT_DIR "${PYTHON_SOURCE_DIR}" SOURCES - GPUPasses.cpp + ${PYTHON_SOURCE_DIR}/GPUPasses.cpp PRIVATE_LINK_LIBS LLVMSupport EMBED_CAPI_LINK_LIBS @@ -271,9 +258,8 @@ declare_mlir_python_extension(MLIRPythonExtension.GPUDialectPasses declare_mlir_python_extension(MLIRPythonExtension.LinalgPasses MODULE_NAME _mlirLinalgPasses ADD_TO_PARENT MLIRPythonSources.Dialects.linalg - ROOT_DIR "${PYTHON_SOURCE_DIR}" SOURCES - LinalgPasses.cpp + ${PYTHON_SOURCE_DIR}/LinalgPasses.cpp PRIVATE_LINK_LIBS LLVMSupport EMBED_CAPI_LINK_LIBS @@ -283,9 +269,8 @@ declare_mlir_python_extension(MLIRPythonExtension.LinalgPasses declare_mlir_python_extension(MLIRPythonExtension.SparseTensorDialectPasses MODULE_NAME _mlirSparseTensorPasses ADD_TO_PARENT MLIRPythonSources.Dialects.sparse_tensor - ROOT_DIR "${PYTHON_SOURCE_DIR}" SOURCES - SparseTensorPasses.cpp + ${PYTHON_SOURCE_DIR}/SparseTensorPasses.cpp PRIVATE_LINK_LIBS LLVMSupport EMBED_CAPI_LINK_LIBS @@ -295,9 +280,8 @@ declare_mlir_python_extension(MLIRPythonExtension.SparseTensorDialectPasses declare_mlir_python_extension(MLIRPythonExtension.Transforms MODULE_NAME _mlirTransforms ADD_TO_PARENT MLIRPythonSources.Passes - ROOT_DIR "${PYTHON_SOURCE_DIR}" SOURCES - Transforms/Transforms.cpp + ${PYTHON_SOURCE_DIR}/Transforms/Transforms.cpp PRIVATE_LINK_LIBS LLVMSupport EMBED_CAPI_LINK_LIBS diff --git a/mlir/test/Examples/standalone/test.toy b/mlir/test/Examples/standalone/test.toy index 02385f28ead0..2e5c4cd575e6 100644 --- a/mlir/test/Examples/standalone/test.toy +++ b/mlir/test/Examples/standalone/test.toy @@ -1,6 +1,4 @@ # RUN: %cmake %mlir_src_root/examples/standalone -DCMAKE_CXX_COMPILER=%host_cxx -DCMAKE_C_COMPILER=%host_cc -DLLVM_ENABLE_LIBCXX=%enable_libcxx -DMLIR_DIR=%mlir_cmake_dir ; %cmake --build . --target check-standalone | tee %t | FileCheck %s -# Note: The number of checked tests is not important. The command will fail -# if any fail. -# CHECK: Passed +# CHECK: Passed: 4 # UNSUPPORTED: windows, android