chore: remove dead AiDotNet JIT scaffolding; bump Tensors to 0.42.3 (Closes #1015)#1155
chore: remove dead AiDotNet JIT scaffolding; bump Tensors to 0.42.3 (Closes #1015)#1155
Conversation
Also bumps AiDotNet.Native.OneDNN in lockstep. Picks up the recent perf work (backward-op primitive fast paths, net471 SIMD gap fix, memory planning / tile scheduling / operator reordering, plan serialization + stitching audit fixes) and is the baseline for the dead-JIT-scaffolding cleanup in issue #1015. Both net10.0 and net471 build with 0 errors. No source changes needed — the Tensors API is backward-compatible across 0.38 → 0.42. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The src/InferenceOptimization/ directory (16 .cs files + Core/IR/Kernels/Passes subdirs + README + ARCHITECTURE) was orphaned JIT IR/optimization-pass scaffolding from a compilation model that no longer exists. Zero production code in src/ referenced it — only tests and benchmarks did. The AiDotNet.Tensors compilation system (AutoTracer + CompiledInferencePlan + CompiledTrainingPlan, auto-enabled) is the replacement. Removed: - src/InferenceOptimization/ (full tree, 36 .cs files) - tests/AiDotNet.Tests/InferenceOptimization/ + IntegrationTests/InferenceOptimization/ - AiDotNetBenchmarkTests/InferenceOptimization/ - The InferenceOptimization PR #768 regression-tests region in MergedPRBugFixTests.cs - global using MemoryLayout / QuantizationParams aliases in src/Helpers/UsingsHelper.cs and tests/AiDotNet.Tests/GlobalUsings.cs (nothing else in either project uses either of those short names) - src/NeuralNetworks/SyntheticData/TapeLayerBridge.cs — public method ExportMLPGeneratorGraph had zero callers; xmldoc falsely claimed WGAN-GP use but WGANGP.cs:450-456 already uses GradientTape<T> directly - SyntheticTabularGeneratorBase.ExportMLPGeneratorGraph wrapper (dead) - SyntheticTabularGeneratorBase.SupportsJitCompilation + ExportComputationGraph stubs (both threw NotSupportedException) Scrubbed TapeLayerBridge mentions from MedSynthGenerator, MisGANGenerator, TimeGANGenerator private helper xmldoc (the helpers themselves remain — they're still used by in-progress gradient-penalty code or kept for analysis). Cosmetic: the "// InferenceOptimization Operations" and "// Fused Operations for InferenceOptimization" comment labels in src/Enums/OperationType.cs are replaced with generic labels. The enum values themselves are public API and left in place. LIVE and untouched (different systems that share a prefix): - src/Inference/InferenceOptimizer.cs (KV-cache, speculative decoding) - src/Configuration/InferenceOptimizationConfig.cs (quantization config) Build: net10.0 + net471 both green, 0 errors. Tests build green. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The removed AiDotNet JitCompiler left behind a graveyard of stub
methods and now-unreachable graph-building helpers. All of them either
threw NotSupportedException or built ComputationNode<T> trees for a
compiler that no longer exists.
Deleted:
- ExportComputationGraph method on: LayerBase, NeuralNetworkBase,
ClassifierBase, MultiLabelClassifierBase, RegressionBase,
NonLinearRegressionBase, DecisionTreeRegressionBase,
DecisionTreeAsyncRegressionBase, DiffusionModelBase, VAEModelBase,
NoisePredictorBase, AutoMLModelBase, ShardedModelBase, CausalModelBase,
OnlineLearningModelBase, TimeSeriesModelBase,
ReinforcementLearningAgentBase, SurvivalModelBase, NBEATSBlock,
AiModelResult, MCDropoutLayer, BayesianDenseLayer.
- ConvertLayerToGraph helper on NeuralNetworkBase.
- SupportsJitCompilation property on LayerBase + same accompanying
bases (kept on IActivationFunction / IVectorActivationFunction
interfaces and their implementations since those are still consumed
by LoRA / SE / Hyperbolic layer fallback paths).
- Layer-internal graph helpers: LayerBase.ApplyActivationToGraph,
CanActivationBeJitted, SparseLinearLayer.ApplyActivationToComputationNode,
SqueezeAndExcitationLayer.ApplyActivationToGraphNode,
SpyNetLayer.{BuildComputationGraph,BuildPyramidGraph,CreateGridFromFlowGraph,
CreateIdentityGrid,CreateScaleTensor},
DeformableConvolutionalLayer.BuildComputationGraph.
- NonLinearRegressionBase kernel-graph helpers:
ComputeLinearKernel, ComputeRBFKernel, ComputeSigmoidKernel,
ComputePolynomialKernel, ComputeLaplacianKernel, CreateFilledTensorLike.
- DecisionTreeRegressionBase / DecisionTreeAsyncRegressionBase
ExportNodeAsComputationGraph + GetMaxFeatureIndexFromTree helpers.
- NBEATSBlock.ApplyBasisExpansionGraph helper.
- TestScaffoldGenerator emitting the SupportsJitCompilation /
ExportComputationGraph stubs into generated test fixtures.
Stale xmldoc bullets "JIT compilation support via ExportComputationGraph()"
removed from GraphAttentionLayer, GraphIsomorphismLayer, GraphSAGELayer,
PrincipalNeighbourhoodAggregationLayer.
Tests: removed obsolete *_JitRemoved_SupportsJitIsFalse* assertions from
BaseClassesIntegrationTests and the LoRA/KNN/LWR/RotaryPE/QuantizedAttention
SupportsJitCompilation checks. Removed MixedPrecisionIntegrationTests'
TestLayer override of SupportsJitCompilation / ExportComputationGraph.
Compilation is transparent via AiDotNet.Tensors' AutoTracer (auto-enabled,
hot paths compile to CompiledInferencePlan after the 2nd call). Opt out
via TensorCodecOptions.Current.EnableCompilation or the still-supported
AiModelBuilder.ConfigureJitCompilation() builder API (which projects
config onto the live TensorCodecOptions under the hood).
Build: net10.0 + net471 + tests all green, 0 errors.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub. 2 Skipped Deployments
|
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
WalkthroughRemoves the AiDotNet JIT / inference-optimization subsystem and all related artifacts: IR (HLIR/LLIR), optimizer/passes, custom operators and kernels (GEMM, Conv, Attention), HLIR→LLIR lowering, OptimizationInitializer/registry, ExportComputationGraph/IJitCompilable surfaces, tests, docs, examples, and bumps AiDotNet.Tensors / OneDNN versions. Changes
Sequence Diagram(s)(omitted) Estimated code review effort🎯 5 (Critical) | ⏱️ ~120 minutes Possibly related issues
Possibly related PRs
Poem
✨ Finishing Touches🧪 Generate unit tests (beta)
|
There was a problem hiding this comment.
Actionable comments posted: 3
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (4)
src/Enums/OperationType.cs (1)
3-18: 🧹 Nitpick | 🔵 TrivialConsider clarifying JIT compilation references in file-level documentation.
The file-level documentation mentions "JIT compilation" and "the JIT compiler" (lines 4, 12), but the PR removes the InferenceOptimization subsystem. While JIT compilation is preserved via the AiDotNet.Tensors package (AutoTracer + CompiledInferencePlan), users reading this enum might be confused about what compilation model is now in effect.
Consider updating the remarks to clarify that JIT compilation now refers to the Tensors package's automatic compilation pipeline rather than the removed InferenceOptimization subsystem.
📝 Suggested documentation clarification
/// <remarks> /// <para> /// <b>For Beginners:</b> Operation types identify mathematical operations performed on tensors in neural networks. /// /// When building a computation graph, each operation (like adding two tensors or applying an activation function) /// needs to be identified so that: -/// 1. The JIT compiler can optimize the code +/// 1. The automatic compilation pipeline (via AiDotNet.Tensors) can optimize the code /// 2. The automatic differentiation system can compute gradients correctly /// 3. The system can analyze and transform the computation graph /// /// This enum provides type-safe identification of operations, preventing typos and enabling better tooling support. /// </para> /// </remarks>🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/Enums/OperationType.cs` around lines 3 - 18, Update the file-level remarks in the OperationType enum to clarify that references to "JIT compilation" and "the JIT compiler" now refer to the AiDotNet.Tensors package automatic compilation pipeline (e.g., AutoTracer + CompiledInferencePlan) rather than the removed InferenceOptimization subsystem; explicitly mention OperationType and that these operation types are used by the Tensors package's AutoTracer/CompiledInferencePlan pipeline for automatic compilation and differentiation so readers aren’t confused about the current compilation model.src/NeuralNetworks/SyntheticData/MisGANGenerator.cs (2)
643-645:⚠️ Potential issue | 🔴 CriticalBLOCKING: Stub method with empty implementation.
BackwardMaskGenerator(Tensor<T> gradOutput)is an empty stub with no implementation. This violates production readiness requirements.Required action:
- Implement the backward pass for the mask generator, or
- Remove this method entirely if it's not needed for MisGAN training
As per coding guidelines: "Every PR must contain production-ready code. Flag ALL stubs, placeholders, TODO comments, simplified implementations, and non-production-ready code as blocking issues."
🔧 Proposed fix if unused
-#region Backward Passes - - private void BackwardMaskGenerator(Tensor<T> gradOutput) - { - } - private void UpdateDataGeneratorParameters(T learningRate)🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/NeuralNetworks/SyntheticData/MisGANGenerator.cs` around lines 643 - 645, The BackwardMaskGenerator(Tensor<T> gradOutput) method is a blocking empty stub—either implement the mask-generator backward pass or remove the method; to implement it, compute and propagate gradients from gradOutput through the mask generator component (e.g., call the mask generator's backward routine such as MaskGenerator.Backward(gradOutput) or equivalent), accumulate/merge resulting parameter gradients into the MisGANGenerator's gradient buffers and ensure gradients flow to any shared inputs (latent vectors or shared layers) and optimizer state; update any related methods that expect returned gradients and add unit tests that confirm gradients are non-null and parameters update during training (or delete usages and references if you choose to remove the method).
596-604:⚠️ Potential issue | 🔴 CriticalBLOCKING: Gradient penalty methods are incomplete stubs.
Both
ApplyDataGradientPenaltyandApplyMaskGradientPenaltyare called during training (lines 556, 588) but only build layer lists without implementing the actual gradient penalty computation. The class documentation explicitly states MisGAN uses "WGAN-GP training" with gradient penalty, making this a critical missing feature.This is a BLOCKING issue. Either:
- Implement the gradient penalty computation (recommended for WGAN-GP), or
- Remove the calls and update documentation to clarify MisGAN does not use gradient penalty
Shipping methods that are called but do nothing silently breaks the training algorithm.
As per coding guidelines: "Incomplete features: Half-implemented patterns where some code paths work but others silently do nothing."
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/NeuralNetworks/SyntheticData/MisGANGenerator.cs` around lines 596 - 604, Both ApplyDataGradientPenalty and ApplyMaskGradientPenalty are empty stubs called during training; implement proper WGAN-GP gradient penalty computation inside these methods using the discriminator layer lists from BuildDataDiscLayerList and BuildMaskDiscLayerList respectively: for each, create interpolated samples between real and fake, run them through the corresponding discriminator to get scores, compute gradients of scores w.r.t. interpolated inputs, calculate the L2 norm per-sample, form penalty = lambda * (norm - 1)^2 (use the existing penalty weight from class config), and backpropagate/add this penalty to the discriminator loss as done elsewhere in the training loop; alternatively, if you choose not to support GP, remove the calls to ApplyDataGradientPenalty and ApplyMaskGradientPenalty from the training code and update class docs to state MisGAN does not use gradient penalty.src/NeuralNetworks/SyntheticData/TimeGANGenerator.cs (1)
481-483:⚠️ Potential issue | 🔴 CriticalBLOCKING: Empty backward passes region in production code.
The empty
#region Backward Passessection violates production readiness requirements. While TimeGAN uses manual gradient updates in the training steps rather than standard backpropagation, this empty region suggests incomplete refactoring or dead code structure.Required action:
- If backward passes are not needed (GAN-style manual training), remove this empty region entirely
- If backward passes should be implemented for the base class contract, implement them
- Do not ship empty region markers in production code
As per coding guidelines: "Every PR must contain production-ready code. Flag ALL stubs, placeholders, TODO comments, simplified implementations, and non-production-ready code as blocking issues."
🔧 Proposed fix: Remove empty region
-#region Backward Passes - -#endregion - `#region` Parameter Updates🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/NeuralNetworks/SyntheticData/TimeGANGenerator.cs` around lines 481 - 483, The empty "#region Backward Passes" in the TimeGANGenerator class is a blocking leftover; remove the entire empty region marker from TimeGANGenerator (delete the "#region Backward Passes" ... "#endregion" block) so no empty regions remain in production code, and if the generator must satisfy a base-class contract implement the required backward methods/overrides (matching the base class method signatures) inside TimeGANGenerator instead of leaving an empty region; do not leave stub or placeholder region markers.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/TimeSeries/NBEATSBlock.cs`:
- Around line 77-92: ParameterCount, GetParameters and SetParameters omit the
generic-mode trainable basis tensors (_basisBackcast and _basisForecast), so
include those tensors alongside the existing fully-connected params: update
ParameterCount to add _basisBackcast.Length and _basisForecast.Length when those
fields are non-null, extend GetParameters to append the flattened values of
_basisBackcast and _basisForecast after iterating _fcWeights/_fcBiases, and
update SetParameters to consume values back into _basisBackcast and
_basisForecast (respecting their shapes) when reconstructing parameters; use the
existing parameter ordering (fc weights, fc biases, then bases) so import/export
remains consistent and handle null checks for non-generic mode.
- Line 367: The override UpdateParameters(T learningRate) in NBEATSBlock
currently has an empty body and must be made explicit; replace the silent no-op
with a fail-fast behavior by throwing a NotImplementedException (or another
appropriate exception) so callers on the training boundary are immediately
notified, or alternatively delegate to the concrete parameter-update
implementation used by this block (e.g., call a concrete
UpdateParametersImplementation or forward to the optimizer path); update the
method body of UpdateParameters to either throw NotImplementedException with a
clear message referencing NBEATSBlock and learningRate or to call the concrete
update method so the behavior is explicit and production-safe.
- Around line 125-150: The constructor for NBEATSBlock is missing validation for
thetaSizeBackcast, thetaSizeForecast, and polynomialDegree; add checks in the
constructor (same area where lookbackWindow, forecastHorizon, hiddenLayerSize,
and numHiddenLayers are validated) to throw ArgumentException or
ArgumentOutOfRangeException using
nameof(thetaSizeBackcast)/nameof(thetaSizeForecast)/nameof(polynomialDegree)
when theta sizes are not > 0 and when polynomialDegree is negative (or out of an
expected range), then proceed to assign _thetaSizeBackcast, _thetaSizeForecast,
and _polynomialDegree only after validation.
---
Outside diff comments:
In `@src/Enums/OperationType.cs`:
- Around line 3-18: Update the file-level remarks in the OperationType enum to
clarify that references to "JIT compilation" and "the JIT compiler" now refer to
the AiDotNet.Tensors package automatic compilation pipeline (e.g., AutoTracer +
CompiledInferencePlan) rather than the removed InferenceOptimization subsystem;
explicitly mention OperationType and that these operation types are used by the
Tensors package's AutoTracer/CompiledInferencePlan pipeline for automatic
compilation and differentiation so readers aren’t confused about the current
compilation model.
In `@src/NeuralNetworks/SyntheticData/MisGANGenerator.cs`:
- Around line 643-645: The BackwardMaskGenerator(Tensor<T> gradOutput) method is
a blocking empty stub—either implement the mask-generator backward pass or
remove the method; to implement it, compute and propagate gradients from
gradOutput through the mask generator component (e.g., call the mask generator's
backward routine such as MaskGenerator.Backward(gradOutput) or equivalent),
accumulate/merge resulting parameter gradients into the MisGANGenerator's
gradient buffers and ensure gradients flow to any shared inputs (latent vectors
or shared layers) and optimizer state; update any related methods that expect
returned gradients and add unit tests that confirm gradients are non-null and
parameters update during training (or delete usages and references if you choose
to remove the method).
- Around line 596-604: Both ApplyDataGradientPenalty and
ApplyMaskGradientPenalty are empty stubs called during training; implement
proper WGAN-GP gradient penalty computation inside these methods using the
discriminator layer lists from BuildDataDiscLayerList and BuildMaskDiscLayerList
respectively: for each, create interpolated samples between real and fake, run
them through the corresponding discriminator to get scores, compute gradients of
scores w.r.t. interpolated inputs, calculate the L2 norm per-sample, form
penalty = lambda * (norm - 1)^2 (use the existing penalty weight from class
config), and backpropagate/add this penalty to the discriminator loss as done
elsewhere in the training loop; alternatively, if you choose not to support GP,
remove the calls to ApplyDataGradientPenalty and ApplyMaskGradientPenalty from
the training code and update class docs to state MisGAN does not use gradient
penalty.
In `@src/NeuralNetworks/SyntheticData/TimeGANGenerator.cs`:
- Around line 481-483: The empty "#region Backward Passes" in the
TimeGANGenerator class is a blocking leftover; remove the entire empty region
marker from TimeGANGenerator (delete the "#region Backward Passes" ...
"#endregion" block) so no empty regions remain in production code, and if the
generator must satisfy a base-class contract implement the required backward
methods/overrides (matching the base class method signatures) inside
TimeGANGenerator instead of leaving an empty region; do not leave stub or
placeholder region markers.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: e540961b-c8e5-4acb-ae85-389196fe0272
📒 Files selected for processing (109)
AiDotNetBenchmarkTests/InferenceOptimization/AttentionBenchmark.csAiDotNetBenchmarkTests/InferenceOptimization/GemmBenchmark.csAiDotNetBenchmarkTests/InferenceOptimization/SimdBenchmark.csDirectory.Packages.propsdocs/JIT-Compiler-Usage-Guide.mddocs/JIT_ACTIVATION_MAPPING.mddocs/JIT_COMPILATION_PATTERN_GUIDE.mddocs/JIT_ROADMAP.mddocs/JIT_WORKSPACE_DESIGN.mdexamples/JitCompiler/BasicUsageExample.csexamples/JitCompiler/README.mdsrc/AiDotNet.Generators/TestScaffoldGenerator.cssrc/AutoML/AutoMLModelBase.cssrc/CausalInference/CausalModelBase.cssrc/Classification/ClassifierBase.cssrc/Classification/MultiLabel/MultiLabelClassifierBase.cssrc/Diffusion/DiffusionModelBase.cssrc/Diffusion/NoisePredictors/NoisePredictorBase.cssrc/Diffusion/VAE/VAEModelBase.cssrc/DistributedTraining/ShardedModelBase.cssrc/Enums/OperationType.cssrc/Helpers/UsingsHelper.cssrc/InferenceOptimization/ARCHITECTURE.mdsrc/InferenceOptimization/Core/GraphBuilder.cssrc/InferenceOptimization/Core/GraphOptimizer.cssrc/InferenceOptimization/Core/IOptimizationGraph.cssrc/InferenceOptimization/Core/OptimizationGraph.cssrc/InferenceOptimization/Core/OptimizationLevel.cssrc/InferenceOptimization/Core/OptimizationNode.cssrc/InferenceOptimization/Core/OptimizationOptions.cssrc/InferenceOptimization/CustomOperatorRegistry.cssrc/InferenceOptimization/ICustomOperator.cssrc/InferenceOptimization/IR/Common/IRTypes.cssrc/InferenceOptimization/IR/HighLevel/HLIRGraph.cssrc/InferenceOptimization/IR/HighLevel/HLIRNode.cssrc/InferenceOptimization/IR/IIRCompiler.cssrc/InferenceOptimization/IR/LowLevel/LLIRGraph.cssrc/InferenceOptimization/IR/LowLevel/LLIROp.cssrc/InferenceOptimization/IR/Lowering/HLIRToLLIRLowering.cssrc/InferenceOptimization/Kernels/AttentionKernel.cssrc/InferenceOptimization/Kernels/ConvolutionKernel.cssrc/InferenceOptimization/Kernels/GemmKernel.cssrc/InferenceOptimization/OptimizationInitializer.cssrc/InferenceOptimization/Passes/AlgebraicSimplificationPass.cssrc/InferenceOptimization/Passes/CommonSubexpressionEliminationPass.cssrc/InferenceOptimization/Passes/ConstantFoldingPass.cssrc/InferenceOptimization/Passes/ConvBatchNormFusionPass.cssrc/InferenceOptimization/Passes/ConvBatchNormReLUFusionPass.cssrc/InferenceOptimization/Passes/DeadCodeEliminationPass.cssrc/InferenceOptimization/Passes/ElementwiseFusionPass.cssrc/InferenceOptimization/Passes/IOptimizationPass.cssrc/InferenceOptimization/Passes/InPlaceOptimizationPass.cssrc/InferenceOptimization/Passes/LayoutOptimizationPass.cssrc/InferenceOptimization/Passes/MatMulBiasActivationFusionPass.cssrc/InferenceOptimization/Passes/MatMulBiasFusionPass.cssrc/InferenceOptimization/Passes/MemoryReuseOptimizationPass.cssrc/InferenceOptimization/Passes/MultiHeadAttentionFusionPass.cssrc/InferenceOptimization/Passes/OptimizationPassBase.cssrc/InferenceOptimization/Passes/StrengthReductionPass.cssrc/InferenceOptimization/README.mdsrc/Models/Results/AiModelResult.cssrc/NeuralNetworks/Layers/DeformableConvolutionalLayer.cssrc/NeuralNetworks/Layers/GraphAttentionLayer.cssrc/NeuralNetworks/Layers/GraphIsomorphismLayer.cssrc/NeuralNetworks/Layers/GraphSAGELayer.cssrc/NeuralNetworks/Layers/LayerBase.cssrc/NeuralNetworks/Layers/PrincipalNeighbourhoodAggregationLayer.cssrc/NeuralNetworks/Layers/SparseLinearLayer.cssrc/NeuralNetworks/Layers/SpyNetLayer.cssrc/NeuralNetworks/Layers/SqueezeAndExcitationLayer.cssrc/NeuralNetworks/NeuralNetworkBase.cssrc/NeuralNetworks/SyntheticData/MedSynthGenerator.cssrc/NeuralNetworks/SyntheticData/MisGANGenerator.cssrc/NeuralNetworks/SyntheticData/SyntheticTabularGeneratorBase.cssrc/NeuralNetworks/SyntheticData/TapeLayerBridge.cssrc/NeuralNetworks/SyntheticData/TimeGANGenerator.cssrc/OnlineLearning/OnlineLearningModelBase.cssrc/Regression/DecisionTreeAsyncRegressionBase.cssrc/Regression/DecisionTreeRegressionBase.cssrc/Regression/NonLinearRegressionBase.cssrc/Regression/RegressionBase.cssrc/ReinforcementLearning/Agents/ReinforcementLearningAgentBase.cssrc/SurvivalAnalysis/SurvivalModelBase.cssrc/TimeSeries/NBEATSBlock.cssrc/TimeSeries/TimeSeriesModelBase.cssrc/UncertaintyQuantification/Layers/BayesianDenseLayer.cssrc/UncertaintyQuantification/Layers/MCDropoutLayer.cstests/AiDotNet.Tests/Benchmarks/JIT_BENCHMARKS_README.mdtests/AiDotNet.Tests/GlobalUsings.cstests/AiDotNet.Tests/InferenceOptimization/AttentionKernelValidationTests.cstests/AiDotNet.Tests/InferenceOptimization/CacheOptimizerTests.cstests/AiDotNet.Tests/InferenceOptimization/ConvolutionKernelValidationTests.cstests/AiDotNet.Tests/InferenceOptimization/GemmKernelValidationTests.cstests/AiDotNet.Tests/InferenceOptimization/IR/HLIRTests.cstests/AiDotNet.Tests/InferenceOptimization/IR/HLIRToLLIRLoweringTests.cstests/AiDotNet.Tests/InferenceOptimization/IR/IRTypesTests.cstests/AiDotNet.Tests/InferenceOptimization/IR/LLIRTests.cstests/AiDotNet.Tests/InferenceOptimization/OptimizationGraphTests.cstests/AiDotNet.Tests/InferenceOptimization/OptimizationPassTests.cstests/AiDotNet.Tests/InferenceOptimization/SimdKernelsTests.cstests/AiDotNet.Tests/IntegrationTests/InferenceOptimization/InferenceOptimizationDeepMathIntegrationTests.cstests/AiDotNet.Tests/IntegrationTests/InferenceOptimization/InferenceOptimizationIntegrationTests.cstests/AiDotNet.Tests/IntegrationTests/LoRA/LoRAIntegrationTests.cstests/AiDotNet.Tests/IntegrationTests/MixedPrecision/MixedPrecisionIntegrationTests.cstests/AiDotNet.Tests/IntegrationTests/Regression/KernelRegressionIntegrationTests.cstests/AiDotNet.Tests/IntegrationTests/ReinforcementLearning/BaseClassesIntegrationTests.cstests/AiDotNet.Tests/MergedPRBugFixTests.cstests/AiDotNet.Tests/UnitTests/Inference/QuantizedAttentionTests.cstests/AiDotNet.Tests/UnitTests/NeuralNetworks/Layers/RotaryPositionalEncodingLayerTests.cs
💤 Files with no reviewable changes (91)
- src/NeuralNetworks/Layers/SqueezeAndExcitationLayer.cs
- src/Helpers/UsingsHelper.cs
- docs/JIT-Compiler-Usage-Guide.md
- src/InferenceOptimization/ARCHITECTURE.md
- docs/JIT_COMPILATION_PATTERN_GUIDE.md
- src/NeuralNetworks/Layers/GraphSAGELayer.cs
- src/InferenceOptimization/Core/OptimizationLevel.cs
- src/Diffusion/NoisePredictors/NoisePredictorBase.cs
- src/CausalInference/CausalModelBase.cs
- AiDotNetBenchmarkTests/InferenceOptimization/AttentionBenchmark.cs
- src/Classification/ClassifierBase.cs
- src/InferenceOptimization/README.md
- examples/JitCompiler/README.md
- src/NeuralNetworks/Layers/GraphIsomorphismLayer.cs
- tests/AiDotNet.Tests/InferenceOptimization/OptimizationGraphTests.cs
- src/Diffusion/DiffusionModelBase.cs
- src/DistributedTraining/ShardedModelBase.cs
- src/Classification/MultiLabel/MultiLabelClassifierBase.cs
- src/NeuralNetworks/Layers/SparseLinearLayer.cs
- src/InferenceOptimization/OptimizationInitializer.cs
- tests/AiDotNet.Tests/Benchmarks/JIT_BENCHMARKS_README.md
- src/AutoML/AutoMLModelBase.cs
- docs/JIT_ACTIVATION_MAPPING.md
- src/InferenceOptimization/IR/HighLevel/HLIRNode.cs
- src/Diffusion/VAE/VAEModelBase.cs
- src/NeuralNetworks/Layers/DeformableConvolutionalLayer.cs
- tests/AiDotNet.Tests/InferenceOptimization/GemmKernelValidationTests.cs
- src/NeuralNetworks/Layers/GraphAttentionLayer.cs
- src/NeuralNetworks/Layers/PrincipalNeighbourhoodAggregationLayer.cs
- docs/JIT_WORKSPACE_DESIGN.md
- src/InferenceOptimization/Passes/ConstantFoldingPass.cs
- src/OnlineLearning/OnlineLearningModelBase.cs
- src/InferenceOptimization/Passes/DeadCodeEliminationPass.cs
- src/SurvivalAnalysis/SurvivalModelBase.cs
- src/UncertaintyQuantification/Layers/MCDropoutLayer.cs
- src/InferenceOptimization/Kernels/GemmKernel.cs
- src/InferenceOptimization/Core/OptimizationOptions.cs
- src/UncertaintyQuantification/Layers/BayesianDenseLayer.cs
- src/InferenceOptimization/Core/GraphBuilder.cs
- tests/AiDotNet.Tests/InferenceOptimization/AttentionKernelValidationTests.cs
- src/InferenceOptimization/Passes/InPlaceOptimizationPass.cs
- src/InferenceOptimization/Passes/IOptimizationPass.cs
- tests/AiDotNet.Tests/GlobalUsings.cs
- src/InferenceOptimization/Passes/ConvBatchNormFusionPass.cs
- tests/AiDotNet.Tests/InferenceOptimization/CacheOptimizerTests.cs
- src/InferenceOptimization/ICustomOperator.cs
- src/NeuralNetworks/Layers/SpyNetLayer.cs
- AiDotNetBenchmarkTests/InferenceOptimization/SimdBenchmark.cs
- src/InferenceOptimization/Passes/LayoutOptimizationPass.cs
- src/AiDotNet.Generators/TestScaffoldGenerator.cs
- tests/AiDotNet.Tests/InferenceOptimization/ConvolutionKernelValidationTests.cs
- src/InferenceOptimization/Passes/MemoryReuseOptimizationPass.cs
- examples/JitCompiler/BasicUsageExample.cs
- src/Regression/RegressionBase.cs
- src/InferenceOptimization/IR/HighLevel/HLIRGraph.cs
- src/ReinforcementLearning/Agents/ReinforcementLearningAgentBase.cs
- src/Regression/DecisionTreeRegressionBase.cs
- tests/AiDotNet.Tests/InferenceOptimization/IR/HLIRTests.cs
- src/InferenceOptimization/Core/GraphOptimizer.cs
- src/InferenceOptimization/Passes/CommonSubexpressionEliminationPass.cs
- src/NeuralNetworks/NeuralNetworkBase.cs
- src/InferenceOptimization/Passes/MatMulBiasFusionPass.cs
- src/InferenceOptimization/Passes/ConvBatchNormReLUFusionPass.cs
- src/InferenceOptimization/Kernels/ConvolutionKernel.cs
- AiDotNetBenchmarkTests/InferenceOptimization/GemmBenchmark.cs
- src/InferenceOptimization/Passes/AlgebraicSimplificationPass.cs
- src/Regression/NonLinearRegressionBase.cs
- tests/AiDotNet.Tests/InferenceOptimization/IR/LLIRTests.cs
- src/NeuralNetworks/Layers/LayerBase.cs
- src/InferenceOptimization/Passes/MultiHeadAttentionFusionPass.cs
- tests/AiDotNet.Tests/InferenceOptimization/IR/HLIRToLLIRLoweringTests.cs
- src/InferenceOptimization/CustomOperatorRegistry.cs
- src/InferenceOptimization/Passes/StrengthReductionPass.cs
- src/InferenceOptimization/Core/OptimizationNode.cs
- src/InferenceOptimization/IR/Lowering/HLIRToLLIRLowering.cs
- src/Models/Results/AiModelResult.cs
- docs/JIT_ROADMAP.md
- src/InferenceOptimization/Passes/ElementwiseFusionPass.cs
- src/InferenceOptimization/Core/IOptimizationGraph.cs
- src/InferenceOptimization/Passes/MatMulBiasActivationFusionPass.cs
- src/Regression/DecisionTreeAsyncRegressionBase.cs
- tests/AiDotNet.Tests/InferenceOptimization/IR/IRTypesTests.cs
- src/NeuralNetworks/SyntheticData/SyntheticTabularGeneratorBase.cs
- src/InferenceOptimization/Kernels/AttentionKernel.cs
- src/NeuralNetworks/SyntheticData/TapeLayerBridge.cs
- src/InferenceOptimization/IR/Common/IRTypes.cs
- src/InferenceOptimization/IR/IIRCompiler.cs
- src/InferenceOptimization/Core/OptimizationGraph.cs
- src/InferenceOptimization/Passes/OptimizationPassBase.cs
- src/InferenceOptimization/IR/LowLevel/LLIROp.cs
- src/InferenceOptimization/IR/LowLevel/LLIRGraph.cs
Newer Tensors release while this PR was in flight. Brings the work after 0.42.x (0.43, 0.44, 0.45, 0.46). Backward-compatible API — no source changes required. Build: net10.0 + net471 both green, 0 errors. Auto-compile regression tests (CompileForwardTests + CompiledModelHostTests, 14 total): all pass on both TFMs. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Three review comments from CodeRabbit, all on src/TimeSeries/NBEATSBlock.cs: 1. (Major) ParameterCount / GetParameters / SetParameters ignored the trainable V_b / V_f bases in generic mode — only fc weights + biases were exported/imported. That made parameter round-trips drop learned basis state. Fixed: include the bases in all three APIs when _useInterpretableBasis == false, and also re-register them in ReRegisterParameters so the SetParameters tensor swap doesn't drop them from the trainable registry. 2. (Major) Constructor validated lookbackWindow / forecastHorizon / hiddenLayerSize / numHiddenLayers but accepted thetaSizeBackcast, thetaSizeForecast, and polynomialDegree without validation. Invalid values deferred failure to tensor allocation/math paths where diagnosis is much harder. Added explicit checks: both theta sizes must be positive; polynomialDegree must be non-negative when useInterpretableBasis is true. 3. (Critical) UpdateParameters(T learningRate) was an empty override that silently ignored update calls — the kind of silent no-op that becomes an accuracy regression you can only find by bisecting. Replaced with a fail-fast InvalidOperationException pointing callers at the tape-based training path (CompiledTapeTrainingStep), so misuse is caught at the training boundary instead of producing silently-undertrained models. Build: net10.0 + net471 + tests all green, 0 errors. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Three review comments from CodeRabbit, all on src/TimeSeries/NBEATSBlock.cs: 1. (Major) ParameterCount / GetParameters / SetParameters ignored the trainable V_b / V_f bases in generic mode — only fc weights + biases were exported/imported. That made parameter round-trips drop learned basis state. Fixed: include the bases in all three APIs when _useInterpretableBasis == false, and also re-register them in ReRegisterParameters so the SetParameters tensor swap doesn't drop them from the trainable registry. 2. (Major) Constructor validated lookbackWindow / forecastHorizon / hiddenLayerSize / numHiddenLayers but accepted thetaSizeBackcast, thetaSizeForecast, and polynomialDegree without validation. Invalid values deferred failure to tensor allocation/math paths where diagnosis is much harder. Added explicit checks: both theta sizes must be positive; polynomialDegree must be non-negative when useInterpretableBasis is true. 3. (Critical) UpdateParameters(T learningRate) was an empty override that silently ignored update calls — the kind of silent no-op that becomes an accuracy regression you can only find by bisecting. Replaced with a fail-fast InvalidOperationException pointing callers at the tape-based training path (CompiledTapeTrainingStep), so misuse is caught at the training boundary instead of producing silently-undertrained models. Build: net10.0 + net471 + tests all green, 0 errors. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/TimeSeries/NBEATSBlock.cs`:
- Around line 462-463: ForwardInternal/ApplyBasisExpansion's generic branch
returns theta directly, causing learned basis tensors
(_basisBackcast/_basisForecast) to be ignored during inference and parameter
round-trips; update ApplyBasisExpansion so the generic branch explicitly
multiplies theta by the matching basis matrix (use _basisBackcast for
thetaBackcast and _basisForecast for thetaForecast) instead of returning theta,
or refactor ForwardInternal to call the same multiplication path used by
Forward()/ForwardTape(); ensure the same fix is applied to the other
ApplyBasisExpansion usages referenced (the region covering the second
occurrence) so PredictSingle, GetParameters and SetParameters remain consistent
with training.
- Around line 149-159: The current validations in NBEATSBlock only reject
negative polynomialDegree but do not prevent thetaSizeBackcast/thetaSizeForecast
from being larger than the interpretable basis length, which causes dead
parameters; update the constructor/validation to, when useInterpretableBasis is
true, either throw ArgumentException if thetaSizeBackcast or thetaSizeForecast >
polynomialDegree + 1 or automatically cap/derive theta sizes to polynomialDegree
+ 1; specifically check thetaSizeBackcast and thetaSizeForecast against
_polynomialDegree + 1 (or derive newThetaSizeBackcast/newThetaSizeForecast from
polynomialDegree + 1) before the block builds and before ApplyBasisExpansion is
used so no trainable weights are created that cannot influence the basis.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: fd294780-48f4-4e04-96ae-1a81dcf86de0
📒 Files selected for processing (1)
src/TimeSeries/NBEATSBlock.cs
1. (Major) Interpretable theta sizes weren't validated against polynomialDegree + 1. ComputeBasisTensor + ApplyBasisExpansion both cap usable rows at polynomialDegree + 1, so oversized thetaSizeBackcast / thetaSizeForecast silently allocated dead trainable weights that couldn't influence the output. Added explicit checks for interpretable mode. 2. (Critical) ForwardInternal's generic branch in ApplyBasisExpansion returned theta directly instead of multiplying by the learned V_b / V_f basis tensors. With the Phase 1 fix that made those bases round-trip through GetParameters/SetParameters, PredictSingle would diverge from both Forward() (which uses _basisBackcast/_basisForecast via matmul) and from loaded-model state. Changed ApplyBasisExpansion to take a basis tensor argument and multiply by it in the generic branch, matching training and tape paths per Oreshkin et al. 2020 §3.2. Build: net10.0 clean, 0 errors. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1. (Major) Interpretable theta sizes weren't validated against polynomialDegree + 1. ComputeBasisTensor + ApplyBasisExpansion both cap usable rows at polynomialDegree + 1, so oversized thetaSizeBackcast / thetaSizeForecast silently allocated dead trainable weights that couldn't influence the output. Added explicit checks for interpretable mode. 2. (Critical) ForwardInternal's generic branch in ApplyBasisExpansion returned theta directly instead of multiplying by the learned V_b / V_f basis tensors. With the Phase 1 fix that made those bases round-trip through GetParameters/SetParameters, PredictSingle would diverge from both Forward() (which uses _basisBackcast/_basisForecast via matmul) and from loaded-model state. Changed ApplyBasisExpansion to take a basis tensor argument and multiply by it in the generic branch, matching training and tape paths per Oreshkin et al. 2020 §3.2. Build: net10.0 clean, 0 errors. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/TimeSeries/NBEATSBlock.cs`:
- Around line 122-139: Validate lookbackWindow and forecastHorizon before
invoking the LayerBase<T> constructor in NBEATSBlock by moving the checks out of
the constructor initializer: add private static helper methods (e.g.,
CreateInputShape(int lookbackWindow) and CreateOutputShape(int lookbackWindow,
int forecastHorizon)) that perform the ArgumentException checks for
lookbackWindow and forecastHorizon and return the int[] shapes, and use these
helpers in the base(...) call; ensure the output shape uses a checked sum
(checked(lookbackWindow + forecastHorizon)) to guard overflow and keep all
validation logic in the helpers so LayerBase<T> only receives already-validated
shapes.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: c49c1033-7ace-456a-bec9-af6898c5706e
📒 Files selected for processing (1)
src/TimeSeries/NBEATSBlock.cs
…+ empty IJitCompilable regions Sweep #1 of the end-to-end JIT audit. The IJitCompilable interface no longer exists (removed with the JitCompiler). Every remaining reference was either a stale region marker with no content, or a vestigial SupportsJitCompilation property that nothing reads. Removed: - SupportsJitCompilation property on 11 model base classes (AutoML, CausalInference, Classification, MultiLabelClassification, Diffusion, NoisePredictor, VAE, DistributedTraining/ShardedModelBase, NeuralNetworkBase, OnlineLearning, Survival). Kept on IActivationFunction / IVectorActivationFunction implementations since LoRA / SqueezeAndExcitation / HyperbolicLinear / SparseLinear still consult those for activation-graph fallback (live code path). - 21 empty #region IJitCompilable Override markers across the SyntheticData generators (AutoDiffTab, CausalGAN, CopulaGAN, CTABGANPlus, CTGAN, DPCTGAN, FinDiff, GOGGLE, MedSynth, MisGAN, OCTGAN, PATEGAN, REaLTabFormer, TabDDPM, TabFlow, TableGAN, TabLLMGen, TabSyn, TabTransformerGen, TimeGAN, TVAE). - 4 empty #region IJitCompilable Implementation Override markers in Regression (AdaBoostR2, ExtremelyRandomizedTrees, GradientBoosting, RandomForest) and TransferLearning (TransferRandomForest). - ExpressionTree.BuildComputationGraph (private method with only recursive self-calls; nothing external called it after JitCompiler removal). - VectorModel.VectorToTensor (private method inside #region IJitCompilable Implementation; only defined, never referenced inside or outside the file). - SuperNet.ExportOperationGraph + SuperNet.Forward (both dead, only existed to satisfy the removed IJitCompilable interface). Build: net10.0 + net471 both green, 0 errors. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…lable xmldoc Audit A: continues the dead JIT-scaffolding sweep from 010bc09 / fb9ebb2. After removal in prior commits of the JitCompiler / InferenceOptimization IR / ExportComputationGraph surface, these eight layer files still carried a closed chain of private BuildComputationGraph() methods that only called each other (zero external callers), plus xmldoc remarks referencing IJitCompilable on interfaces that were removed. All of it is dead. - 8 neural-network layers: remove private BuildComputationGraph chain (DenseBlock, InvertedResidual, RRDB, RRDBNetGenerator, ResidualDense, SqueezeAndExcitation, Transition, UNetDiscriminator) - 5 KnowledgeDistillation teacher-model xmldocs: strip IJitCompilable references; note Tensors' AutoTracer handles auto-compile transparently - DeepReinforcementLearningAgentBase: same xmldoc fix + point to TensorCodecOptions.Current.EnableCompilation for opt-out - InterfaceGuard / IFullModel: scrub IJitCompilable from the remarks list Build: net10.0 + net471 clean (0 errors). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
After the production-side IJitCompilable removal in prior commits, test mocks, testconsole examples, the benchmark harness, and the golden-standard pattern doc still carried SupportsJitCompilation + ExportComputationGraph stubs for a removed interface — purely orphan code that compiled only because no interface required those members. This sweep removes all of them (29 test files + 3 testconsole examples + 1 benchmark helper + GOLDEN_STANDARD_PATTERNS.md). The only remaining SupportsJitCompilation references are on IActivationFunction / IVectorActivationFunction, which are part of the live ComputationNode graph-mode autodiff path (distinct from the removed JIT compiler). Build: net10.0 + net471 clean across src/, tests/, testconsole/, and AiDotNetBenchmarkTests/. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Actionable comments posted: 5
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/ReinforcementLearning/Agents/DeepReinforcementLearningAgentBase.cs (1)
117-139:⚠️ Potential issue | 🔴 CriticalBlocking: Remove
GetPolicyNetworkForJit()— dead code after JIT removal.The method at line 135 is a permanent null stub that always returns
nullafter JIT compilation was removed. This is a placeholder pattern that violates production-readiness standards: it exposes a virtual extension point with misleading XML docs ("Override this method…", "enables JIT compilation support…") but unconditionally returnsnull.Verification confirms no derived classes override this method anywhere in the codebase, so it is safe to delete entirely. Remove the section header (lines 117–118) and the method (lines 135–139).
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/ReinforcementLearning/Agents/DeepReinforcementLearningAgentBase.cs` around lines 117 - 139, Delete the dead virtual method GetPolicyNetworkForJit() and its preceding "JIT Compilation Support" comment block and XML doc (the entire protected virtual INeuralNetworkModel<T>? GetPolicyNetworkForJit() declaration and associated remarks), since it always returns null and is not overridden; also remove any remaining references/usages if present, rebuild the project and run tests to confirm nothing depended on this extension point.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/Helpers/InterfaceGuard.cs`:
- Line 9: The InterfaceGuard helper class is public but should be internal per
facade guidelines; change the class declaration for InterfaceGuard to internal
so its visibility is limited (ensure no public API signatures expose
InterfaceGuard—if any methods in AiModelBuilder or AiModelResult reference it
publicly, update those signatures or create internal overloads). Verify that no
external consumers rely on InterfaceGuard, run build/tests, and adjust any
using/assembly visibility (InternalsVisibleTo) if required for unit tests.
In `@src/KnowledgeDistillation/Teachers/PretrainedTeacherModel.cs`:
- Around line 15-19: The XML doc for PretrainedTeacherModel overstates behavior
by claiming inference "auto-compiles via Tensors' AutoTracer"—update the summary
to say the type invokes the provided forward-pass delegate (Func<...>) and that
any compilation or tracing behavior depends on the implementation of that
delegate and underlying tensor runtime; remove guarantees about AutoTracer or
automatic compilation and instead note that repeated input shapes may allow
backends to optimize if the delegate supports it. Reference the
PretrainedTeacherModel type and its constructor/forward-pass delegate in the
revised wording.
In `@src/KnowledgeDistillation/Teachers/QuantizedTeacherModel.cs`:
- Around line 56-58: The XML doc for the QuantizedTeacherModel<T> constructor
overstates behavior by guaranteeing AutoTracer/auto-compilation of the wrapped
base teacher; update the constructor/class remarks to remove absolutes and
instead state that dynamic quantization operates per-batch and that any
AutoTracer/auto-compilation behavior depends on the wrapped base teacher's
implementation (e.g., "may trigger AutoTracer/auto-compilation if the underlying
ITeacher implementation and input-shape patterns permit it"). Locate the XML
summary/remarks for QuantizedTeacherModel<T> and replace the definitive phrasing
about guaranteed auto-compilation with a conditional/descriptive statement
referencing the wrapped baseTeacher.
In `@src/KnowledgeDistillation/Teachers/SelfTeacherModel.cs`:
- Around line 84-85: Update the XML docs on the GetLogits method of
SelfTeacherModel<T> to match its throw-only behavior: change the <summary> to
state GetLogits is not supported for SelfTeacherModel<T> and callers must use
GetCachedPrediction, update the <returns> to either be removed or to state that
it does not return logits (it always throws), and update the <exception> tag to
document that GetLogits throws NotSupportedException (or the specific exception
type thrown) with a brief reason and a pointer to GetCachedPrediction for
obtaining precomputed predictions.
In `@src/KnowledgeDistillation/Teachers/TransformerTeacherModel.cs`:
- Around line 16-20: Update the XML remarks for the TransformerTeacherModel
class/ctor to avoid promising auto-compilation semantics: clarify that the class
simply invokes the provided forward-pass delegate (the Func<> passed into the
constructor) and that any AutoTracer or compilation behavior is dependent on the
concrete delegate implementation rather than guaranteed by
TransformerTeacherModel. Replace the current sentence referencing "auto-compiles
via Tensors' AutoTracer" with language like "may leverage underlying model or
tensor library auto-compilation when the provided delegate triggers such
behavior; behavior depends on the delegate implementation."
---
Outside diff comments:
In `@src/ReinforcementLearning/Agents/DeepReinforcementLearningAgentBase.cs`:
- Around line 117-139: Delete the dead virtual method GetPolicyNetworkForJit()
and its preceding "JIT Compilation Support" comment block and XML doc (the
entire protected virtual INeuralNetworkModel<T>? GetPolicyNetworkForJit()
declaration and associated remarks), since it always returns null and is not
overridden; also remove any remaining references/usages if present, rebuild the
project and run tests to confirm nothing depended on this extension point.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: de292526-e99a-41c4-aebc-7d78eb700430
📒 Files selected for processing (88)
AiDotNetBenchmarkTests/Helpers/MockNeuralNetwork.csdocs/GOLDEN_STANDARD_PATTERNS.mdsrc/AutoML/AutoMLModelBase.cssrc/CausalInference/CausalModelBase.cssrc/Classification/ClassifierBase.cssrc/Classification/MultiLabel/MultiLabelClassifierBase.cssrc/Diffusion/DiffusionModelBase.cssrc/Diffusion/NoisePredictors/NoisePredictorBase.cssrc/Diffusion/VAE/VAEModelBase.cssrc/DistributedTraining/ShardedModelBase.cssrc/Helpers/InterfaceGuard.cssrc/Interfaces/IFullModel.cssrc/KnowledgeDistillation/Teachers/OnlineTeacherModel.cssrc/KnowledgeDistillation/Teachers/PretrainedTeacherModel.cssrc/KnowledgeDistillation/Teachers/QuantizedTeacherModel.cssrc/KnowledgeDistillation/Teachers/SelfTeacherModel.cssrc/KnowledgeDistillation/Teachers/TransformerTeacherModel.cssrc/LinearAlgebra/ExpressionTree.cssrc/Models/VectorModel.cssrc/NeuralNetworks/Layers/DenseBlockLayer.cssrc/NeuralNetworks/Layers/InvertedResidualBlock.cssrc/NeuralNetworks/Layers/RRDBLayer.cssrc/NeuralNetworks/Layers/RRDBNetGenerator.cssrc/NeuralNetworks/Layers/ResidualDenseBlock.cssrc/NeuralNetworks/Layers/SqueezeAndExcitationLayer.cssrc/NeuralNetworks/Layers/TransitionLayer.cssrc/NeuralNetworks/Layers/UNetDiscriminator.cssrc/NeuralNetworks/NeuralNetworkBase.cssrc/NeuralNetworks/SuperNet.cssrc/NeuralNetworks/SyntheticData/AutoDiffTabGenerator.cssrc/NeuralNetworks/SyntheticData/CTABGANPlusGenerator.cssrc/NeuralNetworks/SyntheticData/CTGANGenerator.cssrc/NeuralNetworks/SyntheticData/CausalGANGenerator.cssrc/NeuralNetworks/SyntheticData/CopulaGANGenerator.cssrc/NeuralNetworks/SyntheticData/DPCTGANGenerator.cssrc/NeuralNetworks/SyntheticData/FinDiffGenerator.cssrc/NeuralNetworks/SyntheticData/GOGGLEGenerator.cssrc/NeuralNetworks/SyntheticData/MedSynthGenerator.cssrc/NeuralNetworks/SyntheticData/MisGANGenerator.cssrc/NeuralNetworks/SyntheticData/OCTGANGenerator.cssrc/NeuralNetworks/SyntheticData/PATEGANGenerator.cssrc/NeuralNetworks/SyntheticData/REaLTabFormerGenerator.cssrc/NeuralNetworks/SyntheticData/TVAEGenerator.cssrc/NeuralNetworks/SyntheticData/TabDDPMGenerator.cssrc/NeuralNetworks/SyntheticData/TabFlowGenerator.cssrc/NeuralNetworks/SyntheticData/TabLLMGenGenerator.cssrc/NeuralNetworks/SyntheticData/TabSynGenerator.cssrc/NeuralNetworks/SyntheticData/TabTransformerGenGenerator.cssrc/NeuralNetworks/SyntheticData/TableGANGenerator.cssrc/NeuralNetworks/SyntheticData/TimeGANGenerator.cssrc/OnlineLearning/OnlineLearningModelBase.cssrc/Regression/AdaBoostR2Regression.cssrc/Regression/ExtremelyRandomizedTreesRegression.cssrc/Regression/GradientBoostingRegression.cssrc/Regression/RandomForestRegression.cssrc/ReinforcementLearning/Agents/DeepReinforcementLearningAgentBase.cssrc/SurvivalAnalysis/SurvivalModelBase.cssrc/TransferLearning/Algorithms/TransferRandomForest.cstestconsole/Examples/KnowledgeDistillationExample.cstestconsole/Examples/MetaLearning/SimpleMetaModel.cstestconsole/Examples/SimpleKnowledgeDistillationExample.cstests/AiDotNet.Tests/AdversarialRobustness/CROWNVerificationTests.cstests/AiDotNet.Tests/AdversarialRobustness/IntervalBoundPropagationTests.cstests/AiDotNet.Tests/Helpers/ActiveLearningTestHelper.cstests/AiDotNet.Tests/Helpers/ContinualLearningTestHelper.cstests/AiDotNet.Tests/Helpers/MockFullModel.cstests/AiDotNet.Tests/Helpers/MockNeuralNetwork.cstests/AiDotNet.Tests/IntegrationTests/ActiveLearning/ActiveLearningDeepMathIntegrationTests.cstests/AiDotNet.Tests/IntegrationTests/ActiveLearning/ActiveLearningIntegrationTests.cstests/AiDotNet.Tests/IntegrationTests/AdversarialRobustness/AdversarialRobustnessDeepMathIntegrationTests.cstests/AiDotNet.Tests/IntegrationTests/AdversarialRobustness/AdversarialRobustnessIntegrationTests.cstests/AiDotNet.Tests/IntegrationTests/ContinualLearning/ContinualLearningDeepMathIntegrationTests.cstests/AiDotNet.Tests/IntegrationTests/DistributedTraining/DistributedTrainingIntegrationTests.cstests/AiDotNet.Tests/IntegrationTests/DistributedTraining/PipelineParallelismIntegrationTests.cstests/AiDotNet.Tests/IntegrationTests/FederatedLearning/FederatedLearningDeepMathIntegrationTests.cstests/AiDotNet.Tests/IntegrationTests/FineTuning/FineTuningIntegrationTests.cstests/AiDotNet.Tests/IntegrationTests/MetaLearning/MetaLearningTestModels.cstests/AiDotNet.Tests/IntegrationTests/Quantization/QuantizationIntegrationTests.cstests/AiDotNet.Tests/IntegrationTests/TransferLearning/TransferLearningAlgorithmsIntegrationTests.cstests/AiDotNet.Tests/UnitTests/AdversarialRobustness/AdversarialAttackTests.cstests/AiDotNet.Tests/UnitTests/AdversarialRobustness/AdversarialTrainingTests.cstests/AiDotNet.Tests/UnitTests/AdversarialRobustness/RandomizedSmoothingTests.cstests/AiDotNet.Tests/UnitTests/ContinualLearning/ElasticWeightConsolidationTests.cstests/AiDotNet.Tests/UnitTests/Genetics/ModelIndividualTests.cstests/AiDotNet.Tests/UnitTests/KnowledgeDistillation/TeacherModelFactoryTests.cstests/AiDotNet.Tests/UnitTests/Layers/AdvancedAlgebraLayerTests.cstests/AiDotNet.Tests/UnitTests/MetaLearning/Helpers/MatrixMockModel.cstests/AiDotNet.Tests/UnitTests/MetaLearning/Helpers/SimpleMockModel.cs
💤 Files with no reviewable changes (48)
- src/Interfaces/IFullModel.cs
- src/Regression/RandomForestRegression.cs
- src/NeuralNetworks/SyntheticData/TableGANGenerator.cs
- src/NeuralNetworks/SyntheticData/GOGGLEGenerator.cs
- src/NeuralNetworks/SyntheticData/FinDiffGenerator.cs
- src/NeuralNetworks/SyntheticData/TVAEGenerator.cs
- src/NeuralNetworks/SyntheticData/DPCTGANGenerator.cs
- src/NeuralNetworks/SyntheticData/CTGANGenerator.cs
- src/NeuralNetworks/SyntheticData/CausalGANGenerator.cs
- src/NeuralNetworks/SyntheticData/TabLLMGenGenerator.cs
- src/Regression/ExtremelyRandomizedTreesRegression.cs
- src/NeuralNetworks/SyntheticData/OCTGANGenerator.cs
- src/NeuralNetworks/SyntheticData/REaLTabFormerGenerator.cs
- src/NeuralNetworks/SyntheticData/TabTransformerGenGenerator.cs
- src/NeuralNetworks/SyntheticData/TabFlowGenerator.cs
- src/NeuralNetworks/SyntheticData/AutoDiffTabGenerator.cs
- src/NeuralNetworks/SyntheticData/PATEGANGenerator.cs
- src/NeuralNetworks/SyntheticData/TabDDPMGenerator.cs
- src/Models/VectorModel.cs
- src/KnowledgeDistillation/Teachers/OnlineTeacherModel.cs
- src/Regression/AdaBoostR2Regression.cs
- src/LinearAlgebra/ExpressionTree.cs
- src/NeuralNetworks/SyntheticData/TabSynGenerator.cs
- src/NeuralNetworks/SuperNet.cs
- src/NeuralNetworks/Layers/RRDBLayer.cs
- AiDotNetBenchmarkTests/Helpers/MockNeuralNetwork.cs
- src/NeuralNetworks/Layers/DenseBlockLayer.cs
- src/Diffusion/NoisePredictors/NoisePredictorBase.cs
- src/CausalInference/CausalModelBase.cs
- src/NeuralNetworks/Layers/ResidualDenseBlock.cs
- src/NeuralNetworks/Layers/InvertedResidualBlock.cs
- src/NeuralNetworks/Layers/TransitionLayer.cs
- src/NeuralNetworks/SyntheticData/CopulaGANGenerator.cs
- src/DistributedTraining/ShardedModelBase.cs
- src/OnlineLearning/OnlineLearningModelBase.cs
- src/NeuralNetworks/Layers/SqueezeAndExcitationLayer.cs
- src/AutoML/AutoMLModelBase.cs
- src/SurvivalAnalysis/SurvivalModelBase.cs
- docs/GOLDEN_STANDARD_PATTERNS.md
- src/NeuralNetworks/Layers/RRDBNetGenerator.cs
- src/Classification/MultiLabel/MultiLabelClassifierBase.cs
- src/NeuralNetworks/SyntheticData/CTABGANPlusGenerator.cs
- src/Diffusion/DiffusionModelBase.cs
- src/Regression/GradientBoostingRegression.cs
- src/NeuralNetworks/Layers/UNetDiscriminator.cs
- src/Classification/ClassifierBase.cs
- src/NeuralNetworks/NeuralNetworkBase.cs
- src/Diffusion/VAE/VAEModelBase.cs
…ers from CI Deep Audit A found 5 dangling references to deleted test namespaces in CI and test-sharding configs. These filters targeted tests that were deleted in the JIT/InferenceOptimization sweep — now no-ops that confuse CI dashboards. - .github/workflows/sonarcloud.yml: - Unit-06 shard: drop UnitTests.JitCompiler (deleted); rename "JIT/KD/..." -> "KD/..." - Exclusion filter: drop UnitTests.JitCompiler (no longer emits tests) - Drop "Other - InferenceOptimization" shard entirely (namespace deleted) - scripts/run-tests-sharded.ps1: - Drop "JitCompiler" from unitNamespaceRoots - Rename Unit-07 shard "Interpretability/JIT/KD" -> "Interpretability/KD" - Drop shard 13 "InferenceOptimization" (namespace deleted); renumber PromptEngineering -> 13 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…c-batch compile (gaps 2+5) Part of the Tensors-0.46.0 parity work (closes 2 of 14 gaps; see Tensors issues #197 + #198 for the two gaps that need upstream Tensors features). ## Gap 5 — acceleration diagnostics (PlatformDetector + NativeLibraryDetector) Tensors already ships PlatformDetector (SIMD level, cache sizes, GPU support flags) and NativeLibraryDetector (OpenBLAS / CLBlast / cuDNN / MKL availability). AiDotNet was ignoring both — users had no visibility into which acceleration path was actually engaged. - src/Diagnostics/AccelerationDiagnostics.cs — new facade wrapping both detectors. GetReport() returns a human-readable summary; GetSnapshot() returns a structured AccelerationSnapshot for programmatic assertions. - AiModelBuilder.ReportAccelerationStatus(Action<string>? logger) — opt-in builder method. Runs after ApplyGpuConfiguration so the snapshot reflects the engine state the built model will actually see. - AiModelResult.AccelerationSnapshot — new property on every AiModelResult. 7 construction sites updated via AttachDiagnostics() helper. ## Gap 2 — SymbolicShape for dynamic batch/seq-len compile keys CompiledModelHost keyed the compile cache on concrete shape via GetOrCompileInference(shape, forward). Every batch-size change forced a fresh trace+compile — wasteful for real inference traffic where request batches vary. Tensors exposes SymbolicShape.BatchDynamic / BatchAndSeqDynamic / AllDynamic + a 3-arg GetOrCompileInference overload for exactly this case. - src/NeuralNetworks/CompiledModelHost.cs: new SymbolicShapeMode enum (Static / BatchDynamic / BatchAndSeqDynamic / AllDynamic). Default = BatchDynamic (matches PyTorch torch.compile(dynamic=True) default). - Predict() builds a SymbolicShape from mode + concrete shape and calls the 3-arg overload, falling back to the 2-arg concrete overload when rank is too small (e.g. 1-D scalar input with BatchDynamic requested). ## Verify dotnet build -f net10.0 — clean. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
… (gap 1)
PyTorch-parity equivalent: torch.jit.save + torch.jit.load. Before this
change AiDotNet recompiled every forward-pass plan on every process start —
wasteful for production serving where warm inference latency matters.
Tensors 0.46.0 already ships everything needed: ICompiledPlan.SaveAsync,
CompiledPlanLoader.LoadInferenceAsync, PlanCompatibilityInfo for hardware-
fingerprint gating. We just weren't wiring it.
## Public API
await new PredictionModelBuilder<float, Tensor<float>, Tensor<float>>()
.ConfigureModel(myNet)
.ConfigurePlanCaching(@"C:\PlanCache") // NEW
.BuildAsync();
Plans are saved under modelTypeName_T_v{structureVersion}_s{shapeHash}.plan.
Per-(model, T, version, shape) — one directory can host multiple models
without collision. Loads that fail PlanCompatibilityInfo fall through to
a fresh compile silently.
## Files
- src/NeuralNetworks/PlanCache.cs: new. Static Current, directory-based
storage, atomic writes (tmp + rename). Shape hash = SHA256 of int32[].
- src/NeuralNetworks/CompiledModelHost.cs:
- ctor now accepts optional modelIdentity — null = disk caching off
- new fields: _diskCheckedShapes (one load attempt per shape-version),
_preloadedPlans (in-memory cache of disk-loaded plans)
- Predict(): before GetOrCompileInference, call TryUseDiskCachedPlan.
If hit, skip compile entirely.
- After fresh compile, fire-and-forget save via Task.Run so Predict
doesn't block on IO.
- src/NeuralNetworks/NeuralNetworkBase.cs: _compileHost is now assigned
in the ctor so GetType().FullName reflects the concrete subclass —
different model types don't collide on disk keys.
- src/Diffusion/NoisePredictors/NoisePredictorBase.cs: same change.
- src/AiModelBuilder.cs + src/Interfaces/IAiModelBuilder.cs: new
ConfigurePlanCaching(directory) fluent method.
## Verify
dotnet build -f net10.0 — clean.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…filing (gaps 6/7/12) ## Gap 12 — Fused GEMM+Bias+Activation (already mostly wired; completing) Audit confirmed the major linear layers (DenseLayer, FullyConnectedLayer, and several others) already dispatch through Engine.FusedLinear / FusedLinearGpu for CPU + GPU paths. The notable miss was FeedForwardLayer.Forward, which was doing separate TensorMatMul + Reshape + TensorBroadcastAdd + ApplyActivation calls (4 kernel launches per forward). Refactored to use Engine.FusedLinear(input, weights, biases, fusedActivation) with the standard pre-activation tape-safe fallback for training. - src/NeuralNetworks/Layers/FeedForwardLayer.cs: Forward() rewritten. Mirror of DenseLayer's fused-inference path. ## Gap 7 — Tensors per-op profiling (orthogonal to existing AiDotNet ProfilerSession) AiDotNet already has its own ProfilerSession / ProfileReport / AiModelResult. ProfilingReport surfacing HIGHER-level workflow timings (Welford stats, hierarchical call trees, reservoir percentiles, memory tracking — richer than Tensors' simpler per-op profiler). Tensors has no parity with that feature set, so we keep it. What was missing: visibility into LOWER-level tensor-op kernel timings. Tensors ships PerformanceProfiler.Instance which wraps every engine op in an IDisposable scope — useful for finding which kernel (MatMul, Softmax, LayerNorm) is the actual bottleneck. - src/Diagnostics/ProfilingReport.cs: new. TensorsOperationProfile wraps PerformanceProfiler output. FormatSummary formats top-N ops. - src/AiModelBuilder.cs + src/Interfaces/IAiModelBuilder.cs: new EnableTensorsOpProfiling() fluent method. - src/Models/Results/AiModelResult.Diagnostics.cs: new TensorsOperationProfile property. Sits alongside existing ProfilingReport (not replacing it). ## Verify dotnet build -f net10.0 — clean. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…ting (gaps 9+14) ## Gap 9 — autotune cache diagnostics Tensors ships AutotuneCache (Helpers.Autotune namespace) with per-kernel autotune storage. Users couldn't see whether it was active. Filed Tensors issue #200 for the WarmupCommonKernelsAsync convenience; added diagnostics surface here so users at least see the cache path + hardware fingerprint. - src/Diagnostics/AccelerationDiagnostics.cs: GetReport now emits AutotuneCache.DefaultCachePath + CurrentHardwareFingerprint. AccelerationSnapshot carries both as AutotuneCachePath / AutotuneHardwareFingerprint. ## Gap 14 — subclass Predict() routing through PredictCompiled 11 NeuralNetwork subclasses overrode Predict as literally `return Forward(input);`, bypassing the base's PredictCompiled auto-compile path. Refactored each to override PredictEager (the base's compile-lambda eager fallback) instead, keeping Forward as the implementation but routing through CompiledModelHost. After: every Predict on these 11 models goes through _compileHost.Predict, which traces → compiles → replays (and triggers disk caching via PlanCache when configured, from Gap 1). Files touched: - src/NeuralNetworks/ConvolutionalNeuralNetwork.cs - src/NeuralNetworks/EfficientNetNetwork.cs - src/NeuralNetworks/FastText.cs - src/NeuralNetworks/GloVe.cs - src/NeuralNetworks/MobileNetV2Network.cs - src/NeuralNetworks/ResNetNetwork.cs - src/NeuralNetworks/SiameseNeuralNetwork.cs - src/NeuralNetworks/UNet3D.cs - src/NeuralNetworks/VGGNetwork.cs - src/NeuralNetworks/VoxelCNN.cs - src/NeuralNetworks/Word2Vec.cs Forward methods unchanged — they still have their GPU-resident fast path (TryForwardGpuOptimized etc.) and shape-validation logic. The base's PredictCompiled treats Forward as the eager fallback but AutoTracer fires on first call regardless. ## Verify - dotnet build -f net10.0 — clean - dotnet build -f net471 — clean - dotnet test CompiledTapeTrainingStep + FusedOptimizer — 9/9 passing Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- NBEATSBlock ctor: extract CreateInputShape / CreateOutputShape static factories that validate lookbackWindow / forecastHorizon BEFORE the base(...) call. Invalid values now surface as ArgumentException with the right nameof(...) tag instead of a downstream LayerBase<T> shape error. - InterfaceGuard: class visibility reduced from public to internal to match the AiDotNet facade pattern. InternalsVisibleTo on src/AiDotNet.csproj already grants access to AiDotNetTests / AiDotNetTestConsole / AiDotNet.Serving / AiDotNetBenchmarkTests, so the 58 existing test call sites still compile. Doc remark added explaining the visibility choice. - PretrainedTeacherModel + TransformerTeacherModel: reworded "auto-compiles via Tensors' AutoTracer" remarks. The wrapper only invokes the delegate; whether auto-compile actually happens depends entirely on what's inside the delegate. Removed the unconditional guarantee and added a note that external paths (ONNX, REST, etc.) won't pick up engine optimizations. - SelfTeacherModel.GetLogits: rewrote XML-doc so summary/returns/exception match the throw-only behavior (method has no underlying model to run and always throws InvalidOperationException). Previous summary said "Gets logits from the underlying model" which was misleading. Verify: dotnet build net10.0 + net471 — 0 errors. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- NBEATSBlock ctor: extract CreateInputShape / CreateOutputShape static factories that validate lookbackWindow / forecastHorizon BEFORE the base(...) call. Invalid values now surface as ArgumentException with the right nameof(...) tag instead of a downstream LayerBase<T> shape error. - InterfaceGuard: class visibility reduced from public to internal to match the AiDotNet facade pattern. InternalsVisibleTo on src/AiDotNet.csproj already grants access to AiDotNetTests / AiDotNetTestConsole / AiDotNet.Serving / AiDotNetBenchmarkTests, so the 58 existing test call sites still compile. Doc remark added explaining the visibility choice. - PretrainedTeacherModel + TransformerTeacherModel: reworded "auto-compiles via Tensors' AutoTracer" remarks. The wrapper only invokes the delegate; whether auto-compile actually happens depends entirely on what's inside the delegate. Removed the unconditional guarantee and added a note that external paths (ONNX, REST, etc.) won't pick up engine optimizations. - SelfTeacherModel.GetLogits: rewrote XML-doc so summary/returns/exception match the throw-only behavior (method has no underlying model to run and always throws InvalidOperationException). Previous summary said "Gets logits from the underlying model" which was misleading. Verify: dotnet build net10.0 + net471 — 0 errors. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
565c4ef to
aa04444
Compare
|
Closing temporarily to re-trigger CI on rewritten branch history. |
|
Reopening to re-trigger CI. |
df660f8 to
49251a6
Compare
Resolves conflicts: - Directory.Packages.props: take AiDotNet.Tensors 0.46.1 from master, keep AiDotNet.Native.OneDNN 0.46.0 for ecosystem alignment. - src/NeuralNetworks/MobileNetV2Network.cs: keep both overrides -- GetNamedLayerActivations (master, 3D->4D probe shape) and PredictEager (HEAD, compiled-plan routing). Master's Predict override was superseded by PredictEager + base-class routing.
49251a6 to
fbd9016
Compare
…Forward PR #1155 replaced `public override Tensor<T> Predict(Tensor<T> input) => Forward(input)` with `protected override Tensor<T> PredictEager(Tensor<T> input) => Forward(input)` in 11 network classes. That reroutes Predict through `NeuralNetworkBase.PredictCompiled` → `CompiledModelHost.Predict` → the compiled-replay plan. The compiled-replay plan silently truncates the forward pass for the affected models: on a ResNet-18 with 3×32×32 input the plan returns a shape-[64] tensor (output of the first conv block's 64 channels) instead of the expected shape-[10] logits. The net effect is wrong output for every `Predict` call on these 11 model classes. Verified with a per-call diagnostic: Forward direct shape: [10] Predict compile-off shape: [10] Predict compile-on shape: [64] ← the regression Root cause is in the tracer / compiled-replay machinery (the tracer does not capture the shape-conditional control flow in Forward — rank-3 → rank-4 promotion, final Reshape, etc.). That's a larger infrastructure fix; this commit restores master's previous behavior so `Predict` calls Forward directly, matching the pre-#1155 contract. Affected models (all had master's `public override Predict` changed to `protected override PredictEager` by #1155): - ResNetNetwork, VGGNetwork, EfficientNetNetwork, MobileNetV2Network, ConvolutionalNeuralNetwork, UNet3D, VoxelCNN - FastText, GloVe, Word2Vec, SiameseNeuralNetwork Unblocks CI on every open PR that merges master (PR #1163, PR #1165). Once the compiled-plan tracer is hardened to preserve shape-conditional control flow, these overrides can be removed again.
Summary
Closes #1015.
AiDotNet's in-tree JitCompiler was deleted some time ago (commit b7ed739) and replaced by the fully-automatic compilation pipeline in `AiDotNet.Tensors` — `AutoTracer` + `CompiledInferencePlan` + `CompiledTrainingPlan`, all auto-enabled, hooked into every `CpuEngine` op. But the AiDotNet side kept ~30 files of stubs, a dead `src/InferenceOptimization/` IR/passes/kernels tree (36 .cs files), a dead `TapeLayerBridge`, a chain of JIT-only helper methods inside layer base classes, and six stale `docs/JIT_*.md` files. This PR clears that debt and pins the latest Tensors with the automatic compilation work.
Per the facade pattern, compilation is transparent — nothing changes at the user-facing API level. `model.Predict(x)` auto-compiles on the 2nd call with the same shape; `TrainWithTape` auto-uses `CompiledTrainingPlan`. Opt out via `TensorCodecOptions.Current.EnableCompilation = false` or the still-supported `AiModelBuilder.ConfigureJitCompilation()` builder API (which projects its config onto the live `TensorCodecOptions` under the hood).
Done
Phase 0 — `AiDotNet.Tensors` 0.38.0 → 0.42.3 (and `AiDotNet.Native.OneDNN` in lockstep). No source changes needed; API is backward-compatible across the bump.
Phase 1 — Deleted dead directories & files:
Phase 2 — Removed `ExportComputationGraph` / `SupportsJitCompilation` / JIT-only graph builders from 22 base/model/layer files including LayerBase, NeuralNetworkBase, every model base (Classifier, Regression, Diffusion, VAE, NoisePredictor, TimeSeries, Survival, Online, Causal, AutoML, Sharded, RL), plus layer-internal dead helpers (ApplyActivationToGraph / CanActivationBeJitted / BuildComputationGraph / kernel-graph helpers / tree-graph helpers). Scrubbed stale "JIT compilation support via ExportComputationGraph()" bullets from 4 Graph* layer xmldoc comments. Removed obsolete `JitRemoved_SupportsJitIsFalse` / `LocallyWeightedRegression_SoftMode_EnablesJitCompilation` / etc. test assertions.
Preserved (live, facade-required):
Test plan
🤖 Generated with Claude Code
Summary by CodeRabbit
Chores
Documentation
Tests
Refactor