AMD HSA... interested?

It would be fun to iterate over a group of entities to do pathfinding or simple AI, and magically the entities are processed in parallel by the JVM on the integrated GPU. Forget OpenCL!

Intel, of course, is not a HSA Alliance member - but just about every ARM CPU vendor is.

You can do parallel processing already though on Java and most languages??

Even things like pathfinding or other things have issues. For example, what if you have 2 entities try to path find into the same ‘open’ space at the same time in your multithread?

Its still usually best to break up different tasks into different threads(if you are doing multithreaded app), e.g. 1 thread does pathfinding, 1 thread AI, 1 thread does particles, or however you go about it.

Of course you can just use threads - but on most CPUs you are limited to two or four real threads. On the GPU you can have hundreds of hardware threads.

Path finding cannot be parallelized on the GPU. Every thread has to execute the same instructions. Only the data can vary, not the control flow. (Though conditional instructions enable if/else by treating whatever branch that isn’t taken is executed as a NOOP.)

I did not comprehend what the article was trying to say Java 9 would have. Would it be an API or would it work with old code where things like for loops are vectorized?

I think a mix of everything in Java 9. But I felt like they were stating both new API to specifically have better/safer/easier multi threading. But also better native support that will automatically make certain loops and other aspects parallel, probably through some use of detection to make sure they don’t interfere with each other.

Good point… but I think that branching code can be processed on the GPU (OpenCL talks about ‘wavefronts’ for groups of threads on the same branch), it’s just that for every branch the GPU acceleration gets much less effective. I think the AI in the latest Civ was GPU accelerated, and that had to have a bit of branching.