From a4e664f0d2db129df11939bbc497eb6e4b682f06 Mon Sep 17 00:00:00 2001
From: Yifan Zhao <yifanz16@illinois.edu>
Date: Sat, 18 Jul 2020 17:53:05 -0500
Subject: [PATCH] Fixing issue llvm/hpvm#50

---
 llvm/projects/hpvm-tensor-rt/CMakeLists.txt | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/llvm/projects/hpvm-tensor-rt/CMakeLists.txt b/llvm/projects/hpvm-tensor-rt/CMakeLists.txt
index e0940eea58..d86c8fa3cb 100644
--- a/llvm/projects/hpvm-tensor-rt/CMakeLists.txt
+++ b/llvm/projects/hpvm-tensor-rt/CMakeLists.txt
@@ -103,7 +103,10 @@ target_link_libraries(tensor_runtime ${LINK_LIBS})
 cuda_add_library(tensor_runtime_install ${RUNTIME_SRCS})
 cuda_add_cublas_to_target(tensor_runtime_install)
 target_link_libraries(tensor_runtime_install ${LINK_LIBS})
-
+# tensor_runtime_install is built AFTER tensor_runtime because of a nvcc bug (bug?)
+# that doesn't allow compiling the same file from multiple targets at once.
+# Same for tensor_runtime_online.
+add_dependencies(tensor_runtime_install tensor_runtime)
 
 # Online version
 remove_definitions(-DONLINE_PROFILING=false)
@@ -112,7 +115,8 @@ remove_definitions(-DFP16_tuning=true)
 add_definitions(-DFP16_tuning=false)
 cuda_add_library(tensor_runtime_online ${RUNTIME_SRCS})
 cuda_add_cublas_to_target(tensor_runtime_online)
-target_link_libraries(tensor_runtime_online  ${LINK_LIBS}) 
+target_link_libraries(tensor_runtime_online  ${LINK_LIBS})
+add_dependencies(tensor_runtime_online tensor_runtime)
 
 # Adding new rule for building a cuDNN runtime library
 
-- 
GitLab