Impulse Graph C++ Engine 2.4.0
High-Performance Zero-Copy C-ABI Kernel and C++20 Fluent VM Engine
Loading...
Searching...
No Matches
contracts_chunk2.hpp
Go to the documentation of this file.
1
5
6#ifndef IMPULSE_CONTRACTS_CHUNK2_HPP
7#define IMPULSE_CONTRACTS_CHUNK2_HPP
8
9#include <vector>
10
11namespace impulse::vm {
12
13inline void append_chunk2_contracts(std::vector<ImpulseOpcodeVariantContract>& list) {
14 // --- Set Operations (0x30..0x33) ---
15
16 // OP_SET_UNION (0x30)
17 list.push_back({
18 OP_SET_UNION, "OP_SET_UNION", "Set Union (BitSet / Node IDs / Node Vectors / Lane Frontier)",
19 0x00, 0x00, 0x00, 0x00000000u,
25 false, false, IMPULSE_VM_FLAG_ZF, true, true
26 });
27
28 // OP_SET_INTERSECT (0x31)
29 list.push_back({
30 OP_SET_INTERSECT, "OP_SET_INTERSECT", "Set Intersect (BitSet / Node IDs / Node Vectors / Lane Frontier)",
31 0x00, 0x00, 0x00, 0x00000000u,
37 false, false, IMPULSE_VM_FLAG_ZF, true, true
38 });
39
40 // OP_SET_DIFFERENCE (0x32)
41 list.push_back({
42 OP_SET_DIFFERENCE, "OP_SET_DIFFERENCE", "Set Difference (BitSet / Node IDs / Node Vectors / Lane Frontier)",
43 0x00, 0x00, 0x00, 0x00000000u,
49 false, false, IMPULSE_VM_FLAG_ZF, true, true
50 });
51
52 // OP_SET_CARDINALITY (0x33)
53 list.push_back({
54 OP_SET_CARDINALITY, "OP_SET_CARDINALITY", "Set Cardinality",
55 0x00, 0x00, 0x00, 0x00000000u,
60 false, false, IMPULSE_VM_FLAG_ZF, true, true
61 });
62
63 // --- Vector Math, Reductions, Projections & Temporal (0x34..0x3D) ---
64
65 // OP_VECTOR_MUL_ATTR (0x34)
66 list.push_back({
67 OP_VECTOR_MUL_ATTR, "OP_VECTOR_MUL_ATTR", "Scale vector by scalar float immediate (flags=0)",
68 0x01, 0x00, 0x01, 0x3F800000u, // 1.0f
72 false, false, 0, true, true
73 });
74 list.push_back({
75 OP_VECTOR_MUL_ATTR, "OP_VECTOR_MUL_ATTR", "Multiply vector by attribute slot (flags=1)",
76 0x01, 0x01, 0x01, 0x00000000u, // rel=0, attr=0
81 false, false, 0, true, true
82 });
83
84 // OP_VECTOR_REDUCE_SUM (0x35)
85 list.push_back({
86 OP_VECTOR_REDUCE_SUM, "OP_VECTOR_REDUCE_SUM", "Sum reduce numeric vector or scalar",
87 0x00, 0x00, 0x00, 0x00000000u,
92 false, false, IMPULSE_VM_FLAG_ZF, true, true
93 });
94
95 // OP_VECTOR_DIV (0x36)
96 list.push_back({
97 OP_VECTOR_DIV, "OP_VECTOR_DIV", "Element-wise vector division",
98 0x00, 0x00, 0x00, 0x00000000u,
104 false, false, 0, true, true
105 });
106
107 // OP_VECTOR_STR_CONCAT (0x37)
108 list.push_back({
109 OP_VECTOR_STR_CONCAT, "OP_VECTOR_STR_CONCAT", "String vector concatenation",
110 0x00, 0x00, 0x00, 0x00000000u,
116 false, false, 0, true, true
117 });
118
119 // OP_FLOAT_VECTOR_SCALE (0x38)
120 list.push_back({
121 OP_FLOAT_VECTOR_SCALE, "OP_FLOAT_VECTOR_SCALE", "In-place float vector scale by immediate (flags=0)",
122 0x01, 0x00, 0x01, 0x3F800000u, // 1.0f
126 false, false, 0, true, false
127 });
128 list.push_back({
129 OP_FLOAT_VECTOR_SCALE, "OP_FLOAT_VECTOR_SCALE", "In-place float vector scale by register (flags=1)",
130 0x01, 0x01, 0x01, 0x00000000u,
135 false, false, 0, true, false
136 });
137
138 // OP_L1_NORM_DIFF (0x39)
139 list.push_back({
140 OP_L1_NORM_DIFF, "OP_L1_NORM_DIFF", "L1 norm difference between vectors or scalars",
141 0x00, 0x00, 0x00, 0x00000000u,
147 false, false, IMPULSE_VM_FLAG_ZF, true, true
148 });
149
150 // OP_PROJECT_STATE (0x3A)
151 list.push_back({
152 OP_PROJECT_STATE, "OP_PROJECT_STATE", "Project Frontier State Register",
153 0x00, 0x00, 0x00, 0x00000000u,
158 false, false, 0, false, true
159 });
160
161 // OP_COALESCE (0x3B)
162 list.push_back({
163 OP_COALESCE, "OP_COALESCE", "Coalesce two values or vectors",
164 0x00, 0x00, 0x00, 0x00000000u,
170 false, false, 0, true, true
171 });
172
173 // OP_EXTRACT_VALIDITY (0x3C)
174 list.push_back({
175 OP_EXTRACT_VALIDITY, "OP_EXTRACT_VALIDITY", "Extract validity bitset from numeric vector",
176 0x00, 0x00, 0x00, 0x00000000u,
181 false, false, IMPULSE_VM_FLAG_ZF, true, true
182 });
183
184 // OP_VECTOR_TIME_VALID_AT (0x3D)
185 list.push_back({
186 OP_VECTOR_TIME_VALID_AT, "OP_VECTOR_TIME_VALID_AT", "Filter valid temporal intervals at timestamp",
187 0x00, 0x00, 0x00, 0x00000000u,
192 false, false, IMPULSE_VM_FLAG_ZF, true, true
193 });
194
195 // --- GraphBLAS & Analytics (0x40..0x4B) ---
196
197 // OP_CC_AFFOREST (0x40)
198 list.push_back({
199 OP_CC_AFFOREST, "OP_CC_AFFOREST", "Connected Components Afforest Algorithm",
200 0x00, 0x00, 0x00, 0x00000000u, // rel=0
204 false, false, 0, true, true
205 });
206
207 // OP_MXV (0x41)
208 list.push_back({
209 OP_MXV, "OP_MXV", "Matrix-Vector Multiply (unmasked, rel=0, plus-times)",
210 0xFF, 0x00, 0xFF, 0x00000000u, // rel=0, semiring=0
215 false, false, 0, true, true
216 });
217
218 // OP_VXM (0x42)
219 list.push_back({
220 OP_VXM, "OP_VXM", "Vector-Matrix Multiply (unmasked, rel=0, plus-times)",
221 0xFF, 0x00, 0xFF, 0x00000000u, // rel=0, semiring=0
226 false, false, 0, true, true
227 });
228
229 // OP_EWISE_ADD (0x43)
230 list.push_back({
231 OP_EWISE_ADD, "OP_EWISE_ADD", "Element-wise vector addition",
232 0x00, 0x00, 0x00, 0x00000000u,
238 false, false, 0, true, true
239 });
240
241 // OP_EWISE_MULT (0x44)
242 list.push_back({
243 OP_EWISE_MULT, "OP_EWISE_MULT", "Element-wise vector multiplication",
244 0x00, 0x00, 0x00, (static_cast<uint32_t>(BINARY_OP_MUL) << 16),
250 false, false, 0, true, true
251 });
252
253 // OP_REDUCE (0x45)
254 list.push_back({
255 OP_REDUCE, "OP_REDUCE", "Vector Scalar Reduction (SUM)",
256 0x00, 0x00, 0x00, 0x00000000u, // BINARY_OP_ADD
261 false, false, 0, true, true
262 });
263 list.push_back({
264 OP_REDUCE, "OP_REDUCE", "Vector Argmin Reduction (ARGMIN)",
265 0x00, 0x00, 0x00, (static_cast<uint32_t>(BINARY_OP_ARGMIN) << 16),
270 false, false, IMPULSE_VM_FLAG_ZF, true, true
271 });
272
273 // OP_CC_HOOK_COMPRESS (0x46)
274 list.push_back({
275 OP_CC_HOOK_COMPRESS, "OP_CC_HOOK_COMPRESS", "Connected Components Hook Compress",
276 0x00, 0x00, 0x00, 0x00000000u,
280 false, false, 0, false, false
281 });
282
283 // OP_TC_SWEEP_BATCH (0x47)
284 list.push_back({
285 OP_TC_SWEEP_BATCH, "OP_TC_SWEEP_BATCH", "Triangle Counting Sweep Batch",
286 0x00, 0x00, 0x00, 0x00000000u,
290 false, false, 0, false, false
291 });
292
293 // OP_BRANDES_FORWARD (0x48)
294 list.push_back({
295 OP_BRANDES_FORWARD, "OP_BRANDES_FORWARD", "Brandes Betweenness Centrality Forward",
296 0x00, 0x00, 0x00, 0x00000000u,
300 false, false, 0, false, false
301 });
302
303 // OP_BRANDES_BACKWARD (0x49)
304 list.push_back({
305 OP_BRANDES_BACKWARD, "OP_BRANDES_BACKWARD", "Brandes Betweenness Centrality Backward",
306 0x00, 0x00, 0x00, 0x00000000u,
310 false, false, 0, false, false
311 });
312
313 // OP_DELTA_STEP_RELAX (0x4A)
314 list.push_back({
315 OP_DELTA_STEP_RELAX, "OP_DELTA_STEP_RELAX", "Delta Stepping SSSP Relaxation",
316 0x00, 0x00, 0x00, 0x00000000u,
320 false, false, 0, false, false
321 });
322
323 // OP_READ_EDGE_WEIGHT (0x4B)
324 list.push_back({
325 OP_READ_EDGE_WEIGHT, "OP_READ_EDGE_WEIGHT", "Read edge weight attribute (rel=0)",
326 0x80, 0x00, 0x80, 0x00000000u, // rel=0
332 false, false, 0, true, true
333 });
334
335 // --- Control Flow & Traps (0x50..0x5C) ---
336
337 // OP_JMP (0x50)
338 list.push_back({
339 OP_JMP, "OP_JMP", "Unconditional Jump",
340 0x00, 0x00, 0x00, 0x00000001u, // offset = +1
344 false, false, 0, false, false
345 });
346
347 // OP_JZ (0x51)
348 list.push_back({
349 OP_JZ, "OP_JZ", "Jump if Zero Flag Set",
350 0x00, 0x00, 0x00, 0x00000001u, // offset = +1
354 false, false, 0, false, false
355 });
356
357 // OP_JNZ (0x52)
358 list.push_back({
359 OP_JNZ, "OP_JNZ", "Jump if Zero Flag Clear",
360 0x00, 0x00, 0x00, 0x00000001u, // offset = +1
364 false, false, 0, false, false
365 });
366
367 // OP_LOOP_DECR (0x53)
368 list.push_back({
369 OP_LOOP_DECR, "OP_LOOP_DECR", "Loop Counter Decrement and Branch",
370 0x00, 0x00, 0x00, 0x00000001u, // offset = +1
374 false, false, IMPULSE_VM_FLAG_ZF, false, true
375 });
376
377 // OP_STABLE_CHECK (0x54)
378 list.push_back({
379 OP_STABLE_CHECK, "OP_STABLE_CHECK", "Fixed-point stability subset check",
380 0x00, 0x00, 0x00, 0x00000000u,
385 false, false, IMPULSE_VM_FLAG_ST | IMPULSE_VM_FLAG_ZF, true, false
386 });
387
388 // OP_CALL (0x55)
389 list.push_back({
390 OP_CALL, "OP_CALL", "Function Call",
391 0x00, 0x00, 0x00, 0x00000001u, // callee = PC+1
395 false, false, 0, false, false
396 });
397
398 // OP_RET (0x56)
399 list.push_back({
400 OP_RET, "OP_RET", "Function Return",
401 0x00, 0x00, 0x00, 0x00000000u,
405 false, false, 0, false, false
406 });
407
408 // OP_ENTER_FRAME (0x57)
409 list.push_back({
410 OP_ENTER_FRAME, "OP_ENTER_FRAME", "Enter Stack Frame",
411 0x00, 0x00, 0x00, 0x00000000u,
415 false, false, 0, false, false
416 });
417
418 // OP_LEAVE_FRAME (0x58)
419 list.push_back({
420 OP_LEAVE_FRAME, "OP_LEAVE_FRAME", "Leave Stack Frame",
421 0x00, 0x00, 0x00, 0x00000000u,
425 false, false, 0, false, false
426 });
427
428 // OP_THROW (0x5A)
429 list.push_back({
430 OP_THROW, "OP_THROW", "User Exception Throw",
431 0x00, 0x00, 0x00, 0x00000000u,
435 false, false, 0, false, false
436 });
437
438 // OP_ASSERT (0x5B)
439 list.push_back({
440 OP_ASSERT, "OP_ASSERT", "Register Value Assertion",
441 0x01, 0x00, 0x01, 2u, // expected_val = 2 (matches populate_register for TYPE_INT64)
446 false, false, 0, false, false
447 });
448
449 // OP_TRAP (0x5C)
450 list.push_back({
451 OP_TRAP, "OP_TRAP", "Debugger Trap",
452 0x00, 0x00, 0x00, 0x00000000u,
456 false, false, 0, false, false
457 });
458}
459
460} // namespace impulse::vm
461
462#endif // IMPULSE_CONTRACTS_CHUNK2_HPP
#define IMP_TYPE_BIT(t)
Definition impulse_opcode_contracts.hpp:28
#define OP_STABLE_CHECK
Definition impulse_vm.h:138
#define OP_RET
Definition impulse_vm.h:140
#define OP_SET_UNION
Definition impulse_vm.h:98
#define OP_BRANDES_BACKWARD
Definition impulse_vm.h:125
#define BINARY_OP_ARGMIN
Definition impulse_vm.h:279
#define OP_EWISE_ADD
Definition impulse_vm.h:119
#define OP_CALL
Definition impulse_vm.h:139
#define OP_EXTRACT_VALIDITY
Definition impulse_vm.h:111
#define OP_VECTOR_MUL_ATTR
Definition impulse_vm.h:102
#define OP_BRANDES_FORWARD
Definition impulse_vm.h:124
#define OP_VECTOR_STR_CONCAT
Definition impulse_vm.h:105
#define OP_MXV
Definition impulse_vm.h:117
#define OP_JZ
Definition impulse_vm.h:135
#define OP_VECTOR_DIV
Definition impulse_vm.h:104
#define OP_REDUCE
Definition impulse_vm.h:121
#define OP_JNZ
Definition impulse_vm.h:136
#define BINARY_OP_MUL
Definition impulse_vm.h:274
#define IMPULSE_VM_FLAG_ST
Definition impulse_vm.h:35
#define OP_CC_HOOK_COMPRESS
Definition impulse_vm.h:122
#define OP_DELTA_STEP_RELAX
Definition impulse_vm.h:126
#define OP_READ_EDGE_WEIGHT
Definition impulse_vm.h:127
@ TYPE_DOUBLE
Definition impulse_vm.h:293
@ TYPE_BITSET_HANDLE
Definition impulse_vm.h:288
@ TYPE_FRONTIER_STATE
Definition impulse_vm.h:299
@ TYPE_INT64
Definition impulse_vm.h:285
@ TYPE_NODE_VECTOR
Definition impulse_vm.h:289
@ TYPE_NULL
Definition impulse_vm.h:284
@ TYPE_FLOAT
Definition impulse_vm.h:292
@ TYPE_BOOLEAN
Definition impulse_vm.h:291
@ TYPE_NODE_ID
Definition impulse_vm.h:286
@ TYPE_LANE_FRONTIER
Definition impulse_vm.h:300
@ TYPE_UINT64_VECTOR
Definition impulse_vm.h:298
@ TYPE_STRING_VECTOR
Definition impulse_vm.h:295
@ TYPE_FLOAT_VECTOR
Definition impulse_vm.h:296
#define OP_EWISE_MULT
Definition impulse_vm.h:120
#define OP_JMP
Definition impulse_vm.h:134
#define OP_L1_NORM_DIFF
Definition impulse_vm.h:107
#define OP_TRAP
Definition impulse_vm.h:148
#define IMPULSE_VM_FLAG_ZF
Definition impulse_vm.h:31
#define OP_ASSERT
Definition impulse_vm.h:147
#define OP_THROW
Definition impulse_vm.h:146
#define OP_SET_INTERSECT
Definition impulse_vm.h:99
#define OP_LEAVE_FRAME
Definition impulse_vm.h:143
#define OP_VXM
Definition impulse_vm.h:118
#define OP_ENTER_FRAME
Definition impulse_vm.h:142
#define OP_PROJECT_STATE
Definition impulse_vm.h:109
#define OP_SET_DIFFERENCE
Definition impulse_vm.h:100
#define OP_VECTOR_TIME_VALID_AT
Definition impulse_vm.h:112
#define OP_VECTOR_REDUCE_SUM
Definition impulse_vm.h:103
#define OP_SET_CARDINALITY
Definition impulse_vm.h:101
#define OP_TC_SWEEP_BATCH
Definition impulse_vm.h:123
#define OP_LOOP_DECR
Definition impulse_vm.h:137
#define OP_COALESCE
Definition impulse_vm.h:110
#define OP_CC_AFFOREST
Definition impulse_vm.h:116
#define OP_FLOAT_VECTOR_SCALE
Definition impulse_vm.h:106
Definition contracts_chunk1.hpp:12
constexpr uint32_t IMP_TYPES_NODE_VEC
Definition impulse_opcode_contracts.hpp:33
constexpr uint32_t IMP_TYPES_NUMERIC_VEC
Definition impulse_opcode_contracts.hpp:35
@ DST_REG
Definition impulse_opcode_contracts.hpp:55
@ PAYLOAD_BYTE1
Definition impulse_opcode_contracts.hpp:58
@ PAYLOAD_LOW8
Definition impulse_opcode_contracts.hpp:56
@ PAYLOAD_HIGH16
Definition impulse_opcode_contracts.hpp:61
@ PAYLOAD_LOW16
Definition impulse_opcode_contracts.hpp:57
@ NONE
Definition impulse_opcode_contracts.hpp:54
constexpr uint32_t IMP_TYPES_FLOAT_OR_DBL
Definition impulse_opcode_contracts.hpp:34
constexpr uint32_t IMP_TYPES_NONE
Definition impulse_opcode_contracts.hpp:30
void append_chunk2_contracts(std::vector< ImpulseOpcodeVariantContract > &list)
Definition contracts_chunk2.hpp:13
constexpr uint32_t IMP_TYPES_ANY
Definition impulse_opcode_contracts.hpp:31
constexpr uint32_t IMP_TYPES_INT_OR_NODE
Definition impulse_opcode_contracts.hpp:32
constexpr uint32_t IMP_TYPES_SOURCE_SET
Definition impulse_opcode_contracts.hpp:37