There are a few things that I think the Code Device would absolutely benefit from:
- Lock the code device down into an encrypted self-contained device (Similar to macros) so people can just use the device as if it were built-in.
- Allow adding the device to the device list at the top of the screen, including custom “categories”.
- After the above, a way to export the device and share it one way or another. Preferrably packaged so that you do not need to host it, and it could be shared any way the user wants.
- Functional Mask Input.
- More OpenCL features. Some of the features (I forget which… I will try to hunt them down) work for integer math, but not floating point math (Runs into “method ambiguity”, but I do not see a way to convert across while maintaining floating point precision).
- Is there a way to increase the precision as needed? I feel like a lot of my issues implementing the Werner Algorithm for Dunes was due to the imprecision of single-point floating values (I had it functioning, but just could not get rid of the spotty random spikes at non-90-degree angles).
- Add a built-in library of OpenCL functions specific to WorldMachine for common cases. For instance, noises (Simplex, Perlin, Cellular, etc) so that they do not need to be recreated in code each time and can be referenced as needed (Available at all times).
- Parameters: Allow for Ranges and default values. Maybe collapse the height and distance capability into separate parameter types (As switching seems to break the ability to revert to “value” in current form. I always had to delete the parameter and recreate it.). Also, allow changing the parameter type after creating it (Again, this currently requires deletion and recreation).
- Support more of the OpenCL Preprocessor Directives. I forget which ones I tried to use, but a few of them were “no-go”. I wonder if one was for increasing floating point precision (Now that I think of it). It had to do with floats, for sure…
(I initially added this elsewhere, but chopped it out and created a new topic as it makes way more sense here. Apologies!)
5 Likes
That’s a great list of feature requests! A few comments on particulars:
-
Functionality around locking/packaging/sharing: This is something that is a high priority for me. The Code device is intended to be a way to not just write your own plugins, but be able to use those written by others seamlessly.
-
OpenCL requests: You can certainly use doubles within OpenCL, although be aware that on normal desktop GPUs they are VERY slow (typically 1/64th the speed of 32bit floats!!). You would need to allocate a raw byte buffer of the correct size for your processing, but your kernels can then use doubles within that without issue.
-
In general, I want to have much better support for both builtin library code, and ‘template’ devices for some typical scenarios (procedural generator, simulator, etc) so you can skip a bunch of the boilerplate setup and get to writing your code faster
4 Likes
I know doubles are way worse on performance on standard “home use” GPUs (unfortunately!), and I may explore trying to achieve it still with floats. There has to be a way to handle those edge-cases nicely (Knowing my luck, I had a minor issue hidden in there and my brain was just fried by that point, haha).
I saw OpenCL can fall back to CPU in cases where things are not supported on the existing GPU… I wonder if there is a way to run it on the CPU for cases like this? I am not an OpenCL professional, by any means, so I could be out of my element here, but I am curious if functions could be flagged CPU or GPU or something like that, or worst case… flag the OpenCL code as a whole as CPU vs GPU in cases like this? (I think I saw that they claim the CPU is parallelized and runs close to GPU speeds in that scenario (Depending on the CPU I would imagine), but again, I could be wrong here).
2 Likes
If you scroll down to the bottom of this page:
There’s a link to the installer for the Intel CPU opencl drivers (they also work with AMD processors). Performance depends on your CPU’s vector support, etc, but is generally pretty good - would almost certainly be faster than GPU for doubles! Unfortunately WM will only run on one CL driver at a time, so you have to choose.
3 Likes