Cuberite Forum
Brainstorming: Noise optimization - Printable Version

+- Cuberite Forum (https://forum.cuberite.org)
+-- Forum: Cuberite (https://forum.cuberite.org/forum-4.html)
+--- Forum: Development (https://forum.cuberite.org/forum-13.html)
+--- Thread: Brainstorming: Noise optimization (/thread-832.html)

Pages: 1 2 3 4 5


RE: Brainstorming: Noise optimization - FakeTruth - 01-16-2014

Yeah I know. I was trying to optimize getting a single noise valueTongue


RE: Brainstorming: Noise optimization - worktycho - 01-17-2014

I'll have a go at this over the weekend. I want to learn sse and avx so it'l be useful for me even if turns out ten times slower. I'll write a benchmark as well as it would be useful to see how the speeds compare. Not sure how to write an interface that depending on compile settings can return an array or an array of ints, may have to resort to macros.


RE: Brainstorming: Noise optimization - bearbin - 01-17-2014

There's an old noise tester in the source - in the tests folder if that's any use.


RE: Brainstorming: Noise optimization - worktycho - 01-17-2014

The TestOldNoise function looks like it could be modified to do the benchmarking.


RE: Brainstorming: Noise optimization - xoft - 01-17-2014

Unfortunately the NoiseTest project uses clock() to measure time, which I have learnt later is no good measure for time in *nix. You may need to modify that, too. All in all, the code's badTongue


RE: Brainstorming: Noise optimization - ThuGie - 01-17-2014

Seems i suddenly put some activity in this thread, would be nice if we got something good out of it :p.


RE: Brainstorming: Noise optimization - worktycho - 01-18-2014

Not sure, Its looking a lot harder than I expected. Writing vectorized code is not to difficult but writing efficient cross-platform vector code is much hard. AT the moment I'm looking a five options:
- Maintain four copy's of every vector function, single, double, triple and quad width for the different vector widths. (given that one of the functions I'm working on is in the ender generator I don't think this is an option)
- Do something horrendous with macros or template-metaprogramming (rewritting c++ syntax bad)
- Write a small function language compiler in lua that can do stream-fusion
- rewrite it in c and use OpenCL.
- Give up


RE: Brainstorming: Noise optimization - xoft - 01-18-2014

How about maintaining four copies of each functions using Lua to generate some of the code? Isn't that possible?

OpenCL is probably not a good idea, I don't think it's supported on all the platforms where we can compile MCServer, yet.


RE: Brainstorming: Noise optimization - worktycho - 01-18-2014

That's option three. The problem is that pre-processor (in lua) needs to be able to understand the source enough to be able to preform stream-fusion or else the code ends up with large numbers of for loops(one per operation). This is not something that can be done with regexs. And it would be easier to write a small functional language parser than a c++ parser.

EDIT:
As for openCL the portableCL project is MIT licensed and supports anything clang does.


RE: Brainstorming: Noise optimization - worktycho - 01-19-2014

Given that no ones objecting I've decided that a small functional language probably easiest to maintain long term. Only problem would be the provision of a lua interperater on windows, I thinking a syntax like:

Code:
@StartVectorCalc(width,iterationvar,resultvar)
     x = iterationvar * 3
     resultvar = x + 7
@EndVectorCalc