History log of /frameworks/rs/cpu_ref/rsCpuExecutable.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
9f5a8564b121b59dc69b95e733e9bb9ee533e46c 14-Dec-2017 Ivan Lozano <ivanlozano@google.com> Merge "Fix createFromSharedObject in sanitized builds."
5f4af759693231777add7683eb06c2cb8af5022c 12-Dec-2017 Ivan Lozano <ivanlozano@google.com> Fix createFromSharedObject in sanitized builds.

On integer sanitized builds, a runtime error occurs on the last loop of
the while loop.

runtime error: unsigned integer overflow: 0 - 1 cannot be represented
in type 'size_t' (aka 'unsigned int')

This restructures the while loop to prevent the overflow from occurring.

Bug: 30969751
Test: Compiles, device boots. Ran RS tests.
Change-Id: I11a3f9299e8fa376abfa63eca8baa6a186f787a1
/frameworks/rs/cpu_ref/rsCpuExecutable.cpp
e0f1e2ef6df041d4d88a4d4135c46ddcb0c50029 05-Dec-2017 Justin Yun <justinyun@google.com> Use versioned VNDK directories

VNDK directories will have "-$VER" as their suffix, where $VER is set
by the property "ro.vndk.version".
For example, if the $VER is "28", the vndk-sp directory is
"system/lib[64]/vndk-sp-28/".

Bug: 69984421
Test: Check if the apps that uses RS works without problem.
Change-Id: I24a9b0ca51f12ab5562a661761401d057d6346a0
/frameworks/rs/cpu_ref/rsCpuExecutable.cpp
316ffa59464f42ac94fd5f992f608c7767001e6d 10-Aug-2017 Jiyong Park <jiyong@google.com> Mark RS libs as VNDK-SP

The RS libs are used by RS HAL implementations which are Same-process
HALs. In order to make the RS libs available to the HALs, they are
marked as VNDK-SP.

Bug: 64425518
Bug: 64395154
Test: BOARD_VNDK_VERSION=current m -j libRSDriver.vendor
Test: BOARD_VNDK_VERSION=current m -j libRS_internal.vendor
Test: BOARD_VNDK_VERSION=current m -j libRSCpuRef.vendor

Merged-In: Ia5c9d59b98b6a910a8cb76be1e823da542ca043a
Change-Id: Ia5c9d59b98b6a910a8cb76be1e823da542ca043a
(cherry picked from commit 6fa614124bdf4b5b5cfe8bbd51ee95a6d4dadbb6)
/frameworks/rs/cpu_ref/rsCpuExecutable.cpp
6fa614124bdf4b5b5cfe8bbd51ee95a6d4dadbb6 10-Aug-2017 Jiyong Park <jiyong@google.com> Mark RS libs as VNDK-SP

The RS libs are used by RS HAL implementations which are Same-process
HALs. In order to make the RS libs available to the HALs, they are
marked as VNDK-SP.

Bug: 64425518
Test: BOARD_VNDK_VERSION=current m -j libRSDriver.vendor
Test: BOARD_VNDK_VERSION=current m -j libRS_internal.vendor
Test: BOARD_VNDK_VERSION=current m -j libRSCpuRef.vendor

Change-Id: Ia5c9d59b98b6a910a8cb76be1e823da542ca043a
/frameworks/rs/cpu_ref/rsCpuExecutable.cpp
da43d5866f6224e17e756fdfea405ca4b00a38fc 16-Jun-2017 Jiyong Park <jiyong@google.com> ld.mc uses libcompier_rt and libRSDriver from the vndk-sp directory

When ld.mc links the compiled bc, it now correctly uses libcompiler_rt
and libRSDriver from the vndk-sp directory. This is because when the bc
is loaded inside the app process, it is provided with the libs in
vndk-sp directory.

Bug: 62848943
Test: Renderscript app (e.g. CameraScript) runs well.
Test: logcat | grep ld.mc shows /system/lib/vndk-sp/libcompiler_rt.so
and --library-path=/system/lib/vndk-sp

Change-Id: Ib6354081af797f395ff042ebe87731311d768784
/frameworks/rs/cpu_ref/rsCpuExecutable.cpp
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/rsCpuExecutable.cpp
a16bfb513347e424bd919135a653de275362f0bb 21-Apr-2017 Michael Butler <butlermichael@google.com> Merge "Fix clang-analyzer-security warnings for RenderScript" into oc-dev
ca451c3280b6265a9b79273b4bf89e121a050cab 20-Apr-2017 Michael Butler <butlermichael@google.com> Fix clang-analyzer-security warnings for RenderScript

Replace unsafe strcpy and strcat with bounded strlcpy and strlcat.

Bug: 32511607

Test: mma, cts, vts
Change-Id: I92bc8142f82eaf78f4465bf061871cad864c53b8
/frameworks/rs/cpu_ref/rsCpuExecutable.cpp
3bc02c5bbcc1f1cd838455bf1a32c57c18addda8 15-Dec-2016 Luke Drummond <luke.drummond@codeplay.com> Add .rs.info versionInfo parser to the cpu_ref driver

This is used by lldb to check for a versioning mismatch between the
frontent and backend, but is not used by libRS. However, libRS should
not fail in its presence, so this CL enables the runtime to skip this
section if it is present.

This field is not checked for by the compatibility lib.

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

Bug: 23535482

Change-Id: I3056dd08e7e14ff1094ead60756fd568131bcf4d
Signed-off-by: Luke Drummond <luke.drummond@codeplay.com>
(cherry picked from commit 341f30630d310f52297cf2d9867618cb7a1e8969)
/frameworks/rs/cpu_ref/rsCpuExecutable.cpp
58423152d9e7791dddd124c235db5f693638bbd6 15-Mar-2017 Miao Wang <miaowang@google.com> resolve merge conflicts of 902d1ab7 to master

Test: mm

Change-Id: Ie8ebf3dc243c24924ba174b40d45029564dbbaff
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/rsCpuExecutable.cpp
2536d3fdafb08cef53b9f099e966dbbe82943a85 02-Mar-2017 Mathias Agopian <mathias@google.com> fallout of cleaning-up libutils includes

Test: run & compile
Bug: n/a
Change-Id: I310db0db93b199063fbce9b849155d91173e1a8f
/frameworks/rs/cpu_ref/rsCpuExecutable.cpp
2a61168a777ee434ce2c28945aa74f6a6bcf2820 28-Feb-2017 Miao Wang <miaowang@google.com> Remove libcutils dependency.

- Implement property_get using __system_property_get, remove
dependencies on cutils/properties.h.
- remove rsCompatibilityLib.cpp since it only contains propery_get, and
it is now in rsCppUtils.cpp.
- Disable ATRACE. The systrace is current done in Java level. If we
want to do it in the driver, we need to have our own implementation
similar to native/utils/trace.cc
- Remove CC_LIKELY macro.

Bug: 34396220
Test: build

Change-Id: I6a6cbcfb2ca15b9d1f09b9ce0579d39fdbe98727
/frameworks/rs/cpu_ref/rsCpuExecutable.cpp
62237219e567b9f972c86e7ca4e96f9b3d5ad4de 28-Feb-2017 Miao Wang <miaowang@google.com> Remove RS_SERVER macros and references to unused headers.

- The RS_SERVER macros were intended to have a version of RenderScript
running on the desktop. It has not fully worked for a very long time.

Bug: 35473587
Test: build and CTS tests pass
Change-Id: I0da3fc9d4601951442384d05f9dbecaeddeff8cc
/frameworks/rs/cpu_ref/rsCpuExecutable.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/rsCpuExecutable.cpp
a824b7c0138e49136fabe166ab4431aa9c220b9f 23-Nov-2016 Ting-Yuan Huang <laszio@google.com> Fix error handling problems

There are
1) a potential memory leak by reduceDescriptions.
2) potential null-pointer-accesses by pragmaKeys and pragmaValues.

Test: make WITH_TIDY=1
Change-Id: I46db7c371e87474dd4d8c256fe1be252fdc944f1
/frameworks/rs/cpu_ref/rsCpuExecutable.cpp
ae2ec3febedfc29376b9104413fb4042028f1265 01-Jun-2016 David Gross <dgross@google.com> Delete simple reduction implementation.

Bug: 27298560
Change-Id: I8c3d568e98aaf0b7d86881c985d13ed5b8e95338
/frameworks/rs/cpu_ref/rsCpuExecutable.cpp
d48481048a68725e79bbe8ba8ea75e710c646fe1 28-Apr-2016 Miao Wang <miaowang@google.com> Fix potential security vulnerability in rsCpuExecutable.cpp

Bug: 28318721
Change-Id: I69a4521bc8fa9c8036f71cac4b846c7118114caa
(cherry picked from commit 523ecf7672c0d7b4c85e9e0674b2d588c42af0dd)
/frameworks/rs/cpu_ref/rsCpuExecutable.cpp
633beab5de5ffe4c5068cf1c7a1c0bd09ee9f195 20-Apr-2016 Yang Ni <yangni@google.com> Remove unnecessary logcat message

Bug: 28281435
Change-Id: If0865b20576322845cd23743916c4589ea199287
/frameworks/rs/cpu_ref/rsCpuExecutable.cpp
5e48002cc4a11e9ce63852a77488cfb9f6765c2b 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
(cherry picked from commit ade3137c22dd91694742145c2d5fe9d6bae17516)
/frameworks/rs/cpu_ref/rsCpuExecutable.cpp
10adb0c2029f112b5738228617d5645f6ecea0c5 29-Mar-2016 David Gross <dgross@google.com> Multithreaded execution of certain general reduction kernels; reduction test overhaul.

A reduction kernel is eligible for multithreaded execution if it has a
combiner function and it is launched over a 1D iteration space.

Note: Properties debug.rs.reduce-accum and debug.rs.reduce-split-accum
are added for debugging multithreaded reduction.

The following changes are made to reduction tests in RsTest:
- Overhaul the test framework -- now data-driven, and can execute the same
test multiple times with different seeds and input sizes, features
separate sets of quick correctness tests, full correctness tests,
and performance tests. (Performance tests are not run by default.)
- Report timing information for test execution.
- Report more information for fz* kernel testing.
- Remove dp kernel testing -- this involved floating-point arithmetic
which is not guaranteed to produce identical results between java
and rs or for different rs multithreaded executions.
- Add sumgcd kernel testing. This is intended to be representative of
a compute-heavy kernel.
- findMinAndMax kernel testing must compare cell value not cell index
-- two or more cells might have the same min or max value, and java
and various rs multithreaded executions are not guaranteed to find
the same cell.
- Fix bug in findMinAndMax kernel's combiner function. (It behaved
incorrectly when operating on an accumulator datum that has been
initialized but never passed to the accumulator function.)
- RsTest now requests largeHeap.

Bug: 27299475
Change-Id: I58f99c21389dbae5c8e3ad85d98700dc165664bb
/frameworks/rs/cpu_ref/rsCpuExecutable.cpp
6c1876bbef1b2c89975dce91230a168bd2d2ce4c 15-Jan-2016 David Gross <dgross@google.com> Support for general reduction kernels.

Requires coordinated change in frameworks/base.

Requires coordinated change in frameworks/compile/libbcc in order
for RsTest to run.

At present, general reduction kernels are run single-threaded.

Also: Remove dead struct field MTLaunchStructForEach::sig.

Bug: 23535724
Change-Id: Ice17ccf20a902f8a106eaa62ec071d46e3c0ad8c
/frameworks/rs/cpu_ref/rsCpuExecutable.cpp
46c93e405b0ad7e8fca12d0b1f9eac3997798e45 10-Jan-2016 David Gross <dgross@google.com> Expect to see "exportReduceNewCount: 0" in metadata.

Needs corresponding change in frameworks/compile/libbcc: The driver
and bcinfo need to remain precisely in sync with regard to metadata
format in order for RenderScript to work at all.

Bug: 23535724

Change-Id: Iad82e495d03215e970d2e99ff45ccfa629688f03
/frameworks/rs/cpu_ref/rsCpuExecutable.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/rsCpuExecutable.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/rsCpuExecutable.cpp
5aa018cc36e589b07674957714d27ae3d1fa1c4e 21-May-2015 Stephen Hines <srhines@google.com> Update RS driver to support extraction of global variable properties.

Bug: 20306487

This patch adds some new enums to classify properties (such as "static",
"constant", and "pointer") for global variables. The reference driver
is also extended to provide methods to examine these properties (when
the bitcode is compiled with bcc).

Change-Id: I331756f8a8990caf5ebdf85599060434a7cfdcb7
/frameworks/rs/cpu_ref/rsCpuExecutable.cpp
0be70c6dd8897603530dbc7411f27d9dbd4fee9a 11-May-2015 Pirama Arumuga Nainar <pirama@google.com> Merge "Add /system/vendor/{lib|lib64} to linker args"
1de97c307624f57d95281ebaa77c2129e66e21bc 11-May-2015 Jason Sams <jsams@google.com> Merge "Add RSGlobalInfoPass information to RS driver."
682672e36b05349bc4d9dee74e9fab73ce804183 08-May-2015 Pirama Arumuga Nainar <pirama@google.com> Add /system/vendor/{lib|lib64} to linker args

Add vendor-specific lib directory to ld.mc's library search path. Since
ld.mc takes multiple search directories, there is no need to derive a
single path at runtime.

bug 20894664

Change-Id: Id62d2acbd94914c70bf4668f553a94a33e2a0587
/frameworks/rs/cpu_ref/rsCpuExecutable.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/rsCpuExecutable.cpp
8409d6414dd4a42aa59779fcfe9fce18648cb135 29-Apr-2015 Stephen Hines <srhines@google.com> 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
/frameworks/rs/cpu_ref/rsCpuExecutable.cpp
38014b1ee631ee61e457b850138d3ea6eb73cb1b 23-Apr-2015 Pirama Arumuga Nainar <pirama@google.com> Merge "Tweak arguments to ld.mc"
c2be413317efcc44e3b282fd38fca3334c11777e 22-Apr-2015 Pirama Arumuga Nainar <pirama@google.com> Tweak arguments to ld.mc

Change the arguments to match mclinker's revamped option parser.

Change-Id: I71135ebf81e3105192caf5c946b16297b2702d37
/frameworks/rs/cpu_ref/rsCpuExecutable.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/rsCpuExecutable.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/rsCpuExecutable.cpp
d6f44bc5aecd024bf2311b9ae844300fbdc3f584 18-Mar-2015 Pirama Arumuga Nainar <pirama@google.com> Remove unnecessary include of RSInfo.h

RSInfo.h is obsolete and not needed here.

Change-Id: Ifc0e21ac0a393224b1e2dff63946aed16e5aa36d
/frameworks/rs/cpu_ref/rsCpuExecutable.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/rsCpuExecutable.cpp
aa6757ffc1b23d771566439c3179fdbc1e5ba569 14-Feb-2015 Pirama Arumuga Nainar <pirama@google.com> Add build fingerprint and ensure match on .so load

bug 19216507

If ro.debuggable system property is set,
- Compute the Adler32 checksum of bitcode, compiler arguments, bcc,
libclcore files.
- On shared object load, check that there is an embedded checksum value
in .rs.info and it matches the value computed in the previous step.
The .so is not loaded if the checksums don't match.
- If invoking bcc, pass the checksum as an argument.

If ro.debuggable is not set, a constant checksum is added to .rs.info.
But it is never checked.

Change-Id: I0a9d16b34148b748daf744007a8515511714a5a5
/frameworks/rs/cpu_ref/rsCpuExecutable.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/rsCpuExecutable.cpp