Open jabraham17 opened 6 days ago
Rather than
Arr[i] = i:complex
What happens if you have
inline proc cmplx(i : int(?w))
{
var t :complex(w+w);
t.re = i:real(w);
}
.....
Arr[i] = cmplx(i);
What happens if you have
inline proc cmplx(i : int(?w)) { var t :complex(w+w); t.re = i:real(w); } ..... Arr[i] = cmplx(i);
That has similar issues to the complex math case in the original post, it hits an internal error during GPU codegen. For the +
case it was the compiler could not find complexAdd128
, for t.re = ...
its because the compiler cannot find complex128GetRealRef
.
Got it. So much for my suggestion.
We currently have limited-to-no support for using
complex
numbers in a GPU kernel.I tried a number of simple cases with complex numbers to get an idea of where our support is at. All tests are done with
CHPL_GPU=nvidia
, except where otherwise noted.What Works
Using existing complex numbers
This program actually does work! The immediate can also be factored outside the kernel and it will still work.
What doesn't work
Creating complex numbers from ints/reals
This code fails because the cast to complex involves
_chpl_complex128
, which is not as a GPU eligible extern function. So assertOnGpu fails with "ChapelTuple.chpl:295: note: function calls out to extern function (_chpl_complex128), which is not marked as GPU eligible".Complex math
This program results in an internal error in the Chapel compiler during GPU compilation in the backend.
Calling math functions
This program fails at codegen time with CHPL_GPU=nvidia when
ptxas
is being invoked with "ptxas fatal : Unresolved extern function 'csin'".I tried this same code with CHPL_GPU=amd, here it fails as "lld: error: undefined hidden symbol: csin".
Similar errors occur with other Math functions