summaryrefslogtreecommitdiff
path: root/cpu_ref/rsCpuScriptGroup2.cpp
diff options
context:
space:
mode:
authorYang Ni <yangni@google.com>2015-06-18 15:57:56 -0700
committerYang Ni <yangni@google.com>2015-06-23 10:08:43 -0700
commit1c20667f7a174a7c0a1599d34a40c524fe24c615 (patch)
tree0427c607dd1c2371305d90baed9ff3b5416f2a7f /cpu_ref/rsCpuScriptGroup2.cpp
parentcd6cf64d012cfb524b69289e6e4e67fcd602626b (diff)
Check for kernel chaining in ScriptGroup
b/21958851 bcc expects kernels chained up via input and output. Check this in the runtime before passing ScriptGroup to bcc for compiler fusion. This serves the same purpose as https://googleplex-android-review.git.corp.google.com/#/c/713267, but provides additional checks in the runtime before bcc is even called. Change-Id: I6004d577410ea1684f5043babadc1e1b885c4f6a (cherry picked from commit 08e7693c13f895677b93537af3b6bc353318a81c)
Diffstat (limited to 'cpu_ref/rsCpuScriptGroup2.cpp')
-rw-r--r--cpu_ref/rsCpuScriptGroup2.cpp21
1 files changed, 20 insertions, 1 deletions
diff --git a/cpu_ref/rsCpuScriptGroup2.cpp b/cpu_ref/rsCpuScriptGroup2.cpp
index b1453110..8923c651 100644
--- a/cpu_ref/rsCpuScriptGroup2.cpp
+++ b/cpu_ref/rsCpuScriptGroup2.cpp
@@ -128,7 +128,26 @@ bool Batch::conflict(CPUClosure* cpuClosure) const {
}
}
- return false;
+ // The compiler fusion pass in bcc expects that kernels chained up through
+ // (1st) input and output.
+
+ const Closure* lastBatched = mClosures.back()->mClosure;
+ const auto& it = argDeps.find(lastBatched);
+
+ if (it == argDeps.end()) {
+ return true;
+ }
+
+ const auto& args = (*it).second;
+ for (const auto &p1 : *args) {
+ if (p1.first == 0 && p1.second.get() == nullptr) {
+ // The new closure depends on the last batched closure's return
+ // value (fieldId being nullptr) for its first argument (argument 0)
+ return false;
+ }
+ }
+
+ return true;
}
CpuScriptGroup2Impl::CpuScriptGroup2Impl(RsdCpuReferenceImpl *cpuRefImpl,