diff --git a/.gitignore b/.gitignore
index 7acd0fa11ec9f01899de11e2ca4cacc24d107471..70639e367bc68fedc132d3b39f4c606e4f8a532f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -27,7 +27,11 @@ cfg.foo.dot
 lit.site.cfg
 *.dot
 JITTests.exports
-build/
-hpvm/install
-hpvm/llvm
-hpvm/llvm-9.0.0.src.tar.xz
+
+hpvm/build/
+hpvm/install/
+hpvm/llvm/
+hpvm/llvm-*.src.tar.xz
+hpvm/llvm-*.src/
+hpvm/projects/visc-rt/visc-rt.ll
+hpvm/test/parboil/benchmarks/*/build/
diff --git a/hpvm/projects/visc-rt/policy.h b/hpvm/projects/visc-rt/policy.h
index f30c310c1a30ad36b4dbfdd6628453f5bf308874..4bd6fa046967a7a1632e89941b155695ee139718 100644
--- a/hpvm/projects/visc-rt/policy.h
+++ b/hpvm/projects/visc-rt/policy.h
@@ -11,6 +11,18 @@ class Policy {
     virtual ~Policy() {};
 };
 
+class ConstPolicy : public Policy {
+public:
+  ConstPolicy(int deviceID): deviceID(deviceID) {}
+
+  int getVersion(const char *, int64_t) override {
+    return deviceID;
+  }
+
+private:
+  int deviceID;
+};
+
 class NodePolicy : public Policy {
   virtual int getVersion(const char *name, int64_t it) override {
     std::string s(name);
diff --git a/hpvm/projects/visc-rt/visc-rt.cpp b/hpvm/projects/visc-rt/visc-rt.cpp
index bcd61a9657159aa154887c90802ca623ba1e4987..e4fddca19e4de480648941640d9688e71c85295e 100644
--- a/hpvm/projects/visc-rt/visc-rt.cpp
+++ b/hpvm/projects/visc-rt/visc-rt.cpp
@@ -122,28 +122,38 @@ void llvm_visc_x86_dstack_push(unsigned n, uint64_t limitX, uint64_t iX, uint64_
     DEBUG(cout << "\tNumDim = " << n << "\t Limit(" << limitX << ", " << limitY << ", "<< limitZ <<")\n");
     DEBUG(cout << "\tInstance(" << iX << ", " << iY << ", "<< iZ <<")\n");
     DFGDepth nodeInfo (n, limitX, iX, limitY, iY, limitZ, iZ);
+    pthread_mutex_lock(&ocl_mtx);
     DStack.push_back(nodeInfo);
     DEBUG(cout << "DStack size = " << DStack.size() << flush << "\n");
+    pthread_mutex_unlock(&ocl_mtx);
 }
 
 void llvm_visc_x86_dstack_pop() {
     DEBUG(cout << "Popping from depth stack\n");
+    pthread_mutex_lock(&ocl_mtx);
     DStack.pop_back();
     DEBUG(cout << "DStack size = " << DStack.size() << flush << "\n");
+    pthread_mutex_unlock(&ocl_mtx);
 }
 
 uint64_t llvm_visc_x86_getDimLimit(unsigned level, unsigned dim) {
    DEBUG(cout << "Request limit for dim " << dim << " of ancestor " << level <<flush << "\n");
+   pthread_mutex_lock(&ocl_mtx);
    unsigned size = DStack.size();
    DEBUG(cout << "\t Return: " << DStack[size-level-1].getDimLimit(dim) <<flush << "\n");
-   return DStack[size-level-1].getDimLimit(dim);
+   uint64_t result = DStack[size-level-1].getDimLimit(dim);
+   pthread_mutex_unlock(&ocl_mtx);
+   return result;
 }
 
 uint64_t llvm_visc_x86_getDimInstance(unsigned level, unsigned dim) {
     DEBUG(cout << "Request instance id for dim " << dim << " of ancestor " << level <<flush << "\n");
+    pthread_mutex_lock(&ocl_mtx);
     unsigned size = DStack.size();
     DEBUG(cout << "\t Return: " << DStack[size-level-1].getDimInstance(dim) <<flush << "\n");
-    return DStack[size-level-1].getDimInstance(dim);
+    uint64_t result = DStack[size-level-1].getDimInstance(dim);
+    pthread_mutex_unlock(&ocl_mtx);
+    return result;
 }
 
 /********************** Memory Tracking Routines **************************/
@@ -236,12 +246,6 @@ void* llvm_visc_x86_argument_ptr(void* ptr, size_t size) {
 }
 
 void* llvm_visc_request_mem(void* ptr, size_t size) {
-  // Ignore objects whose size is 0 - no memory is requested.
-  if (size == 0) {
-    DEBUG(cout << "[X86] Request memory (ignored): " << ptr << flush << "\n");
-    return ptr;
-  }
-
   pthread_mutex_lock(&ocl_mtx);
   DEBUG(cout << "[X86] Request memory: " << ptr << flush << "\n");
   MemTrackerEntry* MTE = MTracker.lookup(ptr);