Skip to content

Integrate all aggregation layers with AttributeManager#3777

Merged
1chandu merged 14 commits intomasterfrom
AggregationLayer
Nov 5, 2019
Merged

Integrate all aggregation layers with AttributeManager#3777
1chandu merged 14 commits intomasterfrom
AggregationLayer

Conversation

@1chandu
Copy link
Copy Markdown
Contributor

@1chandu 1chandu commented Oct 12, 2019

For #3583

Background

Integrate all aggregation layers (except HexagonLayer and CPUGridLayer) with AttributeManager so that :

  1. Custom data parsing is removed and attributes are consumed from AttributeManager
  2. Enables GPU data-filter extension.

At a high level these changes include

  1. When extensions change (could potentially change shader modules, injections, etc ..) re create aggregation models.
  2. Update attributes during updateState, so all aggregation layers can re-run aggregation with latest attributes during update cycle. (regular Composite layers don't do this)
  3. Generate module settings for aggregation model, which usually happens only for non Composite layers only.
  4. Re aggregate when data-filter props change.
  5. Update all affected unit tests.

Remaining items:

  • Integrate AttributeManager for CPU aggregation, which includes HexagonLayer, CPUGridLayer and CPU Aggregation path of ScreenGridLayer.
  • Enable data-filter extension for above CPU aggregation paths.
  • Enable Fp64 extension for both CPU and GPU Aggregation paths.

Change List

  • Aggregation-layers: GPUAggregation: Integrate with AttiributeManager

@1chandu 1chandu requested a review from Pessimistress October 12, 2019 00:41
@coveralls
Copy link
Copy Markdown

coveralls commented Oct 18, 2019

Coverage Status

Coverage decreased (-2.6%) to 80.337% when pulling 35163e3 on AggregationLayer into 7f49cc9 on master.

@1chandu 1chandu changed the title [WIP] Integrate all aggregation layers with AttributeManager Integrate all aggregation layers with AttributeManager Oct 30, 2019
@1chandu 1chandu force-pushed the AggregationLayer branch 2 times, most recently from e8878cd to ecb418d Compare October 30, 2019 23:09
'filterTransformColor'
];

export default class AggregationLayer extends CompositeLayer {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not using Layer as base class, doing so I have to copy _renderLayers method.

Comment thread modules/aggregation-layers/src/aggregation-layer.js Outdated
Comment thread modules/aggregation-layers/src/grid-aggregation-layer.js
Comment thread modules/aggregation-layers/src/heatmap-layer/heatmap-layer.js Outdated
dataChanged = true;
// Clear countsData cache
const dataChanged = this._isAggregationDirty(opts);
const cellSizeChanged = opts.oldProps.cellSize !== opts.props.cellSize;
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aggregator needs dataChanged and cellSIzeChanged flags seperately, so in CPU aggregation path, projection is not performed when only cell size is changed, cellSize can be added to aggregationProps, once CPU Aggregation is moved out of aggregator.

const {compareProps} = experimental;

// props when changed results in new uniforms that requires re-aggregation
const UNIFORM_PROPS = [
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Layers should not be aware of the implementation detail of extensions. This is not going to scale when we support other extensions.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, thought about it, ideal solution for this would be the extension itself expose these props and our existing prop diffing, differentiate these prop changes with existing changeFlags.propsChanged, so that aggregation is only run when these props are changed (not when any prop changed).
We don't need this for non composite layers, because we render the layers any time a prop is changed, but that is un-necessary and expensive for aggregation layers. I can create a task for this.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe you can add a LayerExtension.needsRedraw() method for this purpose?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will do this in separate PR #3844


// viewport is needed only when performing screen space aggregation (projectPoints is true)
log.assert(!(changeFlags.viewportChanged && projectPoints) || opts.viewport);
log.assert(!(changeFlags.viewportChanged && projectPoints) || opts.moduleSettings.viewport);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do not use assert unless checking for user error. GPUGridAggregator is considered an internal component.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

validateProps props method is validating various parameter combinations, once CPU aggregation is moved out and other refactors done, I can remove it altogether, till then this is handy to catch errors. For now commenting out.


const shaders = mergeShaders(
{
vs: fp64 ? AGGREGATE_TO_GRID_VS_FP64 : AGGREGATE_TO_GRID_VS,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Drop legacy fp64 support

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had issues enabling fp64 extension, I have todo item in the issue.
Aggregation only needs fp64 module not the project64, will cleanup this code in a seperate PR.

}
}

setupAggregationModel(fp64 = false) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why create a (public) method for a function that is only 3 lines? Same for getAggregationModel and getAllAggregationModel - these negatively impact the bundle size. Either merge them or make them utility functions outside of this class.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Took pass on class methods, moved several into helper methods, will make more deeper look in future aggregator specific PRs.

Comment thread modules/core/src/lib/layer.js Outdated
}

_setModelAttributes(model, changedAttributes) {
_getShaderAttributes(attributes, excludeAttributes = {}) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move to AttributeManager

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@1chandu 1chandu merged commit 9aa9d64 into master Nov 5, 2019
@1chandu 1chandu deleted the AggregationLayer branch November 5, 2019 18:08
ajduberstein pushed a commit that referenced this pull request Nov 5, 2019
* Aggregation-layers: GPUAggregation: Integrate with AttributeManager
* Clear HeatmapLayer debounce timer
ajduberstein pushed a commit that referenced this pull request Nov 11, 2019
* Aggregation-layers: GPUAggregation: Integrate with AttributeManager
* Clear HeatmapLayer debounce timer
@1chandu 1chandu mentioned this pull request Nov 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants