History log of /frameworks/compile/slang/slang_rs_foreach_lowering.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
40bac5d72af8fe32ab3d0bb38aafb5c65d8d9dfa 09-May-2016 Yang Ni <yangni@google.com> Disallow launching old-style kernels via rsForEach

Bug: 28666819

The "kernel" attribute should be the sole criterion for a kernel
function launchable via rsForEach() in single-source RS.
(The utility function isRSForEachFunc() considers a super set of such
functions as kernels, including old-style kernels or any function
that returns void and has a pointer type first parameter, which
don't have the "kernel" attribute.)

Launching an old-style kernel is forbidden via an rsForEach() or
rsForEachWithOptions() call. Old-style kernels can still co-exist in
the same script with such a call, and can be launched via Java or C++
reflected code.

To make this coexisting possible, old-style kernels are moved to
the end of the list for exported kernels in the metadata. This way,
the single-source RS frontend pass can agree with the metadata
on the slot assignment for "new-style" kernels.

Change-Id: I3d61c1c91b29043f3597ae622ef7c2ef972eb789
2e9b1699b06a85cb15c95efe358cc665ad92ce3f 08-Mar-2016 Stephen Hines <srhines@google.com> Generate proper ParmVarDecls for rsForEachInternal().

Bug: http://b/26987366

We were previously relying on the fact that these declarations weren't
used, but the latest version of Clang actually checks the ParamInfo of

(cherry picked from commit 8f0192fdbc1033dcae4c03e52e1225a1cee79056)

Change-Id: Ie0f23f98decb45e6773aecb1a54fea56d120b31b
9319dfc974a82794d46e9f474f316590f480b976 26-Feb-2016 Yang Ni <yangni@google.com> slang error on kernel launch from another kernel

Bug: 27459075

Extended the AST visitor that lowers rsForEach() and
rsForEachWithOptions() calls to be aware if the function being walked
is a kernel itself. If so, on seeing a call to one of the two kernel
launch functions, reports a compiler error.

Note that such checking is oblivious to the control flow.

Also removed all checks inside the LowerRSForEachCall() function,
since we do all the same checks before entering that function.

Change-Id: Ib7f276e8e8d707f39b310548c084ed550a7a3480
(cherry picked from commit edfcc6949e2ae5374ba548d7543d6f815cf27b65)
2615f383dfc1542a05f19aee23b03a09bd018f4e 03-Dec-2015 Yang Ni <yangni@google.com> Tidy up AST nodes for rsForEach

Bug: 23535985

Slang asserts in debug build, for the following reasons:
1) A mistake using void type instead of the function type for
2) rsForEachInternal() was declared with the second parameter being
void*, but should be rs_script_call_t*; and
3) Integer 0 for launch option is used for rsForEach without an
launch option, where a rs_script_call_t* is expected.

This CL fixes those.

Change-Id: If6245ceca774ee38830aeddda156be55cde9a137
88f21e16250d2e52a75607b7f0c396e1c2a34201 19-Nov-2015 Yang Ni <yangni@google.com> Changed generated calls to rsForEachInternal

Bug: 23535985

Avoided using varargs in rsForEachInternal, since LLVM handles varargs
differently on x86 than on ARM.

Changed generated calls to rsForEachInternal to match the new
signature, in which the last argument is an allocation array.

Change-Id: I1b53861083b87c51c5bdaeaec2be469dc7af7a0a
1946749cebf4a64341d8210890688fef7d958c22 27-Oct-2015 Yang Ni <yangni@google.com> Launch options & multi inputs for single-source RS

Bug: 23535985

Also renamed rsParallelFor to rsForEach.
Added checks for number of allocations to rsForEach matching kernel function

Added slang tests.

Removed code from RSContext for remembering the rs_allocation AST subtree.

Change-Id: Ibc22bd5e9585a4471b15920ef60fe1fe2312de49
fb40ee2a90f37967bf4a40a18dec7f60e5c580d8 13-Oct-2015 Yang Ni <yangni@google.com> Revert "Revert "Handle kernel launch calls""

Bug: 23535985

This reverts commit 5d9263d3a3a7457b9e5fe6e518c0d822dcdfcda6.

This also fixes issues in change list 172074, which caused some
slang tests to fail due to changed hehavior in error handling.

The fix was based on changes originally posted by srhines@.

To keep single-source functionality working, I separated kernel
name logging from the final export processing code. We would
build a map from kernel funciton names to slot numbers as we parse
the script. The map is used when translating a rsParallelFor call
to a call to the internal rsForEachInternal API, so that we can find
the proper slot numbers.

Here is Steve's original commit message.

Only call processExports() after a successful C99 compilation.

This refactoring fixes a bug in the previous single-source patch, where
exported functions/variables/kernels were being processed during the
regular compilation steps. This wastes compile time, since we don't need
to actually prepare for outputting reflected Java/C++ code if the
compile is going to fail for regular C99 reasons.

Change-Id: I81d88731188f4258f12f4c90ae8dd8abc8c2d641
5d9263d3a3a7457b9e5fe6e518c0d822dcdfcda6 13-Oct-2015 Stephen Hines <srhines@google.com> Revert "Handle kernel launch calls"

This reverts commit 45aa8c52c9400cef86efe4343f04e605a66f42af.

Change-Id: If33ad432e4381d1dc64ef884b51eb50f707807ff
45aa8c52c9400cef86efe4343f04e605a66f42af 14-Sep-2015 Yang Ni <yangni@google.com> Handle kernel launch calls

Bug: 23535985

Find rsParallelFor(void*, ...) calls in the .rs source code and
translate them into rsForEachInternal(int, rs_allocation, rs_allocation)

Semantic checks are pretty limited at this point. Will enhance them in followup CLs.

Change-Id: I6e2cf3db868f426aa8e0b9a77732b66c1e6b9f03