summaryrefslogtreecommitdiff
path: root/cpu_ref/rsCpuScript.cpp
AgeCommit message (Collapse)Author
2017-05-04Use different .so names in a debug contextYang Ni
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
2017-03-15Remove libutils.so dependency from libRSDriver, libRSCpuRef, and mostMiao Wang
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
2017-02-28Remove libcutils dependency.Miao Wang
- 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
2017-02-28Remove RS_SERVER macros and references to unused headers.Miao Wang
- 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
2017-02-16Fix path for the flattened libbcc directory.Jean-Luc Brouillet
Just fix a few include paths. Bug: 34265954 Test: Compiled everything, ran a regular and a support lib app. Change-Id: I5d608e58734e50c0d2ac895290ea2a66ebe46345
2017-02-09frameworks/rs: fix typos and clang-tidy warningsRahul Chaudhry
This change fixes a few typos and clang tidy warnings related to the "llvm-namespace-comment" checks. Bug: 26936282 Test: WITH_TIDY=1 WITH_TIDY_CHECKS="llvm-namespace-comment" mm Change-Id: Ic65182e5b4999fbd48d6a8ad7172e4bfeeb541f4
2016-10-28Support x86+arm modeVictor Khimenko
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
2016-06-27Fixed unsafe use of stringstream.str()Yang Ni
Bug: 29772332 Fixed code making reference to internal data of a temporary object. Change-Id: I940cce17cd5ada4bb33fa63fde8a63a9038778a8
2016-06-14Delete simple reduction implementation.David Gross
Bug: 27298560 Change-Id: I8c3d568e98aaf0b7d86881c985d13ed5b8e95338 (cherry picked from commit ae2ec3febedfc29376b9104413fb4042028f1265)
2016-05-04Avoid breaking on dead launch optionsYang Ni
Bug: 28463187 Launch options array[2-4] are not initialized by the support library in the current SDK. They may have arbitrary values that invalide the checks that this CL is removing, and cause a kernel launch to bail out unnecessarily. This CL removes those checks, since the array.*Start and array.*End fields in the launch options are not used anywhere in the current runtime. Change-Id: Ib8a2e551619f770b402f569acbde635ee047675a
2016-04-15Multithreaded execution of certain general reduction kernels; reduction test ↵David Gross
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 (cherry picked from commit 10adb0c2029f112b5738228617d5645f6ecea0c5)
2016-04-06Avoid accessing TLS in rsClearObject()Yang Ni
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
2016-03-18Fixed intrinsics inside a script groupYang Ni
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
2016-02-26Better handle error log and nullptr reference.Miao Wang
Bug: 27367378 Change-Id: Ide29c702d7a70dfe087ddc600d3fd17279223196
2016-02-10Merge "Add a new libclcore_g library which contains debug info."Stephen Hines
2016-01-19Support for general reduction kernels.David Gross
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
2015-12-18Add a new libclcore_g library which contains debug info.Verena Beckham
Add a new libclcore_g.bc which is functionally equivalent to libclcore.bc but is compiled with debug information and -O0. To achieve this some allocation functions had to be written in C, because they were previously available in LLVM IR without debug information. The RenderScript cts has been run to verify these changes, both as it is and forcing it to link with the new libclcore_g library. Both runs show no regressions. Change-Id: Iffc3c54fbf69b9a43703d3c2776101ef881deffd Signed-off-by: Verena Beckham <verena@codeplay.com>
2015-08-14Add a basic implementation of the reduce kernel API to the CPUMatt Wala
reference implementation. Bug: 22631253 For now, this just runs a serial reduction on one thread. Change-Id: I34c96d24bb6f44274de72bb53160abcf79d143b0
2015-07-17Add a flag to the API to specify -O0 on the bcc command line.verena beckham
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>
2015-06-29Avoid overwriting shared library file that is openYang Ni
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)
2015-06-22Skip the checksum if we have precompiled code on the /system/ partition.Stephen Hines
Bug: 20894664 The system partition is read-only, and can/should be compiled correctly during the offline creation of the system image. Since we cannot replace these precompiled blobs (short of app update/OTA), there is no reason or correct way to validate/replace the checksum. Change-Id: Ia66bfdbe178bf215e146c3699f5bc7804222e978
2015-05-29Merge "Remove dead uses of RSCompilerDriver and of compiler callbacks."David Gross
2015-05-29Remove dead uses of RSCompilerDriver and of compiler callbacks.David Gross
Change-Id: Ibe8725074724b75e35c25a404daaba07ffbca2ab
2015-05-27Fix memory leak when rs invoke functionYong Chen
Change-Id: I17c701dfda5b3031c1fc50bfc186e4b7f8b7ac1e Signed-off-by: Yong Chen <yong.a.chen@intel.com>
2015-05-22Merge changes from topic 'global_info'android-m-previewStephen Hines
* changes: Update RS driver to support extraction of global variable properties. Use "override" instead of "virtual" when replacing methods.
2015-05-22Update RS driver to support extraction of global variable properties.Stephen Hines
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
2015-05-15Don't use TEMP_FAILURE_RETRY on close in frameworks/rs.Elliott Hughes
Bug: http://b/20501816 Change-Id: I63a7c690bc5bde3dc1354f6e04ad8d32b3b43015
2015-05-11Merge "Add RSGlobalInfoPass information to RS driver."Jason Sams
2015-05-06Add a way to link against different driver names.Stephen Hines
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
2015-05-05Add RSGlobalInfoPass information to RS driver.Stephen Hines
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
2015-04-28SetError if forEachMtlsSetup fails sanity checkPirama Arumuga Nainar
bug 19866850 Explicitly set error when a kernel launch fails. Change-Id: If42419f3cf7557c524afc5bb27a0753460ca7e4e
2015-04-21Code cleanup: Remove unused typedefs and declarations.Logan Chien
Change-Id: I48dafb2bc1dc335a52b289db2981397251f673c8
2015-04-16Merge "Dedup checksum calculation routines"Yang Ni
2015-04-16Dedup checksum calculation routinesYang Ni
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
2015-04-16Fix allocation-less launches.Jason Sams
Change-Id: I6d6b46c55f3e88a810ebe51def3ebaccb1fd3fa2
2015-04-14Compute checksum for script group generated codeYang Ni
Change-Id: I5f469266fd11b5031d1357f356ac40e00f5c0348
2015-03-25Wrap TEMP_FAILURE_RETRY around system callsPirama Arumuga Nainar
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
2015-03-10Runtime support for Script Group as single moduleYang Ni
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
2015-03-03Add build fingerprint and ensure match on .so loadPirama Arumuga Nainar
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
2015-02-20Moved class ScriptExecutable to its own moduleYang Ni
b/19283946 This move also included the related class SharedObjectUtils. Change-Id: Iefd587b659c4ad99340c330955b41cd92df45563
2015-02-19Remove STL references from header filesYang Ni
b/19148482 Replaced std::string with android::String8, and std::pair with android::renderscript::Pair, in header files. Change-Id: I20ac1a3b7a019e5eee12fac46ad6adf64d850459
2015-02-19Move bcc::getCommandLine to fw/rsPirama Arumuga Nainar
libbcc had a utility function to concatenate string arguments. This patch moves that function to frameworks/rs. The function will no longer be needed in libbcc once we move all the checksum/cache invalidation logic to frameworks/rs. Change-Id: I2b1c15c2763d90d7b099e41257bb72f200680943
2015-02-04Runtime support for invocables in ScriptGroupsYang Ni
This also includes support for InvokeID Change-Id: I5b59df166ea30b309b8dd9623825ac0e72d03856
2015-02-05Merge "Make rsContext be able to have info about the path of native libs for ↵Miao Wang
64bit Renderscript compat lib."
2015-02-03Make rsContext be able to have info about the path of native libsMiao Wang
for 64bit Renderscript compat lib. - Native lib path stored in Java and queried from JNI. - Then set to Context during context creation. Change-Id: I3c997cf849efb7b9a0b0ac35d5b62289d70e7434
2015-02-02Runtime support for compiler kernel fusion.Yang Ni
The runtime will start a seperate process to call the new bcc to fuse kernels. Change-Id: Ia73ea917a126a5055ec97f13d90a5feaafd6a2f5
2015-02-02Remove STL references from header filesYang Ni
b/19148482 Change-Id: I2138664d8ef51d15da23be69ac7d224f30224f42
2015-01-28Mark scripts as threadable or notPirama Arumuga Nainar
bug 19095896 Read embedded flag in .rs.info and use it to mark Scripts as threadable. In compat lib path, scripts are always threadable. Change-Id: I85a3753ffae788dbdec5fd130c20581790c4ee07
2015-01-26add array launch support.Jason Sams
Change-Id: I66cd89b5b44eafa92f391708a06464cd7cdde3ed
2015-01-26Merge "Read pragma keys and values from .rs.info"Pirama Arumuga Nainar