From: Junyan He <[email protected]>

OCL_PROFILING_LINES will be used to specify the kernel name
and line number for profiling points inserting.
It has the format:
KERNEL_NAME:PROFILING_MODE:LINE_NUMBER0,LINE_NUMBER1,LINE_NUMBER2,...

Signed-off-by: Junyan He <[email protected]>
---
 backend/src/backend/program.cpp | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/backend/src/backend/program.cpp b/backend/src/backend/program.cpp
index 06d5f6b..59cfe39 100644
--- a/backend/src/backend/program.cpp
+++ b/backend/src/backend/program.cpp
@@ -116,8 +116,8 @@ namespace gbe {
 #ifdef GBE_COMPILER_AVAILABLE
   BVAR(OCL_OUTPUT_GEN_IR, false);
   BVAR(OCL_STRICT_CONFORMANCE, true);
-  IVAR(OCL_PROFILING_LOG, 0, 0, 1); // Int for different profiling types.
   BVAR(OCL_OUTPUT_BUILD_LOG, false);
+  extern std::string OCL_PROFILING_LINES;
 
   bool Program::buildFromLLVMFile(const char *fileName, const void* module, 
std::string &error, int optLevel, const char* source) {
     ir::Unit *unit = new ir::Unit();
@@ -129,7 +129,7 @@ namespace gbe {
     bool strictMath = true;
     if (fast_relaxed_math || !OCL_STRICT_CONFORMANCE)
       strictMath = false;
-    if (llvmToGen(*unit, fileName, module, optLevel, strictMath, 
OCL_PROFILING_LOG, source) == false) {
+    if (llvmToGen(*unit, fileName, module, optLevel, strictMath, 
OCL_PROFILING_LINES != "", source) == false) {
       if (fileName)
         error = std::string(fileName) + " not found";
       delete unit;
@@ -142,10 +142,10 @@ namespace gbe {
       unit = new ir::Unit();
       if(cloned_module){
         //suppose file exists and llvmToGen will not return false.
-        llvmToGen(*unit, fileName, cloned_module, 0, strictMath, 
OCL_PROFILING_LOG, source);
+        llvmToGen(*unit, fileName, cloned_module, 0, strictMath, 
OCL_PROFILING_LINES != "", source);
       }else{
         //suppose file exists and llvmToGen will not return false.
-        llvmToGen(*unit, fileName, module, 0, strictMath, OCL_PROFILING_LOG, 
source);
+        llvmToGen(*unit, fileName, module, 0, strictMath, OCL_PROFILING_LINES 
!= "", source);
       }
     }
     assert(unit->getValid());
@@ -171,7 +171,7 @@ namespace gbe {
 
     for (const auto &pair : set) {
       const std::string &name = pair.first;
-      Kernel *kernel = this->compileKernel(unit, name, !strictMath, 
OCL_PROFILING_LOG);
+      Kernel *kernel = this->compileKernel(unit, name, !strictMath, 
pair.second->getProfilingMode());
       if (!kernel) {
         error +=  name;
         error += ":(GBE): error: failed in Gen backend.\n";
-- 
1.9.1



_______________________________________________
Beignet mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/beignet

Reply via email to