From 840b5d5326d59b25d38238e077fd3f528fcdf1b5 Mon Sep 17 00:00:00 2001 From: Chris Leary Date: Fri, 12 Feb 2021 14:50:29 -0800 Subject: [PATCH] [build] Make XLS build capable of aarch64 by upgrading some deps. Also try to make the README console session syntax highlight properly in GitHub's syntax highlighting solution (highlight.js I think) by putting prompts on each line that's not "output", including comment lines. PiperOrigin-RevId: 357272823 --- README.md | 21 +++++++++++---------- WORKSPACE | 9 +++------ dependency_support/initialize_external.bzl | 4 ++-- dependency_support/load_external.bzl | 5 ++--- dependency_support/pip_requirements.txt | 4 ++-- docs_src/README.md | 21 +++++++++++---------- xls/jit/BUILD | 4 ++++ 7 files changed, 35 insertions(+), 33 deletions(-) diff --git a/README.md b/README.md index 358c893f67..0f52c71bf5 100644 --- a/README.md +++ b/README.md @@ -41,20 +41,21 @@ Note that we start by assuming [Bazel has been installed](https://docs.bazel.build/versions/master/install-ubuntu.html). ```console -# Follow the bazel install instructions: -# https://docs.bazel.build/versions/master/install-ubuntu.html -# -# Afterwards we observe: +~$ git clone https://github.com/google/xls.git +~$ cd xls -$ bazel --version +~/xls$ # Follow the bazel install instructions: +~/xls$ # https://docs.bazel.build/versions/master/install-ubuntu.html +~/xls$ # Afterwards we observe: +~/xls$ bazel --version bazel 4.0.0 -# Note we're going to tell Ubuntu that `/usr/bin/env python` is actually python3 -# here, since that is not the case by default on Ubuntu 20.04. -$ sudo apt install python3-distutils python3-dev libtinfo5 python3-is-python +~/xls$ # Note we're going to tell Ubuntu that `/usr/bin/env python` is actually python3 +~/xls$ # here, since that is not the case by default on Ubuntu 20.04. +~/xls$ sudo apt install python3-distutils python3-dev libtinfo5 python3-is-python -# Now build/test everything in optimized build mode. -$ bazel test -c opt ... +~/xls$ # Now build/test everything in optimized build mode. +~/xls$ bazel test -c opt ... ``` A reference build/test environment setup is also provided via `Dockerfile`: diff --git a/WORKSPACE b/WORKSPACE index c6ea8ec754..7e91e5b98b 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -8,10 +8,10 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") http_archive( name = "com_grail_bazel_toolchain", urls = [ - "https://github.com/grailbio/bazel-toolchain/archive/f4c17a3ae40f927ff62cc0fb8fe22b1530871807.zip", + "https://github.com/grailbio/bazel-toolchain/archive/f2d1ba2c9d713b2aa6e7063f6d11dd3d64aa402a.zip", ], - strip_prefix = "bazel-toolchain-f4c17a3ae40f927ff62cc0fb8fe22b1530871807", - sha256 = "715fd98d566ed1304cb53e0c640427cf0916ec6db89588e3ac2b6a87632276d4", + strip_prefix = "bazel-toolchain-f2d1ba2c9d713b2aa6e7063f6d11dd3d64aa402a", + sha256 = "0246482b21a04667825c655d3b4f8f796d842817b2e11f536bbfed5673cbfd97", patches = ["//dependency_support/com_grail_bazel_toolchain:google_workstation_workaround.patch"], ) load("@com_grail_bazel_toolchain//toolchain:deps.bzl", "bazel_toolchain_dependencies") @@ -39,6 +39,3 @@ initialize_external_repositories() # the call to pip_install fails. load("@com_github_grpc_grpc//bazel:grpc_extra_deps.bzl", "grpc_extra_deps") grpc_extra_deps() - -load("@xls_pip_deps//:requirements.bzl", "pip_install") -pip_install() diff --git a/dependency_support/initialize_external.bzl b/dependency_support/initialize_external.bzl index 689e924457..7bdb0e2484 100644 --- a/dependency_support/initialize_external.bzl +++ b/dependency_support/initialize_external.bzl @@ -18,7 +18,7 @@ load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace") load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps") load("@pybind11_bazel//:python_configure.bzl", "python_configure") load("@io_bazel_rules_closure//closure:repositories.bzl", "rules_closure_dependencies", "rules_closure_toolchains") -load("@rules_python//python:pip.bzl", "pip_import") +load("@rules_python//python:pip.bzl", "pip_install") load("//dependency_support/boost:initialize.bzl", initialize_boost = "initialize") def initialize_external_repositories(): @@ -28,7 +28,7 @@ def initialize_external_repositories(): python_configure(name = "local_config_python") rules_closure_dependencies() rules_closure_toolchains() - pip_import( + pip_install( name = "xls_pip_deps", requirements = "//dependency_support:pip_requirements.txt", python_interpreter = "python3", diff --git a/dependency_support/load_external.bzl b/dependency_support/load_external.bzl index 1e9adb118f..720b8a7036 100644 --- a/dependency_support/load_external.bzl +++ b/dependency_support/load_external.bzl @@ -150,9 +150,8 @@ def load_external_repositories(): http_archive( name = "rules_python", - url = "https://github.com/bazelbuild/rules_python/releases/download/0.0.2/rules_python-0.0.2.tar.gz", - strip_prefix = "rules_python-0.0.2", - sha256 = "b5668cde8bb6e3515057ef465a35ad712214962f0b3a314e551204266c7be90c", + url = "https://github.com/bazelbuild/rules_python/releases/download/0.1.0/rules_python-0.1.0.tar.gz", + sha256 = "b6d46438523a3ec0f3cead544190ee13223a52f6a6765a29eae7b7cc24cc83a0", ) http_archive( diff --git a/dependency_support/pip_requirements.txt b/dependency_support/pip_requirements.txt index ec83a99538..586a5e5ede 100644 --- a/dependency_support/pip_requirements.txt +++ b/dependency_support/pip_requirements.txt @@ -4,9 +4,9 @@ Jinja2==2.11.2 werkzeug==1.0.1 itsdangerous==1.1.0 click==7.1.2 -numpy==1.18.4 +numpy==1.20.0 markupsafe==1.1.1 -scipy==1.5.0 +scipy==1.6.0 termcolor==1.1.0 psutil==5.7.0 portpicker==1.3.1 diff --git a/docs_src/README.md b/docs_src/README.md index 9dc2eb5551..0245fe0ad7 100644 --- a/docs_src/README.md +++ b/docs_src/README.md @@ -41,20 +41,21 @@ Note that we start by assuming [Bazel has been installed](https://docs.bazel.build/versions/master/install-ubuntu.html). ```console -# Follow the bazel install instructions: -# https://docs.bazel.build/versions/master/install-ubuntu.html -# -# Afterwards we observe: +~$ git clone https://github.com/google/xls.git +~$ cd xls -$ bazel --version +~/xls$ # Follow the bazel install instructions: +~/xls$ # https://docs.bazel.build/versions/master/install-ubuntu.html +~/xls$ # Afterwards we observe: +~/xls$ bazel --version bazel 4.0.0 -# Note we're going to tell Ubuntu that `/usr/bin/env python` is actually python3 -# here, since that is not the case by default on Ubuntu 20.04. -$ sudo apt install python3-distutils python3-dev libtinfo5 python3-is-python +~/xls$ # Note we're going to tell Ubuntu that `/usr/bin/env python` is actually python3 +~/xls$ # here, since that is not the case by default on Ubuntu 20.04. +~/xls$ sudo apt install python3-distutils python3-dev libtinfo5 python3-is-python -# Now build/test everything in optimized build mode. -$ bazel test -c opt ... +~/xls$ # Now build/test everything in optimized build mode. +~/xls$ bazel test -c opt ... ``` A reference build/test environment setup is also provided via `Dockerfile`: diff --git a/xls/jit/BUILD b/xls/jit/BUILD index 02fcd16637..e82d347394 100644 --- a/xls/jit/BUILD +++ b/xls/jit/BUILD @@ -111,6 +111,8 @@ cc_library( "//xls/ir:value", "//xls/ir:value_helpers", "//xls/ir:value_view", + "@llvm//:AArch64AsmParser", # build_cleaner: keep + "@llvm//:AArch64CodeGen", # build_cleaner: keep "@llvm//:Analysis", "@llvm//:Core", "@llvm//:ExecutionEngine", @@ -178,6 +180,8 @@ cc_library( "//xls/ir:ir_parser", "//xls/ir:type", "//xls/ir:value", + "@llvm//:AArch64AsmParser", # build_cleaner: keep + "@llvm//:AArch64CodeGen", # build_cleaner: keep "@llvm//:Core", "@llvm//:OrcJIT", "@llvm//:Support",