History log of /frameworks/rs/rsov/compiler/RSSPIRVWriter.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
28faded3432d20cc2e9b9e58b4706031bd6ea9c9 22-Feb-2017 Yang Ni <yangni@google.com> Added support for global variables

Bug: 30964317

Pass necessary metadata about global variables--i.e., offsets of each
global variable in the synthesized global buffer--from the compiler to
the driver. This metadata is encoded as an OpString in the generated
SPIR-V code. The driver also creates the global buffer to store all
global variables.

Added support for sharing globals between invokes and kernels. rs2spirv
also does global variable access to global buffer field access
transformation for the CPU code, so that CPU and GPU access the same
global buffer resident in shared memory assuming the same data layout.

Added in the compiler support to handle global variable intializers,
and contantant expressions.

Removed capability Address, since Vulkan validation rules disallow it.
Converted OpInBoundsPtrAccessChain into OpInBoundsAccessChain, since the
former requires capability Address. OpInBoundsPtrAccessChain
instructions get generated for accesses to global variables, which are
now fields in the global buffer.

Added an RSoV test for global variables. Adjusted lit tests to check
the new OpString.

This CL is limited to non-allocation global variables, as global
rs_allocations are handled in separate CLs.

This CL does not handle constant globals either, which will be dealt
with in followup CLs.

Test: lit tests and RSoVTest

Change-Id: Ia8f44c4ffa22046a72a58a26942ced595b3f5f53
/frameworks/rs/rsov/compiler/RSSPIRVWriter.cpp
56813de7a00f872fad490b1b3fe5ab1b620c1be5 28-Mar-2017 I-Jui (Ray) Sung <ijsung@google.com> Fix RSoV compiler regression

c/299496/ revised the protocol between bcc and bcinfo; bcc now injects
some metadata into the module which is in turn parsed by the
bcinfo::MetadataExtractor(Module *) constructor. Since RSoV uses bcinfo
on non-bcc-processed bitcodes, those missing data caused the constructor
to fail.

This CL uses a different MetadataExtractor constructor so that all the
required information are passed to the MetadataExtractor via full bitcode.

Bug: 30964317
Bug: 36657118
Test: RSoV LIT test, RSoVTest on Angler
Change-Id: I9b423ad8d0bcab5d261e595c10d4676486ec4b3b
/frameworks/rs/rsov/compiler/RSSPIRVWriter.cpp
c2f647a6c790cb1f4c86e50506c53cd912e725f6 04-Mar-2017 I-Jui (Ray) Sung <ijsung@google.com> Compiler and runtime support for global allocation metadata

On the compiler side, enumerate used global allocations, assign each used
global allocation a unique ID, and record the mapping in an OpString
in the result SPIR-V code. The ID is the index of the metadata
for the global allocation.

On the runtime side, added a new RSoVBuffer for metadata, and with code
marshaling them for the kernel according to the mapping reported by the
compiler. SPIRIT is linked against the driver for extracting metadata
out of the SPIR-V module.

Added a new testcase for global allocation metadata in RSoVTest.

Bug: 30964317
Test: RSoVTest on Angler, RSoV LIT Tests
Change-Id: I66b3cfa8b66ee2b60b984320900dbe2dc3d15f21
/frameworks/rs/rsov/compiler/RSSPIRVWriter.cpp
eb6548743c40f4129ca55a58ff2d5254f22e95e1 22-Feb-2017 Yang Ni <yangni@google.com> Reorganized metadata related code in rs2spirv

Bug: 30964317

Added a Context class, which is a singleton that is shared across
all LLVM and Spirit compiler passes for rs2spirv. Inside Context,
there is a bcinfo::MetadataExtractor, as well as data structures
for quick lookup of information about foreach kernels and exported
variables.

Cleaned up passes which used to use MetadataExtractor to use this
new Context.

Test: lit tests
Change-Id: I3c88f8e8e75b354d87c155312176544fb660526b
/frameworks/rs/rsov/compiler/RSSPIRVWriter.cpp
7f8c490e872221221cbfe213c99d1104c483c3a4 01-Mar-2017 I-Jui (Ray) Sung <ijsung@google.com> Handle global allocations for 64-bit targets

On 64-bit targets global allocations are not promoted to registers and take
memcpys instead when accessed, so the analysis in global allocation LLVM
pass is extended to handle that case. A new LIT testcase is added.

This CL also removed global allocation declarations from LLVM IR to
prevent them from showing in the result SPIR-V code, which otherwise
may crash certain Vulkan drivers.

Bug: 30964317
Test: RSoVTest, RSoV lit tests
Change-Id: Id8531781599130c152816d7eb551999458c075e2
/frameworks/rs/rsov/compiler/RSSPIRVWriter.cpp
c7b3a43821ccf0f2b13840246e1895744799cf6b 01-Mar-2017 Yang Ni <yangni@google.com> Clean up rs2spirv code

Bug: 30964317

Moved tests/globals/getdimx.ll and rewrite_getdim.ll into tests/rs_allocation.

Removed unneeded #include's, and adjusted #include order.

Removed print-as-words command-line option.

Removed some dead code.

Test: lit tests and RSoVTest

Change-Id: I263987597b8c1ec7aa5593157580aa3ad65861a1
/frameworks/rs/rsov/compiler/RSSPIRVWriter.cpp
3f30b6202dd5ad6ff66959131d216405850ed152 26-Feb-2017 Yang Ni <yangni@google.com> Added Pass and PassQueue to Spirit

Bug: 30964317

Reorganized rs2spirv using PassQueue.

Changed LiteralString from const char * to std::string, so that the
life cycle of the underneath string is correctly managed.

Improved Transformer so that it can capture changes made to the
global or decoration section while transforming function defintions.

Fixed #include order per LLVM coding convention.

Test: unit tests, lit tests, and RSoVTest

Change-Id: I93b2588f94541ae90d3a847ce3fc3eaa941b7a59
/frameworks/rs/rsov/compiler/RSSPIRVWriter.cpp
9d73d08c545462e706ef6951952acff94c37605a 23-Feb-2017 I-Jui (Ray) Sung <ijsung@google.com> LLVM and SPIRIT transformations for global allocations

This is the initial compiler-side transformations for global allocation
support.

Added an LLVM pass to lower rsAllocationDimX calls for later SPIRIT
passes. References to alllocations in those calls are lowered into some
unique ID representing allocations of a module.

Also added a SPIRIT pass to transform lowered accessor
(rsAllocationGetDimX) in previous pass to SPIR-V load instructions from
the metadata buffer.

Generate global allocation metadata, necessary SPIR-V decorations and
declarations in the wrapper generation stage for the generated load
instrutions.

Bug: 30964317
Test: RSoV lit tests, SPIRIT unit tests
Change-Id: I00846c255bd76e77c89a16de0e553acc5f73bbfe
/frameworks/rs/rsov/compiler/RSSPIRVWriter.cpp
bf22a8ab4f46a98ee37f95fc0402744132cc3ed2 07-Feb-2017 Yang Ni <yangni@google.com> Rewrite rs2spirv using spirit

Bug: 30964317

Rewrote the wrapper generation and builtin/runtime function
translation passes in rs2spirv using spirit.

Also added support for about a dozen more floating-point builtin
math functions.

Added support for new-style root kernel with lit test. Added check
for old-style kernels with lit test. Updated existing lit tests
since generated code are slightly different, mostly on temp names.

Added SPIR-V validation to all lit tests.

Updated the RSoV driver to work with the new spirit-based compiler.

The entry point is now named entry_<kernel name>.

Fixed an issue with multi-input kernel, so that the type count is
correctly set.

Minor cleanup to destroy descriptor sets after a kernel launch
and to remove an outdated comment.

Test: lit tests and RSoVTest

Change-Id: I07b5957667892e532dcbc2da98ed38fe783af5e9
/frameworks/rs/rsov/compiler/RSSPIRVWriter.cpp
7974fc03e11f3a8dd40f794f3b33b4889483090c 09-Feb-2017 Rahul Chaudhry <rahulchaudhry@google.com> frameworks/rs: fix typos and clang-tidy warnings

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
/frameworks/rs/rsov/compiler/RSSPIRVWriter.cpp
669e475f679d20502ff90923ad0ff2aae2558f12 30-Jan-2017 Yang Ni <yangni@google.com> Cleanup of "Linking" related code

Bug: 30964317

Moved all "linking" related code into the LinkerModule.cpp and .h.
RSSPRIVWriter.cpp does not contain any linking related code any
more.

Also moved the call to linker out of the convertLLVMToSPIRV()
function, since it has nothing to do with LLVM to SPIRV conversion.
Put it into the main() function of the rs2spirv tool.

Moved OpInBoudsPtrAccessChaing translation out of FixMain(), and
rename FixMain() to InlineKernelToWrapper().

This CL does not add or remove any functionality, but simply does
a cleanup that moves code around.

Test: lit tests and RSoVTest on angler

Change-Id: I52ade393c77460748e2b2808c52d849456d3f0ed
/frameworks/rs/rsov/compiler/RSSPIRVWriter.cpp
bd2d7816f90ecdcb25005491812de6e7416948a4 24-Jan-2017 I-Jui (Ray) Sung <ijsung@google.com> Minor improvements on internal error messages

Provide more information in internal compiler error messages for easiler
analysis on failed compilations.

Bug: 30964317
Test: RSoV LIT
Change-Id: I2b8a114c1acafd7895fb9dc8a11cf2d26bfdd341
/frameworks/rs/rsov/compiler/RSSPIRVWriter.cpp
3523b2f99da3f443ab5e7e09061773c836b0e89b 20-Jan-2017 I-Jui (Ray) Sung <ijsung@google.com> Strip non-kernel functions from RS2SPIRV compilation

Added a pass to trim out non-kernel functions from the rest of SPIR-V
compilation passes. Also changed/enforced the pass ordering so that dead
globals exposed by this pass are removed prior of SPIR-V compilation.

Bug: 30964317

Test: RSoV, RSTest, RSoV LIT tests on Angler
Change-Id: I689758ae0977bca694341e948842b668f68caac8
/frameworks/rs/rsov/compiler/RSSPIRVWriter.cpp
f15ce3de10aa8edf30d9c2dca60237a3d24eddcc 06-Dec-2016 Yang Ni <yangni@google.com> Allocation implementation using buffers

Bug: 30964317

Test: lit tests and RSoVTest

Change-Id: Ib7be067638c781c989a2723072c4eae865bfe515
/frameworks/rs/rsov/compiler/RSSPIRVWriter.cpp
ffa85366645c163dd529644ba5b8950c4c588d20 13-Dec-2016 I-Jui (Ray) Sung <ijsung@google.com> Initial multi-kernel support

This change adds multi-kernel support, with localized kernel function
types, argument types and OpEntryPoints. Also emit type and metadata
for each kernel. OpEntryPoints now have the string literals of RS
kernel names.

Some SPIR-V names are still shared, notably the global_invocation_id. This
doesn't seem to affect correctness per our current tests.

On the device side, the RSoV driver has been updated to use actual kernel
names instead of hardcoded "main".

Also added testcases in both LIT and RSoVTest.

Test: RSoV LIT Tests, RSoVTest on angler

Change-Id: I09936e69d9f19d21c5727430cb19414b508496bd
/frameworks/rs/rsov/compiler/RSSPIRVWriter.cpp
ec9360e103cb2fc5aa0af8c89d365e4a18594d97 22-Nov-2016 Yang Ni <yangni@google.com> Add .clang-format for compiler subdirectory

This is LLVM style generated with
clang-format -style=llvm -dump-config > .clang-format

Ran clang-format -i *.cpp *.h under frameworks/rs/rsov/compiler

Test: mm

Change-Id: Idff461c51d6e88e22795ac0a9cfbe41bc8156bbe
/frameworks/rs/rsov/compiler/RSSPIRVWriter.cpp
6749f541c20e86f5deb6fd421ed5849ef43c275c 08-Nov-2016 Yang Ni <yangni@google.com> Initial backend compiler for RSoV

Bug: 30964317

This compiler compiles RenderScript LLVM bitcode into SPIR-V.

This was done by Jakub Kuderski as part of his 2016 summer internship
at Google.

Test: build

Change-Id: I395cdab2b97451b9e0a9b866af2d112ead73ab72
/frameworks/rs/rsov/compiler/RSSPIRVWriter.cpp