History log of /frameworks/rs/cpu_ref/rsCpuScriptGroup2.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
a845c35880f8434619ac299e8af47aa6a5049e8d 02-May-2017 Yang Ni <yangni@google.com> Use different .so names in a debug context

Bug: 37670543
Bug: 36006390
Bug: 37679566
Bug: 37636434

In debug context, a script is forced to be recompiled every time it
is initialized.
To avoid the same .so file being written to by another thread,
while it is being loaded and used by one thread, do not save the .so
file. Delete it right after loading it.

Test: RefocusTest and RSTest (including ScriptGroup2 tests) with
debug.rs.debug set to 1 and CTS on Angler

Change-Id: If63e3d21e3d9abd007a66e0ec79c9e6f1c9f13a0
/frameworks/rs/cpu_ref/rsCpuScriptGroup2.cpp
b4b603d8c1c5574a7a76c7f74d03b996f0902e9a 17-Apr-2017 Luke Drummond <luke.drummond@codeplay.com> [debugger] make the ScriptGroup inspection point weak

Breakpoints set on named ScriptGroups were never resolved by the
debugger due to aggressive optimizations by clang in release builds.

`debugHintScriptGroup2`, used by the debugger to inspect ScriptGroup
compilations at `optlevel == 0`, had its inner loop optimized away
completely as there are no visible side effects (where the ALOGV calls
are actually empty macros). This was fixed by using an `__asm__
__volatile__ ("")` construct as per the gcc docs:

noinline This function attribute prevents a function from being
considered for inlining. If the function does not have side-effects,
there are optimizations other than inlining that causes function
calls to be optimized away, although the function call is live. To
keep such calls from being optimized away, put `asm ("")` in the
called function, to serve as a special side-effect.
(see also
https://gcc.gnu.org/onlinedocs/gcc/Alternate-Keywords.html
https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#Common-Function-Attributes)

Although preventing the inner loop from being optimized away is enough
to get the function called, it is apparent that clang only sets up the
call frame with arguments that it can see are used inside the function
body, meaning that we had garbage values for `groupName` and
`groupNameSize` unless the symbol is weakly visible so that the compiler
can no longer introspect that the arguments are ignored.

Test: aosp_x86_64-eng (emulator)
- RsTest (32-bit, 64-bit)
- cts -m RenderscriptTest
- rs/lldb (required various other pending CLs)

Bug: 23535482

Change-Id: I24e23895e67d1ede8bf8e671165a3a6843a11082
Signed-off-by: Luke Drummond <luke.drummond@codeplay.com>
(cherry picked from commit 6e64e51a6a252bd88acfa72dac8372c863f524e0)
/frameworks/rs/cpu_ref/rsCpuScriptGroup2.cpp
ef6acb98982393e36cad52f67e691d75b6a46cfd 22-Mar-2017 Yang Ni <yangni@google.com> Removed incorrect asserts

Bug: 32278517

RsExpandKernelDriverInfo.outLen is never initialized for any foreach
kernel or a script group. The value does not even apply to a script
group.

There should be no assert on it.

Test: CTS on x86 emulator and checked device logcat no longer has the
asserts in question.

Change-Id: Ib0c25f9978ef5364e8ef0f438243dae14688a634
/frameworks/rs/cpu_ref/rsCpuScriptGroup2.cpp
82e135c4bbe18855d8ed02632bb074f8da0b96e0 28-Feb-2017 Miao Wang <miaowang@google.com> Remove libutils.so dependency from libRSDriver, libRSCpuRef, and most
parts of libRS_internal.

NOTE: we're resolving dependencies to provide a model for vendors.
For us, all this code is above the HAL, thus the dependencies
are acceptable; whereas for vendors, their equivalent of this code is
below the HAL, and so the dependencies are not acceptable.

This CL resolves the libutils dependency by:
- Implement the timings functions in android::renderscript namespace
using NDK APIs, instead of using libutils counterparts.
- Replace android::Vector and android::String8 by std::vector and
std::string.
- PROPERTY_VALUE_MAX is replaced as PROP_VALUE_MAX.

This CL didn't resolve the libutils dependency of rsFont.cpp and
rsDebugger.cpp in libRS_internal:
The dependent functionality in rsDebugHelper.h is off by default, and
only intended for use during development; and rsFont.cpp is part of
graphics API which is not implemented below the HAL and is not used as
a model by vendors.

Additionally, this CL fixed the bug that mNodes was sorted in a
decreasing order. Nodes in ScriptGroup should be executed in
ascending order. The bad sort was only for support lib; so there was a
previously-unknown bug in support lib implementation of ScriptGroup.

Background:
libutils contains a collection of things like Vector, String8,
CallStack. It served the purpose similar to a STL library, when there
was no stable STL implementation available in Android. And most
importantly, it is not part of NDK.
Support lib used to use our own implementations of android::Vector and
android::String8, because it can only depend on NDK, similarly for the
timing related functions.
As part of the Treble requirements, native RS, including vendor version
libRS_internal, libRSDriver, libRSCpuRef could only depend on NDK
too. So we need to break the dependency on libutils. And since we now
have reasonable support of STLs, we should use that instead.

Bug: 34396220
Test: mm, and all CTS tests pass on Bullhead;
RsTest and RSTest_CompatLib (both native and compat path) also pass.
Change-Id: Ib9a37d16235c1dcd0f5bae3b95c374e394483c91
/frameworks/rs/cpu_ref/rsCpuScriptGroup2.cpp
03fab68da223638671c6e21864283e25bb1fec41 17-Feb-2017 Jean-Luc Brouillet <jeanluc@google.com> Fix path for the flattened libbcc directory.

Just fix a few include paths.

Bug: 34265954
Test: Compiled everything, ran a regular and a support lib app.
Change-Id: I5d608e58734e50c0d2ac895290ea2a66ebe46345
/frameworks/rs/cpu_ref/rsCpuScriptGroup2.cpp
9e37ef9974cb8140998e06199115de8ecb93f0d3 08-Nov-2016 Yang Ni <yangni@google.com> Merge "Add a debugger hook point during script group compilation at -O0."
1cea94d9a1268eb8b9d0099a4c145de3f8688e07 04-Oct-2016 Aidan Dodds <aidan@codeplay.com> Add a debugger hook point during script group compilation at -O0.

This hook supplies the debugger with the name of the script group and the
addresses of its kernels. This allows breakpoints to be placed on a script
group, which has the effect of placing a breakpoint on its constituent kernels.
This is only executed when compiling at -O0.

Test: Run the renderscript lldb test suite.
Change-Id: I7c688d59aa702696406214423303853ec8dfa6b7
Signed-off-by: Aidan Dodds <aidan@codeplay.com>
/frameworks/rs/cpu_ref/rsCpuScriptGroup2.cpp
cfb1d0b3ed5a775689c20ce053bfc023ea9d8e5f 28-Oct-2016 Victor Khimenko <khim@google.com> Support x86+arm mode

In that mode libraries could be found in /system/lib/arm, not in
/system/lib or /system/lib64

Test: cts-tradefed run cts -s 77DCDB7A -m CtsRsCppTestCases

BUG=27783760

Change-Id: I31227b281637b93c75b507b03cb4e71a31d670a0
/frameworks/rs/cpu_ref/rsCpuScriptGroup2.cpp
578419f77342870cb34fe689ec2dd558fa394ded 28-Jun-2016 Yang Ni <yangni@google.com> Fixed unsafe use of stringstream.str()

Bug: 29772332

Fixed code making reference to internal data of a temporary object.

Change-Id: I940cce17cd5ada4bb33fa63fde8a63a9038778a8
/frameworks/rs/cpu_ref/rsCpuScriptGroup2.cpp
ade3137c22dd91694742145c2d5fe9d6bae17516 06-Apr-2016 Yang Ni <yangni@google.com> Avoid accessing TLS in rsClearObject()

Bug: 27874893
Bug: 27925095

rsClearObject() may be called on rsContextDestroy() in the JNI thread,
where TLS is not initialized.

This also reverted Icca50fade1199b6f530f963e9e694366b7d8cf67 that
made rsContextDestroy() go through the FIFO. rsContextDestroy() must
happen off the FIFO, since it joins the FIFO consuming thread.

Both the rsClearObject() change and the rsContextDestroy() revert need
to go together to make RenderScript and Camera CTS tests pass. Hence
this single CL for both changes.

Change-Id: I5f1d91a4cc1ce9bf2b3386fbef6f1171638b5266
/frameworks/rs/cpu_ref/rsCpuScriptGroup2.cpp
7a106adbb5e370b544f2cbf5b83c063560c81b57 11-Mar-2016 Yang Ni <yangni@google.com> Fixed intrinsics inside a script group

Bug: 27439842

An RS intrinsic relies on RSExpandKernelDriverInfo.usr for the "this"
pointer to the ScriptIntrinsic object.

Need to to correctly set that field in a script execution for intrinsics.

Also fixed a bcc command-line option.

Added a test of script group with intrinsics to ImageProcessing GroupTest(native).

Change-Id: Ia8b45bca3396ac987ba167fd1709ee89123a2557
/frameworks/rs/cpu_ref/rsCpuScriptGroup2.cpp
fef0cd45027f235126d4fb62bda5ea9037450d9c 12-Nov-2015 Yang Ni <yangni@google.com> Various fixes in setting globals in a script group

Bug: 25602504

1) Fixed setting 64-bit globals on a 32-bit platform.

The long values were casted to pointer-size integers (uintptr_t) or void*
in the runtime implementation. This caused the upper 32 bits to be lost
on 32-bit platforms. Fixed that by casting to int64_t instead.

2) Fixed setting Allocation values (either as arg or a global) in a script
group.

The size for a value in a script is signed, with -1 indicating that the
value is an Allocation. The sign has to be kept across different layers
of our stack.

3) Added a test for both native and support libraries for passing
floating point values to a script group, and for passing 64-bit values
(long or double) to a script group.

Change-Id: Ifff099a76be7707df7b67c388395f5a00f9cae66
/frameworks/rs/cpu_ref/rsCpuScriptGroup2.cpp
14ce007a633b10e3b9a3fae29d8f53a7e8c9b59f 31-Jul-2015 Matt Wala <wala@google.com> Add a basic implementation of the reduce kernel API to the CPU
reference implementation.

Bug: 22631253

For now, this just runs a serial reduction on one thread.

Change-Id: I34c96d24bb6f44274de72bb53160abcf79d143b0
/frameworks/rs/cpu_ref/rsCpuScriptGroup2.cpp
f5029803ae6ce9d92d70b76e7a7cdd8d484f31ca 22-May-2015 verena beckham <verena@codeplay.com> Add a flag to the API to specify -O0 on the bcc command line.

Add a flag RS_CONTEXT_OPT_LEVEL_0 which sets a field mOptLevel in the Context
to 0 when calling bcc.
Using this flag will result in an object file that is easier to debug.

Change-Id: I9673506710cc9f34c415b694fe5d6bc7e967f1db
Signed-off-by: verena beckham <verena@codeplay.com>
/frameworks/rs/cpu_ref/rsCpuScriptGroup2.cpp
1efae29f4bbe6c165caf6dfc4b89cf8a5f8c469b 28-Jun-2015 Yang Ni <yangni@google.com> Avoid overwriting shared library file that is open

b/21949580

Writing different contents to an existing .so file, which is currently
open, may corrupt its globals and code. Choose a different file name
instead.

Change-Id: I3e649b09a55b43339283aa1c46f2844c66434c17
(cherry picked from commit 9844cffc8af28c4829012bc0c48f85d04b671f88)
/frameworks/rs/cpu_ref/rsCpuScriptGroup2.cpp
1c20667f7a174a7c0a1599d34a40c524fe24c615 19-Jun-2015 Yang Ni <yangni@google.com> 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)
/frameworks/rs/cpu_ref/rsCpuScriptGroup2.cpp
cbff7bcc4aacdc39d56628fa5c7c50518d52748c 27-May-2015 Yang Ni <yangni@google.com> Avoid casting for CpuScript object

b/20894664

Vendor driver may have different layout for the Script object.
Avoid casting mHal.drv but use the vendor provided lookupScript callback
instead.

Change-Id: Ie492dd98a435b35843ca222a8430c51ccfc8aea9
/frameworks/rs/cpu_ref/rsCpuScriptGroup2.cpp
8237638f87ca0e265d050fbb13725b41a795fe5f 13-May-2015 Yang Ni <yangni@google.com> Generate global info for fused kernel

b/21114118

Change-Id: I6332572f2f2e6f7857a50bf503e73984371cfe0b
(cherry picked from commit b616bcf3df4ce5d7ccc369acf8e90afe59c359fa)
/frameworks/rs/cpu_ref/rsCpuScriptGroup2.cpp
4c368af7e705f0bcb77fa99495b2e33ef20d2699 06-May-2015 Stephen Hines <srhines@google.com> Add a way to link against different driver names.

The existing linker path hard-coded "-lRSDriver" into the command line, but
this won't work for partner drivers that have a different implementation
loaded. In order to still properly handle use of the CPU driver, this needs
to change depending on whether we actually loaded an OVERRIDE_RS_DRIVER or
not.

Change-Id: I0c4a4f12f5db819b234952bc8f364ac6300f147b
/frameworks/rs/cpu_ref/rsCpuScriptGroup2.cpp
cb17015fed6b11a5028f31cc804a3847e379945d 16-Apr-2015 Yang Ni <yangni@google.com> Dedup checksum calculation routines

I introduced a separate routine to cacluate checksum for ScriptGroup
in my previous CL, in addition to the one we use for regular scripts.
This CL removes the new one and uses the old one.

While I am on it, I made some other minor changes, e.g., changing
mBuildChecksum in RsdCpuScriptIml from char* to uint32_t, and a few
other minor cleanups in ScriptGroup2 implementation.

Change-Id: I168fdbb4e7bd14f1549a687e7b0d0ca6dd4da866
/frameworks/rs/cpu_ref/rsCpuScriptGroup2.cpp
f02a2b0a2749d4a4f07edbc23eddff2e51d11b72 08-Apr-2015 Yang Ni <yangni@google.com> Compute checksum for script group generated code

Change-Id: I5f469266fd11b5031d1357f356ac40e00f5c0348
/frameworks/rs/cpu_ref/rsCpuScriptGroup2.cpp
8b94222cc8ea83c780c98b22dd1921f392a2bcf6 03-Apr-2015 Yang Ni <yangni@google.com> Added a name to ScriptGroup2

Implemented in the runtime and CPU driver the new script group name.
Code caching is not implemented yet, and to be added in another CL.

Change-Id: I46e351c8412740512f56b7915b14f36183c6eeaf
/frameworks/rs/cpu_ref/rsCpuScriptGroup2.cpp
bd0af2d161e36e52e6782ccb2d15dd5a36467704 24-Mar-2015 Yang Ni <yangni@google.com> Clean up ScriptGroup2 implementation

b/19944127

- Adjust ref counting
- Fix value size type in closure creation

Change-Id: I1179d34aa67f845578740e71cc2da4f82419f251
/frameworks/rs/cpu_ref/rsCpuScriptGroup2.cpp
2fa8a238dd69afebdeb757adcb1d674043d78e32 26-Mar-2015 Pirama Arumuga Nainar <pirama@google.com> Wrap TEMP_FAILURE_RETRY around system calls

BUG 19934827

Wrap TEMP_FAILURE_RETRY around system calls that can return EINTR
(waitpid, close).

Refactor fork/exec flows in various places into a utility function
and log errors so we can better understand failures in the test server.

Fix a small use-after-free issue in ScriptGroups.

Change-Id: I60b192f83c395a13c27cd6bd2289c44132b84791
/frameworks/rs/cpu_ref/rsCpuScriptGroup2.cpp
b0abb140ac51b93d1a85aadaa63fe057f2d29850 12-Mar-2015 David Gross <dgross@google.com> Pass RsExpandKernelDriverInfo not RsExpandKernelParams.

Which is to say: retire RsExpandKernelParams and pass RsExpandKernelDriverInfo
directly to kernel wrapper functions instead.

Requires related change in frameworks/compile/libbcc.

Change-Id: I453f45ec18f389e88e27fcfa57ddf245d077cb98
/frameworks/rs/cpu_ref/rsCpuScriptGroup2.cpp
958d8b23ac969d13ea3da0a2d9a355f5951afa8c 12-Mar-2015 Yang Ni <yangni@google.com> Merge "Handle FP precision in kernel fusion"
dced5c96bc53c45a1aac782ea9bd738b0d50fd09 12-Mar-2015 David Gross <dgross@google.com> Add new APIs rsGetDim[XYZ]() and add RSTest test cases to exercise them.

Test UT_kernel3d does not pass reliably, so it is disabled for now.

Tests will not compile without related
platform/frameworks/compile/libbcc and
platform/frameworks/compile/slang changes.

Bug: 18964628

Change-Id: I39660400953306ceb47c8b5e9665e8f0084775dd
/frameworks/rs/cpu_ref/rsCpuScriptGroup2.cpp
edf4ea312cc3f7dd4373f8db5aaf9325ff054c8e 11-Mar-2015 Yang Ni <yangni@google.com> Handle FP precision in kernel fusion

b/19098612

Find the proper core lib for full-precision and relaxed-precions
FP. Path both to bcc while compiling a script group, and let bcc
pick the right one based on the precision of the merged module.

Change-Id: I2a641387f0990463887594729a935a5c3f0f856f
/frameworks/rs/cpu_ref/rsCpuScriptGroup2.cpp
062c287f573ecc06c38ee4295e5627e12c52ac3d 21-Feb-2015 Yang Ni <yangni@google.com> Runtime support for Script Group as single module

Also made two other cleanups:
- Changed KernelID/InvokeID into IDBase in class Closure
Rather than having two fields in class Closure, one of type ScriptKernelID and
the other InovkeID, use a single field of the common base class IDBase. Added a
boolean field to indicate whether it is kernel or invoke, since -fno-rtti is on.
- Removed user pointer from CPU closure

Change-Id: I5553f86b2e58325f85649078d48685a38f12d62f
/frameworks/rs/cpu_ref/rsCpuScriptGroup2.cpp
3e5318a36be470ba7a8c5cf82bbe069178733b11 24-Feb-2015 Yabin Cui <yabinc@google.com> Merge "Move use of tempnam to mkstemp."
433558f0f9abbf07770db288183a15fd261cace2 24-Feb-2015 Yabin Cui <yabinc@google.com> Move use of tempnam to mkstemp.

Bug: 19340053
Change-Id: I1734e085beef395ebcc6453af1efaa19f7409e22
/frameworks/rs/cpu_ref/rsCpuScriptGroup2.cpp
2abfcc6d129fe3defddef4540aa95cc445c03a7a 18-Feb-2015 Yang Ni <yangni@google.com> Moved class ScriptExecutable to its own module

b/19283946

This move also included the related class SharedObjectUtils.

Change-Id: Iefd587b659c4ad99340c330955b41cd92df45563
/frameworks/rs/cpu_ref/rsCpuScriptGroup2.cpp
ff2bb54ebf593b1d19d3a2e4cfa70a8ea4432c0d 02-Feb-2015 Yang Ni <yangni@google.com> Reformat and remove STL reference from header

b/19148482

Reformmated according to Android C++ style guidelines.
Removed STL references in headers.

Change-Id: I6d82b8fe5ac868067b6d9ebe797125feb97e5641
/frameworks/rs/cpu_ref/rsCpuScriptGroup2.cpp
eb9aa675754c49f613c6ad71d41472b30f38b007 27-Jan-2015 Yang Ni <yangni@google.com> Runtime support for invocables in ScriptGroups

This also includes support for InvokeID

Change-Id: I5b59df166ea30b309b8dd9623825ac0e72d03856
/frameworks/rs/cpu_ref/rsCpuScriptGroup2.cpp
da0f069871343119251d6b0586be356dc2146a62 12-Jan-2015 Yang Ni <yangni@google.com> Runtime support for compiler kernel fusion.

The runtime will start a seperate process to call the new bcc to fuse kernels.

Change-Id: Ia73ea917a126a5055ec97f13d90a5feaafd6a2f5
/frameworks/rs/cpu_ref/rsCpuScriptGroup2.cpp
bf2111d3b3de310932099514f06924e48fa1d7b2 27-Jan-2015 Jason Sams <jsams@google.com> add array launch support.

Change-Id: I66cd89b5b44eafa92f391708a06464cd7cdde3ed
/frameworks/rs/cpu_ref/rsCpuScriptGroup2.cpp
1ffd86b448d78366190c540f98f8b6d641cdb6cf 07-Jan-2015 Yang Ni <yangni@google.com> New Script Group API: runtime and cpu driver support.

Change-Id: I9c612cf8874aabaf0ca7d1640567464c71ed3070
/frameworks/rs/cpu_ref/rsCpuScriptGroup2.cpp