libmir / dcompute

DCompute: Native execution of D on GPUs and other Accelerators
Boost Software License 1.0
138 stars 27 forks source link

OpenCL instead of manual thread and sync managment #7

Closed 9il closed 8 years ago

9il commented 8 years ago

@thewilsonator The first GLAS release will be single thread. Current druntime is useless for GLAS because it is not nothrow @nogc.

  1. Will it be possible to use dcompute for CPU execution ?
  2. Can dot_reg_basic internal/gemm use llvm prefetch as openCL kernel?
  3. Do SIMD vectors supported?
thewilsonator commented 8 years ago
  1. yes, you can be both host and device at the same time.
  2. I think so. see "Async Copies and Prefetch" and "Vector Data Load/Store" sections of the OpenCL quick reference cards.
  3. yes the vectors in openCL are the same vectors as std.simd, i.e. llvm vectors.

With the caveat that the names are mangled with C++ mangling so will need to pragma mangle them.

9il commented 8 years ago

Whoohooooo! When do you think dcompute be ready enough to start porting GLAS?

thewilsonator commented 8 years ago

I'll try to rebase my compiler fork over the weekend and get it into ldc ASAP. It's probably ready to START porting but some of the prototypes are missing (there is a table somewhere on khronos's github that has all the mangling), so I don't know how far you'll get.

But the driver API has a long way to go, in terms of easy use. Use should be able to use OpenCL 1.2 with the load binary if you

  1. compile with spirv using Khrono's 3.6 or 3.8 branch of llvm
  2. convert it back to llvm.bc and then run it through the 3.3(?) llvm-spriv tool
9il commented 8 years ago

I'll try to rebase my compiler fork over the weekend and get it into ldc ASAP. It's probably ready to START porting but some of the prototypes are missing (there is a table somewhere on khronos's github that has all the mangling), so I don't know how far you'll get.

Would it be possible to compiler a kernel with the program itself in the future? (I remember that GPU kernels compiled runtime)

9il commented 8 years ago

I think that dcompute has amazing opportunities and we can consider on LDC support only and drop DMD support https://github.com/ljubobratovicrelja/dcv/issues/52

thewilsonator commented 8 years ago

Would it be possible to compiler a kernel with the program itself in the future? (I remember that is GPU kernels compiled runtime)

Not quite sure what you mean. dcompute kernels are compiled with the rest of the program i.e. "offline", it's the OpenCL C compiler (.cl source files) that are compiled at runtime. You could if you really wanted to invoke the compiler at runtime and the load the resulting file.

Too tired, that is the default and only way to compile (except doing things as above).

9il commented 8 years ago

dcompute kernels are compiled with the rest of the program i.e. "offline"

Thanks!