summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h
diff options
context:
space:
mode:
authorLuke Drummond <luke.drummond@codeplay.com>2016-09-16 11:28:12 +0000
committerLuke Drummond <luke.drummond@codeplay.com>2016-09-16 11:28:12 +0000
commit7f193d6903edfcbf604fa56138f2c589634ed0d4 (patch)
tree7f3623e185d1c76a2de1ba368b15ee8b9f452604 /lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h
parent49d728ad2105d760712d1f9a42684a9f47d246e0 (diff)
downloadbcm5719-llvm-7f193d6903edfcbf604fa56138f2c589634ed0d4.tar.gz
bcm5719-llvm-7f193d6903edfcbf604fa56138f2c589634ed0d4.zip
[RenderScript] Support tracking and dumping reduction kernels
Initial implementation of support for tracking [RenderScript Reductions](https://developer.android.com/guide/topics/renderscript/compute.html#reduction-in-depth) With this patch, `language renderscript module dump` properly lists reductions that are part of loaded RenderScript modules as well the the consituent functions and their roles, within the reduction. This support required new tracking mechanisms for the `#pragma(reduce)` mechanism, and extension of `RSModuleDescriptor::ParseRSInfo` to support the metadata output by `bcc`. This work was also an opportunity to refactor/improve parse code: - `RSModuleDescriptor::ParseExportReduceCount` now has a complete implementation and the debugger can correctly track reductions on receipt of a module hook. - `RSModuleDescriptor::Dump` now dumps Reductions as well as `ForEach` kernels. Also, fixed indentation of the output, and made indentation groupings in the source clearer. - `RSModuleDescriptor::ParseRSInfo` now returns true if the `".rs.info"` packet has nonzero linecount, rather than rejecting RenderScripts that don't contain kernels (an unlikely situation, but possibly valid). This was changed because scripts that only contained reductions were not being tracked in `RenderScriptRuntime::LoadModule`. - Refactor `RSModuleInfo::ParseRSInfo` and add reduction spec parser stub - Prepared ParseRSInfo to more easily be able to add new parser types - Use llvm::StringRef and llvm::StringMap helpers to make the parsing code cleaner - factor out forEachCount, globalVarCount, and pragmaCount parsing block to their own methods - Add ExportReduceCount Parser - Use `llvm::StringRef` in `RSKernelDescriptor` constructor - removed now superfluous `MAXLINE` macros as we've switched from `const char *` to `llvm::StringRef` llvm-svn: 281717
Diffstat (limited to 'lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h')
-rw-r--r--lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h57
1 files changed, 55 insertions, 2 deletions
diff --git a/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h
index 7aad7058d86..c19835d6bfb 100644
--- a/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h
+++ b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h
@@ -19,6 +19,8 @@
#include <vector>
// Other libraries and framework includes
+#include "llvm/ADT/SmallVector.h"
+#include "llvm/ADT/StringRef.h"
// Project includes
#include "lldb/Core/Module.h"
#include "lldb/Expression/LLVMUserExpression.h"
@@ -33,6 +35,7 @@ typedef uint32_t RSSlot;
class RSModuleDescriptor;
struct RSGlobalDescriptor;
struct RSKernelDescriptor;
+struct RSReductionDescriptor;
typedef std::shared_ptr<RSModuleDescriptor> RSModuleDescriptorSP;
typedef std::shared_ptr<RSGlobalDescriptor> RSGlobalDescriptorSP;
@@ -75,7 +78,7 @@ protected:
struct RSKernelDescriptor {
public:
- RSKernelDescriptor(const RSModuleDescriptor *module, const char *name,
+ RSKernelDescriptor(const RSModuleDescriptor *module, llvm::StringRef name,
uint32_t slot)
: m_module(module), m_name(name), m_slot(slot) {}
@@ -88,7 +91,7 @@ public:
struct RSGlobalDescriptor {
public:
- RSGlobalDescriptor(const RSModuleDescriptor *module, const char *name)
+ RSGlobalDescriptor(const RSModuleDescriptor *module, llvm::StringRef name)
: m_module(module), m_name(name) {}
void Dump(Stream &strm) const;
@@ -97,7 +100,56 @@ public:
ConstString m_name;
};
+struct RSReductionDescriptor {
+ RSReductionDescriptor(const RSModuleDescriptor *module, uint32_t sig,
+ uint32_t accum_data_size, llvm::StringRef name,
+ llvm::StringRef init_name, llvm::StringRef accum_name,
+ llvm::StringRef comb_name, llvm::StringRef outc_name,
+ llvm::StringRef halter_name = ".")
+ : m_module(module), m_reduce_name(name), m_init_name(init_name),
+ m_accum_name(accum_name), m_comb_name(comb_name),
+ m_outc_name(outc_name), m_halter_name(halter_name) {
+ // TODO Check whether the combiner is an autogenerated name, and track
+ // this
+ }
+
+ void Dump(Stream &strm) const;
+
+ const RSModuleDescriptor *m_module;
+ ConstString m_reduce_name; // This is the name given to the general reduction
+ // as a group as passed to pragma
+ // reduce(m_reduce_name). There is no kernel function with this name
+ ConstString m_init_name; // The name of the initializer name. "." if no
+ // initializer given
+ ConstString m_accum_name; // The accumulator function name. "." if not given
+ ConstString m_comb_name; // The name of the combiner function. If this was not
+ // given, a name is generated by the
+ // compiler. TODO
+ ConstString m_outc_name; // The name of the outconverter
+
+ ConstString m_halter_name; // The name of the halter function. XXX This is not
+ // yet specified by the RenderScript
+ // compiler or runtime, and its semantics and existence is still under
+ // discussion by the
+ // RenderScript Contributors
+ RSSlot m_accum_sig; // metatdata signature for this reduction (bitwise mask of
+ // type information (see
+ // libbcc/include/bcinfo/MetadataExtractor.h
+ uint32_t m_accum_data_size; // Data size of the accumulator function input
+ bool m_comb_name_generated; // Was the combiner name generated by the compiler
+};
+
class RSModuleDescriptor {
+ bool ParseExportForeachCount(llvm::StringRef *, size_t n_lines);
+
+ bool ParseExportVarCount(llvm::StringRef *, size_t n_lines);
+
+ bool ParseExportReduceCount(llvm::StringRef *, size_t n_lines);
+
+ bool ParseBuildChecksum(llvm::StringRef *, size_t n_lines);
+
+ bool ParsePragmaCount(llvm::StringRef *, size_t n_lines);
+
public:
RSModuleDescriptor(const lldb::ModuleSP &module) : m_module(module) {}
@@ -110,6 +162,7 @@ public:
const lldb::ModuleSP m_module;
std::vector<RSKernelDescriptor> m_kernels;
std::vector<RSGlobalDescriptor> m_globals;
+ std::vector<RSReductionDescriptor> m_reductions;
std::map<std::string, std::string> m_pragmas;
std::string m_resname;
};
OpenPOWER on IntegriCloud