0

我在 opencl (v1.1) 中使用了 char 向量类型,并且正在搜索 vector.lo 和 vector.hi 扩展,但只能访问 cl_char 数组。通过搜索 opencl 头文件,我发现了以下清单,这表明这些扩展可用于 GNUC 和“严格 ansi”。

/* Define cl_vector types in cl_platform.h */
/* ---- cl_charn ---- */
typedef union
{
  cl_char  CL_ALIGNED(2) s[2];
#if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
  __extension__ struct{ cl_char  x, y; };
  __extension__ struct{ cl_char  s0, s1; };
  __extension__ struct{ cl_char  lo, hi; };
#endif
#if defined( __CL_CHAR2__) 
  __cl_char2     v2; 
#endif  
}cl_char2;

// other vector type definitions follow...

它是否正确?我该如何解决这个问题?

4

1 回答 1

0

这种“减少的功能”是由错误引起的。详细信息可在Khronos Public Bugzilla (Bug 413)中找到

Bug 413 - Workaround中描述了一些“草率”的解决方法。请注意,这仅限于 ms 编译器。

于 2013-01-04T20:57:03.650 回答