Skip to main content

xlog_cuda/
kernel_manifest_data.rs

1// Single source of truth for CUDA kernel modules.
2//
3// This file is consumed by both `build.rs` (via include!()) and `lib.rs`
4// (via `pub mod kernel_manifest_data`) to avoid the kernel list being
5// duplicated in two places.
6// NOTE: Use regular comments (//), NOT inner doc comments (//!), because
7// include!() in build.rs would interpret //! as documenting the wrong item.
8
9/// Module names matching the .cu filenames (without extension).
10/// Order matches provider/mod.rs load order.
11pub const KERNEL_CU_NAMES: &[&str] = &[
12    "join",
13    "dedup",
14    "groupby",
15    "scan",
16    "sort",
17    "filter",
18    "set_ops",
19    "pack",
20    "pir",
21    "cnf",
22    "cache",
23    "weights",
24    "circuit",
25    "mc_sample",
26    "mc_eval",
27    "arith",
28    "sat",
29    "d4",
30    "neural",
31    "ilp",
32    "ilp_credit",
33    "ilp_exact",
34    "ilp_exact_nary",
35    "epistemic",
36    "wcoj",
37    "mc_resident",
38    "joint_solve",
39    "resident_relational",
40    "resident_filter_project",
41    "resident_schedule",
42    "semantic_hypergraph",
43    "semantic_training_view",
44    "semantic_transition",
45];
46
47/// Describes a single CUDA module: the .cu file name, the runtime module name
48/// used by cudarc, and the list of kernel function entry points within.
49pub struct KernelModuleSpec {
50    pub cu_name: &'static str,
51    pub module_name: &'static str,
52    pub kernels: &'static [&'static str],
53}
54
55/// All kernel modules with their entry-point function names.
56/// Order and cu_names match `KERNEL_CU_NAMES`.
57pub const KERNEL_MODULES: &[KernelModuleSpec] = &[
58    KernelModuleSpec {
59        cu_name: "join",
60        module_name: "xlog_join",
61        kernels: &[
62            "hash_join_build",
63            "hash_join_probe",
64            "compute_composite_hash",
65            "hash_join_bucket_count_v2",
66            "hash_join_scatter_v2",
67            "hash_join_probe_v2",
68            "hash_join_probe_v2_count_per_row",
69            "hash_join_probe_v2_materialize",
70            "hash_join_total_from_scan",
71            "hash_join_csm_unmatched_mask",
72            "hash_join_semi",
73            "hash_join_anti",
74            "init_hash_table",
75            // Nested-loop inner join production operator (emit-pairs design).
76            "nested_loop_join_inner_u32_1key_pairs",
77            // Sort-merge inner join provider-level operator (emit-pairs design,
78            // caller-asserted pre-sorted inputs).
79            "sort_merge_join_inner_u32_1key_pairs",
80        ],
81    },
82    KernelModuleSpec {
83        cu_name: "dedup",
84        module_name: "xlog_dedup",
85        kernels: &[
86            "mark_duplicates",
87            "mark_unique_columnar",
88            "mark_unique_and_scan_columnar",
89            "compact_rows",
90            "mark_unique_full_row_bytewise",
91            "mark_diff_full_row_typed_sorted",
92            "small_sort_full_row_indices_typed",
93        ],
94    },
95    KernelModuleSpec {
96        cu_name: "groupby",
97        module_name: "xlog_groupby",
98        kernels: &[
99            "detect_group_boundaries",
100            "detect_boundaries",
101            "extract_group_keys",
102            "group_ids_from_boundaries",
103            "group_start_indices",
104            "capture_num_groups",
105            "groupby_count",
106            "groupby_sum",
107            "groupby_sum_u64",
108            "groupby_min",
109            "groupby_min_u64",
110            "groupby_max",
111            "groupby_max_u64",
112            "groupby_logsumexp_max",
113            "groupby_logsumexp_sumexp",
114            "groupby_logsumexp_final",
115        ],
116    },
117    KernelModuleSpec {
118        cu_name: "scan",
119        module_name: "xlog_scan",
120        kernels: &[
121            "block_inclusive_scan",
122            "add_block_offsets",
123            "exclusive_scan_mask",
124            "count_mask",
125            "multiblock_scan_phase1",
126            "multiblock_scan_u32_phase1",
127            "multiblock_scan_phase2",
128            "multiblock_scan_phase3",
129        ],
130    },
131    KernelModuleSpec {
132        cu_name: "sort",
133        module_name: "xlog_sort",
134        kernels: &[
135            "radix_histogram",
136            "radix_scatter",
137            "compute_ranks",
138            "radix_scatter_stable",
139            "compute_digit_prefix_sums",
140            "init_indices",
141            "apply_permutation_u32",
142            "apply_permutation_bytes",
143            "gather_keys_i32_ordered_u32",
144            "gather_keys_f32_ordered_u32",
145            "gather_keys_bool_ordered_u32",
146            "gather_keys_u64_lo_u32",
147            "gather_keys_u64_hi_u32",
148            "gather_keys_i64_lo_u32",
149            "gather_keys_i64_hi_u32",
150            "gather_keys_f64_lo_u32",
151            "gather_keys_f64_hi_u32",
152            // Sort-merge sortedness-detection kernel used by provider-level
153            // callers before invoking the sort-merge join.
154            "check_ascending_sorted_u32",
155        ],
156    },
157    KernelModuleSpec {
158        cu_name: "filter",
159        module_name: "xlog_filter",
160        kernels: &[
161            "filter_compare_u32",
162            "filter_compare_i64",
163            "filter_compare_f64",
164            "filter_compare_i32",
165            "filter_compare_u64",
166            "filter_compare_f32",
167            "filter_compare_u8",
168            "filter_compare_u32_scan_phase1",
169            "filter_compare_f64_scan_phase1",
170            "filter_compare_f32_scan_phase1",
171            "filter_compare_u32_col",
172            "filter_compare_i32_col",
173            "filter_compare_i64_col",
174            "filter_compare_u64_col",
175            "filter_compare_f32_col",
176            "filter_compare_f64_col",
177            "filter_compare_u8_col",
178            "fill_u32_iota",
179            "fill_u32_const",
180            "mark_random_vars",
181            "random_var_to_bit_from_list",
182            "check_random_var_count",
183            "compact_u32_by_mask",
184            "compact_i64_by_mask",
185            "compact_f64_by_mask",
186            "compact_bytes_by_mask",
187            "capture_compact_count",
188            "mask_clamp_rows",
189            "mask_and",
190            "mask_or",
191            "mask_not",
192        ],
193    },
194    KernelModuleSpec {
195        cu_name: "set_ops",
196        module_name: "xlog_set_ops",
197        kernels: &["concat_u32", "concat_bytes", "sorted_diff_mark"],
198    },
199    KernelModuleSpec {
200        cu_name: "pack",
201        module_name: "xlog_pack",
202        kernels: &[
203            "pack_keys",
204            "hash_packed_keys",
205            "pack_and_hash_keys",
206            "pack_and_hash_keys_generic",
207            "pack_keys_aligned",
208            "unpack_column",
209            "unpack_column_counted",
210            "gather_packed_rows",
211            "gather_packed_rows_counted",
212            "scatter_packed_rows",
213            "compare_packed_keys",
214            "pack_bools_to_bitmap",
215        ],
216    },
217    KernelModuleSpec {
218        cu_name: "pir",
219        module_name: "xlog_pir",
220        kernels: &[
221            "pir_pack_keys",
222            "pir_hash_keys",
223            "pir_mark_unique",
224            "pir_find_existing",
225            "pir_mark_new_groups",
226            "pir_build_group_ids",
227            "pir_fill_child_parents",
228            "pir_mark_unique_pairs",
229            "pir_compact_pairs",
230            "pir_count_children",
231            "pir_write_child_offsets",
232            "pir_gather_children",
233            "pir_build_graph_child_counts",
234            "pir_sum_counts",
235            "pir_emit_nodes_and_ids",
236            "pir_update_counts",
237        ],
238    },
239    KernelModuleSpec {
240        cu_name: "cnf",
241        module_name: "xlog_cnf",
242        kernels: &[
243            "cnf_reachability_init",
244            "cnf_reachability_bfs",
245            "cnf_mark_leaf_choice",
246            "cnf_assign_leaf_var",
247            "cnf_assign_choice_var",
248            "cnf_mark_node_vars",
249            "cnf_count_clauses",
250            "cnf_capture_last_counts",
251            "cnf_compute_leaf_choice_totals",
252            "cnf_compute_totals",
253            "cnf_assign_node_var",
254            "cnf_emit_clauses",
255            "cnf_set_clause_end",
256        ],
257    },
258    KernelModuleSpec {
259        cu_name: "cache",
260        module_name: "xlog_cache",
261        kernels: &[
262            "cache_cnf_hash",
263            "cache_lookup_or_insert",
264            "cache_evict_lru",
265            "cache_store_u8",
266            "cache_store_u32",
267            "cache_store_i32",
268            "cache_store_f64",
269            "cache_store_meta",
270        ],
271    },
272    KernelModuleSpec {
273        cu_name: "weights",
274        module_name: "xlog_weights",
275        kernels: &[
276            "weights_fill_leaf",
277            "weights_fill_choice",
278            "weights_count_lift_exact",
279            "weights_set_evidence_from_nodes",
280            "weights_apply_evidence",
281            "weights_map_nodes_to_vars",
282            "weights_force_var_false",
283            "weights_restore_var_false",
284            "weights_force_var_true",
285            "weights_restore_var_true",
286            "weights_copy_slot_to_batch",
287            "weights_apply_query_vars",
288            "weights_restore_query_vars",
289            "weights_apply_query_vars_false_batched",
290            "weights_restore_query_vars_false_batched",
291            "weights_apply_query_vars_true_batched",
292            "weights_restore_query_vars_true_batched",
293        ],
294    },
295    KernelModuleSpec {
296        cu_name: "circuit",
297        module_name: "xlog_circuit",
298        kernels: &[
299            "xgcf_forward_level",
300            "xgcf_backward_level_propagate",
301            "xgcf_backward_level_decision_grad",
302            "xgcf_backward_level_lit_grad",
303            "xgcf_free_var_apply_grad",
304            "xgcf_free_var_reduce_stage",
305            "xgcf_add_scalar",
306            "xgcf_forward_level_cached",
307            "xgcf_eval_all_levels_cached",
308            "xgcf_eval_all_levels_cached_batched",
309            "xgcf_backward_level_propagate_cached",
310            "xgcf_backward_level_decision_grad_cached",
311            "xgcf_backward_level_lit_grad_cached",
312            "xgcf_backward_all_levels_cached",
313            "xgcf_backward_all_levels_cached_batched",
314            "xgcf_free_var_apply_grad_cached",
315            "xgcf_free_var_reduce_stage_cached",
316            "xgcf_add_scalar_cached",
317            "xgcf_set_root_adj_cached_batched",
318            "xgcf_copy_root_cached",
319            "xgcf_copy_root_cached_meta",
320            "xgcf_copy_root_cached_meta_batched",
321        ],
322    },
323    KernelModuleSpec {
324        cu_name: "mc_sample",
325        module_name: "xlog_mc_sample",
326        kernels: &["mc_sample_bernoulli"],
327    },
328    KernelModuleSpec {
329        cu_name: "mc_eval",
330        module_name: "xlog_mc_eval",
331        kernels: &[
332            "mc_eval_mask_var",
333            "mc_eval_mask_ad_choice",
334            "mc_eval_query_evidence_truth",
335            "mc_accumulate_counts",
336        ],
337    },
338    KernelModuleSpec {
339        cu_name: "arith",
340        module_name: "xlog_arith",
341        kernels: &[
342            "arith_binary_i64",
343            "arith_binary_i32",
344            "arith_binary_u64",
345            "arith_binary_u32",
346            "arith_binary_f64",
347            "arith_binary_f32",
348            "arith_abs_i64",
349            "arith_abs_i32",
350            "arith_abs_f64",
351            "arith_abs_f32",
352            "arith_pow_f64",
353            "arith_cast",
354            "arith_fill_const_u32",
355            "arith_fill_const_u64",
356            "arith_fill_const_i64",
357            "arith_fill_const_i32",
358            "arith_fill_const_f64",
359            "arith_fill_const_f32",
360            "arith_fill_const_u8",
361            "arith_select_i64",
362            "arith_select_i32",
363            "arith_select_u64",
364            "arith_select_u32",
365            "arith_select_f64",
366            "arith_select_f32",
367        ],
368    },
369    KernelModuleSpec {
370        cu_name: "sat",
371        module_name: "xlog_sat",
372        kernels: &[
373            "sat_cdcl_solve",
374            "sat_check_model",
375            "sat_proof_mark_needed",
376            "sat_proof_check",
377            "sat_assert_status",
378            "sat_assert_ok",
379            "sat_xgcf_cnf_counts",
380            "sat_xgcf_cnf_emit",
381            "sat_xgcf_cnf_capture_last_counts",
382            "sat_xgcf_cnf_compute_totals",
383            "sat_cnf_write_terminator",
384            "sat_cnf_copy_into",
385            "sat_shift_offsets",
386            "sat_xgcf_write_root_unit_clause",
387            "sat_not_phi_counts",
388            "sat_emit_not_phi",
389        ],
390    },
391    KernelModuleSpec {
392        cu_name: "d4",
393        module_name: "xlog_d4",
394        kernels: &[
395            "d4_validate_cnf",
396            "d4_levelize_counts",
397            "d4_levelize_emit",
398            "d4_frontier_prepare",
399            "d4_frontier_expand",
400            "d4_compile_count",
401            "d4_compile_emit",
402            "d4_capture_emit_meta",
403            "d4_support_level",
404            "d4_support_set_root_bits",
405            "d4_smooth_count",
406            "d4_smooth_wrapper_counts",
407            "d4_smooth_wrapper_edge_counts_or",
408            "d4_smooth_wrapper_edge_counts_dec",
409            "d4_smooth_init_nodes",
410            "d4_smooth_emit_level",
411            "d4_smooth_check_edge_cap",
412            "d4_mark_vars_in_clauses",
413            "d4_mark_vars_in_circuit",
414            "d4_build_free_var_mask",
415            "d4_assert_u32_eq",
416            "d4_assert_bitset_var",
417            "d4_assert_leaf_root_and_degree",
418        ],
419    },
420    KernelModuleSpec {
421        cu_name: "neural",
422        module_name: "xlog_neural",
423        kernels: &[
424            "neural_fill_ad_chain_f32",
425            "neural_scatter_ad_chain_grads_f32",
426        ],
427    },
428    KernelModuleSpec {
429        cu_name: "ilp",
430        module_name: "xlog_ilp",
431        kernels: &[
432            "extract_nonzero_indices",
433            "ilp_mark_selected_ids_u32",
434            "ilp_mark_selected_ids_i32",
435            "ilp_mark_selected_ids_i64",
436            "ilp_mark_selected_ids_u64",
437            "ilp_validate_selected_ids_u32",
438            "ilp_validate_selected_ids_i32",
439            "ilp_validate_selected_ids_i64",
440            "ilp_validate_selected_ids_u64",
441            "ilp_broadcast_candidate_flag",
442            "ilp_coo_fill_from_mask",
443            "ilp_csr_histogram",
444            "ilp_reduce_sum_f32",
445            "ilp_reduce_sum_f64",
446        ],
447    },
448    KernelModuleSpec {
449        cu_name: "ilp_credit",
450        module_name: "xlog_ilp_credit",
451        kernels: &[
452            "ilp_coo_fill",
453            "ilp_credit_forward_f32",
454            "ilp_credit_forward_f64",
455            "ilp_credit_backward_f32",
456            "ilp_credit_backward_f64",
457        ],
458    },
459    KernelModuleSpec {
460        cu_name: "ilp_exact",
461        module_name: "xlog_ilp_exact",
462        kernels: &[
463            "ilp_exact_score",
464            "ilp_exact_score_u32",
465            "ilp_exact_score_chain_smem",
466            "ilp_exact_score_chain_smem_u32",
467            "ilp_exact_select_topk",
468        ],
469    },
470    KernelModuleSpec {
471        cu_name: "ilp_exact_nary",
472        module_name: "xlog_ilp_exact_nary",
473        kernels: &["ilp_exact_nary_score"],
474    },
475    KernelModuleSpec {
476        cu_name: "epistemic",
477        module_name: "xlog_epistemic",
478        kernels: &[
479            "epistemic_generate_candidate_assumptions_u8",
480            "epistemic_propagate_candidates_u8",
481            "epistemic_validate_candidate_bits_u8",
482            "epistemic_populate_model_membership_u8",
483            "epistemic_populate_model_membership_from_tuple_source_u8",
484            "epistemic_populate_model_membership_from_tuple_source_arity1_u8",
485            "epistemic_populate_model_membership_from_tuple_source_arity2_u8",
486            "epistemic_populate_model_membership_from_tuple_source_arity3_u8",
487            "epistemic_populate_model_membership_from_tuple_source_arity_n_u8",
488            "epistemic_validate_world_views_u8",
489            "epistemic_validate_constraints_u8",
490            "epistemic_materialize_accepted_candidates_u8",
491            "epistemic_materialize_final_result_flags_u8",
492            "epistemic_build_final_tuple_row_map_u8",
493            "epistemic_close_final_tuple_rejections_u8",
494            "epistemic_materialize_final_tuple_column_u8",
495        ],
496    },
497    KernelModuleSpec {
498        cu_name: "wcoj",
499        module_name: "xlog_wcoj",
500        kernels: &[
501            "wcoj_build_metadata_mark_boundaries_u32",
502            "wcoj_build_metadata_mark_boundaries_u64",
503            "wcoj_build_metadata_scatter_u32",
504            "wcoj_build_metadata_scatter_u64",
505            "wcoj_triangle_build_hg_work_plan_u32",
506            "wcoj_triangle_count_hg_u32",
507            "wcoj_triangle_groupby_root_count_hg_u32",
508            "wcoj_triangle_groupby_root_sum_hg_u32",
509            "wcoj_triangle_groupby_root_min_hg_u32",
510            "wcoj_triangle_groupby_root_max_hg_u32",
511            "wcoj_triangle_materialize_hg_u32",
512            "wcoj_triangle_build_hg_work_plan_u64",
513            "wcoj_triangle_count_hg_u64",
514            "wcoj_triangle_groupby_root_count_hg_u64",
515            "wcoj_triangle_groupby_root_sum_hg_u64",
516            "wcoj_triangle_groupby_root_min_hg_u64",
517            "wcoj_triangle_groupby_root_max_hg_u64",
518            "wcoj_groupby_root_segment_sum_counts_u32",
519            "wcoj_groupby_root_segment_sum_values_u64",
520            "wcoj_groupby_root_segment_min_values_u64",
521            "wcoj_groupby_root_segment_max_values_u64",
522            "wcoj_triangle_materialize_hg_u64",
523            "wcoj_triangle_count_hg_cached_u32",
524            "wcoj_triangle_materialize_hg_cached_u32",
525            "wcoj_scan_hg_block_counts_u32",
526            "wcoj_compute_total",
527            "wcoj_layout_check_sorted_unique_u32",
528            "wcoj_layout_check_sorted_unique_u64",
529            "wcoj_4cycle_build_e2_work_prefix_u32",
530            "wcoj_4cycle_build_hg_work_plan_u32",
531            "wcoj_4cycle_count_hg_u32",
532            "wcoj_4cycle_groupby_root_count_hg_u32",
533            "wcoj_4cycle_groupby_root_sum_hg_u32",
534            "wcoj_4cycle_groupby_root_min_hg_u32",
535            "wcoj_4cycle_groupby_root_max_hg_u32",
536            "wcoj_4cycle_materialize_hg_u32",
537            "wcoj_4cycle_build_e2_work_prefix_u64",
538            "wcoj_4cycle_build_hg_work_plan_u64",
539            "wcoj_4cycle_count_hg_u64",
540            "wcoj_4cycle_groupby_root_count_hg_u64",
541            "wcoj_4cycle_materialize_hg_u64",
542            // General-arity WCOJ clique kernel family (k=5..8 from
543            // a single C++ template; ABI wrappers below are
544            // template-call-only for source-auditability).
545            "wcoj_clique5_count_hg_u32",
546            "wcoj_clique5_materialize_hg_u32",
547            "wcoj_clique5_count_hg_u64",
548            "wcoj_clique5_materialize_hg_u64",
549            "wcoj_clique6_count_hg_u32",
550            "wcoj_clique6_materialize_hg_u32",
551            "wcoj_clique6_count_hg_u64",
552            "wcoj_clique6_materialize_hg_u64",
553            "wcoj_clique7_count_hg_u32",
554            "wcoj_clique7_materialize_hg_u32",
555            "wcoj_clique7_count_hg_u64",
556            "wcoj_clique7_materialize_hg_u64",
557            "wcoj_clique8_count_hg_u32",
558            "wcoj_clique8_materialize_hg_u32",
559            "wcoj_clique8_count_hg_u64",
560            "wcoj_clique8_materialize_hg_u64",
561            // Aggregate-fused K-clique group-by-root count kernels (u32
562            // width-class, K=5/6).
563            "wcoj_clique5_groupby_root_count_hg_u32",
564            "wcoj_clique6_groupby_root_count_hg_u32",
565            // GPU Free Join level-synchronous frontier engine primitives.
566            "fj_expand_work_prefix_u32",
567            "fj_expand_count_u32",
568            "fj_expand_emit_u32",
569            "fj_probe_refine_u32",
570            // u64 width-class twins (work prefix is
571            // width-agnostic and shared).
572            "fj_expand_count_u64",
573            "fj_expand_emit_u64",
574            "fj_probe_refine_u64",
575            // Factorized count epilogue (width-agnostic).
576            "fj_count_multiplicity",
577            // D3 S3 spike — factorized recursive delta novel-set
578            // pipeline (dense-domain bitmap union–diff).
579            "fj_delta_range_u32",
580            "fj_delta_mark_u32",
581            "fj_delta_subtract_u32",
582            "fj_delta_popcount",
583            "fj_delta_emit_u32",
584            "fj_delta_max_u32",
585            // D3 sparse-domain spike — hash-set novel pipeline.
586            "fj_delta_sparse_estimate",
587            "fj_delta_sparse_load_r",
588            "fj_delta_sparse_insert_candidates",
589            "fj_delta_sparse_mark",
590            "fj_delta_sparse_emit",
591        ],
592    },
593    KernelModuleSpec {
594        cu_name: "mc_resident",
595        module_name: "xlog_mc_resident",
596        kernels: &["mc_resident_engine"],
597    },
598    KernelModuleSpec {
599        cu_name: "joint_solve",
600        module_name: "xlog_joint_solve",
601        kernels: &[
602            "joint_label_feasibility",
603            "joint_label_top2",
604            "joint_component_plan_init",
605            "joint_component_entity_owners",
606            "joint_component_union",
607            "joint_component_compress",
608            "joint_component_enumerate",
609            "joint_component_chain_dp",
610            "joint_component_branch_and_bound",
611        ],
612    },
613    KernelModuleSpec {
614        cu_name: "resident_relational",
615        module_name: "xlog_resident_relational",
616        kernels: &[
617            "resident_set_insert",
618            "resident_set_finalize",
619            "resident_join_build",
620            "resident_join_probe_inner",
621            "resident_join_probe_semi",
622            "resident_join_finalize",
623            "resident_control_initialize",
624            "resident_scc_begin",
625            "resident_changed_reset",
626            "resident_changed_mark",
627            "resident_convergence",
628            "resident_terminal_success",
629            "resident_test_status",
630            "resident_trace_initialize",
631            "resident_trace_increment",
632            "resident_schema_winners_initialize",
633            "resident_schema_winner_mark",
634            "resident_receipt_pack",
635        ],
636    },
637    KernelModuleSpec {
638        cu_name: "resident_filter_project",
639        module_name: "xlog_resident_filter_project",
640        kernels: &[
641            "resident_filter_mask_scan",
642            "resident_filter_scan_blocks",
643            "resident_filter_add_offsets",
644            "resident_filter_finalize",
645            "resident_filter_compact",
646            "resident_project_finalize",
647            "resident_project_materialize",
648        ],
649    },
650    KernelModuleSpec {
651        cu_name: "resident_schedule",
652        module_name: "xlog_resident_schedule",
653        kernels: &["resident_schedule_execute"],
654    },
655    KernelModuleSpec {
656        cu_name: "semantic_hypergraph",
657        module_name: "xlog_semantic_hypergraph",
658        kernels: &["semantic_hypergraph_execute"],
659    },
660    KernelModuleSpec {
661        cu_name: "semantic_training_view",
662        module_name: "xlog_semantic_training_view",
663        kernels: &[
664            "semantic_training_view_select",
665            "semantic_training_view_gather",
666        ],
667    },
668    KernelModuleSpec {
669        cu_name: "semantic_transition",
670        module_name: "xlog_semantic_transition",
671        kernels: &[
672            "semantic_transition_execute",
673            "semantic_feedback_encode",
674            "semantic_feedback_project",
675            "semantic_publication_content_guard",
676            "semantic_retained_model_contract_guard",
677            "semantic_tensor_content_witness",
678            "semantic_model_work_reset",
679            "semantic_model_invocation",
680            "semantic_model_evaluation_result",
681            "semantic_learning_fold",
682            #[cfg(feature = "semantic-policy")]
683            "semantic_policy_uniform_domains",
684            "semantic_publication_step_inputs",
685            "semantic_prepared_replay_parent",
686            "semantic_publication_step_input_guard",
687            "semantic_completed_step_input_guard",
688            "semantic_publication_step_admit",
689            "semantic_publication_step_kind_gate",
690            "semantic_publication_step_kind_bank_gate",
691            "semantic_publication_step_active_gate",
692            "semantic_publication_step_release",
693            "semantic_publication_model_seals",
694            "semantic_publication_step_result",
695            "semantic_publication_prepare_continuation",
696            "semantic_publication_prepare_model_update_admissibility",
697            "semantic_publication_apply_model_update",
698            "semantic_publication_prepare_drain",
699        ],
700    },
701];
702
703#[cfg(test)]
704mod tests {
705    use super::*;
706
707    #[test]
708    fn kernel_modules_matches_cu_names() {
709        assert_eq!(
710            KERNEL_MODULES.len(),
711            KERNEL_CU_NAMES.len(),
712            "KERNEL_MODULES length ({}) != KERNEL_CU_NAMES length ({})",
713            KERNEL_MODULES.len(),
714            KERNEL_CU_NAMES.len(),
715        );
716        for (i, spec) in KERNEL_MODULES.iter().enumerate() {
717            assert_eq!(
718                spec.cu_name, KERNEL_CU_NAMES[i],
719                "KERNEL_MODULES[{}].cu_name = {:?}, expected {:?}",
720                i, spec.cu_name, KERNEL_CU_NAMES[i],
721            );
722        }
723    }
724
725    #[test]
726    fn semantic_consumers_are_loaded_with_their_producer_guards() {
727        let module = KERNEL_MODULES
728            .iter()
729            .find(|module| module.module_name == "xlog_semantic_transition")
730            .expect("semantic transition module is registered");
731        for entry in [
732            "semantic_feedback_encode",
733            "semantic_feedback_project",
734            "semantic_publication_content_guard",
735            "semantic_tensor_content_witness",
736            "semantic_publication_prepare_continuation",
737        ] {
738            assert!(
739                module.kernels.contains(&entry),
740                "native semantic entry {entry} is absent from the loaded symbol roster"
741            );
742        }
743    }
744
745    #[test]
746    fn acquired_step_inputs_and_original_baseline_guard_are_loaded_together() {
747        let module = KERNEL_MODULES
748            .iter()
749            .find(|module| module.module_name == "xlog_semantic_transition")
750            .expect("semantic transition module is registered");
751        for entry in [
752            "semantic_publication_step_inputs",
753            "semantic_publication_step_input_guard",
754            "semantic_publication_step_admit",
755            "semantic_publication_step_release",
756            "semantic_publication_step_result",
757            "semantic_publication_model_seals",
758        ] {
759            assert!(
760                module.kernels.contains(&entry),
761                "acquired step input entry {entry} is absent from the loaded symbol roster"
762            );
763        }
764    }
765
766    #[test]
767    fn all_kernel_entries_are_non_empty() {
768        for spec in KERNEL_MODULES {
769            assert!(
770                !spec.kernels.is_empty(),
771                "module {:?} has no kernel entries",
772                spec.cu_name,
773            );
774            assert!(
775                !spec.module_name.is_empty(),
776                "module {:?} has empty module_name",
777                spec.cu_name,
778            );
779        }
780    }
781}