gpt4 book ai didi

opencl - CL_INVALID_WORK_GROUP_SIZE的原因

转载 作者:行者123 更新时间:2023-12-03 08:49:48 26 4
gpt4 key购买 nike

当我将工作组的大小从16更改为32或更大时,我收到 CL_INVALID_WORK_GROUP_SIZE错误。 matrix_size64

  localWorkSize[0] = groupsize;
localWorkSize[1] = localWorkSize[0];
globalWorkSize[0] = matrix_size;
globalWorkSize[1] = globalWorkSize[0];
首先,我检查了 clEnqueueNDRangeKernel的文档,该文档指出了四种(五种)不同的原因 CL_INVALID_WORK_GROUP_SIZE,但我认为它们都不适用。请检查我的结论。 (希望您不要介意我的质量检查风格)

Q CL_INVALID_WORK_GROUP_SIZE if local_work_size is specified and number of work-items specified by global_work_size is not evenly divisable by size of work-group given by local_work_size A 64%32 = 0
Q or does not match the work-group size specified for kernel using the __attribute__((reqd_work_group_size(X, Y, Z))) qualifier in program source. 据我所知,我没有使用 __attribute__
Q CL_INVALID_WORK_GROUP_SIZE if local_work_size is specified and the total number of work-items in the work-group computed as local_work_size[0] *... local_work_size[work_dim - 1] is greater than the value specified by CL_DEVICE_MAX_WORK_GROUP_SIZE in the table of OpenCL Device Queries for clGetDeviceInfo. 我查询了clGetDeviceInfo,而CL_DEVICE_MAX_WORK_GROUP_SIZE512, 512, 64 Q CL_INVALID_WORK_GROUP_SIZE if local_work_size is NULL and the __attribute__((reqd_work_group_size(X, Y, Z))) qualifier is used to declare the work-group size for kernel in the program source. local_work_size不是NULL
Q CL_INVALID_WORK_ITEM_SIZE if the number of work-items specified in any of local_work_size[0], ... local_work_size[work_dim - 1] is greater than the corresponding values specified by CL_DEVICE_MAX_WORK_ITEM_SIZES[0], .... CL_DEVICE_MAX_WORK_ITEM_SIZES[work_dim - 1]. 32 <512

我希望,我没有忽略任何事情。请告诉我,如果您有什么想法会导致CL_INVALID_WORK_GROUP_SIZE或在我的结论中发现错误。
感谢您抽出宝贵的时间阅读所有这些内容:)

最佳答案

CL_DEVICE_MAX_WORK_GROUP_SIZE应该返回一个size_t值(例如512,但我不知道它在您的系统上会是什么)。这是工作组中工作项目的最大数量,而不是每个维度中的最大数量。因此,在您的情况下,您尝试创建一个32 * 32 = 1024个工作项的2D工作组,并且CL_DEVICE_MAX_WORK_GROUP_SIZE可能在系统上小于1024。

请参阅OpenCL 1.1规范,表4.3,第37页,CL_DEVICE_MAX_WORK_GROUP_SIZE的定义:

Maximum number of work-items in a work-group executing a kernel using the data parallel execution model.

关于opencl - CL_INVALID_WORK_GROUP_SIZE的原因,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5557164/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com