CorTeX Core ABI 7
ToolTech Software · C++ library reference
Loading...
Searching...
No Matches
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
47
48// ------------------------------- ctxCompiler ------------------------------------
50class ctxCompiler : public gzObject
51{
52public:
53
54 GZ_DECLARE_TYPE_INTERFACE_EXPORT(CTX_EXPORT);
55
56 // ------------------ static callbacks ----------------------
57
58 CTX_EXPORT static gzBool parallelize();
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);
73
74 CTX_EXPORT static gzBool installSystemCompiler(ctxCompilerTypes type = CTX_COMPILER_DEFAULT,gzString *error=nullptr);
76
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
85protected:
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
103GZ_DECLARE_REFPTR(ctxCompiler);
104
105#endif //__CTX_COMPILER_H__
106
107
Accelerates execution of ctxVirtualMachineProgram by compiler backens.
Definition ctxCompiler.h:51
static gzBool parallelize()
virtual gzString getError()=0
virtual gzBool initialize()=0
virtual gzBool waitMemory_(gzVoid *address)=0
static gzBool waitMemory(gzVoid *address)
virtual gzBool hasError()=0
virtual gzUInt32 parallelInstructionCount_()=0
static gzRefPointer< ctxCompiler > systemCompiler
static gzBool installSystemCompiler(ctxCompilerTypes type=CTX_COMPILER_DEFAULT, gzString *error=nullptr)
virtual gzBool pinMemory_(gzVoid *address)=0
virtual gzBool execute_(ctxVirtualMachineProgram *program, const ctxProgramExecution flags, ctxDetailedRegisterUse *register_use)=0
static gzBool execute(ctxVirtualMachineProgram *program, const ctxProgramExecution flags=CTX_PRG_EXEC_DEFAULT, ctxDetailedRegisterUse *register_use=NULL)
static gzVoid unInstallSystemCompiler()
virtual gzBool readMemory_(gzVoid *address, gzUInt64 offset, gzUInt64 bytes, gzUInt64 stride, gzUInt32 count)
Ranged readback hook for readMemory(); the default pins the whole bank.
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...
static gzBool hasSystemCompiler()
static gzUInt32 parallelInstructionCount()
virtual gzBool parallelize_()=0
static gzBool pinMemory(gzVoid *address)
#define CTX_EXPORT
Definition ctxBase.h:68
ctxCompilerTypes
Definition ctxCompiler.h:30
@ CTX_COMPILER_NONE
Definition ctxCompiler.h:42
@ CTX_COMPILER_OPEN_CL
Definition ctxCompiler.h:32
@ CTX_COMPILER_DEFAULT
Definition ctxCompiler.h:45
@ CTX_COMPILER_THREAD
Definition ctxCompiler.h:36
@ CTX_COMPILER_FASTEST
Definition ctxCompiler.h:39
@ CTX_COMPILER_ASSEMBLER
Definition ctxCompiler.h:34
@ CTX_COMPILER_CPP
Definition ctxCompiler.h:35
@ CTX_COMPILER_CUDA
Definition ctxCompiler.h:33
ctxProgramExecution
Execution flags for ctxVirtualMachine::execute.
@ CTX_PRG_EXEC_DEFAULT
Ignore register dependancies.