diff --git a/.github/workflows/build_test_release_eudsl_tile.yml b/.github/workflows/build_test_release_eudsl_tile.yml new file mode 100644 index 00000000..12c0e52c --- /dev/null +++ b/.github/workflows/build_test_release_eudsl_tile.yml @@ -0,0 +1,332 @@ +# 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 +# Copyright (c) 2024. + +name: "Build, test, release eudsl-tile" + +on: + workflow_dispatch: + inputs: + force_debug_with_tmate: + type: boolean + description: 'Run the build with tmate session' + required: false + default: false + debug_with_tmate: + type: boolean + description: 'Run the build with a tmate session ONLY in case of failure' + required: false + default: false + workflow_call: + inputs: + wheel_version: + description: 'wheel version' + type: string + required: false + default: '' + workflow_call: + description: 'To distinguish workflow_call from regular push' + type: boolean + required: false + default: true + workflow_caller_run_id: + description: '' + type: string + required: false + default: '' + pull_request: + branches: + - main + paths: + - ".github/workflows/build_test_release_eudsl_tile.yml" + - "projects/eudsl-tile/**" + push: + branches: + - main + paths: + - ".github/workflows/build_test_release_eudsl_tile.yml" + - "projects/eudsl-tile/**" + +concurrency: + group: ${{ github.workflow }}-${{ github.event.number || github.sha }}-build_test_release_eudsl_tile + cancel-in-progress: true + +jobs: + build-eudsl-tile: + + strategy: + fail-fast: false + matrix: + include: + - name: "ubuntu_x86_64" + runs-on: "ubuntu-22.04" + os: "ubuntu" + host-arch: "x86_64" + target-arch: "x86_64" + + - name: "ubuntu_aarch64" + runs-on: "ubuntu-22.04-arm" + os: "ubuntu" + host-arch: "aarch64" + target-arch: "aarch64" + + - name: "windows_amd64" + runs-on: "windows-2022" + os: "windows" + host-arch: "amd64" + target-arch: "amd64" + + - name: "macos_arm64" + runs-on: "macos-14" + os: "macos" + host-arch: "arm64" + target-arch: "arm64" + + runs-on: ${{ matrix.runs-on }} + + name: "Build eudsl-tile ${{ matrix.name }}" + + defaults: + run: + shell: bash + + permissions: + id-token: write + contents: write + + env: + # either the PR number or `branch-N` where N always increments + cache-key: eudsl_tile_${{ matrix.name }}_clang_${{ format('{0}-{1}', github.ref_name, github.run_number) }} + + steps: + - name: "Check out repository" + uses: actions/checkout@v4.2.2 + with: + submodules: false + + - name: "Get submodules" + run: git submodule update --init --depth=1 + + - name: "Setup base" + uses: ./.github/actions/setup_base + id: setup_base + with: + cache-key: ${{ env.cache-key }} + restore-key: "eudsl_tile_${{ matrix.name }}_clang" + os: ${{ matrix.os }} + host-arch: ${{ matrix.host-arch }} + target-arch: ${{ matrix.target-arch }} + runs-on: ${{ matrix.runs-on }} + + - name: "Pip download MLIR from releases" + if: ${{ !inputs.workflow_call }} + run: | + + pip download mlir-wheel -f https://llvm.github.io/eudsl + WHEEL_NAME=$(ls mlir_wheel*) + $python3_command -m pip install pkginfo + WHEEL_VERSION=$($python3_command -c "from pkginfo import Wheel; print(Wheel('$WHEEL_NAME').version)") + echo "WHEEL_VERSION=$WHEEL_VERSION" >> $GITHUB_ENV + + - name: Download LLVM distro artifacts + if: ${{ inputs.workflow_call }} + uses: dawidd6/action-download-artifact@v11 + with: + name: mlir_wheel_${{ (matrix.name == 'ubuntu_x86_64' || matrix.name == 'ubuntu_aarch64') && 'manylinux' || matrix.os }}_${{ matrix.target-arch }}_artifact + path: "./" + run_id: ${{ inputs.workflow_caller_run_id }} + + - name: "Set WHEEL_VERSION env var" + if: ${{ inputs.workflow_call }} + run: | + + echo "WHEEL_VERSION=${{ inputs.wheel_version }}" >> $GITHUB_ENV + + - name: "Configure build" + run: | + + unzip -q mlir_wheel*.whl + mv mlir_wheel llvm-install + + if [[ "${{ matrix.os }}" == "ubuntu" ]]; then + echo "LLVM_DIR=/host/$PWD/llvm-install/lib/cmake/llvm" >> $GITHUB_ENV + echo "MLIR_DIR=/host/$PWD/llvm-install/lib/cmake/mlir" >> $GITHUB_ENV + echo "Clang_DIR=/host/$PWD/llvm-install/lib/cmake/clang" >> $GITHUB_ENV + echo "CMAKE_PREFIX_PATH=/host/$PWD/llvm-install" >> $GITHUB_ENV + else + echo "LLVM_DIR=$PWD/llvm-install/lib/cmake/llvm" >> $GITHUB_ENV + echo "MLIR_DIR=$PWD/llvm-install/lib/cmake/mlir" >> $GITHUB_ENV + echo "Clang_DIR=$PWD/llvm-install/lib/cmake/clang" >> $GITHUB_ENV + echo "CMAKE_PREFIX_PATH=$PWD/llvm-install" >> $GITHUB_ENV + fi + + $python3_command -m pip install cibuildwheel + + if [[ "${{ matrix.os }}" == "ubuntu" ]] && [[ "${{ matrix.host-arch }}" == "aarch64" ]]; then + sudo apt-get install libarchive-dev antlr libxml2-dev libxslt-dev libcurl4-openssl-dev + fi + if [[ "${{ matrix.os }}" == "macos" ]]; then + brew install antlr boost libarchive + fi + + - name: "Build eudsl-tile" + run: | + + # combine eudsl-python-extras and eudsl-tile + cp -R "$PWD/projects/eudsl-python-extras/mlir/extras" "$PWD/projects/eudsl-tile/eudsl-tile" + $python3_command -m cibuildwheel "$PWD/projects/eudsl-tile" --output-dir wheelhouse + + - name: Upload artifacts + uses: actions/upload-artifact@v4 + with: + name: eudsl_tile_${{ matrix.name }}_artifact + path: wheelhouse/*.whl + if-no-files-found: error + + - name: "Setup tmate session" + if: (failure() && inputs.debug_with_tmate) || inputs.force_debug_with_tmate + uses: mxschmitt/action-tmate@v3.18 + with: + limit-access-to-actor: true + install-dependencies: ${{ startsWith(matrix.os, 'macos') || startsWith(matrix.os, 'windows') || startsWith(matrix.os, 'ubuntu') }} + + test-eudsl-tile: + + if: github.event_name == 'pull_request' + + needs: [build-eudsl-tile] + + strategy: + fail-fast: false + matrix: + runs-on: [ + "ubuntu-22.04", + "ubuntu-22.04-arm", + "macos-14", + "windows-2022" + ] + python-version: [ + "3.10", "3.11", "3.12", + "3.13", "3.14", "3.14t" + ] + include: [ + {runs-on: "ubuntu-22.04", name: "ubuntu_x86_64", os: "ubuntu"}, + {runs-on: "ubuntu-22.04-arm", name: "ubuntu_aarch64", os: "ubuntu"}, + {runs-on: "windows-2022", name: "windows_amd64", os: "windows"}, + {runs-on: "macos-14", name: "macos_arm64", os: "macos"}, + ] + exclude: + # :491: Warning: Numpy built with MINGW-W64 on Windows 64 bits is experimental, and only available for testing. You are advised not to use it for production. + - runs-on: windows-2022 + python-version: "3.14" + + - runs-on: windows-2022 + python-version: "3.14t" + + - runs-on: macos-14 + python-version: "3.10" + + - runs-on: macos-14 + python-version: "3.11" + + - runs-on: macos-14 + python-version: "3.12" + + - runs-on: macos-14 + python-version: "3.13" + + - runs-on: macos-14 + python-version: "3.14" + + runs-on: ${{ matrix.runs-on }} + + name: "Test eudsl-tile ${{ matrix.name }} ${{ matrix.python-version }}" + + defaults: + run: + shell: bash + + steps: + - name: "Check out repository" + uses: actions/checkout@v4.2.2 + with: + submodules: false + + - name: "Get submodules" + run: git submodule update --init --depth=1 + + - name: "Install Python" + uses: actions/setup-python@v6.0.0 + with: + python-version: "${{ matrix.python-version }}" + + - uses: actions/download-artifact@v4 + with: + name: eudsl_tile_${{ matrix.name }}_artifact + path: wheelhouse + + - name: "Test eudsl-tile" + run: | + + python -m pip install pytest mlir-native-tools -f https://llvm.github.io/eudsl + python -m pytest $PWD/projects/eudsl-tile/tests + + release-eudsl-tile: + + if: (github.event_name == 'push' && github.ref_name == 'main') || github.event_name == 'workflow_dispatch' + + needs: [build-eudsl-tile] + + runs-on: "ubuntu-22.04" + + permissions: + id-token: write + contents: write + + strategy: + fail-fast: false + matrix: + name: [ + "ubuntu_x86_64", + "ubuntu_aarch64", + "ubuntu_wasm32", + "macos_arm64", + "windows_amd64" + ] + + name: "Release eudsl-tile ${{ matrix.name }}" + + steps: + + - uses: actions/download-artifact@v4 + with: + name: eudsl_tile_${{ matrix.name }}_artifact + path: wheelhouse + + - name: Release current commit + uses: ncipollo/release-action@v1.12.0 + with: + artifacts: "wheelhouse/eudsl_tile*.whl" + token: "${{ secrets.GITHUB_TOKEN }}" + tag: eudsl-tile + name: eudsl-tile + removeArtifacts: false + allowUpdates: true + replacesArtifacts: true + makeLatest: true + omitBody: true + + call-deploy-pip-page: + + if: (github.event_name == 'push' && github.ref_name == 'main') || github.event_name == 'workflow_dispatch' + + needs: [release-eudsl-tile] + + permissions: + contents: read + id-token: write + pages: write + + uses: ./.github/workflows/deploy_pip_page.yml + secrets: inherit # pass all secrets diff --git a/.github/workflows/deploy_pip_page.yml b/.github/workflows/deploy_pip_page.yml index b5394042..ef37e6d4 100644 --- a/.github/workflows/deploy_pip_page.yml +++ b/.github/workflows/deploy_pip_page.yml @@ -48,6 +48,8 @@ jobs: wget https://github.com/llvm/eudsl/releases/expanded_assets/eudsl wget https://github.com/llvm/eudsl/releases/expanded_assets/llvm wget https://github.com/llvm/eudsl/releases/expanded_assets/eudsl-python-extras + wget https://github.com/llvm/eudsl/releases/expanded_assets/eudsl-tile + cat mlir-python-bindings eudsl llvm eudsl-python-extras > index.html sed -i.bak 's/\/llvm\/eudsl/https:\/\/github.com\/llvm\/eudsl/g' index.html mkdir -p page && mv index.html page diff --git a/projects/eudsl-python-extras/README.md b/projects/eudsl-python-extras/README.md index ec19335a..8de992c7 100644 --- a/projects/eudsl-python-extras/README.md +++ b/projects/eudsl-python-extras/README.md @@ -169,18 +169,6 @@ jax[cpu] eudsl-python-extras; --config-settings=EUDSL_PYTHON_EXTRAS_HOST_PACKAGE_PREFIX=jaxlib.mlir ``` -or - -```toml -# pyproject.toml -[project] -name = ... -dependencies = [ - "jax[cpu]", - "eudsl-python-extras; --config-settings=EUDSL_PYTHON_EXTRAS_HOST_PACKAGE_PREFIX=jaxlib.mlir" -] -``` - ## Examples/Demo Check [examples](examples) and [tests](tests) for a plethora of example code. diff --git a/projects/eudsl-tile/CMakeLists.txt b/projects/eudsl-tile/CMakeLists.txt new file mode 100644 index 00000000..adf992ed --- /dev/null +++ b/projects/eudsl-tile/CMakeLists.txt @@ -0,0 +1,199 @@ +# 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 +# Copyright (c) 2025. + +cmake_minimum_required(VERSION 3.29) +project(eudsl-tile LANGUAGES CXX C) + +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CMAKE_CXX_EXTENSIONS OFF) + +if(POLICY CMP0068) + cmake_policy(SET CMP0068 NEW) + set(CMAKE_BUILD_WITH_INSTALL_NAME_DIR ON) +endif() + +if(POLICY CMP0075) + cmake_policy(SET CMP0075 NEW) +endif() + +if(POLICY CMP0077) + cmake_policy(SET CMP0077 NEW) +endif() + +if(POLICY CMP0091) + cmake_policy(SET CMP0091 NEW) +endif() + +if(POLICY CMP0116) + cmake_policy(SET CMP0116 NEW) +endif() + +if(POLICY CMP0135) + cmake_policy(SET CMP0116 OLD) +endif() + +if(MSVC OR WIN32) + add_compile_options( + $<$:/MT> # ---------| + $<$:/MTd> # ---|-- Statically link the runtime libraries + $<$:/MT> # --| + ) +endif() + +set(CMAKE_C_VISIBILITY_PRESET "hidden") +set(CMAKE_CXX_VISIBILITY_PRESET "hidden") +set(CMAKE_VISIBILITY_INLINES_HIDDEN ON) + +find_package(MLIR REQUIRED CONFIG) + +message(STATUS "Using MLIRConfig.cmake in: ${MLIR_DIR}") +message(STATUS "Using LLVMConfig.cmake in: ${LLVM_DIR}") + +set(MLIR_BINDINGS_PYTHON_NB_DOMAIN "eudsl_tile" CACHE STRING "") +set(MLIR_PYTHON_PACKAGE_PREFIX "eudsl_tile" CACHE STRING "") + +set(LLVM_RUNTIME_OUTPUT_INTDIR ${CMAKE_CURRENT_BINARY_DIR}/bin) +set(LLVM_LIBRARY_OUTPUT_INTDIR ${CMAKE_CURRENT_BINARY_DIR}/lib) + +list(APPEND CMAKE_MODULE_PATH "${MLIR_CMAKE_DIR}") +list(APPEND CMAKE_MODULE_PATH "${LLVM_CMAKE_DIR}") +include(TableGen) +include(AddLLVM) +include(AddMLIR) +include(AddMLIRPython) +include(MLIRDetectPythonEnv) +include(HandleLLVMOptions) + +include_directories(${LLVM_INCLUDE_DIRS}) +include_directories(${MLIR_INCLUDE_DIRS}) +link_directories(${LLVM_BUILD_LIBRARY_DIR}) +add_definitions(${LLVM_DEFINITIONS}) + +add_compile_definitions("MLIR_PYTHON_PACKAGE_PREFIX=${MLIR_PYTHON_PACKAGE_PREFIX}.") + +mlir_configure_python_dev_packages() + +# This includes eudsl-python-extras +declare_mlir_python_sources(EUDSLTilePythonSources + ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/eudsl_tile" + SOURCES_GLOB "*.py" +) + +set(_ext_sources + # not MLIRPythonExtension.Core, which doesn't depend on MLIRPythonSupport and etc. + MLIRPythonSources.Core + # we register everything even though we don't use all the dialects + # because currently RegisterEverything isn't factored (and probably won't ever be...) + MLIRPythonExtension.RegisterEverything + # other extensions + MLIRPythonExtension.Dialects.GPU.Nanobind + MLIRPythonExtension.Dialects.LLVM.Nanobind + MLIRPythonExtension.Dialects.Linalg.Nanobind + MLIRPythonExtension.Dialects.Transform.Nanobind + MLIRPythonExtension.ExecutionEngine + MLIRPythonExtension.GPUDialectPasses + MLIRPythonExtension.LinalgPasses + MLIRPythonExtension.TransformInterpreter +) + +add_mlir_python_common_capi_library(EUDSLTilePythonCAPI + INSTALL_COMPONENT EUDSLTilePythonModules + INSTALL_DESTINATION eudsl_tile/_mlir_libs + OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/eudsl_tile/_mlir_libs" + RELATIVE_INSTALL_ROOT "../../../.." + # Source groups from which to discover dependent EMBED_CAPI_LINK_LIBS + DECLARED_SOURCES ${_ext_sources} +) + +# ############################################################################## +# The fully assembled package of modules. This must come last. +# ############################################################################## + +set(_declared_sources + ${_ext_sources} + # dialects + MLIRPythonSources.Dialects.arith + MLIRPythonSources.Dialects.bufferization + MLIRPythonSources.Dialects.bufferization_transform + MLIRPythonSources.Dialects.builtin + MLIRPythonSources.Dialects.cf + MLIRPythonSources.Dialects.complex + MLIRPythonSources.Dialects.func + MLIRPythonSources.Dialects.gpu + MLIRPythonSources.Dialects.gpu_transform + MLIRPythonSources.Dialects.index + MLIRPythonSources.Dialects.linalg + MLIRPythonSources.Dialects.llvm + MLIRPythonSources.Dialects.math + MLIRPythonSources.Dialects.memref + MLIRPythonSources.Dialects.memref_transform + MLIRPythonSources.Dialects.scf + MLIRPythonSources.Dialects.spirv + MLIRPythonSources.Dialects.tensor + MLIRPythonSources.Dialects.tensor_transform + MLIRPythonSources.Dialects.transform + MLIRPythonSources.Dialects.transform.extras + MLIRPythonSources.Dialects.transform.interpreter + MLIRPythonSources.Dialects.vector + MLIRPythonSources.Dialects.vector_transform + # other sources + MLIRPythonSources.ExecutionEngine + EUDSLTilePythonSources +) +if(NOT CMAKE_CROSSCOMPILING) + list(APPEND _declared_sources MLIRPythonExtension.Core.type_stub_gen) +endif() + +add_mlir_python_modules(EUDSLTilePythonModules + ROOT_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/eudsl_tile" + INSTALL_PREFIX "eudsl_tile" + MLIR_BINDINGS_PYTHON_NB_DOMAIN ${MLIR_BINDINGS_PYTHON_NB_DOMAIN} + DECLARED_SOURCES + ${_declared_sources} + COMMON_CAPI_LINK_LIBS + EUDSLTilePythonCAPI +) + +set(_runtimes + mlir_async_runtime + mlir_c_runner_utils + mlir_float16_utils + mlir_runner_utils +) + +if (TARGET mlir_apfloat_wrappers) + list(APPEND _runtimes mlir_apfloat_wrappers) +endif() + +if (TARGET mlir_rocm_runtime) + list(APPEND _runtimes mlir_rocm_runtime) +endif() + +if (TARGET mlir_cuda_runtime) + list(APPEND _runtimes mlir_cuda_runtime) +endif() + +if (TARGET omp) + list(APPEND _runtimes omp) +endif() + +if (TARGET vulkan-runtime-wrappers) + list(APPEND _runtimes vulkan-runtime-wrappers) +endif() + +foreach(r ${_runtimes}) + add_custom_command( + TARGET EUDSLTilePythonModules + PRE_BUILD + COMMAND ${CMAKE_COMMAND} -E copy $ + ${CMAKE_CURRENT_BINARY_DIR}/eudsl_tile/_mlir_libs) +endforeach() + +install( + IMPORTED_RUNTIME_ARTIFACTS ${_runtimes} + LIBRARY DESTINATION "eudsl_tile/_mlir_libs" + COMPONENT EUDSLTilePythonModules +) diff --git a/projects/eudsl-tile/eudsl_tile/.gitignore b/projects/eudsl-tile/eudsl_tile/.gitignore new file mode 100644 index 00000000..3536896d --- /dev/null +++ b/projects/eudsl-tile/eudsl_tile/.gitignore @@ -0,0 +1 @@ +extras \ No newline at end of file diff --git a/projects/eudsl-tile/eudsl_tile/__init__.py b/projects/eudsl-tile/eudsl_tile/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/projects/eudsl-tile/pyproject.toml b/projects/eudsl-tile/pyproject.toml new file mode 100644 index 00000000..9f851439 --- /dev/null +++ b/projects/eudsl-tile/pyproject.toml @@ -0,0 +1,97 @@ +# 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 +# Copyright (c) 2025. + +[project] +name = "eudsl-tile" +version = "0.0.1" +requires-python = ">=3.8" +dependencies = [ + "numpy>=1.19.5", + "PyYAML>=5.4.0, <=6.0.1", + "ml_dtypes>=0.1.0, <=0.6.0; python_version<'3.13'", + "ml_dtypes>=0.5.0, <=0.6.0; python_version>='3.13'", +] + +[project.urls] +Homepage = "https://github.com/llvm/eudsl" +Discussions = "https://discourse.llvm.org/" +"Issue Tracker" = "https://github.com/llvm/eudsl/issues" +"Source Code" = "https://github.com/llvm/eudsl/tree/main/" + +[build-system] +requires = [ + "scikit-build-core>=0.10.7", + "typing_extensions>=4.12.2", + "nanobind>=2.9, <3.0", + "numpy>=1.19.5, <=2.3.0", + "cloudpickle>=3.0.0" +] +build-backend = "scikit_build_core.build" + +[tool.scikit-build] +# This is the minimum version of scikit-build-core. +minimum-version = "0.10.7" +# This pyproject.toml must be adjacent to the root CMakeLists.txt (wherever project(...) is specified). +cmake.source-dir = "." +# This is for installing/distributing the python bindings target and only the python bindings target. +build.targets = ["EUDSLTilePythonModules"] +install.components = ["EUDSLTilePythonModules"] + +[tool.scikit-build.cmake.define] +# Optional +CMAKE_C_COMPILER = { env = "CMAKE_C_COMPILER", default = "" } +CMAKE_CXX_COMPILER = { env = "CMAKE_CXX_COMPILER", default = "" } +CMAKE_C_COMPILER_LAUNCHER = { env = "CMAKE_C_COMPILER_LAUNCHER", default = "" } +CMAKE_CXX_COMPILER_LAUNCHER = { env = "CMAKE_CXX_COMPILER_LAUNCHER", default = "" } +CMAKE_GENERATOR = { env = "CMAKE_GENERATOR", default = "Ninja" } +CMAKE_PLATFORM_NO_VERSIONED_SONAME = "ON" +CMAKE_MSVC_RUNTIME_LIBRARY = "MultiThreaded" +CMAKE_C_FLAGS = { env = "CMAKE_C_FLAGS", default = "" } +CMAKE_CXX_FLAGS = { env = "CMAKE_CXX_FLAGS", default = "" } +LLVM_USE_LINKER = { env = "LLVM_USE_LINKER", default = "" } +# Optional but highly recommended (this makes the bindings compatible with other bindings packages +# by preventing symbol collisions). +CMAKE_VISIBILITY_INLINES_HIDDEN = "ON" +CMAKE_C_VISIBILITY_PRESET = "hidden" +CMAKE_CXX_VISIBILITY_PRESET = "hidden" + +MLIR_DIR = { env = "MLIR_DIR", default = "" } +CMAKE_PREFIX_PATH = { env = "CMAKE_PREFIX_PATH", default = "" } +# Non-optional +CMAKE_BUILD_TYPE = { env = "CMAKE_BUILD_TYPE", default = "Release" } +MLIR_ENABLE_BINDINGS_PYTHON = "ON" +MLIR_BINDINGS_PYTHON_NB_DOMAIN = "eudsl_tile" + +[tool.cibuildwheel] +enable = "cpython-prerelease cpython-freethreading" +build-verbosity = 3 +manylinux-aarch64-image = "quay.io/pypa/manylinux_2_34_aarch64" +manylinux-x86_64-image = "quay.io/pypa/manylinux_2_34_x86_64" +archs = ["native"] + +[tool.cibuildwheel.linux] +build = "cp310-* cp311-* cp312-* cp313-* cp314-* cp314t-*" +skip = ["*-manylinux_i686", "*-musllinux*"] +environment-pass = [ + "CMAKE_CXX_FLAGS", + "CMAKE_C_FLAGS", + "CMAKE_PREFIX_PATH", + "MLIR_DIR", + "WHEEL_VERSION", +] +repair-wheel-command = [ + "LD_LIBRARY_PATH=$CMAKE_PREFIX_PATH/lib auditwheel repair -w {dest_dir} {wheel}", +] + +[tool.cibuildwheel.macos] +build = "cp310-* cp311-* cp312-* cp313-* cp314-* cp314t-*" +repair-wheel-command = [ + "DYLD_LIBRARY_PATH=$CMAKE_PREFIX_PATH/lib delocate-wheel --require-archs {delocate_archs} -w {dest_dir} -v {wheel}" +] + +[tool.cibuildwheel.windows] +build = "cp310-* cp311-* cp312-* cp313-* cp314-* cp314t-*" +skip = ["*-win32"] +# repair-wheel-command = "delvewheel repair -v -w {dest_dir} {wheel}" diff --git a/projects/eudsl-tile/tests/test_smoke.py b/projects/eudsl-tile/tests/test_smoke.py new file mode 100644 index 00000000..6e1437a5 --- /dev/null +++ b/projects/eudsl-tile/tests/test_smoke.py @@ -0,0 +1,36 @@ +# 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 eudsl_tile.extras import types as T +from eudsl_tile.extras.dialects import arith, func + +# noinspection PyUnresolvedReferences +from eudsl_tile.extras.testing import ( + mlir_ctx as ctx, + filecheck_with_comments, + MLIRContext, +) + + +def test_arith_value(ctx: MLIRContext): + i32 = T.i32() + + @func.FuncOp.from_py_func(i32, i32) + def foo(a: i32, b: i32) -> i32: + c1 = arith.constant(1) + return c1 * a + b - c1 / a // c1 % b + + # CHECK-LABEL: func.func @foo( + # CHECK-SAME: %[[ARG0:.*]]: i32, + # CHECK-SAME: %[[ARG1:.*]]: i32) -> i32 { + # CHECK: %[[CONSTANT_0:.*]] = arith.constant 1 : i32 + # CHECK: %[[MULI_0:.*]] = arith.muli %[[CONSTANT_0]], %[[ARG0]] : i32 + # CHECK: %[[ADDI_0:.*]] = arith.addi %[[MULI_0]], %[[ARG1]] : i32 + # CHECK: %[[DIVSI_0:.*]] = arith.divsi %[[CONSTANT_0]], %[[ARG0]] : i32 + # CHECK: %[[FLOORDIVSI_0:.*]] = arith.floordivsi %[[DIVSI_0]], %[[CONSTANT_0]] : i32 + # CHECK: %[[REMSI_0:.*]] = arith.remsi %[[FLOORDIVSI_0]], %[[ARG1]] : i32 + # CHECK: %[[SUBI_0:.*]] = arith.subi %[[ADDI_0]], %[[REMSI_0]] : i32 + # CHECK: return %[[SUBI_0]] : i32 + # CHECK: } + filecheck_with_comments(ctx.module)