Skip to content

Commit

Permalink
Merge pull request YaccConstructor#129 from dpanfilyonok/fixes
Browse files Browse the repository at this point in the history
Fixes + Support of using DU inside kernels
  • Loading branch information
gsvgit authored Jan 3, 2022
2 parents 02502db + e3b4690 commit 88be551
Show file tree
Hide file tree
Showing 42 changed files with 2,111 additions and 1,846 deletions.
2 changes: 2 additions & 0 deletions src/Brahma.FSharp.OpenCL.AST/Expressions.fs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ type BOp<'lang> =
| Pow
| BitAnd
| BitOr
| BitXor
| LeftShift
| RightShift
| And
Expand All @@ -91,6 +92,7 @@ type UOp<'lang> =
| Not
| Incr
| Decr
| BitNegation

type Unop<'lang>(op: UOp<'lang>, expr: Expression<'lang>) =
inherit Expression<'lang>()
Expand Down
10 changes: 8 additions & 2 deletions src/Brahma.FSharp.OpenCL.AST/Statements.fs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ type ForIntegerLoop<'lang>
(
var: VarDecl<'lang>,
cond: Expression<'lang>,
countModifier: Expression<'lang>,
countModifier: Statement<'lang>,
body: StatementBlock<'lang>
) =

Expand All @@ -94,9 +94,15 @@ type WhileLoop<'lang>(cond: Expression<'lang>, whileBlock: StatementBlock<'lang>
member this.Condition = cond
member this.WhileBlock = whileBlock

type Barrier<'lang>() =
type MemFence =
| Local
| Global
| Both

type Barrier<'lang>(memFence: MemFence) =
inherit Statement<'lang>()
override this.Children = []
member this.MemFence = memFence

type FieldSet<'lang>(host: Expression<'lang>, field: string, _val: Expression<'lang>) =
inherit Statement<'lang>()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@
<ItemGroup>
<Compile Include="AssemblyInfo.fs" />
<Compile Include="ClException.fs" />
<Compile Include="NDRangeDimensions.fs" />
<Compile Include="NDRange.fs" />
<Compile Include="CustomMarshaler.fs" />
<Compile Include="IKernel.fs" />
<Compile Include="Messages.fs" />
<Compile Include="CommandQueueProvider.fs" />
<Compile Include="IContext.fs" />
<Compile Include="ClBuffer.fs" />
<Compile Include="ClKernel.fs" />
<Compile Include="ClProgram.fs" />
<Compile Include="ClContext.fs" />
<Compile Include="ClTask.fs" />
<Compile Include="DataStructures.fs" />
Expand All @@ -39,4 +39,4 @@
<ProjectReference Include="..\Brahma.FSharp.OpenCL.Shared\Brahma.FSharp.OpenCL.Shared.fsproj" />
</ItemGroup>
<Import Project="..\..\.paket\Paket.Restore.targets" />
</Project>
</Project>
5 changes: 3 additions & 2 deletions src/Brahma.FSharp.OpenCL.Core/ClContext.fs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ type ClDeviceType =
| GPU -> DeviceType.Gpu
| Default -> DeviceType.Default

// TODO redesign
module internal Device =
open System.Text.RegularExpressions

Expand Down Expand Up @@ -82,7 +83,7 @@ type ClContext private (context: Context, device: Device, translator: FSQuotatio

ctx

let translator = FSQuotationToOpenCLTranslator()
let translator = FSQuotationToOpenCLTranslator(TranslatorOptions())
let queue = CommandQueueProvider.CreateQueue(context, device)

ClContext(context, device, translator, queue)
Expand All @@ -101,7 +102,7 @@ type ClContext private (context: Context, device: Device, translator: FSQuotatio
member this.WithNewCommandQueue() =
ClContext(this.Context, this.Device, this.Translator, CommandQueueProvider.CreateQueue(this.Context, this.Device))

member this.CreateClKernel(srcLambda: Expr<'a -> 'b>) =
member this.CreateClProgram(srcLambda: Expr<'a -> 'b>) =
ClProgram<_,_>(this, srcLambda)

member this.CreateClBuffer
Expand Down
184 changes: 0 additions & 184 deletions src/Brahma.FSharp.OpenCL.Core/ClKernel.fs

This file was deleted.

Loading

0 comments on commit 88be551

Please sign in to comment.