Skip to content

feat: add WebGPU and WebGL2 chart renderers - #230

Open
ktsaou wants to merge 28 commits into
mainfrom
codex/webgpu-charts-integration
Open

feat: add WebGPU and WebGL2 chart renderers#230
ktsaou wants to merge 28 commits into
mainfrom
codex/webgpu-charts-integration

Conversation

@ktsaou

@ktsaou ktsaou commented Jul 30, 2026

Copy link
Copy Markdown
Member

Summary

Adds an opt-in Netdata-native GPU renderer with an internal fallback chain:

WebGPU → WebGL2 → visualization-specific legacy renderer

Public chart identity remains stable throughout selection and fallback. Consumers continue to render the same React component and see the established chartLibrary values (dygraph, gauge, d3pie, easypiechart, and others); they never need to know which GPU backend is active.

Dygraphs and all existing standalone renderers remain installed, supported, and enabled by default. GPU rendering is enabled only through makeDefaultSDK({ acceleratedRendering: true }) while broader rollout evidence is collected.

Visualization coverage

Accelerated:

  • Line: regular, smooth, and step
  • Area
  • Diverging Stacked Area
  • Stacked Bar
  • Multi Column
  • Heatmap
  • EasyPie / Circle
  • Gauge
  • D3 Pie

Bars, Value/Number, Group Boxes, and Table intentionally remain React/DOM-based. Gauge configurations using staticZones route to the existing Gauge renderer rather than being approximated.

Preserved contracts

  • SDK attributes, events, queries, payloads, timestamps, exports, and React component identity
  • Exact source values, gaps, stacking, categorical buckets, and visible-series ordering; no hidden aggregation or downsampling
  • Hover, selection, pan, zoom, touch, annotations, alerts, resizing, and chart-type behavior
  • Semantic DOM content where required, including Gauge labels and D3 Pie labels, connectors, and hit targets
  • Capability/error/loss-based fallback only; frame duration never changes the renderer

Architecture and review order

  1. Private routing and stable identity
    • src/sdk/makeChart/renderers/
    • src/sdk/rendererRouting.test.js
  2. Backend-neutral models and lifecycle
    • src/chartLibraries/gpu/
  3. Independent backends
    • src/chartLibraries/webgpu/
    • src/chartLibraries/webgl2/
  4. Consumer ownership and same-backend replacement
    • src/components/chartContainer.js
    • src/components/provider/selectors.js
  5. Browser correctness, CI, and maintainer docs
    • benchmarks/time-series-renderers/
    • .github/workflows/tests.yml
    • docs/gpu-renderers.md
    • src/gpuRenderers.stories.js

The neutral GPU layer does not import either backend, the backends do not import one another, and legacy renderers do not depend on GPU code. WebGPU and WebGL2 share neutral frame models while retaining explicit backend resource and loss handling.

Validation

Final validation on current main:

  • 195 Jest suites passed
  • 1,680 tests passed; 2 skipped
  • Repository coverage thresholds passed
  • ESLint passed across 207 changed JavaScript files
  • CommonJS and ES6 builds passed with identical 637-file distributions
  • Storybook production build passed with existing size warnings only
  • Real Chromium WebGL2 correctness passed every visualization, PNG export, shared-resource lifecycle, immediate-unmount races, unsupported configurations, same-backend replacement, and context-loss fallback
  • Blocking pull-request CI covers Jest, changed-file ESLint, both package builds, Storybook, and real-browser WebGL2 correctness

Installed integration validation used unmodified Cloud Frontend source and exactly one Chromium context/window/page:

  • Hardware WebGPU: 19 active GPU charts, no page errors
  • WebGPU unavailable: the same 19 charts selected hardware WebGL2
  • WebGPU and WebGL2 unavailable: all charts selected their visualization-specific legacy renderer
  • Public chartLibrary values remained unchanged in all three phases; no backend names leaked to the consumer
  • The installed bundle manifest and content-hashed Charts artifact matched the production build exactly
  • A stale off-screen click selection no longer suppresses the visible hover hairline; the exact state combination is covered by a regression test
  • Backend-wide runtime failure now migrates every cached chart adapter immediately instead of retrying the failed backend during virtualization; a deterministic 128-chart regression test covers this path
  • In the authoritative large-dashboard Chromium profile, WebGPU failure left zero stale WebGPU chart states before, during, and after scrolling
  • The normalized 4,000-pixel real-profile scroll measured 33.3 ms p95, 83.4 ms maximum, 213 ms total long-task time, and no post-scroll long tasks; the corresponding legacy run measured 33.5 ms p95, 100 ms maximum, 487 ms total long-task time, and 50 ms after scrolling

Prior physical Linux parity/performance runs cover both NVIDIA WebGPU and WebGL2 paths, exact pixel probes, 100,000- and 1,000,000-value workloads, exports, multi-chart teardown, WebGPU device loss to WebGL2, and WebGL2 context loss to each legacy renderer.

Rollout boundary

This PR delivers the complete installable implementation but does not change defaults. Windows/macOS hardware evidence, broader device coverage, power policy, prewarming/batching policy, opt-in UX, and any default switch remain separate rollout decisions.

The implementation is intentionally kept in one PR so maintainers can install and review the complete fallback chain. Maintainers can choose whether to split it before merge after reviewing the integrated proof.

@ktsaou
ktsaou marked this pull request as ready for review July 30, 2026 23:14
@ktsaou
ktsaou force-pushed the codex/webgpu-charts-integration branch from 82c3132 to ed0cd26 Compare July 30, 2026 23:46
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.

1 participant