[Beignet] [PATCH V3 1/5] GBE/DebugInfo: Enable new feature

Bai Yannan yannan.bai at intel.com
Wed Nov 18 00:28:35 PST 2015


    1. Add a bool env OCL_DEBUGINFO to enable generate debug infomation while compiling cl source, set it false as default value.
    2. Define a structure type DebugInfo.

Signed-off-by: Yannan Bai <yannan.bai at intel.com>
---
 backend/src/backend/program.cpp | 2 ++
 backend/src/backend/program.h   | 5 +++++
 2 files changed, 7 insertions(+)

diff --git a/backend/src/backend/program.cpp b/backend/src/backend/program.cpp
index 08b33da..f145fef 100644
--- a/backend/src/backend/program.cpp
+++ b/backend/src/backend/program.cpp
@@ -519,6 +519,7 @@ namespace gbe {
     program->CleanLlvmResource();
   }
 
+  BVAR(OCL_DEBUGINFO, false);
 #ifdef GBE_COMPILER_AVAILABLE
   BVAR(OCL_OUTPUT_BUILD_LOG, false);
 
@@ -557,6 +558,7 @@ namespace gbe {
 #endif /* LLVM_VERSION_MINOR <= 2 */
     args.push_back("stringInput.cl");
     args.push_back("-ffp-contract=off");
+    if(OCL_DEBUGINFO) args.push_back("-g");
 
     // The compiler invocation needs a DiagnosticsEngine so it can report problems
     std::string ErrorString;
diff --git a/backend/src/backend/program.h b/backend/src/backend/program.h
index f948a6b..51797ee 100644
--- a/backend/src/backend/program.h
+++ b/backend/src/backend/program.h
@@ -36,6 +36,11 @@
 extern "C" {
 #endif /* __cplusplus */
 
+typedef struct _DebugInfo {
+    uint32_t line;
+    uint32_t col;
+} DebugInfo;
+
 /*! Opaque structure that interfaces a GBE program */
 typedef struct _gbe_program *gbe_program;
 
-- 
1.9.1



More information about the Beignet mailing list