Skip to content

Commit

Permalink
don't checkout torch-mlir
Browse files Browse the repository at this point in the history
  • Loading branch information
makslevental committed Aug 30, 2024
1 parent 2de5cb7 commit cf291c5
Show file tree
Hide file tree
Showing 5 changed files with 97 additions and 103 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ jobs:
- name: Build packages
run: |
export cache_dir="${{ env.CACHE_DIR }}"
export CCACHE_COMPILERCHECK="string:$(clang --version)"
bash build_tools/ci/build_test_cpp.sh
- name: Create artifacts
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/ci-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ jobs:
- name: Build packages
run: |
export cache_dir="${{ env.CACHE_DIR }}"
export CCACHE_COMPILERCHECK="string:$(clang --version)"
bash build_tools/ci/build_test_cpp.sh
- name: Create artifacts
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/ci-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ jobs:
- name: Build packages
run: |
export cache_dir="${{ env.CACHE_DIR }}"
export CCACHE_COMPILERCHECK="string:$(clang-cl.exe --version)"
bash build_tools/ci/build_test_cpp.sh
- name: Create artifacts
Expand Down
8 changes: 0 additions & 8 deletions build_tools/ci/build_test_cpp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,24 +32,16 @@ if [[ "$OSTYPE" == "linux-gnu"* ]]; then
export CMAKE_TOOLCHAIN_FILE="$this_dir/linux_default_toolchain.cmake"
export CC=clang
export CXX=clang++
CC_VERSION=$($CC --version)
elif [[ "$OSTYPE" == "darwin"* ]]; then
# i don't know why but mac doesn't like it when you export CC/CXX
# so just call clang directly
CC_VERSION=$(clang --version)
elif [[ "$OSTYPE" == "msys"* ]]; then
export CC=clang-cl.exe
export CXX=clang-cl.exe
CC_VERSION=$($CC --version)
fi

export CCACHE_DIR="${cache_dir}/ccache"
export CCACHE_MAXSIZE="700M"
export CMAKE_C_COMPILER_LAUNCHER=ccache
export CMAKE_CXX_COMPILER_LAUNCHER=ccache
export CCACHE_SLOPPINESS=include_file_ctime,include_file_mtime,time_macros
export CCACHE_COMPILERCHECK="string:$CC_VERSION"
echo $CCACHE_COMPILERCHECK

# Clear ccache stats.
ccache -z
Expand Down
189 changes: 94 additions & 95 deletions sync_deps.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,122 +2,121 @@
### AUTO-GENERATED: DO NOT EDIT
### Casual developers and CI bots invoke this to do the most
### efficient checkout of dependencies.
### Cross-repo project development should use the
### Cross-repo project development should use the
### 'shark-workspace' dev tool for more full featured setup.
### Update with: shark-workspace pin

PINNED_VERSIONS = {
"iree": "60b65f30c932eaf967922785253a85a1aa14cebb",
"iree": "60b65f30c932eaf967922785253a85a1aa14cebb",
}

ORIGINS = {
"iree": "https://github.com/iree-org/iree.git",
"iree": "https://github.com/iree-org/iree.git",
}

SUBMODULES = {
"iree": 1
}
SUBMODULES = {"iree"}

EXCLUDED_SUBMODULES = {"third_party/torch-mlir"}


### Update support:

import argparse
from pathlib import Path
import re
import shlex
import subprocess
from pathlib import Path


def main():
parser = argparse.ArgumentParser(description="Source deps sync")
parser.add_argument(
"--exclude-submodule",
nargs="*",
help="Exclude submodules by regex (relative to '{project}:{path})")
parser.add_argument("--exclude-dep",
nargs="*",
help="Excludes dependencies by regex")
parser.add_argument("--depth",
type=int,
default=0,
help="Fetch revisions with --depth")
parser.add_argument("--submodules-depth",
type=int,
default=0,
help="Update submodules with --depth")
args = parser.parse_args()

workspace_dir = Path(__file__).resolve().parent.parent
for repo_name, revision in PINNED_VERSIONS.items():
# Exclude this dep?
exclude_repo = False
for exclude_pattern in (args.exclude_dep or ()):
if re.search(exclude_pattern, repo_name):
exclude_repo = True
if exclude_repo:
print(f"Excluding {repo_name} based on --exclude-dep")
continue

print(f"Syncing {repo_name}")
repo_dir = workspace_dir / repo_name
if not repo_dir.exists():
# Shallow clone
print(f" Cloning {repo_name}...")
repo_dir.mkdir()
run(["init"], repo_dir)
run(["remote", "add", "origin", ORIGINS[repo_name]], repo_dir)
# Checkout detached head.
fetch_args = ["fetch"]
if args.depth > 0:
fetch_args.extend(["--depth=1"])
fetch_args.extend(["origin", revision])
run(fetch_args, repo_dir)
run(["-c", "advice.detachedHead=false", "checkout", revision], repo_dir)
if SUBMODULES.get(repo_name):
print(f" Initializing submodules for {repo_name}")
cp = run(["submodule", "status"],
repo_dir,
silent=True,
capture_output=True)
submodules = []
for submodule_status_line in cp.stdout.decode().splitlines():
submodule_status_parts = submodule_status_line.split()
submodule_path = submodule_status_parts[1]
exclude_submodule = False
for exclude_pattern in (args.exclude_submodule or ()):
if re.search(exclude_pattern, f"{repo_name}:{submodule_path}"):
exclude_submodule = True
if exclude_submodule:
print(f" Excluding {submodule_path} based on --exclude-submodule")
continue
submodules.append(submodule_path)

update_args = ["submodule", "update", "--init"]
if args.submodules_depth > 0:
update_args.extend(["--depth", "1"])
update_args.extend(["--"])
update_args.extend(submodules)
run(update_args, repo_dir)


def run(args,
cwd,
*,
capture_output: bool = False,
check: bool = True,
silent: bool = False):
args = ["git"] + args
args_text = ' '.join([shlex.quote(arg) for arg in args])
if not silent:
print(f" [{cwd}]$ {args_text}")
cp = subprocess.run(args, cwd=str(cwd), capture_output=capture_output)
if check and cp.returncode != 0:
addl_info = f":\n({cp.stderr.decode()})" if capture_output else ""
raise RuntimeError(f"Git command failed: {args_text} (from {cwd})"
f"{addl_info}")
return cp
parser = argparse.ArgumentParser(description="Source deps sync")
parser.add_argument(
"--exclude-submodule",
nargs="*",
help="Exclude submodules by regex (relative to '{project}:{path})",
default=(),
)
parser.add_argument(
"--exclude-dep", nargs="*", help="Excludes dependencies by regex"
)
parser.add_argument(
"--depth", type=int, default=0, help="Fetch revisions with --depth"
)
parser.add_argument(
"--submodules-depth", type=int, default=0, help="Update submodules with --depth"
)
args = parser.parse_args()

workspace_dir = Path(__file__).resolve().parent.parent
for repo_name, revision in PINNED_VERSIONS.items():
# Exclude this dep?
exclude_repo = False
for exclude_pattern in args.exclude_dep or ():
if re.search(exclude_pattern, repo_name):
exclude_repo = True
if exclude_repo:
print(f"Excluding {repo_name} based on --exclude-dep")
continue

print(f"Syncing {repo_name}")
repo_dir = workspace_dir / repo_name
if not repo_dir.exists():
# Shallow clone
print(f" Cloning {repo_name}...")
repo_dir.mkdir()
run(["init"], repo_dir)
run(["remote", "add", "origin", ORIGINS[repo_name]], repo_dir)
# Checkout detached head.
fetch_args = ["fetch"]
if args.depth > 0:
fetch_args.extend(["--depth=1"])
fetch_args.extend(["origin", revision])
run(fetch_args, repo_dir)
run(["-c", "advice.detachedHead=false", "checkout", revision], repo_dir)
if repo_name in SUBMODULES:
print(f" Initializing submodules for {repo_name}")
cp = run(
["submodule", "status"], repo_dir, silent=True, capture_output=True
)
submodules = []
for submodule_status_line in cp.stdout.decode().splitlines():
submodule_status_parts = submodule_status_line.split()
submodule_path = submodule_status_parts[1]
exclude_submodule = False
for exclude_pattern in args.exclude_submodule + tuple(
EXCLUDED_SUBMODULES
):
if re.search(exclude_pattern, f"{repo_name}:{submodule_path}"):
exclude_submodule = True
if exclude_submodule:
print(f" Excluding {submodule_path} based on --exclude-submodule")
continue
submodules.append(submodule_path)

update_args = ["submodule", "update", "--init"]
if args.submodules_depth > 0:
update_args.extend(["--depth", "1"])
update_args.extend(["--"])
update_args.extend(submodules)
print(update_args)
run(update_args, repo_dir)


def run(
args, cwd, *, capture_output: bool = False, check: bool = True, silent: bool = False
):
args = ["git"] + args
args_text = " ".join([shlex.quote(arg) for arg in args])
if not silent:
print(f" [{cwd}]$ {args_text}")
cp = subprocess.run(args, cwd=str(cwd), capture_output=capture_output)
if check and cp.returncode != 0:
addl_info = f":\n({cp.stderr.decode()})" if capture_output else ""
raise RuntimeError(
f"Git command failed: {args_text} (from {cwd})" f"{addl_info}"
)
return cp


if __name__ == "__main__":
main()
main()

0 comments on commit cf291c5

Please sign in to comment.