Skip to content

Zezhang/upgrade jun 05 #8

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

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
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
3 changes: 1 addition & 2 deletions .bazelignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
# Also available under a BSD-style license. See LICENSE.

# ignore local_repos of llvm-project, torch-mlir, stablehlo
# ignore local_repos of llvm-project, torch-mlir
third_party/llvm-project
third_party/torch-mlir
third_party/stablehlo
64 changes: 0 additions & 64 deletions .github/workflows/bazelBuildAndTestStablehlo.yml

This file was deleted.

3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,9 @@ bazel-out
bazel-mlir-tcp
bazel-testlogs

# ignore local_repos of llvm, torch-mlir, stablehlo
# ignore local_repos of llvm, torch-mlir
third_party/llvm-project
third_party/torch-mlir
third_party/stablehlo

# clangd related
.cache
Expand Down
21 changes: 0 additions & 21 deletions BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,6 @@ cc_library(
hdrs = ["include/mlir-tcp/Conversion/Passes.h"],
strip_include_prefix = "include",
deps = [
":StablehloToTcp",
":TcpToArith",
":TcpToLinalg",
":TcpToTensor",
Expand Down Expand Up @@ -237,25 +236,6 @@ cc_library(
],
)

cc_library(
name = "StablehloToTcp",
srcs = [
"lib/Conversion/PassDetail.h",
"lib/Conversion/StablehloToTcp/StablehloToTcp.cpp",
],
hdrs = ["include/mlir-tcp/Conversion/StablehloToTcp/StablehloToTcp.h"],
strip_include_prefix = "include",
deps = [
":TcpConversionPassesIncGen",
":TcpDialect",
"@llvm-project//mlir:Dialect",
"@llvm-project//mlir:LinalgDialect",
"@llvm-project//mlir:Pass",
"@llvm-project//mlir:Transforms",
"@stablehlo//:stablehlo_ops",
],
)

cc_library(
name = "TcpToLinalg",
srcs = [
Expand Down Expand Up @@ -364,6 +344,5 @@ cc_binary(
"@llvm-project//mlir:AllPassesAndDialects",
"@llvm-project//mlir:MlirOptLib",
"@llvm-project//mlir:QuantOps",
"@stablehlo//:register",
],
)
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,17 +51,15 @@ bazel run //tools/clangd:refresh_compile_commands
```
When run successfully, a `compile_commands.json` is generated at the workspace root (and refreshed upon re-runs). If you're using VSCode, just hit CMD+SHIFT+P and select `clangd: Restart language server` to start clangd. Note that this only works for non-docker builds at the moment.

When bumping upstream dependencies (LLVM, Torch-MLIR, StableHLO), you may validate the set of "green commits" by running the corresponding third-party tests:
When bumping upstream dependencies (LLVM, Torch-MLIR), you may validate the set of "green commits" by running the corresponding third-party tests:
```shell
bazel test @llvm-project//mlir/...
bazel test @torch-mlir//...
bazel test @stablehlo//...
```

The following CI workflows are automatically triggered anytime upstream dependencies (`deps.bzl`) are updated:
- [![Bazel Build and Test (llvm-project)](https://github.com/llvm/mlir-tcp/actions/workflows/bazelBuildAndTestLlvm.yml/badge.svg)](https://github.com/llvm/mlir-tcp/actions/workflows/bazelBuildAndTestLlvm.yml)
- [![Bazel Build and Test (torch-mlir)](https://github.com/llvm/mlir-tcp/actions/workflows/bazelBuildAndTestTorchmlir.yml/badge.svg)](https://github.com/llvm/mlir-tcp/actions/workflows/bazelBuildAndTestTorchmlir.yml)
- [![Bazel Build and Test (stablehlo)](https://github.com/llvm/mlir-tcp/actions/workflows/bazelBuildAndTestStablehlo.yml/badge.svg)](https://github.com/llvm/mlir-tcp/actions/workflows/bazelBuildAndTestStablehlo.yml)

To use newer `torch-mlir` and/or `torch` python packages in our hermetic python sandbox, just regenerate `requirements_lock.txt` as follows:
```shell
Expand Down
29 changes: 5 additions & 24 deletions deps.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load(
":local_repos.bzl",
"local_llvm_repo_path",
"local_stablehlo_repo_path",
"local_torch_mlir_repo_path",
"use_local_llvm_repo",
"use_local_stablehlo_repo",
"use_local_torch_mlir_repo",
)

Expand All @@ -22,8 +20,8 @@ def third_party_deps():
path = local_llvm_repo_path(),
)
else:
LLVM_COMMIT = "72144d119a7291f8b6b8e022a2947fbe31e66afc"
LLVM_SHA256 = "2caacb6925a13cb5886a5d7f225fa408b80ca8e1efe0736186954b2abc4ee1c3"
LLVM_COMMIT = "eda3e96b401a9b86132e39432e41e2000d1ab382"
LLVM_SHA256 = "26c4060f19982482d57f1a47945f3f7613b7659415f0482c4bac63769366b501"
http_archive(
name = "llvm-raw",
build_file_content = "# empty",
Expand All @@ -39,32 +37,15 @@ def third_party_deps():
path = local_torch_mlir_repo_path(),
)
else:
TORCH_MLIR_COMMIT = "9f2ba5abaa85cefd95cc85579fafd0c53c1101e8"
TORCH_MLIR_SHA256 = "09444281839eeae4aff42c029d87b1728f307fa26511b896ff448d51aaa98049"
TORCH_MLIR_COMMIT = "1ad9702d2a290b693c4f6f17921d0e0a8d14a999"
TORCH_MLIR_SHA256 = "8843399168c34ca3ca16d2417703fe4e1440ca7240d9e04844b3deedf256f0ab"
http_archive(
name = "torch-mlir-raw",
build_file_content = "# empty",
patches = ["//third_party/patches:torch-mlir-bazel-build.1.patch"],
sha256 = TORCH_MLIR_SHA256,
strip_prefix = "torch-mlir-" + TORCH_MLIR_COMMIT,
urls = ["https://github.com/llvm/torch-mlir/archive/{commit}.tar.gz".format(commit = TORCH_MLIR_COMMIT)],
patches = [
"//third_party/patches:torch-mlir.1.patch",
],
)

if use_local_stablehlo_repo():
native.local_repository(
name = "stablehlo",
path = local_stablehlo_repo_path(),
)
else:
STABLEHLO_COMMIT = "a54938f0651d3b4b7be9771848eda2463c92a8e7"
STABLEHLO_SHA256 = "edab2288f0b19e3efbf08815d17d4efb106984aa6fe02fed0cb2165284e6a5b7"
http_archive(
name = "stablehlo",
sha256 = STABLEHLO_SHA256,
strip_prefix = "stablehlo-" + STABLEHLO_COMMIT,
urls = ["https://github.com/openxla/stablehlo/archive/{commit}.tar.gz".format(commit = STABLEHLO_COMMIT)],
)

SKYLIB_VERSION = "1.3.0"
Expand Down
17 changes: 0 additions & 17 deletions include/mlir-tcp/Conversion/Passes.td
Original file line number Diff line number Diff line change
Expand Up @@ -46,23 +46,6 @@ def ConvertTorchToTcpCustomOp : Pass<"convert-torch-to-tcp-custom-op", "func::Fu
];
}

//===----------------------------------------------------------------------===//
// StablehloToTcp
//===----------------------------------------------------------------------===//

def ConvertStablehloToTcp
: Pass<"convert-stablehlo-to-tcp", "func::FuncOp"> {
let summary = "Lower StableHLO to TCP";
let description = [{
Pass that converts StableHLO operations to equivalent operations in TCP.
}];

let constructor = "mlir::tcp::createConvertStablehloToTcpPass()";
let dependentDialects = [
"mlir::tcp::TcpDialect",
];
}

//===----------------------------------------------------------------------===//
// TcpToLinalg
//===----------------------------------------------------------------------===//
Expand Down
25 changes: 0 additions & 25 deletions include/mlir-tcp/Conversion/StablehloToTcp/StablehloToTcp.h

This file was deleted.

4 changes: 2 additions & 2 deletions include/mlir-tcp/Dialect/IR/TcpTypes.td
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ include "mlir-tcp/Dialect/IR/TcpBase.td"
// Where low and high ends are 0,255 when unsigned, -128,127 when signed, for
// the 8-bit case.
class Tcp_QuantizedType<string n, list<int> params, bit signed>
: Type<And<[CPred<"$_self.isa<mlir::quant::QuantizedType>()">,
CPred<"$_self.cast<mlir::quant::QuantizedType>()" #
: Type<And<[CPred<"::llvm::isa<mlir::quant::QuantizedType>($_self)">,
CPred<"::llvm::cast<mlir::quant::QuantizedType>($_self)" #
".getStorageTypeIntegralWidth() == " # !head(params)>]>,
"Q" # !if (signed, "int", "uint") # !head(params) # " type"> {
string name = n;
Expand Down
1 change: 0 additions & 1 deletion lib/Conversion/Passes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

#include "mlir-tcp/Conversion/Passes.h"

#include "mlir-tcp/Conversion/StablehloToTcp/StablehloToTcp.h"
#include "mlir-tcp/Conversion/TcpToArith/TcpToArith.h"
#include "mlir-tcp/Conversion/TcpToLinalg/TcpToLinalg.h"
#include "mlir-tcp/Conversion/TcpToTensor/TcpToTensor.h"
Expand Down
75 changes: 0 additions & 75 deletions lib/Conversion/StablehloToTcp/StablehloToTcp.cpp

This file was deleted.

10 changes: 4 additions & 6 deletions lib/Conversion/TcpToLinalg/DataMovement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,8 @@ class ConvertGatherOp : public OpConversionPattern<GatherOp> {
matchAndRewrite(GatherOp op, OpAdaptor adaptor,
ConversionPatternRewriter &rewriter) const override {
Location loc = op->getLoc();
auto resultTensorType = getTypeConverter()
->convertType(op.getOut().getType())
.cast<RankedTensorType>();
auto resultTensorType = cast<RankedTensorType>(getTypeConverter()
->convertType(op.getOut().getType()));

auto inputTensor = adaptor.getInput();
auto indicesTensor = adaptor.getIndices();
Expand Down Expand Up @@ -110,9 +109,8 @@ class ConvertGatherNDOp : public OpConversionPattern<GatherNDOp> {
matchAndRewrite(GatherNDOp op, OpAdaptor adaptor,
ConversionPatternRewriter &rewriter) const override {
Location loc = op->getLoc();
auto resultTensorType = getTypeConverter()
->convertType(op.getOut().getType())
.cast<RankedTensorType>();
auto resultTensorType = cast<RankedTensorType>(getTypeConverter()
->convertType(op.getOut().getType()));

auto inputTensor = adaptor.getInput();
auto indicesTensor = adaptor.getIndices();
Expand Down
Loading
Loading