Ticket #4412 (closed feature request: invalid)

Opened 3 years ago

Last modified 3 years ago

Produce CUDA code

Reported by: victorusu Owned by:
Priority: normal Milestone:
Component: Compiler Version:
Keywords: CUDA, parallel Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Difficulty:
Test Case: Blocked By:
Blocking: Related Tickets:

Description

I would like to suggest the generation of CUDA code by the GHC compiler. Think about it. It is really reasonable to think about it! In Haskell we do not tell how to compute things but what they are, so instead of generating code to run on 32/64 bits machines we could have a compiler flag to produce a program that would run on NVIDIA video devices without the need of changing any part of the code. Except for the IO operation all the other processes would generate CUDA code.

I believe that this new feature would make Haskell the must used language to produce CUDA based programs! For it is already the must awesome language!

Change History

Changed 3 years ago by guest

  • version 6.12.3 deleted

while I do not know enough to comment on this, I would like to point out that targeting multiple backends is probably becoming far more pressing than it was say ten years ago. it would be nice if GHC could be made more flexible, programmably so, to target Haskell "box"es to run programs on. JavaScript?, JVM, .NET, BEAMS have all been more or less tinkered with, but all that you could demand of such a "box" would be a set of primitives that the "box" would have to supply that obeys some properties (such as purity). designing a box would be more or less tantamount to supplying those primitives. of course I know that the situation is far more complicated than that but it would be a good start to promote Haskell as an abstract interpretive language as long as you do not worry about performance too much.

Changed 3 years ago by chak

  • status changed from new to closed
  • resolution set to invalid

Unfortunately, compiling Haskell to CUDA is impossible as GPUs do not support recursive functions and general function pointers. You may want to have a look at the following paper to see how a very restricted subset of Haskell can be compiled to CUDA:

 http://www.cse.unsw.edu.au/~chak/papers/acc-cuda.pdf

The library is available on Hackage if you want to try for yourself. (No extension to GHC is required as it is an embedded language in a library.)

Note: See TracTickets for help on using tickets.