AMD GPU 上的 OpenCL 2.0

OpenCL 2.0 on AMD GPU

我正在尝试在 AMD Fury X 上初始化 OpenCL 2.0,我正在查看 __OPENCL_VERSION__ 的值。无论如何都是120。我正在查看我的驱动程序,在那里可以找到 #define __OPENCL_VERSION__ 120#define __OPENCL_VERSION__ 200

是否需要在某个地方有一个特殊的标志来启用 2.0 版?我有以下平台和设备:

OpenCL platform 'AMD Accelerated Parallel Processing' by Advanced Micro Devices, Inc., version OpenCL 2.0 AMD-APP (1912.5), FULL_PROFILE
device: Advanced Micro Devices, Inc. 'Fiji' (driver version: 1912.5 (VM))
OpenCL version: OpenCL 2.0 AMD-APP (1912.5)
OpenCL "C" version: OpenCL C 2.0

编辑

啊,傻了。在 clCreateProgramWithSource 中的编译器选项中指定 -cl-std=CL2.0 似乎有所帮助。这应该是预期的行为吗?

Is that supposed to be the expected behaviour?

是的。这是 OpenCL 2.0 规范中的相关段落(第 5.8.4.5 控制 OpenCL C 版本的选项):

If the –cl-std build option is not specified, the highest OpenCL C 1.x language version supported by each device is used when compiling the program for each device. Applications are required to specify the –cl-std=CL2.0 option if they want to compile or build their programs with OpenCL C 2.0.