Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion test/lit.cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@

llvm_config.with_system_environment(["HOME", "INCLUDE", "LIB", "TMP", "TEMP"])

# llvm_config.use_default_substitutions()
llvm_config.use_default_substitutions()
Copy link
Author

Choose a reason for hiding this comment

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

for FileCheck substitution using @LLVM_TOOLS_DIR@


# excludes: A list of directories to exclude from the testsuite. The 'Inputs'
# subdirectories contain auxiliary inputs for various tests in their parent
Expand Down
4 changes: 2 additions & 2 deletions utils/bazel/.bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

build --action_env=CC=clang-16
build --action_env=CXX=clang++-16
build --action_env=CC=clang
build --action_env=CXX=clang++
build --cxxopt=-std=c++17
build --host_cxxopt=-std=c++17
build --cxxopt=-D_GLIBCXX_USE_CXX11_ABI=0
Expand Down
1 change: 1 addition & 0 deletions utils/bazel/.bazelversion
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
8.4.0
110 changes: 110 additions & 0 deletions utils/bazel/MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
# This file is 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

"""
Torch-MLIR Overlay
"""

module(
name = "torch-mlir-overlay",
)

bazel_dep(
name = "bazel_skylib",
version = "1.8.2",
)
bazel_dep(
name = "platforms",
version = "0.0.11",
)
bazel_dep(
name = "rules_cc",
version = "0.2.14",
)
bazel_dep(
name = "rules_python",
version = "1.7.0",
)
bazel_dep(
name = "rules_shell",
version = "0.6.1",
)

bazel_dep(
name = "buildifier_prebuilt",
version = "8.2.1",
dev_dependency = True,
)

bazel_dep(
name = "apple_support",
version = "1.24.1",
repo_name = "build_bazel_apple_support",
)

# LLVM
new_local_repository = use_repo_rule("@bazel_tools//tools/build_defs/repo:local.bzl", "new_local_repository")

new_local_repository(
name = "llvm-raw",
build_file_content = "# empty",
path = "../../externals/llvm-project",
)

llvm_configure = use_repo_rule("@llvm-raw//utils/bazel:configure.bzl", "llvm_configure")

llvm_configure(
name = "llvm-project",
targets = [
"X86",
"AArch64",
# The bazel dependency graph for mlir-opt fails to load (at the analysis step) without the NVPTX
# target in this list, because mlir/test:TestGPU depends on the //llvm:NVPTXCodeGen target,
# which is not defined unless this is included.
"NVPTX",
],
)

http_archive = use_repo_rule("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
name = "llvm_zstd",
build_file = "@llvm-raw//utils/bazel/third_party_build:zstd.BUILD",
sha256 = "7c42d56fac126929a6a85dbc73ff1db2411d04f104fae9bdea51305663a83fd0",
strip_prefix = "zstd-1.5.2",
urls = [
"https://github.com/facebook/zstd/releases/download/v1.5.2/zstd-1.5.2.tar.gz",
],
)

http_archive(
name = "llvm_zlib",
build_file = "@llvm-raw//utils/bazel/third_party_build:zlib-ng.BUILD",
sha256 = "e36bb346c00472a1f9ff2a0a4643e590a254be6379da7cddd9daeb9a7f296731",
strip_prefix = "zlib-ng-2.0.7",
urls = [
"https://github.com/zlib-ng/zlib-ng/archive/refs/tags/2.0.7.zip",
],
)

# StableHLO
local_repository = use_repo_rule("@bazel_tools//tools/build_defs/repo:local.bzl", "local_repository")

local_repository(
name = "stablehlo",
path = "../../externals/stablehlo/",
)

# Torch-MLIR
new_local_repository(
name = "torch-mlir-raw",
build_file_content = "# empty",
path = "../..",
)

torch_mlir_configure = use_repo_rule("@torch-mlir-raw//utils/bazel:configure.bzl", "torch_mlir_configure")

torch_mlir_configure(
name = "torch-mlir",
)
140 changes: 0 additions & 140 deletions utils/bazel/WORKSPACE.bazel

This file was deleted.

12 changes: 9 additions & 3 deletions utils/bazel/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,11 @@ RUN echo $REPO_NAME >> /etc/apt/sources.list.d/llvm.list && \
clang-16

# Install bazel
ARG ARCH="x86_64"
ARG BAZEL_VERSION=6.4.0
RUN wget -q https://github.com/bazelbuild/bazel/releases/download/${BAZEL_VERSION}/bazel-${BAZEL_VERSION}-linux-${ARCH} -O /usr/bin/bazel \
ARG TARGETARCH
ARG BAZEL_VERSION=8.4.0
RUN ARCH=${TARGETARCH} \
&& if [ ${TARGETARCH} = "amd64" ]; then ARCH="x86_64"; fi \
&& wget -q https://github.com/bazelbuild/bazel/releases/download/${BAZEL_VERSION}/bazel-${BAZEL_VERSION}-linux-${ARCH} -O /usr/bin/bazel \
&& chmod a+x /usr/bin/bazel

# Install torch-mlir requirements
Expand All @@ -37,6 +39,10 @@ WORKDIR /opt/app
RUN python3 -m pip install --upgrade pip
RUN python3 -m pip install --upgrade --ignore-installed -r requirements.txt

# Make a symlink to clang for uniformity
RUN ln -s /usr/bin/clang-16 /usr/bin/clang
RUN ln -s /usr/bin/clang++-16 /usr/bin/clang++

# Clean up
RUN apt-get clean \
&& rm -rf /var/lib/apt/lists/*
Expand Down
Loading