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

Double support? #83

Open
sfla opened this issue Jan 28, 2022 · 11 comments
Open

Double support? #83

sfla opened this issue Jan 28, 2022 · 11 comments
Labels
enhancement New feature or request

Comments

@sfla
Copy link

sfla commented Jan 28, 2022

The examples output to a vector<float>, and I find no mention of Doubles.
Having used the older FastNoise, I remember I could just add #define FN_USE_DOUBLES. Is there similar support here?

@sfla
Copy link
Author

sfla commented Jan 28, 2022

Spooky. I googled around, and found a similar question posted on the FastNoiseSIMD. Asked by ME two years ago.
Auburn/FastNoiseSIMD#44

Anyway, I also found the even older question, with answer, here:
Auburn/FastNoiseSIMD#4 (comment)
So I assume it's not in yet..
Unfortunately, that's a deal breaker for my use case.

@connorjak
Copy link

https://github.com/users/Auburn/projects/1#card-49182907 It's on the todo list. I am also eager to see this implemented, and willing to help. @Auburn what all is involved in refactoring for double-precision input functions?

@Auburn
Copy link
Owner

Auburn commented Feb 16, 2022

It's quite a difficult task, there would need to be special versions for most the coherent noise nodes so as not to half the performance. FastSIMD would also need support for doubles which is a reasonable amount of work, although hopefully easier to do with the new version I'm working on.

@connorjak
Copy link

connorjak commented Feb 18, 2022

Ideally this could be done without a macro that disables single-precision support.

I had a look at the code and it seems like this is the workload:

  • Duplicate FastNoise Utils.h and FastSIMD FunctionList.h and their dependencies with doubles, maybe postpending the name with 64
  • Duplicate all nodes with doubles, revising binary operations
  • Optionally implement SIMD specializations on those nodes
    • For initial support, it might be ok to use doubles without explicit SIMD support. The APIs would be unchanged when the SIMD side would be built out.

@connorjak
Copy link

connorjak commented Feb 19, 2022

@Auburn what's the order of magnitude for the timeframe you're expecting for the FastSIMD replacement? I'm evaluating my options for what noise library I should go forward with for now. I would prefer to stick with FastNoise2 for the NoiseTool, graph structure, and the super-fast iteration times from the serialized string noise function encoding.

ScreenShot00067

I'm trying to resolve roundoff error issues from the noise input values being indistinguishable at super-high sampling density with these constraints:

  • No repeated data across the entire domain
  • Evaluate function at double precision coordinates
    • Adjacent sampled points on centimeter scale (with full domain at real-size planet scale) must not have stair-stepping artifacts (most likely caused by rounded-to-be-indistinguishable adjacent input coordinates)
  • Function output value can be either single or double precision
    • Single precision float maintains ~1mm accuracy at 10km, and ~1cm accuracy at 100km. For planetary terrains, elevation changes typically cap out at +-40km from sea level.
  • I personally only use the single-point-sampling for now; my sampling coordinates are not 2D cartesian so the uniform grid approach does not work for me.
  • Performance is not a major concern for me, at least initially. My generation functions are fully async.

@Auburn
Copy link
Owner

Auburn commented Feb 19, 2022

Hi, the approach in your first would not be that easy. Maybe just converting the scalar version to doubles/int64 would be a good enough stand in for you. The problem with doubles in SIMD is many intrinsics only support floats so there is extra work in finding work arounds for those things. That other part is the performance will be halved, there are ways around this but that requires more work again.

Most of the ground work for the new FastSIMD version is now done. I've had a bit a lull in development recently due to moving house, bit I will continue shortly

@connorjak
Copy link

I agree, just converting the scalar version would be enough for me for now. Do the SIMD operations benefit the output functions besides the UniformGrid ones?

@Srekel
Copy link

Srekel commented May 2, 2022

I'd just like to voice my support of this feature, I will eventually need doubles for my project :)

@Auburn Auburn added the enhancement New feature or request label Sep 17, 2022
@sfla
Copy link
Author

sfla commented Mar 5, 2023

Any news on this?

so as not to half the performance.

Since the performance of FastNoise2 seems to be around 5-7x faster than FastNoiseLite, I'd still be happy if the performance was halved tbh.

@connorjak
Copy link

@Auburn Checking in on progress here; how is the newer version of FastSIMD?

@Auburn
Copy link
Owner

Auburn commented Apr 29, 2024

I'm currently working on getting the 1.0 version of FastNoise 2 out, that makes use of the new FastSIMD. Once the 1.0 release is done it's on my list to look at

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants