Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove limit on line and point count #3076

Closed
Wumpf opened this issue Aug 22, 2023 · 1 comment · Fixed by #5207
Closed

Remove limit on line and point count #3076

Wumpf opened this issue Aug 22, 2023 · 1 comment · Fixed by #5207
Assignees
Labels
enhancement New feature or request 🔺 re_renderer affects re_renderer itself
Milestone

Comments

@Wumpf
Copy link
Member

Wumpf commented Aug 22, 2023

Longstanding problem with our line & point renderers is that they each impose a maximum number of line strip segments, line strip counts and points. On top of that they also always allocate the same "buffer textures" (workaround for not actually having buffers)
This was done for easier implementation originally but sticked around for very long now.

-> Line & point strip builder/drawdata should have a dynamic size.
For what we need it is still okay to know the size in advance (we typically do!), but we the only bound we should put on the size is the maximum texture size.

This will

  • allow users to have more lines and points
  • reduce memory usage when using fewer
  • allow to remove shared_render_builders.rs

keep in mind that we still need to clamp when hitting the maximum (texture) size

@Wumpf Wumpf added enhancement New feature or request 🔺 re_renderer affects re_renderer itself labels Aug 22, 2023
Wumpf added a commit that referenced this issue Aug 25, 2023
### What

* Fixes: #3075
* Related to: #3076

The second commit is the actual fix. But to avoid this family of
crashes, the cpuwritegpuread belt now always does error checks and
returns errors instead of paniking

### Checklist
* [x] I have read and agree to [Contributor
Guide](https://github.com/rerun-io/rerun/blob/main/CONTRIBUTING.md) and
the [Code of
Conduct](https://github.com/rerun-io/rerun/blob/main/CODE_OF_CONDUCT.md)
* [x] I've included a screenshot or gif (if applicable)
* [x] I have tested [demo.rerun.io](https://demo.rerun.io/pr/3093) (if
applicable)

- [PR Build Summary](https://build.rerun.io/pr/3093)
- [Docs
preview](https://rerun.io/preview/b6b737939d3219b0ca32e763d7276b5ca0d504ee/docs)
<!--DOCS-PREVIEW-->
- [Examples
preview](https://rerun.io/preview/b6b737939d3219b0ca32e763d7276b5ca0d504ee/examples)
<!--EXAMPLES-PREVIEW--><!--EXAMPLES-PREVIEW--><!--EXAMPLES-PREVIEW--><!--EXAMPLES-PREVIEW-->
- [Recent benchmark results](https://ref.rerun.io/dev/bench/)
- [Wasm size tracking](https://ref.rerun.io/dev/sizes/)
jleibs pushed a commit that referenced this issue Aug 31, 2023
* Fixes: #3075
* Related to: #3076

The second commit is the actual fix. But to avoid this family of
crashes, the cpuwritegpuread belt now always does error checks and
returns errors instead of paniking

* [x] I have read and agree to [Contributor
Guide](https://github.com/rerun-io/rerun/blob/main/CONTRIBUTING.md) and
the [Code of
Conduct](https://github.com/rerun-io/rerun/blob/main/CODE_OF_CONDUCT.md)
* [x] I've included a screenshot or gif (if applicable)
* [x] I have tested [demo.rerun.io](https://demo.rerun.io/pr/3093) (if
applicable)

- [PR Build Summary](https://build.rerun.io/pr/3093)
- [Docs
preview](https://rerun.io/preview/b6b737939d3219b0ca32e763d7276b5ca0d504ee/docs)
<!--DOCS-PREVIEW-->
- [Examples
preview](https://rerun.io/preview/b6b737939d3219b0ca32e763d7276b5ca0d504ee/examples)
<!--EXAMPLES-PREVIEW--><!--EXAMPLES-PREVIEW--><!--EXAMPLES-PREVIEW--><!--EXAMPLES-PREVIEW-->
- [Recent benchmark results](https://ref.rerun.io/dev/bench/)
- [Wasm size tracking](https://ref.rerun.io/dev/sizes/)
jleibs pushed a commit that referenced this issue Aug 31, 2023
* Fixes: #3075
* Related to: #3076

The second commit is the actual fix. But to avoid this family of
crashes, the cpuwritegpuread belt now always does error checks and
returns errors instead of paniking

* [x] I have read and agree to [Contributor
Guide](https://github.com/rerun-io/rerun/blob/main/CONTRIBUTING.md) and
the [Code of
Conduct](https://github.com/rerun-io/rerun/blob/main/CODE_OF_CONDUCT.md)
* [x] I've included a screenshot or gif (if applicable)
* [x] I have tested [demo.rerun.io](https://demo.rerun.io/pr/3093) (if
applicable)

- [PR Build Summary](https://build.rerun.io/pr/3093)
- [Docs
preview](https://rerun.io/preview/b6b737939d3219b0ca32e763d7276b5ca0d504ee/docs)
<!--DOCS-PREVIEW-->
- [Examples
preview](https://rerun.io/preview/b6b737939d3219b0ca32e763d7276b5ca0d504ee/examples)
<!--EXAMPLES-PREVIEW--><!--EXAMPLES-PREVIEW--><!--EXAMPLES-PREVIEW--><!--EXAMPLES-PREVIEW-->
- [Recent benchmark results](https://ref.rerun.io/dev/bench/)
- [Wasm size tracking](https://ref.rerun.io/dev/sizes/)
jleibs pushed a commit that referenced this issue Aug 31, 2023
* Fixes: #3075
* Related to: #3076

The second commit is the actual fix. But to avoid this family of
crashes, the cpuwritegpuread belt now always does error checks and
returns errors instead of paniking

* [x] I have read and agree to [Contributor
Guide](https://github.com/rerun-io/rerun/blob/main/CONTRIBUTING.md) and
the [Code of
Conduct](https://github.com/rerun-io/rerun/blob/main/CODE_OF_CONDUCT.md)
* [x] I've included a screenshot or gif (if applicable)
* [x] I have tested [demo.rerun.io](https://demo.rerun.io/pr/3093) (if
applicable)

- [PR Build Summary](https://build.rerun.io/pr/3093)
- [Docs
preview](https://rerun.io/preview/b6b737939d3219b0ca32e763d7276b5ca0d504ee/docs)
<!--DOCS-PREVIEW-->
- [Examples
preview](https://rerun.io/preview/b6b737939d3219b0ca32e763d7276b5ca0d504ee/examples)
<!--EXAMPLES-PREVIEW--><!--EXAMPLES-PREVIEW--><!--EXAMPLES-PREVIEW--><!--EXAMPLES-PREVIEW-->
- [Recent benchmark results](https://ref.rerun.io/dev/bench/)
- [Wasm size tracking](https://ref.rerun.io/dev/sizes/)
@emilk emilk added this to the 0.10 C++ milestone Sep 1, 2023
@emilk
Copy link
Member

emilk commented Nov 6, 2023

The current maximum point cloud size is 4Mi, limitied by the fixed-size 2048² texture, controlled by DATA_TEXTURE_SIZE in crates/re_renderer/src/renderer/point_cloud.rs

@Wumpf Wumpf self-assigned this Feb 13, 2024
Wumpf added a commit that referenced this issue Feb 14, 2024
### What

* First half of #3076

Removes the old limitation of 4mio points caused by fixed "data texture"
size.

We now allocate dynamically for the needed amount of points. This means
that we use less memory when there's less points and support as many
points in a single `DrawData` as the maximum texture size. This is at
least 16.5mio points on mobile webgl (4096 is a common max texture size
on Android) and about 265mio points on a typical desktop machine &
WebGPU (common max texture size is 16k).
With this change we share a single `DrawData` per visualizer execution,
meaning the limit applies to the total of each 2D & 3D points in a
single space view.


![image](https://github.com/rerun-io/rerun/assets/1220815/d0335a0c-d112-4067-a2ff-1f4f870eeed9)
Scene with 35 mio points. Renders on my desktop with a bit under 300ms
per frame since we still re-upload data every frame.

Note that this change is also the first step towards secondary caching,
i.e. **not** re-uploading (and preparing) all the data for the gpu every
frame: we can now use as many independent point cloud draw data as we
want at a relatively small allocation & bind group setting overhead
without having to fear excessive memory use. (I haven't measured, but
the overhead for new draw data shouldn't be entirely insignificant,
which is why I still keep the number down in this PR, putting the
results an entire visualizer a single one)

Line renderer limitations will be addressed in a follow-up PR.

### Checklist
* [x] I have read and agree to [Contributor
Guide](https://github.com/rerun-io/rerun/blob/main/CONTRIBUTING.md) and
the [Code of
Conduct](https://github.com/rerun-io/rerun/blob/main/CODE_OF_CONDUCT.md)
* [x] I've included a screenshot or gif (if applicable)
* [x] I have tested the web demo (if applicable):
* Using newly built examples:
[app.rerun.io](https://app.rerun.io/pr/5192/index.html)
* Using examples from latest `main` build:
[app.rerun.io](https://app.rerun.io/pr/5192/index.html?manifest_url=https://app.rerun.io/version/main/examples_manifest.json)
* Using full set of examples from `nightly` build:
[app.rerun.io](https://app.rerun.io/pr/5192/index.html?manifest_url=https://app.rerun.io/version/nightly/examples_manifest.json)
* [x] The PR title and labels are set such as to maximize their
usefulness for the next release's CHANGELOG
* [x] If applicable, add a new check to the [release
checklist](https://github.com/rerun-io/rerun/blob/main/tests/python/release_checklist)!

- [PR Build Summary](https://build.rerun.io/pr/5192)
- [Docs
preview](https://rerun.io/preview/d390ba812bf94dec252899b499ec68cfe2708268/docs)
<!--DOCS-PREVIEW-->
- [Examples
preview](https://rerun.io/preview/d390ba812bf94dec252899b499ec68cfe2708268/examples)
<!--EXAMPLES-PREVIEW-->
- [Recent benchmark results](https://build.rerun.io/graphs/crates.html)
- [Wasm size tracking](https://build.rerun.io/graphs/sizes.html)
Wumpf added a commit that referenced this issue Feb 19, 2024
### What

* follow-up of #5192 
* Fixes #3076
* Fixes #4844
* _technically_ there's still limits (see #5192 ) but they are machine
dependent making this relatively hard to query. Overall I'd argue we
removed the previous limits so there's no need for this in the original
sense.

<img width="1252" alt="image"
src="https://github.com/rerun-io/rerun/assets/1220815/512be197-9817-4f5a-8054-e3661346d361">
(note that we haven't spend a lot of time optimizing the collection of
lines, large amounts of lines don't perform all that well so far)


Applies the same principles as on the previous PR that fixes the point
cloud limits.
The key difference here is that we use lines in *a lot* of places,
making this a bigger refactor than originally assumed.

---

~The need to know both strip & vertex count for lines ahead of time is a
bit problematic and isn't always as easy as it was with points. We err
on the side of generating more draw data bundles, but to limit this (a
single drawdata for a single line is extremely wasteful as we have to
allocate a bunch of textures, buffers, bind groups, etc. etc.) I had to
introduce `LineDrawableBuilderAllocator` which is a very simplistic
Vec-like allocator (minus the increase in size) for
`LineDrawableBuilder` (previously called `LineStripSeriesBuilder`).
I'm not super happy with this construct overall, but it's the best I
could come up with in the short-term and things seem to be fairly robust
and at least not overly complicated.~

~In the future it would be nice to reconcile
`LineDrawableBuilderAllocator` and `LineDrawableBuilder` into a single
construct, likely still with the limitations that the size of a batch
(think named unit with a transform) needs to be known ahead of time,
which is practically always the case!~

---

Second iteration: There's now `DataTextureSource` (ideas for better
names?) which is essentially a thing where you can throw data in and get
a data texture out! It handles all the copies and dynamic sizings for
you. This makes everything awesome because now we can handle `reserve`
call just as an optimization without requiring them and without being on
a bad path if you don't! <3

### Checklist
* [x] I have read and agree to [Contributor
Guide](https://github.com/rerun-io/rerun/blob/main/CONTRIBUTING.md) and
the [Code of
Conduct](https://github.com/rerun-io/rerun/blob/main/CODE_OF_CONDUCT.md)
* [x] I've included a screenshot or gif (if applicable)
* [x] I have tested the web demo (if applicable):
* Using newly built examples:
[app.rerun.io](https://app.rerun.io/pr/5207/index.html)
* Using examples from latest `main` build:
[app.rerun.io](https://app.rerun.io/pr/5207/index.html?manifest_url=https://app.rerun.io/version/main/examples_manifest.json)
* Using full set of examples from `nightly` build:
[app.rerun.io](https://app.rerun.io/pr/5207/index.html?manifest_url=https://app.rerun.io/version/nightly/examples_manifest.json)
* [x] The PR title and labels are set such as to maximize their
usefulness for the next release's CHANGELOG
* [x] If applicable, add a new check to the [release
checklist](https://github.com/rerun-io/rerun/blob/main/tests/python/release_checklist)!
* [x] Test misc examples on WebGL
* [x] Test misc examples on WebGPU

- [PR Build Summary](https://build.rerun.io/pr/5207)
- [Docs
preview](https://rerun.io/preview/012ab21d8acbf86f8d45bfdba3737f8ebe989784/docs)
<!--DOCS-PREVIEW-->
- [Examples
preview](https://rerun.io/preview/012ab21d8acbf86f8d45bfdba3737f8ebe989784/examples)
<!--EXAMPLES-PREVIEW-->
- [Recent benchmark results](https://build.rerun.io/graphs/crates.html)
- [Wasm size tracking](https://build.rerun.io/graphs/sizes.html)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request 🔺 re_renderer affects re_renderer itself
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants