Bug 63064 - Apply the ParallelJobs support to FEMorphology
Summary: Apply the ParallelJobs support to FEMorphology
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: SVG (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Enhancement
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-06-21 06:19 PDT by Andras Piroska
Modified: 2011-06-30 04:54 PDT (History)
7 users (show)

See Also:


Attachments
Apply the ParallelJobs support to FEMorphology (10.83 KB, patch)
2011-06-21 06:39 PDT, Andras Piroska
no flags Details | Formatted Diff | Diff
Apply the ParallelJobs support to FEMorphology (10.76 KB, patch)
2011-06-23 06:49 PDT, Andras Piroska
no flags Details | Formatted Diff | Diff
Apply the ParallelJobs support to FEMorphology (10.84 KB, patch)
2011-06-24 03:48 PDT, Andras Piroska
no flags Details | Formatted Diff | Diff
Apply the ParallelJobs support to FEMorphology (11.45 KB, patch)
2011-06-29 00:32 PDT, Andras Piroska
krit: review-
krit: commit-queue-
Details | Formatted Diff | Diff
Apply the ParallelJobs support to FEMorphology (11.44 KB, patch)
2011-06-29 23:21 PDT, Andras Piroska
no flags Details | Formatted Diff | Diff
filterRes.svg result on Apple Mac 10.6 (27.81 KB, image/png)
2011-06-30 01:47 PDT, Kent Tamura
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Andras Piroska 2011-06-21 06:19:42 PDT
The FEMorphology filter of SVG can consume lots of resources if it is
applied to a large area. The computation can be distributed to multiple
cores if the architecture supports.
Comment 1 Andras Piroska 2011-06-21 06:39:39 PDT
Created attachment 97979 [details]
Apply the ParallelJobs support to FEMorphology
Comment 2 Gabor Loki 2011-06-21 06:47:19 PDT
Comment on attachment 97979 [details]
Apply the ParallelJobs support to FEMorphology

View in context: https://bugs.webkit.org/attachment.cgi?id=97979&action=review

> Source/WebCore/ChangeLog:1
> +2011-06-15  Piroska András  <Piroska.András@stud.u-szeged.hu>

Your email address is wrong! I guess you want to write Piroska.Andras@... ;)
Comment 3 Nikolas Zimmermann 2011-06-21 13:07:50 PDT
Zoltan, can you give an informal review?
Comment 4 Zoltan Herczeg 2011-06-21 23:28:40 PDT
Comment on attachment 97979 [details]
Apply the ParallelJobs support to FEMorphology

View in context: https://bugs.webkit.org/attachment.cgi?id=97979&action=review

> Source/WebCore/ChangeLog:10
> +        cores if the architecture supports.

You should mention the gain somewhere (and the benchmark if it is publicly availible).

> Source/WebCore/platform/graphics/filters/FEMorphology.cpp:110
> +    const int rowByteWidth = width * 4;

Strange name for me. I liked the effectWidth better, or maybe scanlineWidth?

> Source/WebCore/platform/graphics/filters/FEMorphology.cpp:115
> +        yEnd = height;

I would not prefer these "ifs" here, why not simply pass these values as arguments?

> Source/WebCore/platform/graphics/filters/FEMorphology.cpp:119
> +        int extStartY = max(0, y - radiusY);

We don't use abbreviations is WebKit, keep the original name or make it extremaStartY

> Source/WebCore/platform/graphics/filters/FEMorphology.cpp:120
> +        int extEndY = min(height - 1, y + radiusY);

Ditto.

> Source/WebCore/platform/graphics/filters/FEMorphology.h:61
> +    };

It seems to me that radiusX and radiusY are constants, so they should go here, and not passed as arguments to platformApply* .

> Source/WebCore/platform/graphics/filters/FEMorphology.h:64
> +        static const int s_minimalArea = 300 * 300;

We should mention here that this is empirical data.

> Source/WebCore/platform/graphics/filters/FEMorphology.h:78
> +        void platformApplyGeneric(PaintingData*, const int radiusX, const int radiusY, const int yStart=-1, const int yEnd=-1);

The above two should be inline function.
Comment 5 Andras Piroska 2011-06-23 06:49:30 PDT
Created attachment 98343 [details]
Apply the ParallelJobs support to FEMorphology
Comment 6 Andras Piroska 2011-06-24 03:48:25 PDT
Created attachment 98477 [details]
Apply the ParallelJobs support to FEMorphology

The FEMorphology filter of SVG can consume lots of resources if it is
applied to a large area. The computation can be distributed to multiple
cores if the architecture supports.
The average performance progression is 20-25% on dual-core machines.
Comment 7 Zoltan Herczeg 2011-06-24 04:18:52 PDT
Comment on attachment 98477 [details]
Apply the ParallelJobs support to FEMorphology

View in context: https://bugs.webkit.org/attachment.cgi?id=98477&action=review

> Source/WebCore/platform/graphics/filters/FEMorphology.h:73
> +        static inline void platformApplyWorker(PlatformApplyParameters*);

This function cannot be inline, since called by pointer. Probably the compiler realises this anyway, but still it would be better to remove it.

> Source/WebCore/platform/graphics/filters/FEMorphology.h:76
> +        inline void platformApply(PaintingData*, const int radiusX, const int radiusY);

Ok, this is still bad. Maybe I was not clear last time.

platformApply should get only 1 parameter: PaintingData*
radiusX and radiusY should go to PaintingData as the width and height

The calculation should be paintingData.radiusX = min(effectDrawingRect.width() - 1, radiusX);, since otherwise the plain radiusX would be an unused parameter.

Drop these lines: int radiusX = static_cast<int>(floorf(filter()->applyHorizontalScale(m_radiusX))); and radiusY = ...
I am not even sure this is correct...
Comment 8 Andras Piroska 2011-06-29 00:32:08 PDT
Created attachment 99048 [details]
Apply the ParallelJobs support to FEMorphology
Comment 9 Zoltan Herczeg 2011-06-29 03:01:47 PDT
(In reply to comment #8)
> Created an attachment (id=99048) [details]
> Apply the ParallelJobs support to FEMorphology

I think the patch is OK now.
Comment 10 Dirk Schulze 2011-06-29 04:21:44 PDT
Comment on attachment 99048 [details]
Apply the ParallelJobs support to FEMorphology

View in context: https://bugs.webkit.org/attachment.cgi?id=99048&action=review

I just have a snippet, a style issue. r- because you don't have commit rights and can't change it before landing.

> Source/WebCore/platform/graphics/filters/FEMorphology.cpp:183
> +                param.endY = (job) ? (currentY) : (paintingData->height);

Can you omit the braces here?  They are superfluous and not webkit style.
Comment 11 Andras Piroska 2011-06-29 23:21:44 PDT
Created attachment 99242 [details]
Apply the ParallelJobs support to FEMorphology
Comment 12 Dirk Schulze 2011-06-29 23:40:13 PDT
Comment on attachment 99242 [details]
Apply the ParallelJobs support to FEMorphology

r=me. Great job!
Comment 13 WebKit Review Bot 2011-06-30 00:21:02 PDT
Comment on attachment 99242 [details]
Apply the ParallelJobs support to FEMorphology

Clearing flags on attachment: 99242

Committed r90091: <http://trac.webkit.org/changeset/90091>
Comment 14 WebKit Review Bot 2011-06-30 00:21:07 PDT
All reviewed patches have been landed.  Closing bug.
Comment 15 Kent Tamura 2011-06-30 01:43:46 PDT
This change broke the following tests on Apple Mac, Chromium-win, Chromium-mac, Chromium-linux.

svg/W3C-SVG-1.1/filters-morph-01-f.svg
svg/filters/filterRes.svg

Especially, the result of filterRes.svg looks significantly different to me.  It this expected?
Comment 16 Kent Tamura 2011-06-30 01:47:12 PDT
Created attachment 99256 [details]
filterRes.svg result on Apple Mac 10.6
Comment 17 Andras Piroska 2011-06-30 01:59:30 PDT
(In reply to comment #16)
> Created an attachment (id=99256) [details]
> filterRes.svg result on Apple Mac 10.6

I examine this difference, but need a little time
Comment 18 Marcus Bulach 2011-06-30 02:08:31 PDT
(In reply to comment #17)
> (In reply to comment #16)
> > Created an attachment (id=99256) [details] [details]
> > filterRes.svg result on Apple Mac 10.6
> 
> I examine this difference, but need a little time

I created a bug / patch with the diff:
https://bugs.webkit.org/show_bug.cgi?id=63692

I'll disable these two tests in chromium now so I can roll WebKit there. Please let me know when you have a fix so I can re-enable these tests.
Comment 19 Andras Piroska 2011-06-30 02:26:44 PDT
(In reply to comment #16)
> Created an attachment (id=99256) [details]
> filterRes.svg result on Apple Mac 10.6

Thanks, I will fix it
Comment 20 Gabor Loki 2011-06-30 04:54:55 PDT
Comment on attachment 99242 [details]
Apply the ParallelJobs support to FEMorphology

View in context: https://bugs.webkit.org/attachment.cgi?id=99242&action=review

> Source/WebCore/platform/graphics/filters/FEMorphology.cpp:122
> +                unsigned char columnExtrema = srcPixelArray->get(yStart * effectWidth  + 4 * x + clrChannel);

There was a typo in this line. The extremaStartY should have been used here instead of yStart. I guess it was a typo, because you used extrameStartY in a right way below.

Anyway, the fix is landed in r90105 and the bug 63692 is closed as well.