Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(381)

Issue 2128633003: pathops coincidence and security rewrite (Closed)

Created:
4 years, 5 months ago by caryclark
Modified:
4 years, 5 months ago
Reviewers:
herb_g
CC:
reviews_skia.org
Base URL:
https://skia.googlesource.com/skia.git@master
Target Ref:
refs/heads/master
Project:
skia
Visibility:
Public.

Description

pathops coincidence and security rewrite Most changes stem from working on an examples bracketed by #if DEBUG_UNDER_DEVELOPMENT // tiger These exposed many problems with coincident curves, as well as errors throughout the code. Fixing these errors also fixed a number of fuzzer-inspired bug reports. * Line/Curve Intersections Check to see if the end of the line nearly intersects the curve. This was a FIXME in the old code. * Performance Use a central chunk allocator. Plumb the allocator into the global variable state so that it can be shared. (Note that 'SkGlobalState' is allocated on the stack and is visible to children functions but not other threads.) * Refactor Let SkOpAngle grow up from a structure to a class. Let SkCoincidentSpans grow up from a structure to a class. Rename enum Alias to AliasMatch. * Coincidence Rewrite Add more debugging to coincidence detection. Parallel debugging routines have read-only logic to report the current coincidence state so that steps through the logic can expose whether things got better or worse. More functions can error-out and cause the pathops engine to non-destructively exit. * Accuracy Remove code that adjusted point locations. Instead, offset the curve part so that sorted curves all use the same origin. Reduce the size (and influence) of magic numbers. * Testing The debug suite with verify and the full release suite ./out/Debug/pathops_unittest -v -V ./out/Release/pathops_unittest -v -V -x expose one error. That error is captured as cubics_d3. This error exists in the checked in code as well. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2128633003 BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2128633003 Committed: https://skia.googlesource.com/skia/+/55888e44171ffd48b591d19256884a969fe4da17

Patch Set 1 #

Patch Set 2 : fix more unit tests #

Patch Set 3 : completes test, still flaky #

Patch Set 4 : add test case for flake #

Patch Set 5 : add dean 4 test #

Patch Set 6 : fix most cubic normal fails #

Patch Set 7 : loosen close tolerance to get through tests #

Patch Set 8 : isolate broken test case #

Patch Set 9 : working on testQuads67 #

Patch Set 10 : try contains instead of equal #

Patch Set 11 : rough check experiment #

Patch Set 12 : tracking down cubics_d3 bug #

Patch Set 13 : mark failures to investigate #

Patch Set 14 : fix remaining tests #

Patch Set 15 : whoops; disabled test expectation checks #

Patch Set 16 : turn tabs into spaces #

Patch Set 17 : one more tab fix, obsolete comment #

Patch Set 18 : scale big numbers down #

Patch Set 19 : wip; update debug versions #

Patch Set 20 : updated debug versions #

Patch Set 21 : fix error; remove trailing spaces #

Patch Set 22 : require resulting t to be between 0 and 1 #

Total comments: 22

Patch Set 23 : address comments #

Patch Set 24 : disable new test since it fails on skia_fast #

Unified diffs Side-by-side diffs Delta from patch set Stats (+4 lines, -0 lines) Patch
M tests/PathOpsSimplifyTest.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 1 chunk +4 lines, -0 lines 0 comments Download

Messages

Total messages: 30 (22 generated)
herb_g
I did not follow most of the new coincident logic. I assume this is vetted ...
4 years, 5 months ago (2016-07-18 15:13:39 UTC) #17
caryclark
https://codereview.chromium.org/2128633003/diff/400001/src/pathops/SkDConicLineIntersection.cpp File src/pathops/SkDConicLineIntersection.cpp (right): https://codereview.chromium.org/2128633003/diff/400001/src/pathops/SkDConicLineIntersection.cpp#newcode244 src/pathops/SkDConicLineIntersection.cpp:244: addLineNearEndPoints(); On 2016/07/18 15:13:38, herb_g wrote: > this->? Done. ...
4 years, 5 months ago (2016-07-18 15:55:50 UTC) #18
herb_g
lgtm
4 years, 5 months ago (2016-07-18 16:34:09 UTC) #23
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2128633003/420001
4 years, 5 months ago (2016-07-18 16:35:15 UTC) #25
commit-bot: I haz the power
Committed patchset #23 (id:420001) as https://skia.googlesource.com/skia/+/55888e44171ffd48b591d19256884a969fe4da17
4 years, 5 months ago (2016-07-18 17:01:43 UTC) #27
mtklein
On 2016/07/18 17:01:43, commit-bot: I haz the power wrote: > Committed patchset #23 (id:420001) as ...
4 years, 5 months ago (2016-07-18 17:36:03 UTC) #28
mtklein
On 2016/07/18 17:36:03, mtklein wrote: > On 2016/07/18 17:01:43, commit-bot: I haz the power wrote: ...
4 years, 5 months ago (2016-07-18 20:25:58 UTC) #29
mtklein
4 years, 5 months ago (2016-07-18 20:39:49 UTC) #30
Message was sent while issue was closed.
On 2016/07/18 20:25:58, mtklein wrote:
> On 2016/07/18 17:36:03, mtklein wrote:
> > On 2016/07/18 17:01:43, commit-bot: I haz the power wrote:
> > > Committed patchset #23 (id:420001) as
> > >
> https://skia.googlesource.com/skia/+/55888e44171ffd48b591d19256884a969fe4da17
> > 
> > The failing -Fast bot is a sort of Release+ bot, built with -O3,
-march=native
> > and -fomit-frame-pointer.  You can set GYP_DEFINES=skia_fast=1 to try to
> > reproduce this failure on your own machine, though because of -march=native
it
> > may vary from machine to machine.  The bots building and running this bot
are
> > most similar to a Z840.
> > 
> >
>
https://build.chromium.org/p/client.skia/builders/Test-Ubuntu-GCC-GCE-CPU-AVX...
> 
> The Nexus9 bot also failed the same way:
>
https://build.chromium.org/p/client.skia.android/builders/Test-Android-GCC-Ne...
> 
> I think that makes FMA the most likely explanation.  These two bots are the
only
> two who can a+b*c with one rounding, and I think GCC is generally willing to
> compile code that doesn't explicitly ask for it (e.g. std::fma) into FMA
> operations when it notices it has the instructions available and they're at
> least as fast as doing it in two steps with two roundings.  (IIRC, you have to
> explicitly ask Clang to act on these opportunities, probably because doing so
> silently can cause these confusing issues to crop up.)

Yep!  That's it.  To reproduce with Clang (e.g. on a recent Mac), you'll need to
add -ffp-contract=fast to the compile flags:

    $ CPPFLAGS=-ffp-contract=fast GYP_DEFINES="skia_fast=1" ./gyp_skia && ninja
-C out/Release dm && out/Release/dm

Powered by Google App Engine
This is Rietveld 408576698