[llvm-branch-commits] [llvm] release/20.x: [ORC][unittests] Remove hard coded 16k page size (#127115) (PR #127144)

via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Thu Feb 13 15:09:38 PST 2025


https://github.com/llvmbot created https://github.com/llvm/llvm-project/pull/127144

Backport 415607e

Requested by: @RossComputerGuy

>From 7d0590cc577b4b6ff243fb733c8c9ac0cc6dc221 Mon Sep 17 00:00:00 2001
From: Tristan Ross <tristan.ross at midstall.com>
Date: Thu, 13 Feb 2025 14:56:55 -0800
Subject: [PATCH] [ORC][unittests] Remove hard coded 16k page size (#127115)

Fixes a couple hard coded 16k values which is being used as the page
size. Replaces the hard coded value with the system's page size. This
fixes #116753 on an Ampere Altra Q64-22

CC @lhames

(cherry picked from commit 415607e10b56d0e6c4661ff1ec5b9b46bf433cba)
---
 .../Orc/JITLinkRedirectionManagerTest.cpp              | 10 ++++++++--
 .../ExecutionEngine/Orc/ReOptimizeLayerTest.cpp        |  9 ++++++++-
 2 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/llvm/unittests/ExecutionEngine/Orc/JITLinkRedirectionManagerTest.cpp b/llvm/unittests/ExecutionEngine/Orc/JITLinkRedirectionManagerTest.cpp
index 4b8a3efe680f1..a57241b8a3da6 100644
--- a/llvm/unittests/ExecutionEngine/Orc/JITLinkRedirectionManagerTest.cpp
+++ b/llvm/unittests/ExecutionEngine/Orc/JITLinkRedirectionManagerTest.cpp
@@ -48,12 +48,18 @@ class JITLinkRedirectionManagerTest : public testing::Test {
     if (Triple.isPPC())
       GTEST_SKIP();
 
+    auto PageSize = sys::Process::getPageSize();
+    if (!PageSize) {
+      consumeError(PageSize.takeError());
+      GTEST_SKIP();
+    }
+
     ES = std::make_unique<ExecutionSession>(
         std::make_unique<UnsupportedExecutorProcessControl>(
-            nullptr, nullptr, JTMB->getTargetTriple().getTriple()));
+            nullptr, nullptr, JTMB->getTargetTriple().getTriple(), *PageSize));
     JD = &ES->createBareJITDylib("main");
     ObjLinkingLayer = std::make_unique<ObjectLinkingLayer>(
-        *ES, std::make_unique<InProcessMemoryManager>(16384));
+        *ES, std::make_unique<InProcessMemoryManager>(*PageSize));
     DL = std::make_unique<DataLayout>(std::move(*DLOrErr));
   }
   JITDylib *JD{nullptr};
diff --git a/llvm/unittests/ExecutionEngine/Orc/ReOptimizeLayerTest.cpp b/llvm/unittests/ExecutionEngine/Orc/ReOptimizeLayerTest.cpp
index 083a924ce9aa1..991b12def55fa 100644
--- a/llvm/unittests/ExecutionEngine/Orc/ReOptimizeLayerTest.cpp
+++ b/llvm/unittests/ExecutionEngine/Orc/ReOptimizeLayerTest.cpp
@@ -66,10 +66,17 @@ class ReOptimizeLayerTest : public testing::Test {
       consumeError(DLOrErr.takeError());
       GTEST_SKIP();
     }
+
+    auto PageSize = sys::Process::getPageSize();
+    if (!PageSize) {
+      consumeError(PageSize.takeError());
+      GTEST_SKIP();
+    }
+
     ES = std::make_unique<ExecutionSession>(std::move(*EPC));
     JD = &ES->createBareJITDylib("main");
     ObjLinkingLayer = std::make_unique<ObjectLinkingLayer>(
-        *ES, std::make_unique<InProcessMemoryManager>(16384));
+        *ES, std::make_unique<InProcessMemoryManager>(*PageSize));
     DL = std::make_unique<DataLayout>(std::move(*DLOrErr));
 
     auto TM = JTMB->createTargetMachine();



More information about the llvm-branch-commits mailing list