You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Проблема: невозможность обработки транслятором функций типа void.
При попытке передачи на компиляцию методу ComputeProvider.Compile цитированной функции, имеющей тип Expr<_ - >unit>, возникает исключение:
System.Exception : Printer. Unsupported statement: Brahma.FSharp.OpenCL.AST.Const`1[Brahma.FSharp.OpenCL.Translator.Common+Lang]
Пример кода:
let Iter func (inArr: int array) =
let platformName = "*"
let localWorkSize = 100
let deviceType = DeviceType.Default
let length = inArr.Length
let provider =
try ComputeProvider.Create(platformName, deviceType)
with
| ex -> failwith ex.Message
let mutable commandQueue = new CommandQueue(provider, provider.Devices |> Seq.head)
let command =
<@
fun (rng: _1D) (a: array<_>) ->
let r = rng.GlobalID0
(%func) a.[r]
@>
let kernel, kernelPrepare, kernelRun = provider.Compile command
let d = new _1D(length, localWorkSize)
kernelPrepare d inArr
let _ = commandQueue.Add(kernelRun()).Finish()
commandQueue.Dispose()
provider.Dispose()
provider.CloseAllBuffers()
let arr = [|for i in 1..1000 -> i|]
Iter <@ fun x -> () @> arr
The text was updated successfully, but these errors were encountered:
Проблема: невозможность обработки транслятором функций типа void.
При попытке передачи на компиляцию методу ComputeProvider.Compile цитированной функции, имеющей тип Expr<_ - >unit>, возникает исключение:
System.Exception : Printer. Unsupported statement: Brahma.FSharp.OpenCL.AST.Const`1[Brahma.FSharp.OpenCL.Translator.Common+Lang]
Пример кода:
The text was updated successfully, but these errors were encountered: