Mesa (master): gallivm: Move LLVMStartMultithreaded() static initializer into gallivm

Tom Stellard tstellar at kemper.freedesktop.org
Mon May 6 16:09:25 UTC 2013


Module: Mesa
Branch: master
Commit: 55eb8eaaa8bf8696d56effce6ed87f03bea779e0
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=55eb8eaaa8bf8696d56effce6ed87f03bea779e0

Author: Tom Stellard <thomas.stellard at amd.com>
Date:   Tue Apr 30 07:38:03 2013 -0700

gallivm: Move LLVMStartMultithreaded() static initializer into gallivm

This does not solve all of the problems with using LLVM in a
multithreaded enivronment, but it should help in some cases.

Reviewed-by: Mathias.Froehlich at web.de

---

 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 a531d98..897f7ff 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
+++ b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
@@ -79,6 +79,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 fb974f9..1012715 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
  *




More information about the mesa-commit mailing list