2
Opencl不支持遞歸函數,但它是否也包含間接版本呢?OpenCL和間接遞歸
void recursiveA(int *a,int b) // call this first to start recursion
{
a[b]=3;
if(b<10)
{
recursiveB(a,b+1); // A calls B
}
}
void recursiveB(int *a, int b)
{
a[b]=3;
if(b<10)
{
recursiveA(a,b+1); // B calls A while A still not finished before
// and entry point & arguments of A are corrupt ?
}
}
代替
void recurse(int *a, int b)
{
a[b]=3;
if(b<10)
{
recurse(a,b+1); // some OpenCL devices does not have the ability so this is not
// possible in OpenCL
}
}
所以,我們可以稱之爲一個 「R」 功能,從另一個功能,即使第一個 「R」 是不是完了?這些函數每次調用它們時都只使用相同的常量地址作爲參數? 在Opencl 2.0發佈之前,我是否必須使用自定義「堆棧」實現來進行間接遞歸?