Skip to content

Nikola Architecture

plcplc edited this page Jan 15, 2013 · 8 revisions

Here we attempt to document the architecture of Nikola, yielding both an overview and an understanding of the details.

Protip: use graphmod from hackage to generate a graphwiz file of Nikola source, and a tool such as zgrviewer to inspect it (both are in the dybberplc dropbox folder)

Abstract Syntax

Module Data.Array.Nikola.Language.Syntax as S

This module defines the first-order AST, S.Exp.

Module Data.Array.Nikola.Exp as E

This module defines a thin newtype wrapper E.Exp t a around S.Exp. t,a are phantom types with t refering to target (eg. CUDA) and a refering to the expected type resulting from evaluating the E.Exp.

Compiler backend

C part

  • Data.Array.Nikola.Backend.C.Codegen

    Actual C code generation happens here through compileProgram. CUDA is treated as a variant of C, as determined by a Dialect enum type. Still, only host code is compiled, but with the (dialect extension?) ability to call cuda kernels.

    Code generation happens inside the C monad, described below:

  • Data.Array.Nikola.Backend.C.Monad

Cuda part

  • Compilable typeclass

Haskell part

Device<->Host data exchange

Survey "VectorMARK" in progress

Clone this wiki locally