Commit Graph

5 Commits

Author SHA1 Message Date
Brian Osman
3d81fdcbd2 Add unit tests for for-loop unrolling
Change-Id: I350a6768ac124362b0d3e0f17e7a026265acf804
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/353627
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-01-14 14:38:16 +00:00
Mike Klein
00e43df25b rename Arg to Ptr
This makes almost all existing code read more clearly.

Change-Id: I314331d9aa2ecb4664557efc7972e1a820afc250
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/352085
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2021-01-08 20:50:15 +00:00
John Stiles
32d68537a8 Add SkVM support for conversion constructors to and from boolean.
Change-Id: Ia4a1c38161046b94dc56a1a76704766f1e14aab7
Bug: skia:11131
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/350019
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2021-01-06 15:23:09 +00:00
Mike Klein
f471c827fb Stop calling schedule()
The new unit test demonstrates load/store reordering is error-prone.

At head we're allowing loads from a given pointer to reorder later than
a store to that same pointer, and boy, that's just not sound.  In the
scenario constructed by the test we reorder this swap,

   x = load32 X
   y = load32 Y
   store32 X y
   store32 Y x

using schedule() (following Op argument data dependencies) into

   y = load32 Y
   store32 X y
   x = load32 X
   store32 Y x

which moves `x = load32 X` illegally past `store X y`.
We write `y` twice instead of swapping `x` and `y`.

It's not impossible to implement that extra reordering constraint: I
think it's easiest to think about by adding implicit use edges in
schedule() from stores to prior loads of the same pointer.  But that'd
be a little complicated to implement, and doesn't handle aliasing at
all, so I decided to ponder on other approaches that handle a wider
range of programs or would have a simpler implementation to reason
about.  I ended up walking through this rough chain of ideas:

    0) reorder using only Op argument data dependencies          (HEAD)
    1) don't let load(ptr) pass store(ptr)                      (above)
    2) don't let any load pass any store              (allows aliasing)
    3) don't reorder any Op that touches memory
    4) don't reorder any Op, period.

This CL is 4).  It's certainly the easiest and cheapest implementation.
It's not clear to me that we need this scheduling, and should we find we
really want it I'll come back and work back through the list until we
find something that meets our needs.

(Hoisting of uniforms is unaffected here.)

Change-Id: I7765b1d16202e0645b11295f7e30c5e09f2b7339
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/350256
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2021-01-05 20:29:46 +00:00
Brian Osman
977feec5d7 Add .rte -> .skvm unit test framework
Includes a handful of test cases to exercise the system

Change-Id: I98e73a8bca063f475d2ddb51778e395697392ddb
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/346637
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2020-12-22 17:59:42 +00:00