CorTeX
Core ABI 7
ToolTech Software · C++ library reference
ToolTech
CorTeX overview
Programmer’s manual
Class reference
Change history
CycloPos ↗
Toggle main menu visibility
Loading...
Searching...
No Matches
include
ctxCompiler.h
Go to the documentation of this file.
1
//*****************************************************************************
2
// File : ctxCompiler.h
3
// Description : Compilation of virtual machine opcodes into assembler
4
// Author : Anders Modén
5
// Product : CorTeX 2.0.1
6
//
7
// Copyright © 2015- Anders Modén, Sweden
8
//
9
// NOTE: CorTeX is a software development kit (SDK)
10
// for neural networks and genetic programming.
11
// Licensed by Anders Modén.
12
//
13
//
14
// Revision History...
15
//
16
// Who Date Description
17
//
18
// AMO 150708 Created file (1.0.0)
19
// AMO 261104 Added ranged backend readback as Core ABI generation 7 (2.0.2)
20
//
21
//******************************************************************************
22
#ifndef __CTX_COMPILER_H__
23
#define __CTX_COMPILER_H__
24
25
#include "
ctxVirtualMachine.h
"
26
27
// ------------------------------- ctxCompiler ------------------------------------
28
29
enum
ctxCompilerTypes
30
{
31
// Specifics
32
CTX_COMPILER_OPEN_CL
,
33
CTX_COMPILER_CUDA
,
34
CTX_COMPILER_ASSEMBLER
,
35
CTX_COMPILER_CPP
,
36
CTX_COMPILER_THREAD
,
37
38
// Descriptive
39
CTX_COMPILER_FASTEST
,
40
41
// Disable
42
CTX_COMPILER_NONE
,
43
44
// Default
45
CTX_COMPILER_DEFAULT
,
46
};
47
48
// ------------------------------- ctxCompiler ------------------------------------
50
class
ctxCompiler
:
public
gzObject
51
{
52
public
:
53
54
GZ_DECLARE_TYPE_INTERFACE_EXPORT(
CTX_EXPORT
);
55
56
// ------------------ static callbacks ----------------------
57
58
CTX_EXPORT
static
gzBool
parallelize
();
59
CTX_EXPORT
static
gzBool
execute
(
ctxVirtualMachineProgram
*program,
const
ctxProgramExecution
flags=
CTX_PRG_EXEC_DEFAULT
,
ctxDetailedRegisterUse
*register_use = NULL);
60
CTX_EXPORT
static
gzBool
pinMemory
(gzVoid* address);
// pin before reading memory that GPU Writes
61
CTX_EXPORT
static
gzBool
waitMemory
(gzVoid* address);
// wait before writing memory that GPU reads, (followd by unpin) before execute
62
71
CTX_EXPORT
static
gzBool
readMemory
(gzVoid* address, gzUInt64 offset, gzUInt64 bytes, gzUInt64 stride = 0, gzUInt32 count = 1);
72
CTX_EXPORT
static
gzUInt32
parallelInstructionCount
();
73
74
CTX_EXPORT
static
gzBool
installSystemCompiler
(
ctxCompilerTypes
type =
CTX_COMPILER_DEFAULT
,gzString *error=
nullptr
);
75
CTX_EXPORT
static
gzVoid
unInstallSystemCompiler
();
76
77
CTX_EXPORT
static
gzBool
hasSystemCompiler
();
78
79
// ----------- instance -------------------------------------
80
81
CTX_EXPORT
virtual
gzBool
initialize
() = 0;
82
CTX_EXPORT
virtual
gzBool
hasError
() = 0;
83
CTX_EXPORT
virtual
gzString
getError
() = 0;
84
85
protected
:
86
87
CTX_EXPORT
virtual
gzBool
parallelize_
() = 0;
88
89
CTX_EXPORT
virtual
gzBool
execute_
(
ctxVirtualMachineProgram
*program,
const
ctxProgramExecution
flags,
ctxDetailedRegisterUse
*register_use) = 0;
90
91
CTX_EXPORT
virtual
gzBool
pinMemory_
(gzVoid *address) = 0;
92
93
CTX_EXPORT
virtual
gzBool
waitMemory_
(gzVoid *address) = 0;
94
95
CTX_EXPORT
virtual
gzUInt32
parallelInstructionCount_
() = 0;
96
98
CTX_EXPORT
virtual
gzBool
readMemory_
(gzVoid *address, gzUInt64 offset, gzUInt64 bytes, gzUInt64 stride, gzUInt32 count);
99
100
CTX_EXPORT
static
gzRefPointer<ctxCompiler>
systemCompiler
;
101
};
102
103
GZ_DECLARE_REFPTR(
ctxCompiler
);
104
105
#endif
//__CTX_COMPILER_H__
106
107
ctxCompiler
Accelerates execution of ctxVirtualMachineProgram by compiler backens.
Definition
ctxCompiler.h:51
ctxCompiler::parallelize
static gzBool parallelize()
ctxCompiler::getError
virtual gzString getError()=0
ctxCompiler::initialize
virtual gzBool initialize()=0
ctxCompiler::waitMemory_
virtual gzBool waitMemory_(gzVoid *address)=0
ctxCompiler::waitMemory
static gzBool waitMemory(gzVoid *address)
ctxCompiler::hasError
virtual gzBool hasError()=0
ctxCompiler::parallelInstructionCount_
virtual gzUInt32 parallelInstructionCount_()=0
ctxCompiler::systemCompiler
static gzRefPointer< ctxCompiler > systemCompiler
Definition
ctxCompiler.h:100
ctxCompiler::installSystemCompiler
static gzBool installSystemCompiler(ctxCompilerTypes type=CTX_COMPILER_DEFAULT, gzString *error=nullptr)
ctxCompiler::pinMemory_
virtual gzBool pinMemory_(gzVoid *address)=0
ctxCompiler::execute_
virtual gzBool execute_(ctxVirtualMachineProgram *program, const ctxProgramExecution flags, ctxDetailedRegisterUse *register_use)=0
ctxCompiler::execute
static gzBool execute(ctxVirtualMachineProgram *program, const ctxProgramExecution flags=CTX_PRG_EXEC_DEFAULT, ctxDetailedRegisterUse *register_use=NULL)
ctxCompiler::unInstallSystemCompiler
static gzVoid unInstallSystemCompiler()
ctxCompiler::readMemory_
virtual gzBool readMemory_(gzVoid *address, gzUInt64 offset, gzUInt64 bytes, gzUInt64 stride, gzUInt32 count)
Ranged readback hook for readMemory(); the default pins the whole bank.
ctxCompiler::readMemory
static gzBool readMemory(gzVoid *address, gzUInt64 offset, gzUInt64 bytes, gzUInt64 stride=0, gzUInt32 count=1)
Makes count host byte ranges current after backend writes: the range k starts at address + offset + k...
ctxCompiler::hasSystemCompiler
static gzBool hasSystemCompiler()
ctxCompiler::parallelInstructionCount
static gzUInt32 parallelInstructionCount()
ctxCompiler::parallelize_
virtual gzBool parallelize_()=0
ctxCompiler::pinMemory
static gzBool pinMemory(gzVoid *address)
ctxDetailedRegisterUse
Definition
ctxVirtualMachine.h:391
ctxVirtualMachineProgram
Definition
ctxVirtualMachine.h:76
CTX_EXPORT
#define CTX_EXPORT
Definition
ctxBase.h:68
ctxCompilerTypes
ctxCompilerTypes
Definition
ctxCompiler.h:30
CTX_COMPILER_NONE
@ CTX_COMPILER_NONE
Definition
ctxCompiler.h:42
CTX_COMPILER_OPEN_CL
@ CTX_COMPILER_OPEN_CL
Definition
ctxCompiler.h:32
CTX_COMPILER_DEFAULT
@ CTX_COMPILER_DEFAULT
Definition
ctxCompiler.h:45
CTX_COMPILER_THREAD
@ CTX_COMPILER_THREAD
Definition
ctxCompiler.h:36
CTX_COMPILER_FASTEST
@ CTX_COMPILER_FASTEST
Definition
ctxCompiler.h:39
CTX_COMPILER_ASSEMBLER
@ CTX_COMPILER_ASSEMBLER
Definition
ctxCompiler.h:34
CTX_COMPILER_CPP
@ CTX_COMPILER_CPP
Definition
ctxCompiler.h:35
CTX_COMPILER_CUDA
@ CTX_COMPILER_CUDA
Definition
ctxCompiler.h:33
ctxVirtualMachine.h
ctxProgramExecution
ctxProgramExecution
Execution flags for ctxVirtualMachine::execute.
Definition
ctxVirtualMachine.h:492
CTX_PRG_EXEC_DEFAULT
@ CTX_PRG_EXEC_DEFAULT
Ignore register dependancies.
Definition
ctxVirtualMachine.h:499
Generated by
1.18.0