diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index aa1fb4a..e9aaed2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -9,6 +9,9 @@ on: workflow_dispatch: branches: - main + pull_request: + branches: + - main jobs: @@ -29,14 +32,32 @@ jobs: with: python-version: "3.10" - - name: Install cibuildwheel - run: pip install cibuildwheel + - name: Install Ninja + uses: llvm/actions/install-ninja@6a57890d0e3f9f35dfc72e7e48bc5e1e527cdd6c # Jan 17 + + - name: Ccache for C++ compilation + uses: hendrikmuhs/ccache-action@621a41397ed83711c72862638d9ff6e63fca3041 # v1.2.3 + with: + key: ${{ matrix.os }}-${{ matrix.arch }}-torch-mlir + # LLVM needs serious cache size + max-size: 6G + + - name: Install terminfo + if: contains(matrix.os, 'ubuntu') + run: | + sudo apt-get update + sudo apt -y install terminfo - name: Build wheels run: | - cibuildwheel --output-dir wheelhouse + if [ x"${{ matrix.os }}" == x"ubuntu-latest" ]; then + CMAKE_GENERATOR=Ninja pip wheel . -w wheelhouse -v + else + pip install -r requirements.txt + cibuildwheel --platform macos + fi mkdir -p ${{ github.sha }} - mv wheelhouse/PI*.whl ${{ github.sha }}/ + mv wheelhouse/pi*.whl ${{ github.sha }}/ - name: Upload an artifact uses: actions/upload-artifact@v3 @@ -72,8 +93,8 @@ jobs: tag_name="$PI_VERSION" release_title="PI $PI_VERSION" echo "PI $PI_VERSION created at $(date)" > body.md - echo "::set-output name=tag_name::${tag_name}" - echo "::set-output name=release_title::${release_title}" + echo "tag_name=${tag_name}" | tee -a $GITHUB_OUTPUT + echo "release_title=${release_title}" | tee -a $GITHUB_OUTPUT - name: Upload tarballs uses: ncipollo/release-action@v1 diff --git a/TorchMLIRConfig.cmake b/TorchMLIRConfig.cmake index 5a7ccc4..c11634f 100644 --- a/TorchMLIRConfig.cmake +++ b/TorchMLIRConfig.cmake @@ -13,6 +13,10 @@ elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(aarch64|arm64)") set(ARCH AArch64) endif() +if (CMAKE_OSX_ARCHITECTURES MATCHES "arm64") + set(ARCH AArch64) +endif() + message(STATUS "os: ${OS} arch: ${ARCH}") set(TORCH_MLIR_COMMIT @@ -112,6 +116,7 @@ else() FATAL_ERROR "Python requirements install failed because ${RESVAR} ${LOG1}" ) endif() + execute_process( COMMAND ${CMAKE_COMMAND} -G ${CMAKE_GENERATOR} diff --git a/pyproject.toml b/pyproject.toml index 15904e4..44fe685 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -22,12 +22,12 @@ before-build = "pip install -r requirements.txt -v" environment = { PIP_NO_BUILD_ISOLATION = "false" } build-verbosity = "3" -[tool.cibuildwheel.linux] -archs = ["x86_64"] -build = "cp311-manylinux_x86_64" +#[tool.cibuildwheel.linux] +#archs = ["x86_64"] +#build = "cp311-manylinux_x86_64" [tool.cibuildwheel.macos] build = "cp311-*" archs = ["arm64"] -environment = { PIP_NO_BUILD_ISOLATION = "false", LIB_ARCH = "arm64" } +environment = { PIP_NO_BUILD_ISOLATION = "false", ARCHFLAGS = "-arch arm64" , MACOSX_DEPLOYMENT_TARGET= 12.6 } repair-wheel-command = "delocate-wheel --ignore-missing-dependencies --require-archs {delocate_archs} -w {dest_dir} -v {wheel}" \ No newline at end of file diff --git a/setup.py b/setup.py index f9a655d..d949fa8 100644 --- a/setup.py +++ b/setup.py @@ -132,7 +132,7 @@ def build_extension(self, ext: CMakeExtension) -> None: f"{PACKAGE_NAME}.*", ], ) -VERSION = "0.0.3" +VERSION = "0.0.4" if len(sys.argv) > 1 and sys.argv[1] == "--version": print(VERSION)