tenferro-cpu 0.4.0

CPU backend, kernels, provider selection, and CPU resource pools for tenferro.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
use std::mem::{size_of, size_of_val};
use std::num::NonZeroUsize;
use std::sync::Arc;

use tenferro_runtime::program::CoreSemanticOp;
use tenferro_runtime::{
    CompareDir, DType, DotGeneralConfig, DotGeneralPreparation, ElementwiseRuntime, EngineId,
    IndexingRuntime, InputSignature, InputSignatureEntry, InputSpecializationProjection,
    InputSpecializationRequirements, LayoutClass, LayoutRuntime, LayoutSpecialization,
    PlacementSpecialization, ReductionRuntime, Runtime, RuntimeCacheOwner, SpecializationError,
    SpecializationRequirements,
};
use tenferro_tensor::{
    CpuDomainId, GatherConfig, PadConfig, Placement, ScatterConfig, ShapeVec, SliceConfig,
    StrideVec, Tensor, TensorIndexing,
};

use super::{
    checked_specialization_heap_retained_bytes, concrete_axes_for_rank, cpu_operation_kind,
    minimum_specialization_requirements, CpuPreparedKind,
};
use crate::CpuBackend;

#[test]
fn cpu_backend_coerces_to_all_runtime_traits() {
    let backend = Arc::new(CpuBackend::new());

    let _: Arc<dyn ElementwiseRuntime> = backend.clone();
    let _: Arc<dyn ReductionRuntime> = backend.clone();
    let _: Arc<dyn IndexingRuntime> = backend.clone();
    let _: Arc<dyn DotGeneralPreparation> = backend.clone();
    let _: Arc<dyn LayoutRuntime> = backend.clone();
    let _: Arc<dyn RuntimeCacheOwner> = backend;
}

#[test]
fn public_cpu_runtime_registration_exposes_complete_preparation_capabilities() {
    let backend = CpuBackend::new();

    let registration = crate::runtime_engine_registration(&backend).expect("CPU registration");

    assert_eq!(registration.engine_id().as_str(), "tenferro-cpu.default.v1");
    let capabilities = registration.capabilities();
    assert!(capabilities.elementwise().is_some());
    assert!(capabilities.reduction().is_some());
    assert!(capabilities.indexing().is_some());
    assert!(capabilities.dot_general().is_some());
    assert!(capabilities.layout().is_some());
    let expected_provider_id = match backend.kind() {
        crate::CpuBackendKind::Faer => "tenferro.cpu.faer",
        crate::CpuBackendKind::Blas => "tenferro.cpu.blas",
    };
    assert_eq!(
        registration
            .provider_device_identity()
            .provider_id()
            .as_str(),
        expected_provider_id
    );
    assert_eq!(
        registration.provider_device_identity().target_identity(),
        format!("domain:{}", backend.execution_info().domain_id().as_u64())
    );
}

#[test]
fn public_cpu_runtime_registration_tracks_distinct_selected_cpu_domains() {
    let topology = crate::discover_cpu_topology().expect("CPU topology");
    if topology.nodes().len() < 2 {
        return;
    }
    let first_node = &topology.nodes()[0];
    let second_node = &topology.nodes()[1];
    let first_domain_id = CpuDomainId::new(101);
    let second_domain_id = CpuDomainId::new(102);
    let first_domain = crate::ExternalCpuDomain::new(
        first_domain_id,
        crate::ResolvedCpuPlacement::NumaNode {
            id: first_node.id(),
            cpus: first_node.cpus().clone(),
        },
        Arc::new(crate::CpuContext::with_threads(1).expect("first CPU context")),
        NonZeroUsize::new(1).unwrap(),
        crate::CpuPlacementGuarantee::AdvisoryDeclared,
    )
    .expect("first CPU domain");
    let second_domain = crate::ExternalCpuDomain::new(
        second_domain_id,
        crate::ResolvedCpuPlacement::NumaNode {
            id: second_node.id(),
            cpus: second_node.cpus().clone(),
        },
        Arc::new(crate::CpuContext::with_threads(1).expect("second CPU context")),
        NonZeroUsize::new(1).unwrap(),
        crate::CpuPlacementGuarantee::AdvisoryDeclared,
    )
    .expect("second CPU domain");
    let first = crate::CpuBackend::from_external_managed_domains(first_domain_id, [first_domain])
        .expect("first external CPU backend");
    let second =
        crate::CpuBackend::from_external_managed_domains(second_domain_id, [second_domain])
            .expect("second external CPU backend");

    let first_registration = crate::runtime_engine_registration_with_id(
        &first,
        EngineId::new("tenferro-cpu.domain-first.v1").expect("first engine ID"),
    )
    .expect("first CPU registration");
    let second_registration = crate::runtime_engine_registration_with_id(
        &second,
        EngineId::new("tenferro-cpu.domain-second.v1").expect("second engine ID"),
    )
    .expect("second CPU registration");
    assert_ne!(
        first_registration.provider_device_identity(),
        second_registration.provider_device_identity()
    );
    assert_eq!(
        first_registration
            .provider_device_identity()
            .target_identity(),
        "domain:101"
    );
    assert_eq!(
        second_registration
            .provider_device_identity()
            .target_identity(),
        "domain:102"
    );
}

#[test]
fn public_cpu_runtime_registration_allows_two_selected_cpu_domains_in_one_runtime() {
    let topology = crate::discover_cpu_topology().expect("CPU topology");
    if topology.nodes().len() < 2 {
        return;
    }
    let first_node = &topology.nodes()[0];
    let second_node = &topology.nodes()[1];
    let first_domain_id = CpuDomainId::new(201);
    let second_domain_id = CpuDomainId::new(202);
    let first_domain = crate::ExternalCpuDomain::new(
        first_domain_id,
        crate::ResolvedCpuPlacement::NumaNode {
            id: first_node.id(),
            cpus: first_node.cpus().clone(),
        },
        Arc::new(crate::CpuContext::with_threads(1).expect("first CPU context")),
        NonZeroUsize::new(1).unwrap(),
        crate::CpuPlacementGuarantee::AdvisoryDeclared,
    )
    .expect("first CPU domain");
    let second_domain = crate::ExternalCpuDomain::new(
        second_domain_id,
        crate::ResolvedCpuPlacement::NumaNode {
            id: second_node.id(),
            cpus: second_node.cpus().clone(),
        },
        Arc::new(crate::CpuContext::with_threads(1).expect("second CPU context")),
        NonZeroUsize::new(1).unwrap(),
        crate::CpuPlacementGuarantee::AdvisoryDeclared,
    )
    .expect("second CPU domain");
    let first_backend = CpuBackend::from_external_managed_domains(first_domain_id, [first_domain])
        .expect("first external CPU backend");
    let second_backend =
        CpuBackend::from_external_managed_domains(second_domain_id, [second_domain])
            .expect("second external CPU backend");
    let first_id = EngineId::new("tenferro-cpu.first.v1").expect("first engine ID");
    let second_id = EngineId::new("tenferro-cpu.second.v1").expect("second engine ID");

    let mut builder = Runtime::builder();
    builder
        .register_engine(
            crate::runtime_engine_registration_with_id(&first_backend, first_id.clone())
                .expect("first CPU registration"),
        )
        .expect("register first CPU engine");
    builder
        .register_engine(
            crate::runtime_engine_registration_with_id(&second_backend, second_id.clone())
                .expect("second CPU registration"),
        )
        .expect("register second CPU engine");
    let runtime = builder.build().expect("runtime with two CPU engines");
    let snapshot = runtime.snapshot().expect("runtime snapshot");

    assert_eq!(snapshot.engine_count(), 2);
    assert_eq!(snapshot.engine(&first_id).unwrap().engine_id(), &first_id);
    assert_eq!(snapshot.engine(&second_id).unwrap().engine_id(), &second_id);
}

#[cfg(all(feature = "cpu-faer", feature = "cpu-blas"))]
#[test]
fn public_cpu_runtime_registration_supports_distinct_compiled_provider_kinds() {
    let faer = CpuBackend::with_threads_and_kind(1, crate::CpuBackendKind::Faer)
        .expect("faer CPU backend");
    let blas = CpuBackend::with_threads_and_kind(1, crate::CpuBackendKind::Blas)
        .expect("BLAS CPU backend");

    assert_ne!(faer.kind(), blas.kind());
    let faer_registration = crate::runtime_engine_registration_with_id(
        &faer,
        EngineId::new("tenferro-cpu.faer.identity.v1").expect("faer engine ID"),
    )
    .expect("faer CPU registration");
    let blas_registration = crate::runtime_engine_registration_with_id(
        &blas,
        EngineId::new("tenferro-cpu.blas.identity.v1").expect("BLAS engine ID"),
    )
    .expect("BLAS CPU registration");
    assert_eq!(
        faer_registration
            .provider_device_identity()
            .provider_id()
            .as_str(),
        "tenferro.cpu.faer"
    );
    assert_eq!(
        blas_registration
            .provider_device_identity()
            .provider_id()
            .as_str(),
        "tenferro.cpu.blas"
    );
    assert_ne!(
        faer_registration.provider_device_identity(),
        blas_registration.provider_device_identity()
    );

    let mut builder = Runtime::builder();
    builder
        .register_engine(
            crate::runtime_engine_registration_with_id(
                &faer,
                EngineId::new("tenferro-cpu.faer.v1").expect("faer engine ID"),
            )
            .expect("faer CPU registration"),
        )
        .expect("register faer CPU engine");
    builder
        .register_engine(
            crate::runtime_engine_registration_with_id(
                &blas,
                EngineId::new("tenferro-cpu.blas.v1").expect("BLAS engine ID"),
            )
            .expect("BLAS CPU registration"),
        )
        .expect("register BLAS CPU engine");
    assert_eq!(
        builder
            .build()
            .expect("runtime")
            .snapshot()
            .unwrap()
            .engine_count(),
        2
    );
}

#[test]
fn cpu_family_minimum_specialization_matches_adapter_contract() {
    let signature = two_input_signature();

    assert_minimum_requirements(
        &minimum_specialization_requirements(CpuPreparedKind::Elementwise, &signature)
            .expect("elementwise requirements"),
        &[&[], &[]],
        LayoutSpecialization::None,
    );
    assert_minimum_requirements(
        &minimum_specialization_requirements(CpuPreparedKind::Reduction, &signature)
            .expect("reduction requirements"),
        &[&[], &[]],
        LayoutSpecialization::None,
    );
    assert_minimum_requirements(
        &minimum_specialization_requirements(CpuPreparedKind::Indexing, &signature)
            .expect("indexing requirements"),
        &[&[0, 1], &[0]],
        LayoutSpecialization::None,
    );
    assert_minimum_requirements(
        &minimum_specialization_requirements(CpuPreparedKind::DotGeneral, &signature)
            .expect("dot requirements"),
        &[&[0, 1], &[0]],
        LayoutSpecialization::Class,
    );
    assert_minimum_requirements(
        &minimum_specialization_requirements(CpuPreparedKind::Layout, &signature)
            .expect("layout requirements"),
        &[&[], &[]],
        LayoutSpecialization::None,
    );
}

#[test]
fn cpu_specialization_projection_retained_bytes_count_owned_heap_payloads() {
    let signature = two_input_signature();
    let requirements = minimum_specialization_requirements(CpuPreparedKind::DotGeneral, &signature)
        .expect("dot requirements");
    let projection = requirements.project(&signature).expect("projection");

    let expected = size_of_val(requirements.inputs())
        + (2 + 1) * size_of::<u32>()
        + size_of_val(projection.inputs())
        + (2 + 1) * size_of::<(u32, usize)>();
    assert_eq!(
        checked_specialization_heap_retained_bytes(&projection),
        Some(expected)
    );
}

#[test]
fn cpu_specialization_projection_retained_bytes_count_spilled_exact_strides() {
    let signature = high_rank_signature();
    let mut builder = InputSpecializationRequirements::builder();
    builder
        .rank(true)
        .layout(LayoutSpecialization::ExactStrides);
    let requirements =
        SpecializationRequirements::new(vec![builder.build().expect("requirements")]);
    let projection = requirements.project(&signature).expect("projection");

    let expected = size_of::<InputSpecializationRequirements>()
        + size_of::<InputSpecializationProjection>()
        + 9 * size_of::<isize>();
    assert_eq!(
        checked_specialization_heap_retained_bytes(&projection),
        Some(expected)
    );
}

#[test]
fn cpu_runtime_adapter_source_stays_metadata_only() {
    let source = include_str!("../runtime_adapter.rs");

    assert!(!source.contains("use tenferro_tensor"));
    assert!(!source.contains("Tensor::"));
    assert!(!source.contains("lock_engine_resources"));
    assert!(!source.contains(".install("));
    assert!(!source.contains("with_backend_session"));
    assert!(!source.contains("execute_"));
}

#[test]
fn cpu_runtime_adapter_has_only_the_six_runtime_trait_impls_on_cpu_backend() {
    let source = include_str!("../runtime_adapter.rs");

    for implementation in [
        "impl ElementwiseRuntime for CpuBackend",
        "impl ReductionRuntime for CpuBackend",
        "impl IndexingRuntime for CpuBackend",
        "impl DotGeneralPreparation for CpuBackend",
        "impl LayoutRuntime for CpuBackend",
        "impl RuntimeCacheOwner for CpuBackend",
    ] {
        assert_eq!(
            source.matches(implementation).count(),
            1,
            "{implementation}"
        );
    }
    assert!(!source.contains("pub struct"));
    assert!(!source.contains("pub enum"));
}

#[test]
fn cpu_backend_cache_owner_hooks_report_and_clear_current_engine_caches() {
    let mut backend = CpuBackend::with_threads(1).expect("backend");

    let stats = RuntimeCacheOwner::cache_stats(&backend).expect("cache stats");
    assert_eq!(stats.entries, 0);
    assert_eq!(stats.retained_bytes, 0);
    assert_eq!(stats.hits, 0);
    assert_eq!(stats.misses, 0);
    assert_eq!(stats.evictions, 0);
    assert_eq!(stats.clears, 0);

    let operand = Tensor::from_vec_col_major(vec![3], vec![1.0_f64, 2.0, 3.0]).expect("operand");
    let indices = Tensor::from_vec_col_major(vec![2, 1], vec![0_i64, 2]).expect("indices");
    let config = GatherConfig {
        offset_dims: vec![],
        collapsed_slice_dims: vec![0],
        start_index_map: vec![0],
        index_vector_dim: 1,
        slice_sizes: vec![1],
    };
    backend
        .gather(&operand, &indices, &config)
        .expect("compile gather plan");
    backend
        .gather(&operand, &indices, &config)
        .expect("reuse gather plan");
    let populated = RuntimeCacheOwner::cache_stats(&backend).expect("populated cache stats");
    assert_eq!(populated.entries, 1);
    assert!(populated.retained_bytes > 0);
    assert_eq!(populated.hits, 1);
    assert_eq!(populated.misses, 1);

    RuntimeCacheOwner::clear_caches(&backend).expect("clear caches");
    let cleared = RuntimeCacheOwner::cache_stats(&backend).expect("cleared cache stats");
    assert_eq!(cleared.entries, 0);
    assert_eq!(cleared.retained_bytes, 0);
    assert_eq!(cleared.clears, 1);
}

#[test]
fn current_core_vocabulary_has_explicit_cpu_family_classification() {
    let cases = all_current_core_variants();
    assert_eq!(cases.len(), 50);
    for (operation, expected) in cases {
        assert_eq!(
            cpu_operation_kind(&operation),
            Some(expected),
            "{operation:?}"
        );
    }
}

#[test]
fn concrete_axis_projection_overflow_is_reported_before_allocation() {
    let error = concrete_axes_for_rank(3, usize::MAX).expect_err("rank too large");

    assert!(matches!(
        error,
        tenferro_runtime::PrepareError::Specialization {
            source: SpecializationError::ProjectionOverflow {
                input: 3,
                rank: usize::MAX
            }
        }
    ));
}

fn two_input_signature() -> InputSignature {
    InputSignature::new(vec![
        InputSignatureEntry::new(
            DType::F64,
            ShapeVec::from_vec(vec![2, 3]),
            Placement::default(),
            layout_class(),
            StrideVec::from_vec(vec![1, 2]),
            Some(4),
        )
        .expect("lhs signature"),
        InputSignatureEntry::new(
            DType::F64,
            ShapeVec::from_vec(vec![5]),
            Placement::default(),
            layout_class(),
            StrideVec::from_vec(vec![1]),
            Some(4),
        )
        .expect("rhs signature"),
    ])
}

fn high_rank_signature() -> InputSignature {
    InputSignature::new(vec![InputSignatureEntry::new(
        DType::F64,
        ShapeVec::from_vec(vec![1; 9]),
        Placement::default(),
        layout_class(),
        StrideVec::from_vec(vec![1; 9]),
        None,
    )
    .expect("high-rank signature")])
}

fn layout_class() -> LayoutClass {
    LayoutClass::new("tenferro.layout.compact-col-major.v1").expect("layout class")
}

fn assert_minimum_requirements(
    requirements: &SpecializationRequirements,
    expected_axes: &[&[u32]],
    expected_layout: LayoutSpecialization,
) {
    assert_eq!(requirements.inputs().len(), expected_axes.len());
    for (input, axes) in requirements.inputs().iter().zip(expected_axes) {
        assert!(input.specializes_dtype());
        assert!(input.specializes_rank());
        assert_eq!(input.concrete_dimensions(), *axes);
        assert_eq!(input.placement(), PlacementSpecialization::None);
        assert_eq!(input.layout(), expected_layout);
        assert_eq!(input.alignment_log2(), None);
    }
}

fn all_current_core_variants() -> Vec<(CoreSemanticOp, CpuPreparedKind)> {
    use CpuPreparedKind::{DotGeneral, Elementwise, Indexing, Layout, Reduction};

    vec![
        (CoreSemanticOp::Add, Elementwise),
        (CoreSemanticOp::Sub, Elementwise),
        (CoreSemanticOp::Mul, Elementwise),
        (CoreSemanticOp::Neg, Elementwise),
        (CoreSemanticOp::Conj, Elementwise),
        (
            CoreSemanticOp::DotGeneral {
                config: DotGeneralConfig {
                    lhs_contracting_dims: vec![1],
                    rhs_contracting_dims: vec![0],
                    lhs_batch_dims: vec![],
                    rhs_batch_dims: vec![],
                },
            },
            DotGeneral,
        ),
        (CoreSemanticOp::Transpose { perm: vec![1, 0] }, Layout),
        (
            CoreSemanticOp::Reshape {
                to_shape: vec![1_usize.into()],
            },
            Layout,
        ),
        (
            CoreSemanticOp::BroadcastInDim {
                shape: vec![1_usize.into()],
                dims: vec![0],
            },
            Layout,
        ),
        (
            CoreSemanticOp::Convert {
                from: DType::F32,
                to: DType::F64,
            },
            Layout,
        ),
        (
            CoreSemanticOp::Constant {
                dtype: DType::F64,
                bytes: vec![0; 8],
            },
            Layout,
        ),
        (CoreSemanticOp::ReduceSum { axes: vec![0] }, Reduction),
        (CoreSemanticOp::Div, Elementwise),
        (CoreSemanticOp::Rem, Elementwise),
        (CoreSemanticOp::Abs, Elementwise),
        (CoreSemanticOp::Sign, Elementwise),
        (CoreSemanticOp::Maximum, Elementwise),
        (CoreSemanticOp::Minimum, Elementwise),
        (CoreSemanticOp::Compare(CompareDir::Eq), Elementwise),
        (CoreSemanticOp::Select, Elementwise),
        (CoreSemanticOp::Clamp, Elementwise),
        (CoreSemanticOp::Exp, Elementwise),
        (CoreSemanticOp::Log, Elementwise),
        (CoreSemanticOp::Sin, Elementwise),
        (CoreSemanticOp::Cos, Elementwise),
        (CoreSemanticOp::Tanh, Elementwise),
        (CoreSemanticOp::Sqrt, Elementwise),
        (CoreSemanticOp::Rsqrt, Elementwise),
        (CoreSemanticOp::Pow, Elementwise),
        (CoreSemanticOp::Expm1, Elementwise),
        (CoreSemanticOp::Log1p, Elementwise),
        (
            CoreSemanticOp::ExtractDiag {
                axis_a: 0,
                axis_b: 1,
            },
            Layout,
        ),
        (
            CoreSemanticOp::EmbedDiag {
                axis_a: 0,
                axis_b: 1,
            },
            Layout,
        ),
        (CoreSemanticOp::Tril { k: 0 }, Layout),
        (CoreSemanticOp::Triu { k: 0 }, Layout),
        (
            CoreSemanticOp::Gather(GatherConfig {
                offset_dims: vec![1],
                collapsed_slice_dims: vec![0],
                start_index_map: vec![0],
                index_vector_dim: 1,
                slice_sizes: vec![1],
            }),
            Indexing,
        ),
        (
            CoreSemanticOp::GatherDynamicSliceSizes {
                offset_dims: vec![1],
                collapsed_slice_dims: vec![0],
                start_index_map: vec![0],
                index_vector_dim: 1,
                slice_sizes: vec![1_usize.into()],
            },
            Indexing,
        ),
        (
            CoreSemanticOp::Scatter(ScatterConfig {
                update_window_dims: vec![0],
                inserted_window_dims: vec![0],
                scatter_dims_to_operand_dims: vec![0],
                index_vector_dim: 1,
            }),
            Indexing,
        ),
        (
            CoreSemanticOp::Slice(SliceConfig {
                starts: vec![0],
                limits: vec![1],
                strides: vec![1],
            }),
            Indexing,
        ),
        (
            CoreSemanticOp::DynamicSlice {
                slice_sizes: vec![1],
            },
            Indexing,
        ),
        (CoreSemanticOp::DynamicUpdateSlice, Indexing),
        (
            CoreSemanticOp::Pad(PadConfig {
                edge_padding_low: vec![0],
                edge_padding_high: vec![0],
                interior_padding: vec![0],
            }),
            Indexing,
        ),
        (
            CoreSemanticOp::Concatenate {
                axis: 0,
                input_count: 2,
            },
            Indexing,
        ),
        (CoreSemanticOp::Reverse { axes: vec![0] }, Indexing),
        (CoreSemanticOp::ShapeOf { axis: 0 }, Indexing),
        (CoreSemanticOp::DynamicTruncate { axis: 0 }, Indexing),
        (CoreSemanticOp::PadToMatch { axis: 0 }, Indexing),
        (CoreSemanticOp::ReduceProd { axes: vec![0] }, Reduction),
        (CoreSemanticOp::ReduceMax { axes: vec![0] }, Reduction),
        (CoreSemanticOp::ReduceMin { axes: vec![0] }, Reduction),
    ]
}