Skip to content

[mlir][emitc] Add support for C-API/python binding to EmitC dialect #119476

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

Merged
merged 3 commits into from
Dec 11, 2024

Conversation

TGMM
Copy link
Contributor

@TGMM TGMM commented Dec 11, 2024

Added EmitC dialect bindings.

Copy link

Thank you for submitting a Pull Request (PR) to the LLVM Project!

This PR will be automatically labeled and the relevant teams will be notified.

If you wish to, you can add reviewers by using the "Reviewers" section on this page.

If this is not working for you, it is probably because you do not have write permissions for the repository. In which case you can instead tag reviewers by name in a comment by using @ followed by their GitHub username.

If you have received no comments on your PR for a week, you can request a review by "ping"ing the PR by adding a comment “Ping”. The common courtesy "ping" rate is once a week. Please remember that you are asking for valuable time from other developers.

If you have further questions, they may be answered by the LLVM GitHub User Guide.

You can also ask questions in a comment on this PR, on the LLVM Discord or on the forums.

@llvmbot llvmbot added mlir:python MLIR Python bindings mlir bazel "Peripheral" support tier build system: utils/bazel labels Dec 11, 2024
@llvmbot
Copy link
Member

llvmbot commented Dec 11, 2024

@llvm/pr-subscribers-mlir

Author: Eliud de León (TGMM)

Changes

Added EmitC dialect bindings.


Full diff: https://github.com/llvm/llvm-project/pull/119476.diff

8 Files Affected:

  • (added) mlir/include/mlir-c/Dialect/EmitC.h (+26)
  • (modified) mlir/lib/CAPI/Dialect/CMakeLists.txt (+9)
  • (added) mlir/lib/CAPI/Dialect/EmitC.cpp (+13)
  • (modified) mlir/python/CMakeLists.txt (+7)
  • (added) mlir/python/mlir/dialects/EmitC.td (+14)
  • (added) mlir/python/mlir/dialects/emitc.py (+5)
  • (added) mlir/test/python/dialects/emitc_dialect.py (+31)
  • (modified) utils/bazel/llvm-project-overlay/mlir/python/BUILD.bazel (+31)
diff --git a/mlir/include/mlir-c/Dialect/EmitC.h b/mlir/include/mlir-c/Dialect/EmitC.h
new file mode 100644
index 00000000000000..82e698344bf1e7
--- /dev/null
+++ b/mlir/include/mlir-c/Dialect/EmitC.h
@@ -0,0 +1,26 @@
+//===-- mlir-c/Dialect/EmitC.h - C API for EmitC dialect ----------*- C -*-===//
+//
+// Part of the LLVM Project, 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
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef MLIR_C_DIALECT_EmitC_H
+#define MLIR_C_DIALECT_EmitC_H
+
+#include "mlir-c/IR.h"
+#include "mlir-c/Support.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+MLIR_DECLARE_CAPI_DIALECT_REGISTRATION(EmitC, emitc);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // MLIR_C_DIALECT_EmitC_H
diff --git a/mlir/lib/CAPI/Dialect/CMakeLists.txt b/mlir/lib/CAPI/Dialect/CMakeLists.txt
index 4e141b60ff8cc9..5ad4bafedf6c48 100644
--- a/mlir/lib/CAPI/Dialect/CMakeLists.txt
+++ b/mlir/lib/CAPI/Dialect/CMakeLists.txt
@@ -40,6 +40,15 @@ add_mlir_upstream_c_api_library(MLIRCAPIControlFlow
   MLIRControlFlowDialect
 )
 
+add_mlir_upstream_c_api_library(MLIRCAPIEmitC
+  EmitC.cpp
+
+  PARTIAL_SOURCES_INTENDED
+  LINK_LIBS PUBLIC
+  MLIRCAPIIR
+  MLIREmitCDialect
+)
+
 add_mlir_upstream_c_api_library(MLIRCAPIMath
   Math.cpp
 
diff --git a/mlir/lib/CAPI/Dialect/EmitC.cpp b/mlir/lib/CAPI/Dialect/EmitC.cpp
new file mode 100644
index 00000000000000..3dcb7038a57981
--- /dev/null
+++ b/mlir/lib/CAPI/Dialect/EmitC.cpp
@@ -0,0 +1,13 @@
+//===- EmitC.cpp - C Interface for EmitC dialect --------------------------===//
+//
+// Part of the LLVM Project, 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
+//
+//===----------------------------------------------------------------------===//
+
+#include "mlir-c/Dialect/EmitC.h"
+#include "mlir/CAPI/Registration.h"
+#include "mlir/Dialect/EmitC/IR/EmitC.h"
+
+MLIR_DEFINE_CAPI_DIALECT_REGISTRATION(EmitC, emitc, mlir::emitc::EmitCDialect)
diff --git a/mlir/python/CMakeLists.txt b/mlir/python/CMakeLists.txt
index e1b870b53ad25c..6af5433fe946b7 100644
--- a/mlir/python/CMakeLists.txt
+++ b/mlir/python/CMakeLists.txt
@@ -352,6 +352,13 @@ declare_mlir_python_sources(
     dialects/quant.py
     _mlir_libs/_mlir/dialects/quant.pyi)
 
+declare_mlir_dialect_python_bindings(
+    ADD_TO_PARENT MLIRPythonSources.Dialects
+    ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/mlir"
+    TD_FILE dialects/EmitC.td
+    SOURCES dialects/emitc.py
+    DIALECT_NAME emitc)
+
 declare_mlir_dialect_python_bindings(
   ADD_TO_PARENT MLIRPythonSources.Dialects
   ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/mlir"
diff --git a/mlir/python/mlir/dialects/EmitC.td b/mlir/python/mlir/dialects/EmitC.td
new file mode 100644
index 00000000000000..ff0a56d1550148
--- /dev/null
+++ b/mlir/python/mlir/dialects/EmitC.td
@@ -0,0 +1,14 @@
+//===-- EmitC.td - Entry point for EmitC bind --------*- tablegen -*-===//
+//
+// Part of the LLVM Project, 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
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef PYTHON_BINDINGS_EMITC
+#define PYTHON_BINDINGS_EMITC
+
+include "mlir/Dialect/EmitC/IR/EmitC.td"
+
+#endif
diff --git a/mlir/python/mlir/dialects/emitc.py b/mlir/python/mlir/dialects/emitc.py
new file mode 100644
index 00000000000000..99c3286e576f1e
--- /dev/null
+++ b/mlir/python/mlir/dialects/emitc.py
@@ -0,0 +1,5 @@
+#  Part of the LLVM Project, 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
+
+from ._emitc_ops_gen import *
diff --git a/mlir/test/python/dialects/emitc_dialect.py b/mlir/test/python/dialects/emitc_dialect.py
new file mode 100644
index 00000000000000..0c42c2d4084f19
--- /dev/null
+++ b/mlir/test/python/dialects/emitc_dialect.py
@@ -0,0 +1,31 @@
+# RUN: %PYTHON %s | FileCheck %s
+
+from mlir.ir import *
+import mlir.dialects.emitc as emitc
+
+
+def run(f):
+    print("\nTEST:", f.__name__)
+    with Context() as ctx, Location.unknown():
+        module = Module.create()
+        with InsertionPoint(module.body):
+            f(ctx)
+        print(module)
+
+
+# CHECK-LABEL: TEST: testConstantOp
+@run
+def testConstantOp(ctx):
+    i32 = IntegerType.get_signless(32)
+    a = emitc.ConstantOp(result=i32, value=IntegerAttr.get(i32, 42))
+    # CHECK: %{{.*}} = "emitc.constant"() <{value = 42 : i32}> : () -> i32
+
+
+# CHECK-LABEL: TEST: testAddOp
+@run
+def testAddOp(ctx):
+    i32 = IntegerType.get_signless(32)
+    lhs = emitc.ConstantOp(result=i32, value=IntegerAttr.get(i32, 0))
+    rhs = emitc.ConstantOp(result=i32, value=IntegerAttr.get(i32, 0))
+    a = emitc.AddOp(i32, lhs, rhs)
+    # CHECK: %{{.*}} = emitc.add %{{.*}}, %{{.*}} : (i32, i32) -> i32
diff --git a/utils/bazel/llvm-project-overlay/mlir/python/BUILD.bazel b/utils/bazel/llvm-project-overlay/mlir/python/BUILD.bazel
index 254cab0db4a5d6..2b3971a5088044 100644
--- a/utils/bazel/llvm-project-overlay/mlir/python/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/mlir/python/BUILD.bazel
@@ -227,6 +227,37 @@ filegroup(
     ],
 )
 
+##---------------------------------------------------------------------------##
+# EmitC dialect.
+##---------------------------------------------------------------------------##
+
+gentbl_filegroup(
+    name = "EmitCPyGen",
+    tbl_outs = [
+        (
+            [
+                "-gen-python-op-bindings",
+                "-bind-dialect=emitc",
+            ],
+            "mlir/dialects/_emitc_ops_gen.py",
+        ),
+    ],
+    tblgen = "//mlir:mlir-tblgen",
+    td_file = "mlir/dialects/EmitC.td",
+    deps = [
+        "//mlir:OpBaseTdFiles",
+        "//mlir:EmitCTdFiles",
+    ],
+)
+
+filegroup(
+    name = "EmitCPyFiles",
+    srcs = [
+        "mlir/dialects/emitc.py",
+        ":EmitCPyGen",
+    ],
+)
+
 ##---------------------------------------------------------------------------##
 # Linalg dialect.
 ##---------------------------------------------------------------------------##

Copy link
Contributor

@makslevental makslevental left a comment

Choose a reason for hiding this comment

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

LGTM modulo the nits (bazel maybe needs to be removed...).

Just curious: what's your plan for these bindings?

@makslevental
Copy link
Contributor

cc @marbre now we can write C in any language 😛

@TGMM
Copy link
Contributor Author

TGMM commented Dec 11, 2024

LGTM modulo the nits (bazel maybe needs to be removed...).

Just curious: what's your plan for these bindings?

Thanks for the quick review! I'm working on a toy compiler that emits C code. I'd like to use Rust for it, which is why I need the bindings for this dialect.

@makslevental
Copy link
Contributor

Cool - lemme know when you're ready for me to merge this.

@TGMM
Copy link
Contributor Author

TGMM commented Dec 11, 2024

Thank you, please merge this.

@makslevental makslevental merged commit 3c464d2 into llvm:main Dec 11, 2024
8 checks passed
Copy link

@TGMM Congratulations on having your first Pull Request (PR) merged into the LLVM Project!

Your changes will be combined with recent changes from other authors, then tested by our build bots. If there is a problem with a build, you may receive a report in an email or a comment on this PR.

Please check whether problems have been caused by your change specifically, as the builds can include changes from many authors. It is not uncommon for your change to be included in a build that fails due to someone else's changes, or infrastructure issues.

How to do this, and the rest of the post-merge process, is covered in detail here.

If your change does cause a problem, it may be reverted, or you can revert it yourself. This is a normal part of LLVM development. You can fix your changes and open a new PR to merge them again.

If you don't get any reports, no action is required from you. Your changes are working as expected, well done!

@llvm-ci
Copy link
Collaborator

llvm-ci commented Dec 11, 2024

LLVM Buildbot has detected a new failure on builder sanitizer-x86_64-linux-bootstrap-msan running on sanitizer-buildbot6 while building mlir at step 2 "annotate".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/164/builds/5444

Here is the relevant piece of the build log for the reference
Step 2 (annotate) failure: 'python ../sanitizer_buildbot/sanitizers/zorg/buildbot/builders/sanitizers/buildbot_selector.py' (failure)
...
llvm-lit: /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:506: note: using lld-link: /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm_build_msan/bin/lld-link
llvm-lit: /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:506: note: using ld64.lld: /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm_build_msan/bin/ld64.lld
llvm-lit: /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:506: note: using wasm-ld: /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm_build_msan/bin/wasm-ld
llvm-lit: /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:506: note: using ld.lld: /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm_build_msan/bin/ld.lld
llvm-lit: /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:506: note: using lld-link: /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm_build_msan/bin/lld-link
llvm-lit: /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:506: note: using ld64.lld: /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm_build_msan/bin/ld64.lld
llvm-lit: /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:506: note: using wasm-ld: /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm_build_msan/bin/wasm-ld
llvm-lit: /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/utils/lit/lit/main.py:72: note: The test suite configuration requested an individual test timeout of 0 seconds but a timeout of 900 seconds was requested on the command line. Forcing timeout to be 900 seconds.
-- Testing: 87774 tests, 88 workers --
Testing:  0.. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80
FAIL: LLVM :: Transforms/VectorCombine/AArch64/load-extract-insert-store-scalarization.ll (73690 of 87774)
******************** TEST 'LLVM :: Transforms/VectorCombine/AArch64/load-extract-insert-store-scalarization.ll' FAILED ********************
Exit Code: 2

Command Output (stderr):
--
RUN: at line 2: /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm_build_msan/bin/opt -passes=vector-combine -S /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/test/Transforms/VectorCombine/AArch64/load-extract-insert-store-scalarization.ll | /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm_build_msan/bin/FileCheck /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/test/Transforms/VectorCombine/AArch64/load-extract-insert-store-scalarization.ll
+ /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm_build_msan/bin/opt -passes=vector-combine -S /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/test/Transforms/VectorCombine/AArch64/load-extract-insert-store-scalarization.ll
+ /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm_build_msan/bin/FileCheck /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/test/Transforms/VectorCombine/AArch64/load-extract-insert-store-scalarization.ll
==794391==WARNING: MemorySanitizer: use-of-uninitialized-value
    #0 0x55555e00fe7c in getTypeID /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/include/llvm/IR/Type.h:136:37
    #1 0x55555e00fe7c in isIntegerTy /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/include/llvm/IR/Type.h:237:37
    #2 0x55555e00fe7c in (anonymous namespace)::VectorCombine::run()::$_0::operator()(llvm::Instruction&) const /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/lib/Transforms/Vectorize/VectorCombine.cpp:3019:22
    #3 0x55555dfed7b8 in run /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/lib/Transforms/Vectorize/VectorCombine.cpp:3076:7
    #4 0x55555dfed7b8 in llvm::VectorCombinePass::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/lib/Transforms/Vectorize/VectorCombine.cpp:3105:17
    #5 0x55555d5e5791 in llvm::detail::PassModel<llvm::Function, llvm::VectorCombinePass, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/include/llvm/IR/PassManagerInternal.h:90:17
    #6 0x55555a0e6d20 in llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/include/llvm/IR/PassManagerImpl.h:81:38
    #7 0x55555d5ea1f1 in llvm::detail::PassModel<llvm::Function, llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function>>, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/include/llvm/IR/PassManagerInternal.h:90:17
    #8 0x55555a0f5df2 in llvm::ModuleToFunctionPassAdaptor::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/lib/IR/PassManager.cpp:124:38
    #9 0x55555d5dbcc1 in llvm::detail::PassModel<llvm::Module, llvm::ModuleToFunctionPassAdaptor, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/include/llvm/IR/PassManagerInternal.h:90:17
    #10 0x55555a0e3190 in llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/include/llvm/IR/PassManagerImpl.h:81:38
    #11 0x55555d4888e0 in llvm::runPassPipeline(llvm::StringRef, llvm::Module&, llvm::TargetMachine*, llvm::TargetLibraryInfoImpl*, llvm::ToolOutputFile*, llvm::ToolOutputFile*, llvm::ToolOutputFile*, llvm::StringRef, llvm::ArrayRef<llvm::PassPlugin>, llvm::ArrayRef<std::__1::function<void (llvm::PassBuilder&)>>, llvm::opt_tool::OutputKind, llvm::opt_tool::VerifierKind, bool, bool, bool, bool, bool, bool, bool) /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/tools/opt/NewPMDriver.cpp:541:7
    #12 0x555559a56e4b in optMain /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/tools/opt/optdriver.cpp:739:12
    #13 0x7ffff7a2a3b7  (/lib/x86_64-linux-gnu/libc.so.6+0x2a3b7) (BuildId: 5f3f024b472f38389da3a2f567b3d0eaa8835ca2)
    #14 0x7ffff7a2a47a in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2a47a) (BuildId: 5f3f024b472f38389da3a2f567b3d0eaa8835ca2)
    #15 0x5555599ac824 in _start (/home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm_build_msan/bin/opt+0x4458824)

SUMMARY: MemorySanitizer: use-of-uninitialized-value /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/include/llvm/IR/Type.h:136:37 in getTypeID
Exiting
FileCheck error: '<stdin>' is empty.
FileCheck command line:  /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm_build_msan/bin/FileCheck /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/test/Transforms/VectorCombine/AArch64/load-extract-insert-store-scalarization.ll

--

********************
Testing:  0.. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80
FAIL: LLVM :: Transforms/VectorCombine/load-insert-store.ll (73712 of 87774)
******************** TEST 'LLVM :: Transforms/VectorCombine/load-insert-store.ll' FAILED ********************
Exit Code: 2
Step 11 (stage2/msan check) failure: stage2/msan check (failure)
...
llvm-lit: /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:506: note: using lld-link: /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm_build_msan/bin/lld-link
llvm-lit: /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:506: note: using ld64.lld: /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm_build_msan/bin/ld64.lld
llvm-lit: /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:506: note: using wasm-ld: /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm_build_msan/bin/wasm-ld
llvm-lit: /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:506: note: using ld.lld: /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm_build_msan/bin/ld.lld
llvm-lit: /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:506: note: using lld-link: /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm_build_msan/bin/lld-link
llvm-lit: /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:506: note: using ld64.lld: /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm_build_msan/bin/ld64.lld
llvm-lit: /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:506: note: using wasm-ld: /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm_build_msan/bin/wasm-ld
llvm-lit: /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/utils/lit/lit/main.py:72: note: The test suite configuration requested an individual test timeout of 0 seconds but a timeout of 900 seconds was requested on the command line. Forcing timeout to be 900 seconds.
-- Testing: 87774 tests, 88 workers --
Testing:  0.. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80
FAIL: LLVM :: Transforms/VectorCombine/AArch64/load-extract-insert-store-scalarization.ll (73690 of 87774)
******************** TEST 'LLVM :: Transforms/VectorCombine/AArch64/load-extract-insert-store-scalarization.ll' FAILED ********************
Exit Code: 2

Command Output (stderr):
--
RUN: at line 2: /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm_build_msan/bin/opt -passes=vector-combine -S /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/test/Transforms/VectorCombine/AArch64/load-extract-insert-store-scalarization.ll | /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm_build_msan/bin/FileCheck /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/test/Transforms/VectorCombine/AArch64/load-extract-insert-store-scalarization.ll
+ /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm_build_msan/bin/opt -passes=vector-combine -S /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/test/Transforms/VectorCombine/AArch64/load-extract-insert-store-scalarization.ll
+ /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm_build_msan/bin/FileCheck /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/test/Transforms/VectorCombine/AArch64/load-extract-insert-store-scalarization.ll
==794391==WARNING: MemorySanitizer: use-of-uninitialized-value
    #0 0x55555e00fe7c in getTypeID /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/include/llvm/IR/Type.h:136:37
    #1 0x55555e00fe7c in isIntegerTy /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/include/llvm/IR/Type.h:237:37
    #2 0x55555e00fe7c in (anonymous namespace)::VectorCombine::run()::$_0::operator()(llvm::Instruction&) const /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/lib/Transforms/Vectorize/VectorCombine.cpp:3019:22
    #3 0x55555dfed7b8 in run /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/lib/Transforms/Vectorize/VectorCombine.cpp:3076:7
    #4 0x55555dfed7b8 in llvm::VectorCombinePass::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/lib/Transforms/Vectorize/VectorCombine.cpp:3105:17
    #5 0x55555d5e5791 in llvm::detail::PassModel<llvm::Function, llvm::VectorCombinePass, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/include/llvm/IR/PassManagerInternal.h:90:17
    #6 0x55555a0e6d20 in llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/include/llvm/IR/PassManagerImpl.h:81:38
    #7 0x55555d5ea1f1 in llvm::detail::PassModel<llvm::Function, llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function>>, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/include/llvm/IR/PassManagerInternal.h:90:17
    #8 0x55555a0f5df2 in llvm::ModuleToFunctionPassAdaptor::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/lib/IR/PassManager.cpp:124:38
    #9 0x55555d5dbcc1 in llvm::detail::PassModel<llvm::Module, llvm::ModuleToFunctionPassAdaptor, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/include/llvm/IR/PassManagerInternal.h:90:17
    #10 0x55555a0e3190 in llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/include/llvm/IR/PassManagerImpl.h:81:38
    #11 0x55555d4888e0 in llvm::runPassPipeline(llvm::StringRef, llvm::Module&, llvm::TargetMachine*, llvm::TargetLibraryInfoImpl*, llvm::ToolOutputFile*, llvm::ToolOutputFile*, llvm::ToolOutputFile*, llvm::StringRef, llvm::ArrayRef<llvm::PassPlugin>, llvm::ArrayRef<std::__1::function<void (llvm::PassBuilder&)>>, llvm::opt_tool::OutputKind, llvm::opt_tool::VerifierKind, bool, bool, bool, bool, bool, bool, bool) /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/tools/opt/NewPMDriver.cpp:541:7
    #12 0x555559a56e4b in optMain /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/tools/opt/optdriver.cpp:739:12
    #13 0x7ffff7a2a3b7  (/lib/x86_64-linux-gnu/libc.so.6+0x2a3b7) (BuildId: 5f3f024b472f38389da3a2f567b3d0eaa8835ca2)
    #14 0x7ffff7a2a47a in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2a47a) (BuildId: 5f3f024b472f38389da3a2f567b3d0eaa8835ca2)
    #15 0x5555599ac824 in _start (/home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm_build_msan/bin/opt+0x4458824)

SUMMARY: MemorySanitizer: use-of-uninitialized-value /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/include/llvm/IR/Type.h:136:37 in getTypeID
Exiting
FileCheck error: '<stdin>' is empty.
FileCheck command line:  /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm_build_msan/bin/FileCheck /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/test/Transforms/VectorCombine/AArch64/load-extract-insert-store-scalarization.ll

--

********************
Testing:  0.. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80
FAIL: LLVM :: Transforms/VectorCombine/load-insert-store.ll (73712 of 87774)
******************** TEST 'LLVM :: Transforms/VectorCombine/load-insert-store.ll' FAILED ********************
Exit Code: 2
Step 15 (stage2/msan_track_origins check) failure: stage2/msan_track_origins check (failure)
...
llvm-lit: /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:506: note: using lld-link: /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm_build_msan_track_origins/bin/lld-link
llvm-lit: /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:506: note: using ld64.lld: /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm_build_msan_track_origins/bin/ld64.lld
llvm-lit: /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:506: note: using wasm-ld: /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm_build_msan_track_origins/bin/wasm-ld
llvm-lit: /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:506: note: using ld.lld: /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm_build_msan_track_origins/bin/ld.lld
llvm-lit: /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:506: note: using lld-link: /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm_build_msan_track_origins/bin/lld-link
llvm-lit: /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:506: note: using ld64.lld: /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm_build_msan_track_origins/bin/ld64.lld
llvm-lit: /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:506: note: using wasm-ld: /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm_build_msan_track_origins/bin/wasm-ld
llvm-lit: /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/utils/lit/lit/main.py:72: note: The test suite configuration requested an individual test timeout of 0 seconds but a timeout of 900 seconds was requested on the command line. Forcing timeout to be 900 seconds.
-- Testing: 87774 tests, 88 workers --
Testing:  0.. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80
FAIL: LLVM :: Transforms/VectorCombine/AArch64/load-extract-insert-store-scalarization.ll (73647 of 87774)
******************** TEST 'LLVM :: Transforms/VectorCombine/AArch64/load-extract-insert-store-scalarization.ll' FAILED ********************
Exit Code: 2

Command Output (stderr):
--
RUN: at line 2: /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm_build_msan_track_origins/bin/opt -passes=vector-combine -S /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/test/Transforms/VectorCombine/AArch64/load-extract-insert-store-scalarization.ll | /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm_build_msan_track_origins/bin/FileCheck /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/test/Transforms/VectorCombine/AArch64/load-extract-insert-store-scalarization.ll
+ /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm_build_msan_track_origins/bin/opt -passes=vector-combine -S /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/test/Transforms/VectorCombine/AArch64/load-extract-insert-store-scalarization.ll
+ /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm_build_msan_track_origins/bin/FileCheck /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/test/Transforms/VectorCombine/AArch64/load-extract-insert-store-scalarization.ll
==2964328==WARNING: MemorySanitizer: use-of-uninitialized-value
    #0 0x5a52ce6c1317 in getTypeID /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/include/llvm/IR/Type.h:136:37
    #1 0x5a52ce6c1317 in isIntegerTy /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/include/llvm/IR/Type.h:237:37
    #2 0x5a52ce6c1317 in (anonymous namespace)::VectorCombine::run()::$_0::operator()(llvm::Instruction&) const /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/lib/Transforms/Vectorize/VectorCombine.cpp:3019:22
    #3 0x5a52ce69337c in run /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/lib/Transforms/Vectorize/VectorCombine.cpp:3076:7
    #4 0x5a52ce69337c in llvm::VectorCombinePass::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/lib/Transforms/Vectorize/VectorCombine.cpp:3105:17
    #5 0x5a52cd7c77a1 in llvm::detail::PassModel<llvm::Function, llvm::VectorCombinePass, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/include/llvm/IR/PassManagerInternal.h:90:17
    #6 0x5a52c8b4678b in llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/include/llvm/IR/PassManagerImpl.h:81:38
    #7 0x5a52cd7d0091 in llvm::detail::PassModel<llvm::Function, llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function>>, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/include/llvm/IR/PassManagerInternal.h:90:17
    #8 0x5a52c8b5cac9 in llvm::ModuleToFunctionPassAdaptor::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/lib/IR/PassManager.cpp:124:38
    #9 0x5a52cd7b7a21 in llvm::detail::PassModel<llvm::Module, llvm::ModuleToFunctionPassAdaptor, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/include/llvm/IR/PassManagerInternal.h:90:17
    #10 0x5a52c8b413ab in llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/include/llvm/IR/PassManagerImpl.h:81:38
    #11 0x5a52cd5999bd in llvm::runPassPipeline(llvm::StringRef, llvm::Module&, llvm::TargetMachine*, llvm::TargetLibraryInfoImpl*, llvm::ToolOutputFile*, llvm::ToolOutputFile*, llvm::ToolOutputFile*, llvm::StringRef, llvm::ArrayRef<llvm::PassPlugin>, llvm::ArrayRef<std::__1::function<void (llvm::PassBuilder&)>>, llvm::opt_tool::OutputKind, llvm::opt_tool::VerifierKind, bool, bool, bool, bool, bool, bool, bool) /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/tools/opt/NewPMDriver.cpp:541:7
    #12 0x5a52c81975a9 in optMain /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/tools/opt/optdriver.cpp:739:12
    #13 0x76e0fce2a3b7  (/lib/x86_64-linux-gnu/libc.so.6+0x2a3b7) (BuildId: 5f3f024b472f38389da3a2f567b3d0eaa8835ca2)
    #14 0x76e0fce2a47a in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2a47a) (BuildId: 5f3f024b472f38389da3a2f567b3d0eaa8835ca2)
    #15 0x5a52c80e78e4 in _start (/home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm_build_msan_track_origins/bin/opt+0x47d58e4)

  Uninitialized value was created by a heap deallocation
    #0 0x5a52c8182a19 in operator delete(void*) /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/compiler-rt/lib/msan/msan_new_delete.cpp:80:44
    #1 0x5a52c8675057 in deleteNode /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/include/llvm/IR/Instruction.h:1051:6
    #2 0x5a52c8675057 in erase /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/include/llvm/ADT/ilist.h:205:5
    #3 0x5a52c8675057 in llvm::Instruction::eraseFromParent() /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/lib/IR/Instruction.cpp:94:37
    #4 0x5a52ce6b2d3b in foldSingleElementStore /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/lib/Transforms/Vectorize/VectorCombine.cpp:1325:5
    #5 0x5a52ce6b2d3b in (anonymous namespace)::VectorCombine::run()::$_0::operator()(llvm::Instruction&) const /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/lib/Transforms/Vectorize/VectorCombine.cpp:3013:21
    #6 0x5a52ce69337c in run /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/lib/Transforms/Vectorize/VectorCombine.cpp:3076:7
    #7 0x5a52ce69337c in llvm::VectorCombinePass::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/lib/Transforms/Vectorize/VectorCombine.cpp:3105:17
    #8 0x5a52cd7c77a1 in llvm::detail::PassModel<llvm::Function, llvm::VectorCombinePass, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/include/llvm/IR/PassManagerInternal.h:90:17
    #9 0x5a52c8b4678b in llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/include/llvm/IR/PassManagerImpl.h:81:38
    #10 0x5a52cd7d0091 in llvm::detail::PassModel<llvm::Function, llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function>>, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/include/llvm/IR/PassManagerInternal.h:90:17

TGMM added a commit to TGMM/llvm-project that referenced this pull request Dec 12, 2024
@makslevental
Copy link
Contributor

makslevental commented Dec 12, 2024

LLVM Buildbot has detected a new failure on builder sanitizer-x86_64-linux-bootstrap-msan running on sanitizer-buildbot6 while building mlir at step 2 "annotate".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/164/builds/5444

Looks unrelated

@TGMM
Copy link
Contributor Author

TGMM commented Dec 12, 2024

LLVM Buildbot has detected a new failure on builder sanitizer-x86_64-linux-bootstrap-msan running on sanitizer-buildbot6 while building mlir at step 2 "annotate".
Full details are available at: https://lab.llvm.org/buildbot/#/builders/164/builds/5444

Looks unrelated

Thank you for double checking. I looked at the error as soon as I got the notification but also found it unrelated. What should I do in those situations? Is posting a comment stating that it seems unrelated enough? Just trying to make sure I'm following the proper contribution guidelines.

@makslevental
Copy link
Contributor

LLVM Buildbot has detected a new failure on builder sanitizer-x86_64-linux-bootstrap-msan running on sanitizer-buildbot6 while building mlir at step 2 "annotate".
Full details are available at: https://lab.llvm.org/buildbot/#/builders/164/builds/5444

Looks unrelated

Thank you for double checking. I looked at the error as soon as I got the notification but also found it unrelated. What should I do in those situations? Is posting a comment stating that it seems unrelated enough? Just trying to make sure I'm following the proper contribution guidelines.

You can ignore it if you're reasonably sure it's unrelated. The tests can be flaky (especially ASAN for some reason 🤷‍♀️). Sometimes it persists and it turns out it's not a flake (just just logs are misreporting). At that point you either "fix-forward" (push a change quickly you know will fix) or revert. But either way it's not the end of the world - it happens fairly often that the build is broken and then gets fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bazel "Peripheral" support tier build system: utils/bazel mlir:python MLIR Python bindings mlir
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants