Skip to content

Commit

Permalink
Merge branch 'main' into annotate_rootOp
Browse files Browse the repository at this point in the history
Signed-off-by: nithinsubbiah <[email protected]>
  • Loading branch information
nithinsubbiah committed Dec 4, 2024
2 parents 9d91a9d + 9f8aad8 commit 721a9e7
Show file tree
Hide file tree
Showing 239 changed files with 5,665 additions and 2,290 deletions.
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
/compiler/src/iree/compiler/Codegen/Common @hanhanW
/compiler/src/iree/compiler/Codegen/Common/GPU @antiagainst @qedawkins
/compiler/src/iree/compiler/Codegen/Dialect/GPU @antiagainst @qedawkins
/compiler/src/iree/compiler/Codegen/LLVMCPU/ @hanhanW @MaheshRavishankar
/compiler/src/iree/compiler/Codegen/LLVMCPU/ @hanhanW @MaheshRavishankar @pashu123
/compiler/src/iree/compiler/Codegen/LLVMGPU/ @MaheshRavishankar @qedawkins @kuhar @Groverkss
/compiler/src/iree/compiler/Codegen/SPIRV/ @antiagainst @MaheshRavishankar @kuhar
/compiler/src/iree/compiler/ConstEval/ @hanhanW @stellaraccident
Expand Down
98 changes: 0 additions & 98 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,21 +41,11 @@ concurrency:
group: ${{ github.workflow }}-${{ github.event.number || github.sha }}
cancel-in-progress: true

env:
# This needs to be in env instead of the outputs of setup because it contains
# the run attempt and we want that to be the current attempt, not whatever
# attempt the setup step last ran in.
GCS_URL: https://storage.googleapis.com/iree-github-actions-${{ github.event_name == 'pull_request' && 'presubmit' || 'postsubmit' }}-artifacts/${{ github.run_id }}/${{ github.run_attempt }}

# Jobs are organized into groups and topologically sorted by dependencies
jobs:
setup:
uses: ./.github/workflows/setup.yml

############################### Configurations ###############################
# Jobs that build IREE in some non-default configuration
##############################################################################

runtime:
needs: setup
name: "runtime :: ${{ matrix.name }}"
Expand Down Expand Up @@ -206,86 +196,6 @@ jobs:
- name: CMake - build
run: cmake --build ${BUILD_DIR} -- -k 0

############################## Crosscompilation ##############################
# Jobs that cross-compile IREE for other platforms
##############################################################################

# Disabled to reduce self-hosted runners needed. See #17957
# TODO(#17957): migrate to pkgci
# cross_compile_and_test:
# needs: [setup, build_all]
# if: contains(fromJson(needs.setup.outputs.enabled-jobs), 'cross_compile_and_test')
# runs-on:
# - self-hosted # must come first
# - runner-group=${{ needs.setup.outputs.runner-group }}
# - environment=${{ needs.setup.outputs.runner-env }}
# - cpu
# - os-family=Linux
# strategy:
# matrix:
# target:
# - platform: linux
# arch: riscv_32
# abi: ilp32d
# docker_image: "gcr.io/iree-oss/riscv@sha256:62e87bad3405d691ddba6f9be0ef44eeb60461a467c8d86f0842c81a1f97da79"
# build_script: "./build_tools/cmake/build_riscv.sh"
# test_script: "./build_tools/cmake/test_riscv.sh"
# - platform: generic
# arch: riscv_32
# abi: ilp32
# docker_image: "gcr.io/iree-oss/riscv@sha256:62e87bad3405d691ddba6f9be0ef44eeb60461a467c8d86f0842c81a1f97da79"
# build_script: "./build_tools/cmake/build_riscv.sh"
# test_script: "./tests/riscv32/smoke.sh"
# - platform: emscripten
# arch: wasm32
# abi: wasm32
# docker_image: "gcr.io/iree-oss/emscripten@sha256:2dd4c52f1bb499ab365aad0111fe5538b685d88af38636b409b0cf6a576ab214"
# build_script: "./build_tools/cmake/build_runtime_emscripten.sh"
# # No test script
# env:
# PLATFORM: ${{ matrix.target.platform }}
# ARCH: ${{ matrix.target.arch }}
# ABI: ${{ matrix.target.abi }}
# DOCKER_IMAGE: ${{ matrix.target.docker_image }}
# BUILD_SCRIPT: ${{ matrix.target.build_script }}
# TEST_SCRIPT: ${{ matrix.target.test_script }}
# INSTALL_DIR: ${{ needs.build_all.outputs.install-dir }}
# INSTALL_DIR_ARCHIVE: ${{ needs.build_all.outputs.install-dir-archive }}
# INSTALL_DIR_GCS_ARTIFACT: ${{ needs.build_all.outputs.install-dir-gcs-artifact }}
# TARGET_BUILD_DIR: build-${{ matrix.target.platform }}-${{ matrix.target.arch }}
# IREE_WRITE_REMOTE_CCACHE: ${{ needs.setup.outputs.write-caches }}
# steps:
# - name: "Checking out repository"
# uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
# - name: "Checking out runtime submodules"
# run: ./build_tools/scripts/git/update_runtime_submodules.sh
# - name: "Downloading install dir archive"
# run: gcloud storage cp "${INSTALL_DIR_GCS_ARTIFACT}" "${INSTALL_DIR_ARCHIVE}"
# - name: "Extracting install directory"
# run: tar -xf "${INSTALL_DIR_ARCHIVE}"
# - name: "Build cross-compiling target"
# run: |
# ./build_tools/github_actions/docker_run.sh \
# --env "IREE_CCACHE_GCP_TOKEN=$(gcloud auth application-default print-access-token)" \
# --env "IREE_WRITE_REMOTE_CCACHE=${IREE_WRITE_REMOTE_CCACHE}" \
# --env "CCACHE_NAMESPACE=${DOCKER_IMAGE}" \
# --env "IREE_TARGET_PLATFORM=${PLATFORM}" \
# --env "IREE_TARGET_ARCH=${ARCH}" \
# --env "IREE_TARGET_ABI=${ABI}" \
# --env "IREE_TARGET_BUILD_DIR=${TARGET_BUILD_DIR}" \
# --env "IREE_HOST_BIN_DIR=${INSTALL_DIR}/bin" \
# "${DOCKER_IMAGE}" \
# "${BUILD_SCRIPT}"
# - name: "Test cross-compiling target"
# if: matrix.target.test_script
# run: |
# ./build_tools/github_actions/docker_run.sh \
# --env "IREE_TARGET_PLATFORM=${PLATFORM}" \
# --env "IREE_TARGET_ARCH=${ARCH}" \
# --env "IREE_TARGET_BUILD_DIR=${TARGET_BUILD_DIR}" \
# "${DOCKER_IMAGE}" \
# "${TEST_SCRIPT}"

##############################################################################

# Depends on all the other jobs to provide a single anchor that indicates the
Expand All @@ -298,17 +208,9 @@ jobs:
runs-on: ubuntu-20.04
needs:
- setup

# Accelerators
# - test_nvidia_a100

# Runtime build variants
- runtime
- runtime_small
- runtime_tracing

# Crosscompilation
# - cross_compile_and_test
steps:
- name: "Checking out repository"
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/pkgci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,12 @@ jobs:
if: contains(fromJson(needs.setup.outputs.enabled-jobs), 'test_onnx')
uses: ./.github/workflows/pkgci_test_onnx.yml

test_sharktank:
name: Test Sharktank
needs: [setup, build_packages]
if: contains(fromJson(needs.setup.outputs.enabled-jobs), 'test_sharktank')
uses: ./.github/workflows/pkgci_test_sharktank.yml

test_tensorflow:
name: Test TensorFlow
needs: [setup, build_packages]
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/pkgci_regression_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ jobs:
--goldentime-rocm-unet-ms 419.0 \
--goldentime-rocm-clip-ms 18.5 \
--goldentime-rocm-vae-ms 337.0 \
--goldendispatch-rocm-unet 1531 \
--goldendispatch-rocm-unet 1602 \
--goldendispatch-rocm-clip 1139 \
--goldendispatch-rocm-vae 246 \
--goldensize-rocm-unet-bytes 2280000 \
Expand All @@ -238,21 +238,21 @@ jobs:
run: |
source ${VENV_DIR}/bin/activate
pytest ./experimental/benchmarks/sdxl/benchmark_sdxl_rocm.py \
--goldentime-rocm-e2e-ms 372.0 \
--goldentime-rocm-unet-ms 95.0 \
--goldentime-rocm-e2e-ms 330.0 \
--goldentime-rocm-unet-ms 80.0 \
--goldentime-rocm-clip-ms 15.5 \
--goldentime-rocm-vae-ms 80.0 \
--goldendispatch-rocm-unet 1531 \
--goldendispatch-rocm-unet 1602 \
--goldendispatch-rocm-clip 1139 \
--goldendispatch-rocm-vae 246 \
--goldensize-rocm-unet-bytes 2270000 \
--goldensize-rocm-clip-bytes 860000 \
--goldensize-rocm-vae-bytes 840000 \
--goldentime-rocm-punet-int8-fp16-ms 55 \
--goldendispatch-rocm-punet-int8-fp16 1284 \
--goldentime-rocm-punet-int8-fp16-ms 53 \
--goldendispatch-rocm-punet-int8-fp16 1424 \
--goldensize-rocm-punet-int8-fp16-bytes 2560000 \
--goldentime-rocm-punet-int8-fp8-ms 59 \
--goldendispatch-rocm-punet-int8-fp8 1564 \
--goldentime-rocm-punet-int8-fp8-ms 53 \
--goldendispatch-rocm-punet-int8-fp8 1704 \
--goldensize-rocm-punet-int8-fp8-bytes 2800000 \
--rocm-chip gfx942 \
--log-cli-level=info \
Expand Down
73 changes: 73 additions & 0 deletions .github/workflows/pkgci_test_sharktank.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# Copyright 2024 The IREE Authors
#
# Licensed 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

name: PkgCI Test Sharktank
on:
workflow_call:
inputs:
artifact_run_id:
type: string
default: ""
workflow_dispatch:
inputs:
artifact_run_id:
type: string
default: ""

jobs:
test_sharktank_models:
name: "test_sharktank_models :: ${{ matrix.name }}"
runs-on: ${{ matrix.runs-on }}
strategy:
fail-fast: false
matrix:
include:
# CPU
- name: cpu_llvm_task
runs-on: ubuntu-20.04

env:
VENV_DIR: ${{ github.workspace }}/venv
steps:
- name: Checking out IREE repository
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
submodules: false
- uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.1.0
with:
# Must match the subset of versions built in pkgci_build_packages.
python-version: "3.11"
- uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: linux_x86_64_release_packages
path: ${{ env.PACKAGE_DOWNLOAD_DIR }}
- name: Setup venv
run: |
./build_tools/pkgci/setup_venv.py ${VENV_DIR} \
--artifact-path=${PACKAGE_DOWNLOAD_DIR} \
--fetch-gh-workflow=${{ inputs.artifact_run_id }}
- name: Checkout test suites repository
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
repository: iree-org/iree-test-suites
ref: a0c84d59c4332463dd46a3c4877d8e0ab2e0a80d
path: iree-test-suites
lfs: true
- name: Install Sharktank models test suite requirements
run: |
source ${VENV_DIR}/bin/activate
python -m pip install -r iree-test-suites/sharktank_models/requirements.txt
- name: Run Sharktank models test suite
run: |
source ${VENV_DIR}/bin/activate
pytest iree-test-suites/sharktank_models/ \
-rA \
-m "target_cpu" \
--log-cli-level=info \
--override-ini=xfail_strict=false \
--timeout=120 \
--durations=0
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ Testing/

# Bazel artifacts
**/bazel-*
MODULE.bazel
MODULE.bazel.lock

# Executables
*.exe
Expand Down
19 changes: 13 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,21 @@ repos:
# probably changed again in a future version, whatever.
language_version: "1.16"

- id: bazel_to_cmake
name: Run bazel_to_cmake.py
# Convert BUILD.bazel files to CMakeLists.txt files in two passes to
# avoid potential race conditions.
# Note: this passes file names to the tool. The tool can also be run
# manually with no arguments specified to walk directories on its own.
# Keep the top level directories here in sync with .bazel_to_cmake.cfg.py.
- id: bazel_to_cmake_1
name: Run bazel_to_cmake.py on BUILD.bazel files
language: python
# Note: this passes file names to the tool. The tool can also be run
# manually with no arguments specified to walk directories on its own.
entry: ./build_tools/bazel_to_cmake/bazel_to_cmake.py
# Keep the top level directories here in sync with .bazel_to_cmake.cfg.py.
files: '^(compiler|runtime|samples|tests|tools)/(.*/)?(BUILD\.bazel|CMakeLists.txt)$'
files: '^(compiler|runtime|samples|tests|tools)/(.*/)?(BUILD\.bazel)$'
- id: bazel_to_cmake_2
name: Run bazel_to_cmake.py on CMakeLists.txt files
language: python
entry: ./build_tools/bazel_to_cmake/bazel_to_cmake.py
files: "^(compiler|runtime|samples|tests|tools)/(.*/)?(CMakeLists.txt)$"

- id: check_path_lengths
name: Check for excessively long path lengths
Expand Down
74 changes: 74 additions & 0 deletions build_tools/bazel/iree_bitcode_library.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,80 @@ def iree_cuda_bitcode_library(
**kwargs
)

def iree_amdgpu_bitcode_library(
name,
gpu_arch,
srcs,
copts = [],
out = None,
**kwargs):
"""Builds an AMDGPU LLVM bitcode library from an input file using clang.
Args:
name: Name of the target.
gpu_arch: Target AMDGPU architecture, e.g. gfx942.
srcs: Source files to pass to clang. Headers (*.h) are for dependency
tracking only. Current limitation: only one non-header source is
supported.
copts: Additional flags to pass to clang.
out: Output file name. Defaults to {source.c}.{gpu_arch}.bc.
**kwargs: any additional attributes to pass to the underlying rules.
"""

clang_tool = "@llvm-project//clang:clang"

base_copts = [
# Language: C23.
"-std=c23",

# Avoid dependencies.
"-nogpulib",

# Avoid ABI issues.
"-fno-short-wchar", # Shouldn't matter to us, but doesn't hurt.

# Target architecture/machine.
"-target",
"amdgcn-amd-amdhsa",
"-march=%s" % gpu_arch,
"-fgpu-rdc", # NOTE: may not be required for all targets.

# Optimized.
"-O3",
"-fno-ident",
"-fvisibility=hidden",

# Object file only in bitcode format.
"-c",
"-emit-llvm",
]

non_header_srcs = [src for src in srcs if not src.endswith(".h")]
if len(non_header_srcs) != 1:
fail("Expected exactly one non-header file in srcs, got srcs=[" + ", ".join(srcs) + "]")
src = non_header_srcs[0]

if not out:
out = "%s.%s.bc" % (src, gpu_arch)

native.genrule(
name = "gen_%s" % (out),
srcs = srcs,
outs = [out],
cmd = " ".join([
"$(location %s)" % (clang_tool),
"$(location %s)" % (src),
"-o $(location %s)" % (out),
"-I .",
] + base_copts + copts),
tools = [
clang_tool,
],
message = "Compiling %s to %s..." % (src, out),
output_to_bindir = 1,
**kwargs
)

def iree_link_bitcode(
name,
bitcode_files,
Expand Down
Loading

0 comments on commit 721a9e7

Please sign in to comment.