[llvm] [mlgo] Support composite AOT-ed models (PR #96276)

Aiden Grossman via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 21 11:17:33 PDT 2024


================
@@ -60,6 +65,64 @@ class MockAOTModel final {
     }
   }
 };
+
+class AdditionAOTModel final : public MockAOTModelBase {
+public:
+  AdditionAOTModel() = default;
+  void Run() override { R = A + B; }
+};
+
+class DiffAOTModel final : public MockAOTModelBase {
+public:
+  DiffAOTModel() = default;
+  void Run() override { R = A - B; }
+};
+
+static const char *M1Selector = "the model that subtracts";
+static const char *M2Selector = "the model that adds";
+
+static auto Hash1 = MD5::hash(arrayRefFromStringRef(M1Selector));
+static auto Hash2 = MD5::hash(arrayRefFromStringRef(M2Selector));
----------------
boomanaiden154 wrote:

Maybe use `MD5::update(StringRef)` here? Also, I think explicitly typing as `MD5Result` might be better as it isn't immediately obvious that's what `MD5::hash` returns.

https://github.com/llvm/llvm-project/pull/96276


More information about the llvm-commits mailing list