Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create pkgci.yml and pkgci_build_packages.yml. #589

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

ScottTodd
Copy link
Member

Progress on #584.

Summary

  • Added .github/workflows/pkgci_build_packages.yml that builds sharktank, shortfin, and shark-ai dev packages and upload them to GitHub artifacts.
    • With ccache configured and tracing disabled, this job takes around 2 minutes to run.
  • Added .github/workflows/pkgci.yml that just runs pkgci_build_packages.yml for now. Other jobs can be migrated to depend on that job and use/test the packages.

Other details

  • Experimented a bit with ccache. I'm seeing a ~30% cache hit rate but that still gets the shortfin build from 2m30s (test logs here) down to 1m30s on standard GitHub-hosted ubuntu-24.04 runners (test logs here).
  • Plumbed the SHORTFIN_ENABLE_TRACING setting through scripts / Docker. For dev packages we can keep tracing disabled (unless there is a clear reason to add it). If the cache hit rate improves then we might be able to enable tracing for low cost.
  • Dropped cache: "pip" from build_packages.yml since it is counterproductive for a job that only installs packaging. Multiple workflows seem to be writing to the same cache and I see no way to customize the cache key. That, or the cache is unnecessarily large and we just need to prune it manually.

Copy link
Collaborator

@marbre marbre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Just two minor things.

.github/workflows/pkgci_build_packages.yml Outdated Show resolved Hide resolved
Comment on lines +144 to +150
elif [[ "${ARCH}" == "aarch64" ]]; then
# Latest version of ccache is not released for arm64, built it
git clone --depth 1 --branch "v${CCACHE_VERSION}" https://github.com/ccache/ccache.git
mkdir -p ccache/build && cd "$_"
cmake -G "Ninja" -DCMAKE_BUILD_TYPE=Release ..
ninja
cp ccache /usr/bin/
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need aarch64 support? We probably can just install ccache for x86_64.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We might at some point. I've written this code a few times before, most recently at https://github.com/iree-org/base-docker-images/blob/main/build_tools/install_ccache.sh, and supporting both architectures isn't much extra code. Better to write cross-platform/architecture code whenever possible instead of artificially limiting ourselves.

I plan on updating https://github.com/nod-ai/base-docker-images/blob/main/dockerfiles/manylinux_x86_64.Dockerfile to more closely match https://github.com/iree-org/base-docker-images/blob/main/dockerfiles/manylinux_x86_64.Dockerfile, as part of upgrading from manylinux2014 to manylinux_2_28:

# TODO(#130): Update to manylinux_2_28, upstream or a fork
# * upstream uses a version of gcc that has build warnings/errors
# * https://github.com/nod-ai/base-docker-images is a bit out of date but can include a recent clang
# MANYLINUX_DOCKER_IMAGE="${MANYLINUX_DOCKER_IMAGE:-quay.io/pypa/manylinux_2_28_${ARCH}:latest}"
MANYLINUX_DOCKER_IMAGE="${MANYLINUX_DOCKER_IMAGE:-quay.io/pypa/manylinux2014_${ARCH}:latest}"

Co-authored-by: Marius Brehler <marius.brehler@gmail.com>
@ScottTodd
Copy link
Member Author

Next steps with this:

  • Refactor at least one workflow to use the package artifacts
  • Put some more thought into how workflows can get different versions of the IREE / iree-turbine / etc. dependencies. Should they keep doing this?
    # Install latest iree-tubrine.
    pip install --no-compile -f https://iree.dev/pip-release-links.html --src deps \
    -e "git+https://github.com/iree-org/iree-turbine.git#egg=iree-turbine"
    # Try with the latest IREE nightly releases, not what iree-turbine pins.
    # We could also pin to a known working or stable version.
    # This should eventually stabilize. Do the best we can for now.
    pip install -f https://iree.dev/pip-release-links.html --upgrade --pre \
    iree-base-compiler \
    iree-base-runtime

@ScottTodd
Copy link
Member Author

Picking this back up now.

Copy link
Contributor

@renxida renxida left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extremely excited for every bit of CI time reduction.

@@ -75,6 +89,23 @@ function run_in_docker() {
echo "Using python versions: ${PYTHON_VERSIONS}"
local orig_path="${PATH}"

# Configure caching.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

YES!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants