YaccConstructor / Brahma.FSharp

F# quotation to OpenCL translator and respective runtime to utilize GPGPUs in F# applications.
http://yaccconstructor.github.io/Brahma.FSharp
Eclipse Public License 1.0
74 stars 17 forks source link

ClBuildProgram fails on kernels with infinite loop #132

Open dpanfilyonok opened 2 years ago

dpanfilyonok commented 2 years ago

Describe the bug Fatal error. System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt. while compiling following kernel:

let command =
    <@ fun (range: Range1D) (xs: int clarray) ->
        let mutable i = 0

        while i < 10 do
            printf "str"
    @>

The following kernels are OK:

let command =
    <@ fun (range: Range1D) (xs: int clarray) ->
        let mutable i = 0

        while i < 10 do
            printf "str"
            i <- i + 1
    @>
let command =
    <@ fun (range: Range1D) (xs: int clarray) ->
        let mutable i = 0

        while i < 10 do
            xs.[0] <- 0
    @>

Desktop (please complete the following information):

Additional context Stack trace:

Fatal error. System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
Repeat 2 times:
--------------------------------
   at OpenCL.Net.Cl.clBuildProgram(IntPtr, UInt32, OpenCL.Net.Device[], System.String, ProgramNotify, IntPtr)
--------------------------------
   at OpenCL.Net.Cl.BuildProgram(OpenCL.Net.Program, UInt32, OpenCL.Net.Device[], System.String, ProgramNotify, IntPtr)
   at Brahma.FSharp.OpenCL.ClProgram`2[[System.__Canon, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.__Canon, System.Private.CoreLib, Version=5.0.0.0, C
ulture=neutral, PublicKeyToken=7cec85d7bea7798e]]..ctor(Brahma.FSharp.OpenCL.IContext, Microsoft.FSharp.Quotations.FSharpExpr`1<Microsoft.FSharp.Core.FSharpFunc`2<System.__Canon,System.__Canon>>)
   at Brahma.FSharp.OpenCL.ClContext.CreateClProgram[[System.__Canon, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.__Canon, System.Private.CoreLib, Vers
ion=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](Microsoft.FSharp.Quotations.FSharpExpr`1<Microsoft.FSharp.Core.FSharpFunc`2<System.__Canon,System.__Canon>>)
   at Brahma.FSharp.Tests.Utils.openclCompile[[System.__Canon, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.__Canon, System.Private.CoreLib, Version=5.0
.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](Microsoft.FSharp.Quotations.FSharpExpr`1<Microsoft.FSharp.Core.FSharpFunc`2<System.__Canon,System.__Canon>>)
   at Program.main(System.String[])