VulkanRaytracingCycles 0.0.0
Cycles Render Engine With VulkanRaytracingShaderModules. ( Experiment , in progress)
front::Schedule Struct Reference

#include <SignalVk.h>

Public Types

typedef UINT16 tpCnt
 
typedef UINT32 tpOrd
 

Public Member Functions

void start ()
 
void stop ()
 
tpOrd wakeup (bool boss=false)
 
void gohome (tpOrd order)
 
bool rollcall (uint64_t num)
 
void EnsureEscapeEnd ()
 
tpOrd wakeup (tpCnt kumi, bool tyo=false)
 
void gohome (tpCnt kumi, tpCnt sima)
 
bool rollcall (tpCnt kumi, uint32_t num)
 

Public Attributes

bool escape
 
uint64_t escapeID
 
CRITICAL_SECTION gCs
 
const uint64_t seed = 0x19f093ab37c01fULL
 
struct {
   uint64_t   fmly64
 
   uint32_t   fmly32 [64]
 
   uint32_t *   fmlyNext
 
gene
 
struct {
   uint64_t   fmly64
 
   uint32_t   fmly32 [64]
 
   uint32_t *   fmlyNext
 
mask
 

Detailed Description

Definition at line 92 of file SignalVk.h.

Member Typedef Documentation

◆ tpCnt

typedef UINT16 front::Schedule::tpCnt

Definition at line 94 of file SignalVk.h.

◆ tpOrd

typedef UINT32 front::Schedule::tpOrd

Definition at line 95 of file SignalVk.h.

Member Function Documentation

◆ EnsureEscapeEnd()

void front::Schedule::EnsureEscapeEnd ( )

Definition at line 133 of file SignalVk.cpp.

133 {
134
135 if (escape) {
136 EnterCriticalSection(&gCs);
137 gene.fmly64 = escapeID;
138
139 LeaveCriticalSection(&gCs);
140 escape = false;
141 }
142 else {
143
144 };
145 };
CRITICAL_SECTION gCs
Definition: SignalVk.h:98
struct front::Schedule::@15 gene
uint64_t escapeID
Definition: SignalVk.h:97

◆ gohome() [1/2]

void front::Schedule::gohome ( tpCnt  kumi,
tpCnt  sima 
)

Definition at line 178 of file SignalVk.cpp.

178 {
179 InterlockedBitTestAndSet((LONG*)&gene.fmly32[kumi], sima);
180 };

◆ gohome() [2/2]

void front::Schedule::gohome ( tpOrd  order)

Definition at line 114 of file SignalVk.cpp.

114 {
115 InterlockedBitTestAndSet64((LONG64*)&gene.fmly64, (LONG64)order);
116 };

◆ rollcall() [1/2]

bool front::Schedule::rollcall ( tpCnt  kumi,
uint32_t  num 
)

assert(room[curry.key].table[curry.buc].val == room[curry.key].table[curry.buc].key);

Definition at line 181 of file SignalVk.cpp.

181 {
182
183
184 while (num != _InterlockedCompareExchange(&gene.fmly32[kumi], mask.fmly32[kumi], num)) {
185
186 std::this_thread::sleep_for(std::chrono::nanoseconds(100));
187 };
188
189
190
192
193
194 return true;
195 };
struct front::Schedule::@15 mask

◆ rollcall() [2/2]

bool front::Schedule::rollcall ( uint64_t  num)

assert(room[curry.key].table[curry.buc].val == room[curry.key].table[curry.buc].key);

Definition at line 117 of file SignalVk.cpp.

117 {
118
119 escape = true; escapeID = num;
120 while (num != _InterlockedCompareExchange(&gene.fmly64, mask.fmly64, num)) {
121
122
123 std::this_thread::sleep_for(std::chrono::nanoseconds(100));
124
125 };
126 escape = false;
127
129
130
131 return true;
132 };

◆ start()

void front::Schedule::start ( )

memset(mask.fmly32, 0, 4 * 64);

memset(gene.fmly32, 0, 4 * 64);

Definition at line 46 of file SignalVk.cpp.

46 {
47 InitializeCriticalSectionAndSpinCount(&gCs, 8000);
48 mask = { 0,{0},nullptr };
49 gene = { 0,{0},nullptr };
50 };

◆ stop()

void front::Schedule::stop ( )

Definition at line 51 of file SignalVk.cpp.

51 {
52 DeleteCriticalSection(&gCs);
53 if (gene.fmlyNext != nullptr) delete[] gene.fmlyNext;
54 mask = { 0,{0},nullptr };
55 gene = { 0,{0},nullptr };
56
57 };

◆ wakeup() [1/2]

Schedule::tpOrd front::Schedule::wakeup ( bool  boss = false)

gene.fmly32 = new uint32_t[64 * 32];

Definition at line 59 of file SignalVk.cpp.

59 {
60
61 static tpCnt member = -1;
62 constexpr tpCnt giant64 = 64 - 1;
63 constexpr tpCnt giant64x32 = 64 * 32 - 1;
64 constexpr tpCnt giant64x32x32 = 64 * 32 * 32 - 1;
65
66 if (boss) {
67
68 uint64_t id = _InterlockedCompareExchange(&mask.fmly64, 0, gene.fmly64);
69 if (id == gene.fmly64) {
70 member = -1;
71 gene.fmly64 = 0;
72 escape = false;
73 }
74 else {
75 log_bad("a busy mainstream.\n");
76 }
77
78 return 0;
79 }
80 else {
81
82
83 tpOrd ID = 0;
84 tpCnt order = (tpCnt)(InterlockedIncrement16((SHORT*)&member));
85
86 if (order > giant64) {
87 order -= 64;
88 if (order > giant64x32) {
89 log_bad("memory out\n");
90 }
91 else {
92
93 if (gene.fmly32 == nullptr) {
94 EnterCriticalSection(&gCs);
96 LeaveCriticalSection(&gCs);
97 }
98
99 ID = (order / 32);
100 ID |= ((order % 32) << 6);
101
102 InterlockedBitTestAndSet((volatile LONG*)(&mask.fmly32[(order / 32)]), (LONG)(order % 32));
103 }
104 }
105 else {
106
107 InterlockedBitTestAndSet64((LONG64*)&mask.fmly64, (LONG64)order);
108 ID = order;
109
110 }
111 return ID;
112 }
113 };
#define log_bad(...)
Definition: log.hpp:37
UINT32 tpOrd
Definition: SignalVk.h:95
UINT16 tpCnt
Definition: SignalVk.h:94

◆ wakeup() [2/2]

Schedule::tpOrd front::Schedule::wakeup ( tpCnt  kumi,
bool  tyo = false 
)

Definition at line 147 of file SignalVk.cpp.

147 {
148
149 static tpCnt member[64] = { 0 };
150 constexpr tpCnt giant64 = 64 - 1;
151 constexpr tpCnt giant64x32 = 64 * 32 - 1;
152 constexpr tpCnt giant64x32x32 = 64 * 32 * 32 - 1;
153
154 if (tyo) {
155
156 uint64_t id = _InterlockedCompareExchange(&mask.fmly32[kumi], 0, gene.fmly32[kumi]);
157 if (id == gene.fmly32[kumi]) {
158 member[kumi] = -1;
159 gene.fmly32[kumi] = 0;
160 }
161 else {
162 log_bad("a busy mainstream.\n");
163 }
164
165 return 0;
166 }
167
168
169
170
171 tpCnt order = (tpCnt)(InterlockedIncrement16((SHORT*)&member[kumi])) % 32;
172
173 InterlockedBitTestAndSet((volatile LONG*)(&mask.fmly32[kumi]), (LONG)(order));
174
175 return order;
176
177 };

Member Data Documentation

◆ escape

bool front::Schedule::escape

Definition at line 96 of file SignalVk.h.

◆ escapeID

uint64_t front::Schedule::escapeID

Definition at line 97 of file SignalVk.h.

◆ fmly32

uint32_t front::Schedule::fmly32[64]

Definition at line 105 of file SignalVk.h.

◆ fmly64

uint64_t front::Schedule::fmly64

Definition at line 104 of file SignalVk.h.

◆ fmlyNext

uint32_t* front::Schedule::fmlyNext

Definition at line 106 of file SignalVk.h.

◆ gCs

CRITICAL_SECTION front::Schedule::gCs

Definition at line 98 of file SignalVk.h.

◆ 

struct { ... } front::Schedule::gene

◆ 

struct { ... } front::Schedule::mask

◆ seed

const uint64_t front::Schedule::seed = 0x19f093ab37c01fULL

Definition at line 99 of file SignalVk.h.


The documentation for this struct was generated from the following files: