summaryrefslogtreecommitdiff
path: root/cpu_ref/rsCpuScript.cpp
diff options
context:
space:
mode:
authorStephen Hines <srhines@google.com>2015-04-28 18:49:56 -0700
committerStephen Hines <srhines@google.com>2015-05-05 23:52:03 -0700
commit8409d6414dd4a42aa59779fcfe9fce18648cb135 (patch)
treeb6babca8b4be89ba76e1b46beb7a9c1b1a22a69d /cpu_ref/rsCpuScript.cpp
parentc8ed6d305d5adc98367bb3acdd5e2188946fb35b (diff)
downloadrs-8409d6414dd4a42aa59779fcfe9fce18648cb135.tar.gz
Add RSGlobalInfoPass information to RS driver.
Bug: 20306487 This change enables vendor drivers to configure support for including additional information about global variables in the emitted CPU code. This information includes the number of total global variables, the names of these variables, the addresses of these variables and the sizes of these variables. The driver can also select whether the information includes constant (immutable) globals or not. The reference driver defaults to embedding information about each of the existing, non-constant global variables. Change-Id: I1e55fc3f08e518f04eeee3e4f9dc7b6ea3b80d7c
Diffstat (limited to 'cpu_ref/rsCpuScript.cpp')
-rw-r--r--cpu_ref/rsCpuScript.cpp37
1 files changed, 35 insertions, 2 deletions
diff --git a/cpu_ref/rsCpuScript.cpp b/cpu_ref/rsCpuScript.cpp
index 3f64534a..7e024bc5 100644
--- a/cpu_ref/rsCpuScript.cpp
+++ b/cpu_ref/rsCpuScript.cpp
@@ -55,6 +55,9 @@
#endif
namespace {
+
+static const bool kDebugGlobalVariables = false;
+
#ifndef RS_COMPATIBILITY_LIB
static bool is_force_recompile() {
@@ -83,11 +86,18 @@ static void setCompileArguments(std::vector<const char*>* args,
const std::string& bcFileName,
const char* cacheDir, const char* resName,
const char* core_lib, bool useRSDebugContext,
- const char* bccPluginName) {
+ const char* bccPluginName, bool emitGlobalInfo,
+ bool emitGlobalInfoSkipConstant) {
rsAssert(cacheDir && resName && core_lib);
args->push_back(android::renderscript::RsdCpuScriptImpl::BCC_EXE_PATH);
args->push_back("-unroll-runtime");
args->push_back("-scalarize-load-store");
+ if (emitGlobalInfo) {
+ args->push_back("-rs-global-info");
+ if (emitGlobalInfoSkipConstant) {
+ args->push_back("-rs-global-info-skip-constant");
+ }
+ }
args->push_back("-o");
args->push_back(resName);
args->push_back("-output_path");
@@ -276,6 +286,10 @@ bool RsdCpuScriptImpl::storeRSInfoFromSO() {
mIsThreadable = mScriptExec->getThreadable();
//ALOGE("Script isThreadable? %d", mIsThreadable);
+ if (kDebugGlobalVariables) {
+ mScriptExec->dumpGlobalInfo();
+ }
+
return true;
}
@@ -326,8 +340,11 @@ bool RsdCpuScriptImpl::init(char const *resName, char const *cacheDir,
bcFileName.append(".bc");
std::vector<const char*> compileArguments;
+ bool emitGlobalInfo = mCtx->getEmbedGlobalInfo();
+ bool emitGlobalInfoSkipConstant = mCtx->getEmbedGlobalInfoSkipConstant();
setCompileArguments(&compileArguments, bcFileName, cacheDir, resName, core_lib,
- useRSDebugContext, bccPluginName);
+ useRSDebugContext, bccPluginName, emitGlobalInfo,
+ emitGlobalInfoSkipConstant);
mChecksumNeeded = isChecksumNeeded();
if (mChecksumNeeded) {
@@ -888,6 +905,22 @@ Allocation * RsdCpuScriptImpl::getAllocationForPointer(const void *ptr) const {
return nullptr;
}
+int RsdCpuScriptImpl::getGlobalEntries() const {
+ return mScriptExec->getGlobalEntries();
+}
+
+const char * RsdCpuScriptImpl::getGlobalName(int i) const {
+ return mScriptExec->getGlobalName(i);
+}
+
+const void * RsdCpuScriptImpl::getGlobalAddress(int i) const {
+ return mScriptExec->getGlobalAddress(i);
+}
+
+size_t RsdCpuScriptImpl::getGlobalSize(int i) const {
+ return mScriptExec->getGlobalSize(i);
+}
+
void RsdCpuScriptImpl::preLaunch(uint32_t slot, const Allocation ** ains,
uint32_t inLen, Allocation * aout,
const void * usr, uint32_t usrLen,