Go to file
Mike Klein 279ca2e10c don't dedup loads or stores
We've been assuming that all Ops with the same arguments produce the
same value and deduplicating them, which results in a simple common
subexpression eliminator.

But we can't soundly dedup two identical loads with a store between;
that store could change the memory those loads read, producing different
values, as demonstrated by the first new unit test.

Then, by similar reasoning, it may first seem fine to deduplicate
stores, e.g.

   store32 arg(0), v1
   store32 arg(0), v1

That second store certainly does look redundant.  But if we slot a
different store between, it's no longer redundant:

   store32 arg(0), v1
   store32 arg(0), v2
   store32 arg(0), v1

If we dedup those two v1 stores, we'll skip the second and be left with
v2 in our buffer instead of v1.  This is the second new unit test.

Now, uniform32 and gather ops also touch memory... are they safe to
dedup?  Surprisingly, yes!  Uniforms are easy: they're read-only.  No
way to store to uniforms, so no intervening store can invalidate them.

Gathers are a little fuzzier, in that the buffer we gather from is
uniform in practice, but not strictly required to be... it's not
impossible to construct a program that gathers from a buffer that the
program also stores to, but you'd have to go out of your way to do it,
and it's not a pattern we use today, and SkVM does not provide the
synchronization primitives you'd need to make attempting that even
vaguely sensible.  So gathers in practice can also be deduplicated.

In general it's safe to dedup an operation unless it touches _varying
memory_, i.e.  loads and stores.  uniform32 and gathers touch
non-varying memory, so they're safe, and while index is varying, it
doesn't touch memory.

Change-Id: Ia275f0ab2708d3f71e783164b419436b90f103a9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/350608
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-01-06 21:17:10 +00:00
animations first cut at a checkbox 2009-10-21 19:41:10 +00:00
bazel bazel baby steps 2020-09-14 15:18:32 +00:00
bench Avoid uninitialized values in strokeIndirect SIMD queues 2020-12-28 17:01:19 +00:00
bin bin/try: automatically set 'git cl issue' when not found 2020-06-25 17:44:01 +00:00
build/fuchsia [fuchsia] Fix fidlc command. 2020-06-10 03:29:24 +00:00
build_overrides Port to ANGLE's GN files 2020-09-11 15:22:34 +00:00
client_utils/android Replace 'typedef xxxxx INHERITED' with 'using INHERITED = xxxx;'. 2020-09-03 03:41:26 +00:00
demos.skia.org [canvaskit] Remove Sk from nearly all function/type names. 2020-10-07 21:01:32 +00:00
dm Reland "SkAndroidCodec: Support decoding all frames" 2020-11-16 16:55:48 +00:00
docker [canvaskit,pathkit] Update to emsdk 2.0 2020-08-20 14:55:50 +00:00
docs/examples Pass sampling to surface.draw 2021-01-06 19:05:00 +00:00
example Reland "Remove use of legacy display globals." 2020-10-05 19:13:58 +00:00
experimental Fix C API example, ensure the C API example is built in CI 2020-12-15 16:38:42 +00:00
fuzz [fuzzing] Add first pass SkParagraph fuzzing. 2020-12-30 19:24:17 +00:00
gm Pass sampling to surface.draw 2021-01-06 19:05:00 +00:00
gn Move GrcommandBufferRef.h to more generic GrRefCnt.h 2021-01-06 17:53:50 +00:00
include Pass sampling to surface.draw 2021-01-06 19:05:00 +00:00
infra Revert "Add more comprehensive test for GPU write pixels." 2021-01-06 14:24:00 +00:00
modules [svg] Deferred text position adjustments 2021-01-05 21:52:25 +00:00
platform_tools Add SkSpan support to the Skia LLDB visualizer. 2020-12-22 18:10:12 +00:00
resources Remove use of do-while loops from particle examples 2020-12-30 21:30:40 +00:00
samplecode Pass sampling to surface.draw 2021-01-06 19:05:00 +00:00
site [canvaskit] Fix typo in docs example 2021-01-06 21:01:07 +00:00
specs Fix CanvasKit generated documentation to work with emscripten 1.39.16. 2020-05-27 12:23:32 +00:00
src don't dedup loads or stores 2021-01-06 21:17:10 +00:00
tests don't dedup loads or stores 2021-01-06 21:17:10 +00:00
third_party Roll skcms from 069b8f699b59 to 8247d3c2481b (1 revision) 2021-01-06 18:13:10 +00:00
tools Accept a callback used in MultiPictureDocument::endPage 2021-01-06 16:52:50 +00:00
.bazelignore bazel baby steps 2020-09-14 15:18:32 +00:00
.clang-format Disable BinPackParameters in .clang-format 2020-03-27 14:32:40 +00:00
.clang-tidy Disable ClangTidy namespace comments for short blocks. 2020-08-24 14:01:22 +00:00
.gitignore bazel baby steps 2020-09-14 15:18:32 +00:00
.gn Basic standalone GN configs. 2016-07-21 12:25:45 -07:00
AUTHORS Fix issues with latest GN 2020-11-07 13:55:45 +00:00
BUILD.bazel bazel baby steps 2020-09-14 15:18:32 +00:00
BUILD.gn [fuzzing] Add first pass SkParagraph fuzzing. 2020-12-30 19:24:17 +00:00
codereview.settings Make uploading to Gerrit the default for Skia 2016-11-09 19:07:56 +00:00
CONTRIBUTING Fix references to https://sites.google.com/site/skiadocs/. 2015-02-03 13:12:54 -02:00
CQ_COMMITTERS Moved committer list to chrome-infra-auth and deleted it from the repo 2015-09-02 13:37:54 -07:00
DEPS Remove glslang from DEPS 2021-01-06 20:27:30 +00:00
go.mod Update go.skia.org/infra in go.mod/go.sum 2020-12-21 20:31:07 +00:00
go.sum Update go.skia.org/infra in go.mod/go.sum 2020-12-21 20:31:07 +00:00
LICENSE LICENSE file: clean up 2019-11-22 21:59:03 +00:00
OWNERS add OWNERS file 2017-12-01 19:50:19 +00:00
PRESUBMIT.py Add presubmit check for git conflict markers 2020-12-16 17:51:16 +00:00
public.bzl [canvaskit] Remove custom_embedded_factory from G3 build 2020-12-23 12:59:36 +00:00
README Fix references to https://sites.google.com/site/skiadocs/. 2015-02-03 13:12:54 -02:00
README.chromium Update README.chromium. 2015-06-11 13:19:24 -07:00
RELEASE_NOTES.txt Revert "Revert "Remove legacy SkImage::MakeFromYUVATextures."" 2020-12-24 03:37:08 +00:00
whitespace.txt Whitespace change to re-trigger Mac/iOS tests 2020-02-23 20:55:01 +00:00
WORKSPACE.bazel bazel baby steps 2020-09-14 15:18:32 +00:00

Skia is a complete 2D graphic library for drawing Text, Geometries, and Images.

See full details, and build instructions, at https://skia.org.