[Mesa-dev] [PATCH 1/3] gallivm: Move LLVMStartMultithreaded() static initializer into gallivm

Tom Stellard tom at stellard.net
Thu May 2 08:01:18 PDT 2013


From: Tom Stellard <thomas.stellard at amd.com>

This does not solve all of the problems with using LLVM in a
multithreaded enivronment, but it should help in some cases.
---
 src/gallium/auxiliary/gallivm/lp_bld_misc.cpp   | 15 +++++++++++++++
 src/gallium/drivers/radeon/radeon_llvm_emit.cpp | 14 --------------
 2 files changed, 15 insertions(+), 14 deletions(-)

diff --git a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
index 717afa7..1500602 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
+++ b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
@@ -77,6 +77,21 @@
 
 #include "lp_bld_misc.h"
 
+namespace {
+
+class LLVMEnsureMultithreaded {
+public:
+   LLVMEnsureMultithreaded()
+   {
+      if (!LLVMIsMultithreaded()) {
+         LLVMStartMultithreaded();
+      }
+   }
+};
+
+static LLVMEnsureMultithreaded lLVMEnsureMultithreaded;
+
+}
 
 extern "C" void
 lp_set_target_options(void)
diff --git a/src/gallium/drivers/radeon/radeon_llvm_emit.cpp b/src/gallium/drivers/radeon/radeon_llvm_emit.cpp
index 55dad9b..03eb5f2 100644
--- a/src/gallium/drivers/radeon/radeon_llvm_emit.cpp
+++ b/src/gallium/drivers/radeon/radeon_llvm_emit.cpp
@@ -58,20 +58,6 @@
 
 using namespace llvm;
 
-namespace {
-
-class LLVMEnsureMultithreaded {
-public:
-   LLVMEnsureMultithreaded()
-   {
-      llvm_start_multithreaded();
-   }
-};
-
-static LLVMEnsureMultithreaded lLVMEnsureMultithreaded;
-
-}
-
 /**
  * Set the shader type we want to compile
  *
-- 
1.7.11.4



More information about the mesa-dev mailing list