JuliaGPU / JuliaGPU/CLBLAS.jl

Complex64 not working

Open
#23 33 comments 0 reactions 0 assignees View on GitHub
Dominant language
Julia
Stars
22
Forks
11
PR merge metrics
No merged PRs in 30d

Description

as discussed in #21 `Complex64` is currently not working and we are getting a seqfault when passing it to clblas, whereas `Complex128` works without issue.

`Complex64` maps to `cl_float2` and `Complex128` maps to `cl_double2`.

The definitions of both types in cl_platform.h is:

``` c
typedef union
{
cl_float CL_ALIGNED(8) s[2];
#if __CL_HAS_ANON_STRUCT__
__CL_ANON_STRUCT__ struct{ cl_float x, y; };
__CL_ANON_STRUCT__ struct{ cl_float s0, s1; };
__CL_ANON_STRUCT__ struct{ cl_float lo, hi; };
#endif
#if defined( __CL_FLOAT2__)
__cl_float2 v2;
#endif
}cl_float2;

typedef union
{
cl_double CL_ALIGNED(16) s[2];
#if __CL_HAS_ANON_STRUCT__
__CL_ANON_STRUCT__ struct{ cl_double x, y; };
__CL_ANON_STRUCT__ struct{ cl_double s0, s1; };
__CL_ANON_STRUCT__ struct{ cl_double lo, hi; };
#endif
#if defined( __CL_DOUBLE2__)
__cl_double2 v2;
#endif
}cl_double2;
```

The only difference I can see is that `cl_float2` is using 8bit alignment and `cl_double2` is using 16bit alignment and if I remember correctly Julia uses 16bit alignment for nearly everything.

Complex is defined here:
https://github.com/JuliaLang/julia/blob/02aeb44299d090d50d2c58e004f58a8b8d4f3da6/base/complex.jl

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.