Skip to content

[SandboxIR] Boilerplate code #95814

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 1 commit into from
Jul 1, 2024
Merged

[SandboxIR] Boilerplate code #95814

merged 1 commit into from
Jul 1, 2024

Conversation

vporpo
Copy link
Contributor

@vporpo vporpo commented Jun 17, 2024

This is the first patch in a series of patches for the Sandbox Vectorizer project. For a detailed description of the project please refer to the RFC: https://discourse.llvm.org/t/rfc-sandbox-vectorizer-an-experimental-modular-vectorizer/79059

This patch adds some basic boilerplate code for the SandboxIR which includes parts of the SBValue class.

@vporpo vporpo requested review from alinas, aeubanks and tmsri June 17, 2024 17:38
@vporpo vporpo requested review from rupprecht and keith as code owners June 17, 2024 17:38
@llvmbot llvmbot added bazel "Peripheral" support tier build system: utils/bazel llvm:transforms labels Jun 17, 2024
@llvmbot
Copy link
Member

llvmbot commented Jun 17, 2024

@llvm/pr-subscribers-llvm-transforms

Author: vporpo (vporpo)

Changes

This is the first patch in a series of patches for the Sandbox Vectorizer project. For a detailed description of the project please refer to the RFC: https://discourse.llvm.org/t/rfc-sandbox-vectorizer-an-experimental-modular-vectorizer/79059

This patch adds some basic boilerplate code for the SandboxIR which includes parts of the SBValue class.


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

7 Files Affected:

  • (added) llvm/include/llvm/Transforms/SandboxIR/SandboxIR.h (+129)
  • (added) llvm/include/llvm/Transforms/SandboxIR/SandboxIRValues.def (+29)
  • (modified) llvm/lib/Transforms/CMakeLists.txt (+1)
  • (added) llvm/lib/Transforms/SandboxIR/CMakeLists.txt (+11)
  • (added) llvm/lib/Transforms/SandboxIR/SandboxIR.cpp (+65)
  • (added) llvm/utils/gn/secondary/llvm/lib/Transforms/SandboxIR/BUILD.gn (+10)
  • (modified) utils/bazel/llvm-project-overlay/llvm/BUILD.bazel (+19)
diff --git a/llvm/include/llvm/Transforms/SandboxIR/SandboxIR.h b/llvm/include/llvm/Transforms/SandboxIR/SandboxIR.h
new file mode 100644
index 0000000000000..753f42d313bb2
--- /dev/null
+++ b/llvm/include/llvm/Transforms/SandboxIR/SandboxIR.h
@@ -0,0 +1,129 @@
+//===- SandboxIR.h ----------------------------------------------*- 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
+//
+//===----------------------------------------------------------------------===//
+//
+// Sandbox IR is a lightweight overlay transactional IR on top of LLVM IR.
+// Features:
+// - You can save/rollback the state of the IR at any time.
+// - Any changes made to Sandbox IR will automatically update the underlying
+//   LLVM IR so both IRs are always in sync.
+// - Feels like LLVM IR, similar API.
+//
+// SandboxIR forms a class hierarcy that resembles that of LLVM IR:
+//
+//          +- SBArgument   +- SBConstant     +- SBOpaqueInstruction
+//          |               |                 |
+// SBValue -+- SBUser ------+- SBInstruction -+- SBInsertElementInstruction
+//          |                                 |
+//          +- SBBasicBlock                   +- SBExtractElementInstruction
+//          |                                 |
+//          +- SBFunction                     +- SBShuffleVectorInstruction
+//                                            |
+//                                            +- SBStoreInstruction
+//                                            |
+//                                            +- SBLoadInstruction
+//                                            |
+//                                            +- SBCmpInstruction
+//                                            |
+//                                            +- SBCastInstruction
+//                                            |
+//                                            +- SBPHINode
+//                                            |
+//                                            +- SBSelectInstruction
+//                                            |
+//                                            +- SBBinaryOperator
+//                                            |
+//                                            +- SBUnaryOperator
+//
+// SBUse
+//
+#ifndef LLVM_TRANSFORMS_SANDBOXIR_SANDBOXIR_H
+#define LLVM_TRANSFORMS_SANDBOXIR_SANDBOXIR_H
+
+#include "llvm/IR/Value.h"
+#include "llvm/Support/raw_ostream.h"
+
+namespace llvm {
+
+class SBContext;
+
+/// A SBValue has users. This is the base class.
+class SBValue {
+public:
+  enum class ClassID : unsigned {
+#define DEF_VALUE(ID, CLASS) ID,
+#define DEF_USER(ID, CLASS) ID,
+#define DEF_INSTR(ID, OPC, CLASS) ID,
+#include "llvm/Transforms/SandboxIR/SandboxIRValues.def"
+  };
+
+protected:
+  static const char *getSubclassIDStr(ClassID ID) {
+    switch (ID) {
+      // clang-format off
+#define DEF_VALUE(ID, CLASS) case ClassID::ID: return #ID;
+#define DEF_USER(ID,  CLASS) case ClassID::ID: return #ID;
+#define DEF_INSTR(ID, OPC, CLASS) case ClassID::ID: return #ID;
+      // clang-format on
+#include "llvm/Transforms/SandboxIR/SandboxIRValues.def"
+    }
+    llvm_unreachable("Unimplemented ID");
+  }
+
+  /// For isa/dyn_cast.
+  ClassID SubclassID;
+#ifndef NDEBUG
+  /// A unique ID used for forming the name (used for debugging).
+  unsigned UID;
+#endif
+  /// The LLVM Value that corresponds to this SBValue.
+  /// NOTE: Some SBInstructions, like Packs, may include more than one value.
+  Value *Val = nullptr;
+  friend class ValueAttorney; // For Val
+
+  /// All values point to the context.
+  SBContext &Ctxt;
+  // This is used by eraseFromParent().
+  void clearValue() { Val = nullptr; }
+  template <typename ItTy, typename SBTy> friend class LLVMOpUserItToSBTy;
+
+public:
+  SBValue(ClassID SubclassID, Value *Val, SBContext &Ctxt);
+  virtual ~SBValue() = default;
+  ClassID getSubclassID() const { return SubclassID; }
+
+  Type *getType() const { return Val->getType(); }
+
+  SBContext &getContext() const;
+  virtual hash_code hashCommon() const {
+    return hash_combine(SubclassID, &Ctxt, Val);
+  }
+  virtual hash_code hash() const = 0;
+  friend hash_code hash_value(const SBValue &SBV) { return SBV.hash(); }
+#ifndef NDEBUG
+  /// Should crash if there is something wrong with the instruction.
+  virtual void verify() const = 0;
+  /// Returns the name in the form 'SB<number>.' like 'SB1.'
+  std::string getName() const;
+  virtual void dumpCommonHeader(raw_ostream &OS) const;
+  void dumpCommonFooter(raw_ostream &OS) const;
+  void dumpCommonPrefix(raw_ostream &OS) const;
+  void dumpCommonSuffix(raw_ostream &OS) const;
+  void printAsOperandCommon(raw_ostream &OS) const;
+  friend raw_ostream &operator<<(raw_ostream &OS, const SBValue &SBV) {
+    SBV.dump(OS);
+    return OS;
+  }
+  virtual void dump(raw_ostream &OS) const = 0;
+  LLVM_DUMP_METHOD virtual void dump() const = 0;
+  virtual void dumpVerbose(raw_ostream &OS) const = 0;
+  LLVM_DUMP_METHOD virtual void dumpVerbose() const = 0;
+#endif
+};
+} // namespace llvm
+
+#endif // LLVM_TRANSFORMS_SANDBOXIR_SANDBOXIR_H
diff --git a/llvm/include/llvm/Transforms/SandboxIR/SandboxIRValues.def b/llvm/include/llvm/Transforms/SandboxIR/SandboxIRValues.def
new file mode 100644
index 0000000000000..e33e8c8c5e07e
--- /dev/null
+++ b/llvm/include/llvm/Transforms/SandboxIR/SandboxIRValues.def
@@ -0,0 +1,29 @@
+//===- SandboxIRValues.def --------------------------------------*- 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
+//
+//===----------------------------------------------------------------------===//
+
+// clang-format off
+
+//        ClassID,                        Class
+// DEF_USER(Constant,                        SBConstant)
+
+// clang-format on
+#ifdef DEF_VALUE
+#undef DEF_VALUE
+#endif
+#ifdef DEF_USER
+#undef DEF_USER
+#endif
+#ifdef DEF_INSTR
+#undef DEF_INSTR
+#endif
+#ifdef OPCODES
+#undef OPCODES
+#endif
+#ifdef OP
+#undef OP
+#endif
diff --git a/llvm/lib/Transforms/CMakeLists.txt b/llvm/lib/Transforms/CMakeLists.txt
index 84a7e34147d08..d9857034ba1a9 100644
--- a/llvm/lib/Transforms/CMakeLists.txt
+++ b/llvm/lib/Transforms/CMakeLists.txt
@@ -10,3 +10,4 @@ add_subdirectory(ObjCARC)
 add_subdirectory(Coroutines)
 add_subdirectory(CFGuard)
 add_subdirectory(HipStdPar)
+add_subdirectory(SandboxIR)
diff --git a/llvm/lib/Transforms/SandboxIR/CMakeLists.txt b/llvm/lib/Transforms/SandboxIR/CMakeLists.txt
new file mode 100644
index 0000000000000..225eca0cadd1a
--- /dev/null
+++ b/llvm/lib/Transforms/SandboxIR/CMakeLists.txt
@@ -0,0 +1,11 @@
+add_llvm_component_library(LLVMSandboxIR
+  SandboxIR.cpp
+
+  ADDITIONAL_HEADER_DIRS
+  ${LLVM_MAIN_INCLUDE_DIR}/llvm/Transforms/SandboxIR
+
+  LINK_COMPONENTS
+  Core
+  Support
+  )
+
diff --git a/llvm/lib/Transforms/SandboxIR/SandboxIR.cpp b/llvm/lib/Transforms/SandboxIR/SandboxIR.cpp
new file mode 100644
index 0000000000000..5bd25083e80c3
--- /dev/null
+++ b/llvm/lib/Transforms/SandboxIR/SandboxIR.cpp
@@ -0,0 +1,65 @@
+//===- SandboxIR.cpp - A transactional overlay IR on top of LLVM IR -------===//
+//
+// 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 "llvm/Transforms/SandboxIR/SandboxIR.h"
+#include "llvm/Support/Debug.h"
+#include <sstream>
+
+using namespace llvm;
+
+SBValue::SBValue(ClassID SubclassID, Value *Val, SBContext &Ctxt)
+    : SubclassID(SubclassID), Val(Val), Ctxt(Ctxt) {
+#ifndef NDEBUG
+  UID = 0; // FIXME: Once SBContext is available.
+#endif
+}
+
+#ifndef NDEBUG
+std::string SBValue::getName() const {
+  std::stringstream SS;
+  SS << "SB" << UID << ".";
+  return SS.str();
+}
+
+void SBValue::dumpCommonHeader(raw_ostream &OS) const {
+  OS << getName() << " " << getSubclassIDStr(SubclassID) << " ";
+}
+
+void SBValue::dumpCommonFooter(raw_ostream &OS) const {
+  OS.indent(2) << "Val: ";
+  if (Val)
+    OS << *Val;
+  else
+    OS << "NULL";
+  OS << "\n";
+}
+
+void SBValue::dumpCommonPrefix(raw_ostream &OS) const {
+  if (Val)
+    OS << *Val;
+  else
+    OS << "NULL ";
+}
+
+void SBValue::dumpCommonSuffix(raw_ostream &OS) const {
+  OS << " ; " << getName() << " (" << getSubclassIDStr(SubclassID) << ") "
+     << this;
+}
+
+void SBValue::printAsOperandCommon(raw_ostream &OS) const {
+  if (Val)
+    Val->printAsOperand(OS);
+  else
+    OS << "NULL ";
+}
+
+void SBValue::dump() const {
+  dump(dbgs());
+  dbgs() << "\n";
+}
+#endif // NDEBUG
diff --git a/llvm/utils/gn/secondary/llvm/lib/Transforms/SandboxIR/BUILD.gn b/llvm/utils/gn/secondary/llvm/lib/Transforms/SandboxIR/BUILD.gn
new file mode 100644
index 0000000000000..01d62f20cf50f
--- /dev/null
+++ b/llvm/utils/gn/secondary/llvm/lib/Transforms/SandboxIR/BUILD.gn
@@ -0,0 +1,10 @@
+static_library("SandboxIR") {
+  output_name = "LLVMSandboxIR"
+  deps = [
+    "//llvm/lib/IR",
+    "//llvm/lib/Support",
+  ]
+  sources = [
+    "SandboxIR.cpp",
+  ]
+}
diff --git a/utils/bazel/llvm-project-overlay/llvm/BUILD.bazel b/utils/bazel/llvm-project-overlay/llvm/BUILD.bazel
index cf7ee18f0d068..6d99b210d0323 100644
--- a/utils/bazel/llvm-project-overlay/llvm/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/llvm/BUILD.bazel
@@ -1467,6 +1467,23 @@ cc_library(
     ],
 )
 
+cc_library(
+    name = "SandboxIR",
+    srcs = glob([
+        "lib/Transforms/SandboxIR/*.cpp",
+    ]),
+    hdrs = glob([
+        "include/llvm/Transforms/SandboxIR/*.h",
+        "include/llvm/Transforms/SandboxIR/*.def",
+    ]),
+    copts = llvm_copts,
+    deps = [
+        ":Core",
+        ":Support",
+        ":config",
+    ],
+)
+
 cc_library(
     name = "Vectorize",
     srcs = glob([
@@ -1826,6 +1843,7 @@ cc_library(
         ":InstCombine",
         ":Instrumentation",
         ":ObjCARC",
+        ":SandboxIR",
         ":Scalar",
         ":Vectorize",
     ],
@@ -2658,6 +2676,7 @@ cc_library(
         ":Instrumentation",
         ":MC",
         ":ObjCARC",
+        ":SandboxIR",
         ":Scalar",
         ":Support",
         ":Target",

@vporpo vporpo requested a review from slackito June 17, 2024 17:42
@tschuett
Copy link

It is missing tests. I don't like the SB prefix. Could you instead put everything into namespace llvm::sandboxir. No worries if the conflict between llvm::Value and the SandBoxIR Value is too large.

@tschuett tschuett self-requested a review June 17, 2024 18:17
@vporpo
Copy link
Contributor Author

vporpo commented Jun 17, 2024

It is missing tests.

There are tons of unit tests for all SandboxIR classes, but they will have to wait for a couple of patches. They will be part of the patches that introduce the Context class which owns the SandboxIR objects, including the SandboxIR Value.

Could you instead put everything into namespace llvm::sandboxir

This is an option, and is probably nicer for the user of the API. But I am a bit concerned about the internals of SandboxIR: Given that this class hierarchy mirrors the LLVM IR one it could make the code within the SandboxIR classes quite confusing and error-prone because we are used to writing LLVM-IR code without the llvm:: prefix. For example consider the SandboxIR Value class:

namespace SB {
class Value {
   Value *V; // <- This points to SB::Value, not llvm::Value
};
}

Wdyt?

@tschuett
Copy link

Each commit/PR comes with a test. There are few exceptions. I let the other reviewers vote on it, but I would still prefer nested namespaces over prefixes. For llvm Values, you probably end up in all/most places with llvm::Value.

@vporpo
Copy link
Contributor Author

vporpo commented Jun 17, 2024

Each commit/PR comes with a test.

I am aware of this rule, but there is no functionality to exercise at this point with a test, since this is just boilerplate code and all we really care about is that it builds and is registered correctly with CMake and the other build systems.
I am happy to add tests to the initial patch, but the patch will end up being a lot larger than this, as it would have to include a lot more code.

Regarding the namespace, I think the additional benefit of using a namespace is that one could potentially switch some code over from LLVM IR to Sandbox IR by replacing using namespace llvm to using namespace sandboxir (with some additional code changes of course). I am fine either way.

@tschuett tschuett requested a review from nikic June 17, 2024 19:28
Copy link
Collaborator

@slackito slackito left a comment

Choose a reason for hiding this comment

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

I'm not qualified to do a proper review here, just a couple of drive-by nits.

// LLVM IR so both IRs are always in sync.
// - Feels like LLVM IR, similar API.
//
// SandboxIR forms a class hierarcy that resembles that of LLVM IR:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Typo: hierarchy

/// The LLVM Value that corresponds to this SBValue.
/// NOTE: Some SBInstructions, like Packs, may include more than one value.
Value *Val = nullptr;
friend class ValueAttorney; // For Val
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit: should this friend declaration be added in the same patch as the ValueAttorney class? It's not added here.

@tschuett
Copy link

Could you add a Value.cpp to llvm/unittests/Transforms/sandboxir/ with a small instantiation of sandboxir::Value to meet the test requirements?

@vporpo
Copy link
Contributor Author

vporpo commented Jun 18, 2024

Yes, let me see what I can do. I am in the process of switching from the SB prefix to namespace for the whole project, so I will update the patch after I am done with the conversion.

@vporpo vporpo force-pushed the SBVec branch 2 times, most recently from bda2114 to eee6d0a Compare June 26, 2024 20:31
@aeubanks
Copy link
Contributor

if you're not maintaining the gn/bazel build, no need to add those build files in this PR, let the respective communities handle them

protected:
static const char *getSubclassIDStr(ClassID ID) {
switch (ID) {
// clang-format off
Copy link
Contributor

Choose a reason for hiding this comment

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

is clang-format off just for one space? doesn't seem worth it

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It looks like this with clang-format:

#define DEF_VALUE(ID, CLASS)                                                   \
  case ClassID::ID:                                                            \
    return #ID;
#define DEF_USER(ID, CLASS)                                                    \
  case ClassID::ID:                                                            \
    return #ID;
#define DEF_INSTR(ID, OPC, CLASS)                                              \
  case ClassID::ID:                                                            \
    return #ID;
    ```
which I find it quite a bit harder to read than with clang-format off, but I don't feel to strongly about it.


class Context {
protected:
LLVMContext &LLVMCtxt;
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: context is almost always abbreviated ctx instead of ctxt, at least in LLVM

see rg -i ctxt llvm/include/llvm vs rg -i ctx llvm/include/llvm

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK, I will replace Ctxt with Ctx.

//
//===----------------------------------------------------------------------===//

// clang-format off
Copy link
Contributor

Choose a reason for hiding this comment

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

is this really necessary? no other .def file in llvm/include has clang-format off

Copy link
Contributor Author

@vporpo vporpo Jun 28, 2024

Choose a reason for hiding this comment

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

At this point it is not necessary, but later on there are some entries that look like this:

DEF_INSTR(BinOp,       OPCODES(\
                               OP(Add)  \
                               OP(FAdd) \
                               OP(Sub)  \
                               OP(FSub) \
                               OP(Mul)  \
                               OP(FMul) \

and clang-format won't list the OP() entries vertically to save vertical space. Anyway, I will remove it for now.

This is the first patch in a series of patches for the Sandbox Vectorizer
project.
SandboxIR is not tightly coupled to the Sandbox Vectorizer and could be used
independently as a transactional layer on top of LLVM IR.

For a more detailed description of the project please refer to the RFC:
https://discourse.llvm.org/t/rfc-sandbox-vectorizer-an-experimental-modular-vectorizer/79059

This patch adds some basic boilerplate code for the SandboxIR which includes
parts of the SandboxIR `Value` class.
Copy link
Contributor

@aeubanks aeubanks left a comment

Choose a reason for hiding this comment

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

putting this in top level under llvm/ as opposed to under llvm/Transforms makes more sense, lgtm

@vporpo vporpo merged commit e8574e8 into llvm:main Jul 1, 2024
7 checks passed
@llvm-ci
Copy link
Collaborator

llvm-ci commented Jul 1, 2024

LLVM Buildbot has detected a new failure on builder llvm-nvptx64-nvidia-ubuntu running on as-builder-7 while building llvm at step 6 "test-build-unified-tree-check-llvm".

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

Here is the relevant piece of the build log for the reference:

Step 6 (test-build-unified-tree-check-llvm) failure: test (failure)
...
0.883 [2/9/638] Linking CXX executable unittests/Transforms/Utils/UtilsTests
0.896 [2/8/639] Linking CXX executable unittests/tools/llvm-exegesis/LLVMExegesisTests
0.946 [2/7/640] Linking CXX executable unittests/CodeGen/CodeGenTests
0.959 [2/6/641] Linking CXX executable unittests/Frontend/LLVMFrontendTests
1.011 [2/5/642] Linking CXX executable unittests/Analysis/AnalysisTests
1.088 [2/4/643] Linking CXX executable unittests/IR/IRTests
1.215 [2/3/644] Linking CXX executable unittests/Support/SupportTests
1.232 [2/2/645] Linking CXX executable unittests/ADT/ADTTests
3.710 [2/1/646] Building CXX object unittests/SandboxIR/CMakeFiles/SandboxIRTests.dir/SandboxIRTest.cpp.o
3.780 [1/1/647] Linking CXX executable unittests/SandboxIR/SandboxIRTests
FAILED: unittests/SandboxIR/SandboxIRTests 
: && /usr/bin/c++ -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -fno-lifetime-dse -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-uninitialized -Wno-nonnull -Wno-class-memaccess -Wno-redundant-move -Wno-pessimizing-move -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wno-misleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -O3 -DNDEBUG -fuse-ld=gold     -Wl,--gc-sections unittests/SandboxIR/CMakeFiles/SandboxIRTests.dir/SandboxIRTest.cpp.o -o unittests/SandboxIR/SandboxIRTests  -Wl,-rpath,/home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx64-nvidia-ubuntu/build/lib  lib/libLLVMAsmParser.so.19.0git  lib/libLLVMSandboxIR.so.19.0git  lib/libllvm_gtest_main.so.19.0git  lib/libllvm_gtest.so.19.0git  lib/libLLVMSupport.so.19.0git  -Wl,-rpath-link,/home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx64-nvidia-ubuntu/build/lib && :
unittests/SandboxIR/CMakeFiles/SandboxIRTests.dir/SandboxIRTest.cpp.o:SandboxIRTest.cpp:function testing::internal::TestFactoryImpl<SandboxIRTest_UserInstantiation_Test>::CreateTest(): error: undefined reference to 'llvm::LLVMContext::LLVMContext()'
unittests/SandboxIR/CMakeFiles/SandboxIRTests.dir/SandboxIRTest.cpp.o:SandboxIRTest.cpp:function SandboxIRTest_UserInstantiation_Test::TestBody() [clone .localalias]: error: undefined reference to 'llvm::Module::~Module()'
unittests/SandboxIR/CMakeFiles/SandboxIRTests.dir/SandboxIRTest.cpp.o:SandboxIRTest.cpp:function SandboxIRTest_UserInstantiation_Test::TestBody() [clone .localalias]: error: undefined reference to 'llvm::Module::~Module()'
unittests/SandboxIR/CMakeFiles/SandboxIRTests.dir/SandboxIRTest.cpp.o:SandboxIRTest.cpp:function SandboxIRTest_UserInstantiation_Test::TestBody() [clone .localalias]: error: undefined reference to 'llvm::Module::getFunction(llvm::StringRef) const'
unittests/SandboxIR/CMakeFiles/SandboxIRTests.dir/SandboxIRTest.cpp.o:SandboxIRTest.cpp:function SandboxIRTest_UserInstantiation_Test::~SandboxIRTest_UserInstantiation_Test(): error: undefined reference to 'llvm::Module::~Module()'
unittests/SandboxIR/CMakeFiles/SandboxIRTests.dir/SandboxIRTest.cpp.o:SandboxIRTest.cpp:function SandboxIRTest_UserInstantiation_Test::~SandboxIRTest_UserInstantiation_Test(): error: undefined reference to 'llvm::LLVMContext::~LLVMContext()'
unittests/SandboxIR/CMakeFiles/SandboxIRTests.dir/SandboxIRTest.cpp.o:SandboxIRTest.cpp:function SandboxIRTest_UserInstantiation_Test::~SandboxIRTest_UserInstantiation_Test(): error: undefined reference to 'llvm::Module::~Module()'
unittests/SandboxIR/CMakeFiles/SandboxIRTests.dir/SandboxIRTest.cpp.o:SandboxIRTest.cpp:function SandboxIRTest_UserInstantiation_Test::~SandboxIRTest_UserInstantiation_Test(): error: undefined reference to 'llvm::LLVMContext::~LLVMContext()'
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.

@llvm-ci
Copy link
Collaborator

llvm-ci commented Jul 1, 2024

LLVM Buildbot has detected a new failure on builder llvm-nvptx-nvidia-ubuntu running on as-builder-7 while building llvm at step 6 "test-build-unified-tree-check-llvm".

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

Here is the relevant piece of the build log for the reference:

Step 6 (test-build-unified-tree-check-llvm) failure: test (failure)
...
0.910 [2/9/638] Linking CXX executable unittests/ExecutionEngine/Orc/OrcJITTests
0.929 [2/8/639] Linking CXX executable unittests/Transforms/Scalar/ScalarTests
0.965 [2/7/640] Linking CXX executable unittests/Frontend/LLVMFrontendTests
0.996 [2/6/641] Linking CXX executable unittests/CodeGen/CodeGenTests
1.019 [2/5/642] Linking CXX executable unittests/Analysis/AnalysisTests
1.100 [2/4/643] Linking CXX executable unittests/IR/IRTests
1.259 [2/3/644] Linking CXX executable unittests/ADT/ADTTests
1.292 [2/2/645] Linking CXX executable unittests/Support/SupportTests
3.980 [2/1/646] Building CXX object unittests/SandboxIR/CMakeFiles/SandboxIRTests.dir/SandboxIRTest.cpp.o
4.049 [1/1/647] Linking CXX executable unittests/SandboxIR/SandboxIRTests
FAILED: unittests/SandboxIR/SandboxIRTests 
: && /usr/bin/c++ -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -fno-lifetime-dse -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-uninitialized -Wno-nonnull -Wno-class-memaccess -Wno-redundant-move -Wno-pessimizing-move -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wno-misleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -O3 -DNDEBUG -fuse-ld=gold     -Wl,--gc-sections unittests/SandboxIR/CMakeFiles/SandboxIRTests.dir/SandboxIRTest.cpp.o -o unittests/SandboxIR/SandboxIRTests  -Wl,-rpath,/home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx-nvidia-ubuntu/build/lib  lib/libLLVMAsmParser.so.19.0git  lib/libLLVMSandboxIR.so.19.0git  lib/libllvm_gtest_main.so.19.0git  lib/libllvm_gtest.so.19.0git  lib/libLLVMSupport.so.19.0git  -Wl,-rpath-link,/home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx-nvidia-ubuntu/build/lib && :
unittests/SandboxIR/CMakeFiles/SandboxIRTests.dir/SandboxIRTest.cpp.o:SandboxIRTest.cpp:function testing::internal::TestFactoryImpl<SandboxIRTest_UserInstantiation_Test>::CreateTest(): error: undefined reference to 'llvm::LLVMContext::LLVMContext()'
unittests/SandboxIR/CMakeFiles/SandboxIRTests.dir/SandboxIRTest.cpp.o:SandboxIRTest.cpp:function SandboxIRTest_UserInstantiation_Test::TestBody() [clone .localalias]: error: undefined reference to 'llvm::Module::~Module()'
unittests/SandboxIR/CMakeFiles/SandboxIRTests.dir/SandboxIRTest.cpp.o:SandboxIRTest.cpp:function SandboxIRTest_UserInstantiation_Test::TestBody() [clone .localalias]: error: undefined reference to 'llvm::Module::~Module()'
unittests/SandboxIR/CMakeFiles/SandboxIRTests.dir/SandboxIRTest.cpp.o:SandboxIRTest.cpp:function SandboxIRTest_UserInstantiation_Test::TestBody() [clone .localalias]: error: undefined reference to 'llvm::Module::getFunction(llvm::StringRef) const'
unittests/SandboxIR/CMakeFiles/SandboxIRTests.dir/SandboxIRTest.cpp.o:SandboxIRTest.cpp:function SandboxIRTest_UserInstantiation_Test::~SandboxIRTest_UserInstantiation_Test(): error: undefined reference to 'llvm::Module::~Module()'
unittests/SandboxIR/CMakeFiles/SandboxIRTests.dir/SandboxIRTest.cpp.o:SandboxIRTest.cpp:function SandboxIRTest_UserInstantiation_Test::~SandboxIRTest_UserInstantiation_Test(): error: undefined reference to 'llvm::LLVMContext::~LLVMContext()'
unittests/SandboxIR/CMakeFiles/SandboxIRTests.dir/SandboxIRTest.cpp.o:SandboxIRTest.cpp:function SandboxIRTest_UserInstantiation_Test::~SandboxIRTest_UserInstantiation_Test(): error: undefined reference to 'llvm::Module::~Module()'
unittests/SandboxIR/CMakeFiles/SandboxIRTests.dir/SandboxIRTest.cpp.o:SandboxIRTest.cpp:function SandboxIRTest_UserInstantiation_Test::~SandboxIRTest_UserInstantiation_Test(): error: undefined reference to 'llvm::LLVMContext::~LLVMContext()'
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.

vporpo added a commit that referenced this pull request Jul 1, 2024
vporpo added a commit that referenced this pull request Jul 1, 2024
@vporpo
Copy link
Contributor Author

vporpo commented Jul 1, 2024

Reverted: 2f4f43c
Recommitted: f9efc29

lravenclaw pushed a commit to lravenclaw/llvm-project that referenced this pull request Jul 3, 2024
This is the first patch in a series of patches for the Sandbox Vectorizer project.  
SandboxIR is not tightly coupled to the Sandbox Vectorizer and could be used
independently as a transactional layer on top of LLVM IR.

For a detailed description of the project please refer to the RFC:
https://discourse.llvm.org/t/rfc-sandbox-vectorizer-an-experimental-modular-vectorizer/79059

This patch adds some basic boilerplate code for the SandboxIR which includes
parts of the SandboxIR `Value`, `User` and `Context` classes.
lravenclaw pushed a commit to lravenclaw/llvm-project that referenced this pull request Jul 3, 2024
lravenclaw pushed a commit to lravenclaw/llvm-project that referenced this pull request Jul 3, 2024
kbluck pushed a commit to kbluck/llvm-project that referenced this pull request Jul 6, 2024
This is the first patch in a series of patches for the Sandbox Vectorizer project.  
SandboxIR is not tightly coupled to the Sandbox Vectorizer and could be used
independently as a transactional layer on top of LLVM IR.

For a detailed description of the project please refer to the RFC:
https://discourse.llvm.org/t/rfc-sandbox-vectorizer-an-experimental-modular-vectorizer/79059

This patch adds some basic boilerplate code for the SandboxIR which includes
parts of the SandboxIR `Value`, `User` and `Context` classes.
kbluck pushed a commit to kbluck/llvm-project that referenced this pull request Jul 6, 2024
kbluck pushed a commit to kbluck/llvm-project that referenced this pull request Jul 6, 2024
@vporpo
Copy link
Contributor Author

vporpo commented Sep 9, 2024 via email

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 llvm:transforms
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants