Skip to content

refactor: remove per-layer JIT compiler system - #1099

Merged
ooples merged 3 commits into
masterfrom
refactor/remove-per-layer-jit
Apr 7, 2026
Merged

ooples merged 3 commits into
masterfrom
refactor/remove-per-layer-jit

Conversation

@ooples

@ooples ooples commented Apr 6, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • Deleted the entire src/JitCompiler/ directory (238 files) — IR, codegen, optimization passes, memory pool, gradient ops
  • Deleted IJitCompilable<T> interface and JitCompilationConfig configuration class
  • Cleaned JIT references from 38+ source files and all test/benchmark files
  • Verified every trainable layer uses IEngine operations for automatic tape-based differentiation

Why

The per-layer JIT compiler has been superseded by the Lazy Tensor Graph Compiler in AiDotNet.Tensors v0.28.0, which operates at the engine level and provides automatic tape recording for all operations. The per-layer system was redundant and added maintenance burden without benefit.

What Changed

  • Deleted: src/JitCompiler/ (238 source files), IJitCompilable.cs, JitCompilationConfig.cs
  • Deleted: All JitCompiler test directories, integration tests, unit tests, and benchmarks
  • Cleaned: AiModelBuilder.ConfiguredJitCompilation, YAML config loader/schema/docs
  • Updated: RL agent tests, MergedPRBugFixTests, YamlConfigTests to remove JIT assertions
  • Net: 309 files changed, 37,359 lines deleted, 80 lines inserted

Verification

  • Full solution builds with 0 errors (both net10.0 and net471 targets)
  • All trainable layers confirmed to use IEngine operations (only RotaryPositionalEncodingLayer has no Engine ops — it is non-trainable with zero parameters)

Test plan

  • CI build passes on both target frameworks
  • Existing tests pass (no regressions from JIT removal)
  • No remaining references to AiDotNet.JitCompiler namespace in any project

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Refactor

    • Removed JIT compilation and its public APIs — models no longer expose JIT-compiled execution or graph-export capabilities; builder/configuration surface for JIT is gone.
  • Chores

    • Removed GPU/kernel generation, SIMD optimization, memory pooling and compilation tooling; related configuration, schema/docs, and diagnostics entries were removed.

The per-layer JIT compiler has been superseded by the Lazy Tensor Graph
Compiler in AiDotNet.Tensors v0.28.0, which operates at the engine level
and provides automatic tape-based differentiation for all operations.

Deleted:
- src/JitCompiler/ (238 files) — IR, codegen, optimization passes
- src/Configuration/JitCompilationConfig.cs
- src/Interfaces/IJitCompilable.cs
- All JitCompiler test directories and benchmark files

Cleaned:
- Removed IJitCompilable interface references from 38+ source files
- Removed JitCompilation config from YAML loader, schema, and docs
- Removed ConfiguredJitCompilation from AiModelBuilder
- Updated RL agent tests to reflect JIT removal
- Removed JitCompiler PR #770 tests from MergedPRBugFixTests
- Removed JitCompilation assertions from YamlConfigTests

Verified: Every trainable layer uses IEngine operations for automatic
tape recording. Only RotaryPositionalEncodingLayer has no Engine ops
but it is non-trainable (no parameters).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings April 6, 2026 23:11
@vercel

vercel Bot commented Apr 6, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

2 Skipped Deployments
Project Deployment Actions Updated (UTC)
aidotnet_website Ignored Ignored Preview Apr 7, 2026 11:23am
aidotnet-playground-api Ignored Ignored Preview Apr 7, 2026 11:23am

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Removes the legacy per-layer JIT compiler system across the codebase and shifts remaining pathways to CPU/engine-based execution, aligning with the Lazy Tensor Graph Compiler approach.

Changes:

  • Deleted the src/JitCompiler/ subsystem (IR, codegen, memory pooling, gradient ops, tests/benchmarks).
  • Removed IJitCompilable<T> and eliminated JIT-related API/config surfaces (builder + YAML).
  • Updated remaining components (e.g., interpretability helper, neural network autodiff graph export) to work without JIT.

Reviewed changes

Copilot reviewed 257 out of 309 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
src/Interpretability/Helpers/GPUExplainerHelper.cs Removes GPU/JIT runtime wiring; forces CPU-only behavior.
src/Interfaces/ILayer.cs Removes IJitCompilable<T> inheritance from layer contract.
src/Interfaces/ITextToSpeech.cs Drops IJitCompilable<T> from model interface inheritance.
src/Interfaces/INeuralNetwork.cs Drops IJitCompilable<T> from model interface inheritance.
src/Interfaces/IAiModelBuilder.cs Removes ConfigureJitCompilation API from builder interface.
src/Configuration/YamlModelConfig.cs Removes JIT compilation configuration section from YAML model config.
src/Configuration/YamlConfigApplier.cs Stops applying JIT compilation config to the builder.
src/Autodiff/NeuralNetworkDerivatives.cs Adjusts computation-graph export to work without IJitCompilable<T>.
src/Genetics/ModelIndividual.cs Replaces JIT capability with constant “unsupported” behavior.
src/DistributedTraining/ShardedModelBase.cs Replaces JIT capability with constant “unsupported” behavior.
src/AutoML/AutoMLModelBase.cs Replaces JIT capability with constant “unsupported” behavior.
AiDotNetBenchmarkTests/GlobalUsings.cs Removes AiDotNet.JitCompiler global using.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/Interpretability/Helpers/GPUExplainerHelper.cs
Comment thread src/Interpretability/Helpers/GPUExplainerHelper.cs
Comment thread src/Interpretability/Helpers/GPUExplainerHelper.cs
Comment thread src/Interpretability/Helpers/GPUExplainerHelper.cs Outdated
Comment thread src/Interpretability/Helpers/GPUExplainerHelper.cs Outdated
Comment thread src/Autodiff/NeuralNetworkDerivatives.cs Outdated
Comment thread src/Genetics/ModelIndividual.cs Outdated
- GPUExplainerHelper: updated XML docs to reflect JIT removal —
  IsGPUEnabled/DeviceInfo now document they always return false/null
  and that GPU is at the Tensors engine level
- NeuralNetworkDerivatives: removed dead BuildGraph method that used
  the deleted ExportComputationGraph
- ModelIndividual: removed vestigial SupportsJitCompilation and
  ExportComputationGraph — not required by any interface

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Apr 7, 2026 •

Copy link
Copy Markdown
Contributor

Walkthrough

This PR removes the entire JIT compilation subsystem and related APIs: IJitCompilable, JIT config, the JIT compiler and codegen, IR model and operations, SIMD/GPU kernels and runtimes, tensor pooling, workspace compilation, and builder/YAML wiring; multiple interfaces and model wrappers were updated to drop JIT surfaces.

Changes

Cohort / File(s) Summary
Configuration & YAML
src/Configuration/JitCompilationConfig.cs, src/Configuration/YamlConfigApplier.cs, src/Configuration/YamlDocsGenerator.cs, src/Configuration/YamlJsonSchema.cs, src/Configuration/YamlModelConfig.cs
Removed JIT configuration POCO, removed application of JIT config in YAML applier, removed docs/schema entries and YamlModelConfig.JitCompilation property.
Builder & Public API
src/AiModelBuilder.cs, src/Interfaces/IAiModelBuilder.cs, AiDotNetBenchmarkTests/GlobalUsings.cs
Removed ConfigureJitCompilation API, internal JIT config accessor, build-time JIT logic; benchmark global using for AiDotNet.JitCompiler removed.
Core JIT + Codegen
src/JitCompiler/*.cs, src/JitCompiler/CodeGen/*, src/JitCompiler/CodeGen/* (many files)
Deleted JitCompiler, JitCompilerOptions, CompilationStats, HybridCompilationResult, CacheStats, CodeGenerator, WorkspaceCodeGenerator and extensive GPU/FP16/kernel/codegen files.
IR, Ops & IR Builder
src/JitCompiler/IR/*.cs, src/JitCompiler/IR/Operations/*, src/JitCompiler/IRBuilder.cs
Removed IR types (IRGraph, IROp, IRType, TensorShape), ~50+ forward/backward/fused/vectorized op files, IRBuilder and many validation/string helpers.
SIMD & Optimizer
src/JitCompiler/CodeGen/SIMDCapabilities.cs, SIMDOptimizer.cs, SIMDStats.cs, VectorHelper.cs
Removed SIMD detection, optimizer, stats and vector helper utilities.
GPU runtime & mocks
src/JitCompiler/CodeGen/IGPURuntime.cs, IGPUKernelHandle.cs, IGPUMemoryHandle.cs, MockGPURuntime.cs, GPUKernelLibrary.cs, FP16Kernels.cs
Deleted GPU runtime abstractions, handles, mock runtime and CUDA kernel generator sources.
Gradient & Math kernels
src/JitCompiler/CodeGen/GradientOps.cs, RecurrentOps.cs
Removed large gradient/backprop helper implementations and recurrent op kernels.
Memory pooling
src/JitCompiler/Memory/TensorPool.cs, TensorPoolStats.cs, TensorRental.cs
Removed tensor pool, rental wrapper and pool stats (buffer reuse removed).
Interface surface removals
src/Interfaces/IJitCompilable.cs, numerous src/Interfaces/*.cs (30+ files)
Deleted IJitCompilable; removed IJitCompilable from many interfaces (audio, diffusion, speech, classifiers, models, layers, etc.).
Helpers / Guards / Wrappers
src/Helpers/InterfaceGuard.cs, model wrappers and related files
Removed InterfaceGuard.JitCompilable and removed or changed SupportsJitCompilation/ExportComputationGraph members in wrappers (some now return false or throw NotSupportedException).
Autodiff / Model changes
src/Autodiff/NeuralNetworkDerivatives.cs, src/Diffusion/NoisePredictors/UNetNoisePredictor.cs, src/AdversarialRobustness/Defenses/AdversarialTraining.cs, src/AutoML/AutoMLModelBase.cs, src/DistributedTraining/ShardedModelBase.cs, src/Genetics/ModelIndividual.cs, src/Clustering/Base/ClusteringBase.cs
Removed private BuildGraph helper; removed UNet compile path and IsCompiled/CompileForward; removed or changed SupportsJitCompilation and ExportComputationGraph implementations (many now constant-false or removed).
Interpretability GPU helper
src/Interpretability/Helpers/GPUExplainerHelper.cs
Removed GPU runtime injection/fields; IsGPUEnabled now always false, DeviceInfo null; constructor/factories simplified; Dispose no longer disposes GPU runtime.

Sequence Diagram(s)

(omitted)

Estimated code review effort

🎯 5 (Critical) | ⏱️ ~120+ minutes

Possibly related PRs

Poem

The compiler's wings are folded tight,
IR gone dim, kernels lose their light,
Pools and SIMD laid to rest,
A leaner tree begins its quest —
Quiet code now seeks what's right.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch refactor/remove-per-layer-jit

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (3)
src/AiModelBuilder.cs (1)

2699-2719: ⚠️ Potential issue | 🟡 Minor

Remove stale JIT wording around the now-null result field.

Line 2718 hard-disables JIT output, but Line 2699 still documents JIT as part of the result flow. Please update nearby comments to reflect full JIT removal (and align the similar stale note around Lines 3190-3191).

✂️ Suggested cleanup
-        // Return AiModelResult with CV results, agent data, JIT compilation, reasoning config, and training infrastructure
+        // Return AiModelResult with CV results, agent data, reasoning config, and training infrastructure
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/AiModelBuilder.cs` around lines 2699 - 2719, The code still mentions "JIT
compilation" in comments around the AiModelBuilder options even though the
JitCompiledFunction field is always set to null; update the comments and any
stale notes (including the similar note near the block around Lines ~3190-3191)
to remove or reword JIT/JIT compilation references and reflect that JIT output
was removed. Locate the AiModelResultOptions construction in AiModelBuilder and
any adjacent comment blocks referencing JIT or JitCompiledFunction and change
them to describe the current state (e.g., no JIT support / JIT removed) or
remove the JIT wording entirely so comments align with JitCompiledFunction =
null.
src/DistributedTraining/ShardedModelBase.cs (1)

489-509: ⚠️ Potential issue | 🟡 Minor

Fix contradictory JIT documentation in sharded model API.

Line 505 and Line 509 hard-disable JIT, but the surrounding docs still claim support is delegated to WrappedModel. Please update/remove that guidance to avoid incorrect IntelliSense and migration confusion.

Proposed doc cleanup
-    `#region` IJitCompilable Implementation
+    `#region` Former JIT Surface (Removed)
@@
-    /// <value>True if the wrapped model supports JIT compilation, false otherwise.</value>
+    /// <value>Always <c>false</c>. Per-layer JIT compilation has been removed.</value>
@@
-    /// Sharded models delegate JIT compilation support to their wrapped model.
-    /// JIT compilation is performed on the full model representation, not on individual shards.
+    /// Per-layer JIT compilation is no longer available.
@@
-    public virtual ComputationNode<T> ExportComputationGraph(List<ComputationNode<T>> inputNodes)
+    /// <summary>
+    /// Exporting computation graphs for JIT is no longer supported.
+    /// </summary>
+    /// <exception cref="NotSupportedException">Always thrown because JIT was removed.</exception>
+    public virtual ComputationNode<T> ExportComputationGraph(List<ComputationNode<T>> inputNodes)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/DistributedTraining/ShardedModelBase.cs` around lines 489 - 509, Update
the XML docs on the ShardedModelBase API to remove the incorrect delegation
claim to WrappedModel and clearly state that JIT compilation is not supported
for sharded models: revise the summary/remarks of the SupportsJitCompilation
property and the ExportComputationGraph method to explicitly say JIT compilation
is disabled/unsupported for sharded models (do not say it is delegated to
WrappedModel or that sharding allows JIT), and adjust the ExportComputationGraph
remark/message to match the thrown NotSupportedException text so IntelliSense
and migration guidance are consistent.
src/AutoML/AutoMLModelBase.cs (1)

1162-1185: ⚠️ Potential issue | 🟡 Minor

Update stale JIT XML docs to match removed functionality.

Line 1181 always returns false and Line 1185 always throws, but the current XML docs still describe delegated JIT support and possible successful export. Please update the summaries/remarks/value text (and region label) to reflect permanent removal.

Proposed doc cleanup
-        `#region` IJitCompilable Implementation
+        `#region` Former JIT Surface (Removed)
@@
-        /// Gets whether this model currently supports JIT compilation.
+        /// Gets whether this model supports JIT compilation.
@@
-        /// <value>True if the best model found supports JIT compilation, false otherwise.</value>
+        /// <value>Always <c>false</c>. Per-layer JIT compilation has been removed.</value>
@@
-        /// AutoML models delegate JIT compilation support to their best model.
-        /// If no best model has been found yet, JIT compilation is not supported.
+        /// Per-layer JIT compilation is no longer available.
@@
-        public virtual ComputationNode<T> ExportComputationGraph(List<ComputationNode<T>> inputNodes)
+        /// <summary>
+        /// Exporting computation graphs for JIT is no longer supported.
+        /// </summary>
+        /// <exception cref="NotSupportedException">Always thrown because JIT was removed.</exception>
+        public virtual ComputationNode<T> ExportComputationGraph(List<ComputationNode<T>> inputNodes)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/AutoML/AutoMLModelBase.cs` around lines 1162 - 1185, The XML docs for
SupportsJitCompilation and ExportComputationGraph are stale: update the summary,
value and remarks (and any region label) to clearly state that JIT compilation
was removed and is permanently unsupported (SupportsJitCompilation always
returns false) and that ExportComputationGraph always throws
NotSupportedException; replace any text about delegation or conditional support
with a concise statement that JIT compilation is not supported by
AutoMLModelBase and consumers should not expect ExportComputationGraph to work.
🤖 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/Interpretability/Helpers/GPUExplainerHelper.cs`:
- Around line 70-80: Validate the constructor parameter in GPUExplainerHelper:
ensure maxParallelism (and any code paths setting _maxParallelism, e.g., the
constructor that assigns _maxParallelism) is > 0; if null use
Environment.ProcessorCount, but if a value is supplied and it's <= 0 throw an
ArgumentOutOfRangeException (with a clear message) rather than accepting it, so
later uses (division by _maxParallelism and setting
ParallelOptions.MaxDegreeOfParallelism) won't fail with divide-by-zero or
invalid-parallelism errors.
- Around line 50-62: The public GPU surface (IsGPUEnabled, DeviceInfo) is
returning hardcoded placeholder values, making GPU branches in
GPUExplainerHelper unreachable; update GPUExplainerHelper by either
removing/marking obsolete the GPU-specific API and collapsing dead branches, or
implement real detection by querying the tensors engine capability in
CreateWithAutoDetect and returning true/actual device info from IsGPUEnabled and
DeviceInfo; locate and modify the properties IsGPUEnabled and DeviceInfo and the
factory method CreateWithAutoDetect (and related GPU branch methods) to either
delegate to the engine-level GPU capability API or to obsolete/remove the GPU
surface and clean up dead code paths.

---

Outside diff comments:
In `@src/AiModelBuilder.cs`:
- Around line 2699-2719: The code still mentions "JIT compilation" in comments
around the AiModelBuilder options even though the JitCompiledFunction field is
always set to null; update the comments and any stale notes (including the
similar note near the block around Lines ~3190-3191) to remove or reword JIT/JIT
compilation references and reflect that JIT output was removed. Locate the
AiModelResultOptions construction in AiModelBuilder and any adjacent comment
blocks referencing JIT or JitCompiledFunction and change them to describe the
current state (e.g., no JIT support / JIT removed) or remove the JIT wording
entirely so comments align with JitCompiledFunction = null.

In `@src/AutoML/AutoMLModelBase.cs`:
- Around line 1162-1185: The XML docs for SupportsJitCompilation and
ExportComputationGraph are stale: update the summary, value and remarks (and any
region label) to clearly state that JIT compilation was removed and is
permanently unsupported (SupportsJitCompilation always returns false) and that
ExportComputationGraph always throws NotSupportedException; replace any text
about delegation or conditional support with a concise statement that JIT
compilation is not supported by AutoMLModelBase and consumers should not expect
ExportComputationGraph to work.

In `@src/DistributedTraining/ShardedModelBase.cs`:
- Around line 489-509: Update the XML docs on the ShardedModelBase API to remove
the incorrect delegation claim to WrappedModel and clearly state that JIT
compilation is not supported for sharded models: revise the summary/remarks of
the SupportsJitCompilation property and the ExportComputationGraph method to
explicitly say JIT compilation is disabled/unsupported for sharded models (do
not say it is delegated to WrappedModel or that sharding allows JIT), and adjust
the ExportComputationGraph remark/message to match the thrown
NotSupportedException text so IntelliSense and migration guidance are
consistent.
🪄 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: 6fc9455e-f105-4438-9e08-43a2364efc99

📥 Commits

Reviewing files that changed from the base of the PR and between 85b8623 and 9ee83bc.

📒 Files selected for processing (300)
  • AiDotNetBenchmarkTests/GlobalUsings.cs
  • src/AdversarialRobustness/Defenses/AdversarialTraining.cs
  • src/AiModelBuilder.cs
  • src/AutoML/AutoMLModelBase.cs
  • src/Autodiff/NeuralNetworkDerivatives.cs
  • src/Clustering/Base/ClusteringBase.cs
  • src/Configuration/JitCompilationConfig.cs
  • src/Configuration/YamlConfigApplier.cs
  • src/Configuration/YamlDocsGenerator.cs
  • src/Configuration/YamlJsonSchema.cs
  • src/Configuration/YamlModelConfig.cs
  • src/Diffusion/NoisePredictors/UNetNoisePredictor.cs
  • src/DistributedTraining/ShardedModelBase.cs
  • src/Genetics/ModelIndividual.cs
  • src/Helpers/InterfaceGuard.cs
  • src/Interfaces/IAiModelBuilder.cs
  • src/Interfaces/IAudioEventDetector.cs
  • src/Interfaces/IAudioGenerator.cs
  • src/Interfaces/ICausalModel.cs
  • src/Interfaces/IDiffusionModel.cs
  • src/Interfaces/IGenreClassifier.cs
  • src/Interfaces/IJitCompilable.cs
  • src/Interfaces/ILayer.cs
  • src/Interfaces/IMultiLabelClassifier.cs
  • src/Interfaces/IMusicSourceSeparator.cs
  • src/Interfaces/INeuralNetwork.cs
  • src/Interfaces/INoisePredictor.cs
  • src/Interfaces/IOnlineLearningModel.cs
  • src/Interfaces/IRLAgent.cs
  • src/Interfaces/ISceneClassifier.cs
  • src/Interfaces/ISegmentationModel.cs
  • src/Interfaces/ISpeakerDiarizer.cs
  • src/Interfaces/ISpeakerVerifier.cs
  • src/Interfaces/ISpeechRecognizer.cs
  • src/Interfaces/ITextToSpeech.cs
  • src/Interfaces/IVAEModel.cs
  • src/Interpretability/Helpers/GPUExplainerHelper.cs
  • src/JitCompiler/CacheStats.cs
  • src/JitCompiler/CodeGen/CodeGenerator.cs
  • src/JitCompiler/CodeGen/FP16Kernels.cs
  • src/JitCompiler/CodeGen/GPUCodeGenerator.cs
  • src/JitCompiler/CodeGen/GPUKernelLibrary.cs
  • src/JitCompiler/CodeGen/GradientOps.cs
  • src/JitCompiler/CodeGen/IGPUKernelHandle.cs
  • src/JitCompiler/CodeGen/IGPUMemoryHandle.cs
  • src/JitCompiler/CodeGen/IGPURuntime.cs
  • src/JitCompiler/CodeGen/MockGPURuntime.cs
  • src/JitCompiler/CodeGen/RecurrentOps.cs
  • src/JitCompiler/CodeGen/SIMDCapabilities.cs
  • src/JitCompiler/CodeGen/SIMDOptimizer.cs
  • src/JitCompiler/CodeGen/SIMDStats.cs
  • src/JitCompiler/CodeGen/VectorHelper.cs
  • src/JitCompiler/CodeGen/WorkspaceCodeGenerator.cs
  • src/JitCompiler/CompilationStats.cs
  • src/JitCompiler/HybridCompilationResult.cs
  • src/JitCompiler/IR/IFusableActivation.cs
  • src/JitCompiler/IR/IRGraph.cs
  • src/JitCompiler/IR/IROp.cs
  • src/JitCompiler/IR/IRType.cs
  • src/JitCompiler/IR/Operations/AbsOp.cs
  • src/JitCompiler/IR/Operations/AddOp.cs
  • src/JitCompiler/IR/Operations/AffineGridOp.cs
  • src/JitCompiler/IR/Operations/ApplyActivationOp.cs
  • src/JitCompiler/IR/Operations/AttentionOp.cs
  • src/JitCompiler/IR/Operations/AvgPool2DOp.cs
  • src/JitCompiler/IR/Operations/BackwardOp.cs
  • src/JitCompiler/IR/Operations/BatchNormOp.cs
  • src/JitCompiler/IR/Operations/BentIdentityOp.cs
  • src/JitCompiler/IR/Operations/CELUOp.cs
  • src/JitCompiler/IR/Operations/ComplexMatMulOp.cs
  • src/JitCompiler/IR/Operations/ComplexMultiplyOp.cs
  • src/JitCompiler/IR/Operations/ConcatOp.cs
  • src/JitCompiler/IR/Operations/ConstantOp.cs
  • src/JitCompiler/IR/Operations/Conv2DOp.cs
  • src/JitCompiler/IR/Operations/ConvTranspose2DOp.cs
  • src/JitCompiler/IR/Operations/CropOp.cs
  • src/JitCompiler/IR/Operations/DepthwiseConv2DOp.cs
  • src/JitCompiler/IR/Operations/DifferentiableApproximationOps.cs
  • src/JitCompiler/IR/Operations/DilatedConv2DOp.cs
  • src/JitCompiler/IR/Operations/DivideOp.cs
  • src/JitCompiler/IR/Operations/DropoutOp.cs
  • src/JitCompiler/IR/Operations/ELUOp.cs
  • src/JitCompiler/IR/Operations/ElementwiseMultiplyOp.cs
  • src/JitCompiler/IR/Operations/EmbeddingOp.cs
  • src/JitCompiler/IR/Operations/ExpOp.cs
  • src/JitCompiler/IR/Operations/FusedAddGroupNormOp.cs
  • src/JitCompiler/IR/Operations/FusedAddLayerNormOp.cs
  • src/JitCompiler/IR/Operations/FusedAddReLUOp.cs
  • src/JitCompiler/IR/Operations/FusedAttentionOp.cs
  • src/JitCompiler/IR/Operations/FusedBatchNormActivationOp.cs
  • src/JitCompiler/IR/Operations/FusedBiasActivationOp.cs
  • src/JitCompiler/IR/Operations/FusedConv2DBiasActivationOp.cs
  • src/JitCompiler/IR/Operations/FusedConvBatchNormActivationOp.cs
  • src/JitCompiler/IR/Operations/FusedConvBatchNormOp.cs
  • src/JitCompiler/IR/Operations/FusedDenseLayerOp.cs
  • src/JitCompiler/IR/Operations/FusedElementwiseActivationOp.cs
  • src/JitCompiler/IR/Operations/FusedElementwiseChainOp.cs
  • src/JitCompiler/IR/Operations/FusedGELUOp.cs
  • src/JitCompiler/IR/Operations/FusedGroupNormActivationConv2DOp.cs
  • src/JitCompiler/IR/Operations/FusedGroupNormActivationOp.cs
  • src/JitCompiler/IR/Operations/FusedLayerNormAddOp.cs
  • src/JitCompiler/IR/Operations/FusedLinearActivationOp.cs
  • src/JitCompiler/IR/Operations/FusedLinearOp.cs
  • src/JitCompiler/IR/Operations/FusedLinearReLUOp.cs
  • src/JitCompiler/IR/Operations/FusedMatMulAddOp.cs
  • src/JitCompiler/IR/Operations/FusedMultiHeadAttentionOp.cs
  • src/JitCompiler/IR/Operations/FusedResidualBlockOp.cs
  • src/JitCompiler/IR/Operations/FusedSwishOp.cs
  • src/JitCompiler/IR/Operations/GELUOp.cs
  • src/JitCompiler/IR/Operations/GRUCellOp.cs
  • src/JitCompiler/IR/Operations/GaussianOp.cs
  • src/JitCompiler/IR/Operations/GeometricProductOp.cs
  • src/JitCompiler/IR/Operations/GradAccumulateOp.cs
  • src/JitCompiler/IR/Operations/GradAddOp.cs
  • src/JitCompiler/IR/Operations/GradAttentionOp.cs
  • src/JitCompiler/IR/Operations/GradAvgPool2DOp.cs
  • src/JitCompiler/IR/Operations/GradBatchNormOp.cs
  • src/JitCompiler/IR/Operations/GradBentIdentityOp.cs
  • src/JitCompiler/IR/Operations/GradBroadcastOp.cs
  • src/JitCompiler/IR/Operations/GradCELUOp.cs
  • src/JitCompiler/IR/Operations/GradConcatOp.cs
  • src/JitCompiler/IR/Operations/GradConv2DOp.cs
  • src/JitCompiler/IR/Operations/GradConvTranspose2DOp.cs
  • src/JitCompiler/IR/Operations/GradCropOp.cs
  • src/JitCompiler/IR/Operations/GradDepthwiseConv2DOp.cs
  • src/JitCompiler/IR/Operations/GradDivideOp.cs
  • src/JitCompiler/IR/Operations/GradDropoutOp.cs
  • src/JitCompiler/IR/Operations/GradELUOp.cs
  • src/JitCompiler/IR/Operations/GradElementwiseMultiplyOp.cs
  • src/JitCompiler/IR/Operations/GradEmbeddingOp.cs
  • src/JitCompiler/IR/Operations/GradExpOp.cs
  • src/JitCompiler/IR/Operations/GradGELUOp.cs
  • src/JitCompiler/IR/Operations/GradGRUCellOp.cs
  • src/JitCompiler/IR/Operations/GradGRUSequenceOp.cs
  • src/JitCompiler/IR/Operations/GradGatherOp.cs
  • src/JitCompiler/IR/Operations/GradGaussianOp.cs
  • src/JitCompiler/IR/Operations/GradGeometricProductOp.cs
  • src/JitCompiler/IR/Operations/GradHardSigmoidOp.cs
  • src/JitCompiler/IR/Operations/GradHardTanhOp.cs
  • src/JitCompiler/IR/Operations/GradISRUOp.cs
  • src/JitCompiler/IR/Operations/GradLSTMCellInputOp.cs
  • src/JitCompiler/IR/Operations/GradLSTMSequenceOp.cs
  • src/JitCompiler/IR/Operations/GradLayerNormOp.cs
  • src/JitCompiler/IR/Operations/GradLeakyReLUOp.cs
  • src/JitCompiler/IR/Operations/GradLiSHTOp.cs
  • src/JitCompiler/IR/Operations/GradLogOp.cs
  • src/JitCompiler/IR/Operations/GradLogSoftmaxOp.cs
  • src/JitCompiler/IR/Operations/GradMatMulLeftOp.cs
  • src/JitCompiler/IR/Operations/GradMatMulRightOp.cs
  • src/JitCompiler/IR/Operations/GradMaxPool2DOp.cs
  • src/JitCompiler/IR/Operations/GradMeanOp.cs
  • src/JitCompiler/IR/Operations/GradMishOp.cs
  • src/JitCompiler/IR/Operations/GradMobiusAddOp.cs
  • src/JitCompiler/IR/Operations/GradMultiHeadAttentionOp.cs
  • src/JitCompiler/IR/Operations/GradOctonionMultiplyOp.cs
  • src/JitCompiler/IR/Operations/GradPReLUOp.cs
  • src/JitCompiler/IR/Operations/GradPadOp.cs
  • src/JitCompiler/IR/Operations/GradPoincareExpMapOp.cs
  • src/JitCompiler/IR/Operations/GradPowerOp.cs
  • src/JitCompiler/IR/Operations/GradRReLUOp.cs
  • src/JitCompiler/IR/Operations/GradReLUOp.cs
  • src/JitCompiler/IR/Operations/GradReshapeOp.cs
  • src/JitCompiler/IR/Operations/GradSELUOp.cs
  • src/JitCompiler/IR/Operations/GradScaledTanhOp.cs
  • src/JitCompiler/IR/Operations/GradSigmoidOp.cs
  • src/JitCompiler/IR/Operations/GradSliceOp.cs
  • src/JitCompiler/IR/Operations/GradSoftPlusOp.cs
  • src/JitCompiler/IR/Operations/GradSoftSignOp.cs
  • src/JitCompiler/IR/Operations/GradSoftmaxOp.cs
  • src/JitCompiler/IR/Operations/GradSpMMOp.cs
  • src/JitCompiler/IR/Operations/GradSpMVOp.cs
  • src/JitCompiler/IR/Operations/GradSparsemaxOp.cs
  • src/JitCompiler/IR/Operations/GradSplitOp.cs
  • src/JitCompiler/IR/Operations/GradSqrtOp.cs
  • src/JitCompiler/IR/Operations/GradSubtractOp.cs
  • src/JitCompiler/IR/Operations/GradSumOp.cs
  • src/JitCompiler/IR/Operations/GradSwishOp.cs
  • src/JitCompiler/IR/Operations/GradTanhOp.cs
  • src/JitCompiler/IR/Operations/GradThresholdedReLUOp.cs
  • src/JitCompiler/IR/Operations/GradTransposeOp.cs
  • src/JitCompiler/IR/Operations/GradUpsampleOp.cs
  • src/JitCompiler/IR/Operations/GraphConvOp.cs
  • src/JitCompiler/IR/Operations/GridSampleOp.cs
  • src/JitCompiler/IR/Operations/GroupNormOp.cs
  • src/JitCompiler/IR/Operations/HardSigmoidOp.cs
  • src/JitCompiler/IR/Operations/HardTanhOp.cs
  • src/JitCompiler/IR/Operations/HierarchicalSoftmaxOp.cs
  • src/JitCompiler/IR/Operations/ISRUOp.cs
  • src/JitCompiler/IR/Operations/LSTMCellOp.cs
  • src/JitCompiler/IR/Operations/LayerNormOp.cs
  • src/JitCompiler/IR/Operations/LeakyReLUOp.cs
  • src/JitCompiler/IR/Operations/LiSHTOp.cs
  • src/JitCompiler/IR/Operations/LocallyConnectedConv2DOp.cs
  • src/JitCompiler/IR/Operations/LogOp.cs
  • src/JitCompiler/IR/Operations/LogSoftmaxOp.cs
  • src/JitCompiler/IR/Operations/LogSoftminOp.cs
  • src/JitCompiler/IR/Operations/MatMulOp.cs
  • src/JitCompiler/IR/Operations/MaxPool2DOp.cs
  • src/JitCompiler/IR/Operations/MaxoutOp.cs
  • src/JitCompiler/IR/Operations/MeanOp.cs
  • src/JitCompiler/IR/Operations/MishOp.cs
  • src/JitCompiler/IR/Operations/MobiusAddOp.cs
  • src/JitCompiler/IR/Operations/MultiHeadAttentionOp.cs
  • src/JitCompiler/IR/Operations/NegateOp.cs
  • src/JitCompiler/IR/Operations/NormOp.cs
  • src/JitCompiler/IR/Operations/OctonionMatMulOp.cs
  • src/JitCompiler/IR/Operations/OctonionMultiplyOp.cs
  • src/JitCompiler/IR/Operations/PReLUOp.cs
  • src/JitCompiler/IR/Operations/PadOp.cs
  • src/JitCompiler/IR/Operations/PixelShuffleOp.cs
  • src/JitCompiler/IR/Operations/PoincareExpMapOp.cs
  • src/JitCompiler/IR/Operations/PoincareLogMapOp.cs
  • src/JitCompiler/IR/Operations/PowerOp.cs
  • src/JitCompiler/IR/Operations/RBFKernelOp.cs
  • src/JitCompiler/IR/Operations/RReLUOp.cs
  • src/JitCompiler/IR/Operations/ReLUOp.cs
  • src/JitCompiler/IR/Operations/ReduceLogVarianceOp.cs
  • src/JitCompiler/IR/Operations/ReduceMaxOp.cs
  • src/JitCompiler/IR/Operations/ReduceMeanOp.cs
  • src/JitCompiler/IR/Operations/ReshapeOp.cs
  • src/JitCompiler/IR/Operations/SELUOp.cs
  • src/JitCompiler/IR/Operations/SQRBFOp.cs
  • src/JitCompiler/IR/Operations/ScalarConstantOp.cs
  • src/JitCompiler/IR/Operations/ScaledDotProductAttentionOp.cs
  • src/JitCompiler/IR/Operations/ScaledTanhOp.cs
  • src/JitCompiler/IR/Operations/SigmoidOp.cs
  • src/JitCompiler/IR/Operations/SignOp.cs
  • src/JitCompiler/IR/Operations/SliceOp.cs
  • src/JitCompiler/IR/Operations/SoftPlusOp.cs
  • src/JitCompiler/IR/Operations/SoftSignOp.cs
  • src/JitCompiler/IR/Operations/SoftmaxOp.cs
  • src/JitCompiler/IR/Operations/SoftminOp.cs
  • src/JitCompiler/IR/Operations/SpMMOp.cs
  • src/JitCompiler/IR/Operations/SpMVOp.cs
  • src/JitCompiler/IR/Operations/SparsemaxOp.cs
  • src/JitCompiler/IR/Operations/SphericalSoftmaxOp.cs
  • src/JitCompiler/IR/Operations/SplitOp.cs
  • src/JitCompiler/IR/Operations/SqrtOp.cs
  • src/JitCompiler/IR/Operations/SquareOp.cs
  • src/JitCompiler/IR/Operations/SquashOp.cs
  • src/JitCompiler/IR/Operations/SubtractOp.cs
  • src/JitCompiler/IR/Operations/SumOp.cs
  • src/JitCompiler/IR/Operations/SwishOp.cs
  • src/JitCompiler/IR/Operations/TanhOp.cs
  • src/JitCompiler/IR/Operations/TaylorSoftmaxOp.cs
  • src/JitCompiler/IR/Operations/ThresholdedReLUOp.cs
  • src/JitCompiler/IR/Operations/TransposeOp.cs
  • src/JitCompiler/IR/Operations/UpsampleOp.cs
  • src/JitCompiler/IR/Operations/VectorizedOps.cs
  • src/JitCompiler/IR/Operations/WedgeProductOp.cs
  • src/JitCompiler/IR/TensorShape.cs
  • src/JitCompiler/IRBuilder.cs
  • src/JitCompiler/JitCompatibilityResult.cs
  • src/JitCompiler/JitCompiler.cs
  • src/JitCompiler/JitCompilerOptions.cs
  • src/JitCompiler/Memory/TensorPool.cs
  • src/JitCompiler/Memory/TensorPoolStats.cs
  • src/JitCompiler/Memory/TensorRental.cs
  • src/JitCompiler/Optimizations/AdaptiveFusionPass.cs
  • src/JitCompiler/Optimizations/AutoTuningPass.cs
  • src/JitCompiler/Optimizations/ConstantFoldingPass.cs
  • src/JitCompiler/Optimizations/DeadCodeEliminationPass.cs
  • src/JitCompiler/Optimizations/IOptimizationPass.cs
  • src/JitCompiler/Optimizations/LoopUnrollingPass.cs
  • src/JitCompiler/Optimizations/MemoryPlanningPass.cs
  • src/JitCompiler/Optimizations/OperationFusionPass.cs
  • src/JitCompiler/Optimizations/OperatorReorderingPass.cs
  • src/JitCompiler/Optimizations/TileSchedulingPass.cs
  • src/JitCompiler/Optimizations/VectorizationPass.cs
  • src/JitCompiler/Optimizations/VectorizationStats.cs
  • src/JitCompiler/README.md
  • src/JitCompiler/Runtime/UnrolledOps.cs
  • src/JitCompiler/Runtime/VectorizedOps.cs
  • src/JitCompiler/Testing/GradientVerification.cs
  • src/JitCompiler/Testing/GradientVerificationExtensions.cs
  • src/JitCompiler/UnsupportedOperationInfo.cs
  • src/KnowledgeDistillation/TeacherModelBase.cs
  • src/KnowledgeDistillation/Teachers/OnlineTeacherModel.cs
  • src/KnowledgeDistillation/Teachers/PretrainedTeacherModel.cs
  • src/KnowledgeDistillation/Teachers/QuantizedTeacherModel.cs
  • src/KnowledgeDistillation/Teachers/SelfTeacherModel.cs
  • src/KnowledgeDistillation/Teachers/TransformerTeacherModel.cs
  • src/Models/ModelBase.cs
  • src/Models/ModelWrapperBase.cs
  • src/Models/Results/AiModelResult.cs
  • src/NeuralNetworks/NeuralNetworkBase.cs
  • src/NeuralNetworks/SyntheticData/SyntheticTabularGeneratorBase.cs
  • src/NeuralNetworks/SyntheticData/TapeLayerBridge.cs
  • src/Regression/NonLinearRegressionBase.cs
  • src/Regression/RegressionBase.cs
  • src/ReinforcementLearning/Agents/DeepReinforcementLearningAgentBase.cs
  • tests/AiDotNet.Tests/Benchmarks/JitCompilerBenchmarks.cs
  • tests/AiDotNet.Tests/IntegrationTests/Configuration/YamlConfigTests.cs
  • tests/AiDotNet.Tests/IntegrationTests/JitCompiler/JitCompilerDeepMathIntegrationTests.cs
  • tests/AiDotNet.Tests/IntegrationTests/JitCompiler/JitCompilerExtendedIntegrationTests.cs
  • tests/AiDotNet.Tests/IntegrationTests/JitCompiler/JitCompilerIntegrationTests.cs
  • tests/AiDotNet.Tests/IntegrationTests/JitCompiler/WorkspaceCompilationTests.cs
  • tests/AiDotNet.Tests/IntegrationTests/ReinforcementLearning/BaseClassesIntegrationTests.cs
  • tests/AiDotNet.Tests/JitCompiler/JitCompilerOperationsTests.cs
  • tests/AiDotNet.Tests/MergedPRBugFixTests.cs
💤 Files with no reviewable changes (232)
  • src/JitCompiler/IR/Operations/GradSqrtOp.cs
  • AiDotNetBenchmarkTests/GlobalUsings.cs
  • src/AdversarialRobustness/Defenses/AdversarialTraining.cs
  • src/Autodiff/NeuralNetworkDerivatives.cs
  • src/Configuration/YamlConfigApplier.cs
  • src/Configuration/YamlDocsGenerator.cs
  • src/Configuration/YamlJsonSchema.cs
  • src/Configuration/YamlModelConfig.cs
  • src/Helpers/InterfaceGuard.cs
  • src/JitCompiler/CacheStats.cs
  • src/JitCompiler/CodeGen/IGPUKernelHandle.cs
  • src/JitCompiler/CodeGen/IGPUMemoryHandle.cs
  • src/JitCompiler/IR/IFusableActivation.cs
  • src/JitCompiler/IR/IRType.cs
  • src/JitCompiler/IR/Operations/AbsOp.cs
  • src/JitCompiler/IR/Operations/AddOp.cs
  • src/JitCompiler/IR/Operations/AffineGridOp.cs
  • src/JitCompiler/IR/Operations/ApplyActivationOp.cs
  • src/JitCompiler/IR/Operations/AttentionOp.cs
  • src/JitCompiler/IR/Operations/AvgPool2DOp.cs
  • src/JitCompiler/IR/Operations/BackwardOp.cs
  • src/JitCompiler/IR/Operations/BatchNormOp.cs
  • src/JitCompiler/IR/Operations/BentIdentityOp.cs
  • src/JitCompiler/IR/Operations/CELUOp.cs
  • src/JitCompiler/IR/Operations/ComplexMatMulOp.cs
  • src/JitCompiler/IR/Operations/ComplexMultiplyOp.cs
  • src/JitCompiler/IR/Operations/ConcatOp.cs
  • src/JitCompiler/IR/Operations/Conv2DOp.cs
  • src/JitCompiler/IR/Operations/ConvTranspose2DOp.cs
  • src/JitCompiler/IR/Operations/CropOp.cs
  • src/JitCompiler/IR/Operations/DepthwiseConv2DOp.cs
  • src/JitCompiler/IR/Operations/DilatedConv2DOp.cs
  • src/JitCompiler/IR/Operations/DivideOp.cs
  • src/JitCompiler/IR/Operations/DropoutOp.cs
  • src/JitCompiler/IR/Operations/ELUOp.cs
  • src/JitCompiler/IR/Operations/ElementwiseMultiplyOp.cs
  • src/JitCompiler/IR/Operations/EmbeddingOp.cs
  • src/JitCompiler/IR/Operations/ExpOp.cs
  • src/JitCompiler/IR/Operations/FusedAddGroupNormOp.cs
  • src/JitCompiler/IR/Operations/FusedAddLayerNormOp.cs
  • src/JitCompiler/IR/Operations/FusedAttentionOp.cs
  • src/JitCompiler/IR/Operations/FusedBatchNormActivationOp.cs
  • src/JitCompiler/IR/Operations/FusedBiasActivationOp.cs
  • src/JitCompiler/IR/Operations/FusedConv2DBiasActivationOp.cs
  • src/JitCompiler/IR/Operations/FusedConvBatchNormActivationOp.cs
  • src/JitCompiler/IR/Operations/FusedDenseLayerOp.cs
  • src/JitCompiler/IR/Operations/FusedElementwiseActivationOp.cs
  • src/JitCompiler/IR/Operations/FusedGELUOp.cs
  • src/JitCompiler/IR/Operations/FusedGroupNormActivationConv2DOp.cs
  • src/JitCompiler/IR/Operations/FusedGroupNormActivationOp.cs
  • src/JitCompiler/IR/Operations/FusedLayerNormAddOp.cs
  • src/JitCompiler/IR/Operations/FusedLinearActivationOp.cs
  • src/JitCompiler/IR/Operations/FusedLinearOp.cs
  • src/JitCompiler/IR/Operations/FusedLinearReLUOp.cs
  • src/JitCompiler/IR/Operations/FusedMatMulAddOp.cs
  • src/JitCompiler/IR/Operations/FusedMultiHeadAttentionOp.cs
  • src/JitCompiler/IR/Operations/FusedSwishOp.cs
  • src/JitCompiler/IR/Operations/GELUOp.cs
  • src/JitCompiler/IR/Operations/GRUCellOp.cs
  • src/JitCompiler/IR/Operations/GaussianOp.cs
  • src/JitCompiler/IR/Operations/GeometricProductOp.cs
  • src/JitCompiler/IR/Operations/GradAccumulateOp.cs
  • src/JitCompiler/IR/Operations/GradAddOp.cs
  • src/JitCompiler/IR/Operations/GradAttentionOp.cs
  • src/JitCompiler/IR/Operations/GradAvgPool2DOp.cs
  • src/JitCompiler/IR/Operations/GradBatchNormOp.cs
  • src/JitCompiler/IR/Operations/GradBentIdentityOp.cs
  • src/JitCompiler/IR/Operations/GradBroadcastOp.cs
  • src/JitCompiler/IR/Operations/GradCELUOp.cs
  • src/JitCompiler/IR/Operations/GradConcatOp.cs
  • src/JitCompiler/IR/Operations/GradCropOp.cs
  • src/JitCompiler/IR/Operations/GradDepthwiseConv2DOp.cs
  • src/JitCompiler/IR/Operations/GradDivideOp.cs
  • src/JitCompiler/IR/Operations/GradDropoutOp.cs
  • src/JitCompiler/IR/Operations/GradELUOp.cs
  • src/JitCompiler/IR/Operations/GradElementwiseMultiplyOp.cs
  • src/JitCompiler/IR/Operations/GradEmbeddingOp.cs
  • src/JitCompiler/IR/Operations/GradExpOp.cs
  • src/JitCompiler/IR/Operations/GradGELUOp.cs
  • src/JitCompiler/IR/Operations/GradGRUCellOp.cs
  • src/JitCompiler/IR/Operations/GradGRUSequenceOp.cs
  • src/JitCompiler/IR/Operations/GradGatherOp.cs
  • src/JitCompiler/IR/Operations/GradGaussianOp.cs
  • src/JitCompiler/IR/Operations/GradGeometricProductOp.cs
  • src/JitCompiler/IR/Operations/GradHardSigmoidOp.cs
  • src/JitCompiler/IR/Operations/GradHardTanhOp.cs
  • src/JitCompiler/IR/Operations/GradISRUOp.cs
  • src/JitCompiler/IR/Operations/GradLSTMCellInputOp.cs
  • src/JitCompiler/IR/Operations/GradLSTMSequenceOp.cs
  • src/JitCompiler/IR/Operations/GradLayerNormOp.cs
  • src/JitCompiler/IR/Operations/GradLeakyReLUOp.cs
  • src/JitCompiler/IR/Operations/GradLogOp.cs
  • src/JitCompiler/IR/Operations/GradLogSoftmaxOp.cs
  • src/JitCompiler/IR/Operations/GradMatMulLeftOp.cs
  • src/JitCompiler/IR/Operations/GradMatMulRightOp.cs
  • src/JitCompiler/IR/Operations/GradMaxPool2DOp.cs
  • src/JitCompiler/IR/Operations/GradMeanOp.cs
  • src/JitCompiler/IR/Operations/GradMishOp.cs
  • src/JitCompiler/IR/Operations/GradMobiusAddOp.cs
  • src/JitCompiler/IR/Operations/GradMultiHeadAttentionOp.cs
  • src/JitCompiler/IR/Operations/GradOctonionMultiplyOp.cs
  • src/JitCompiler/IR/Operations/GradPReLUOp.cs
  • src/JitCompiler/IR/Operations/GradPoincareExpMapOp.cs
  • src/JitCompiler/IR/Operations/GradPowerOp.cs
  • src/JitCompiler/IR/Operations/GradReLUOp.cs
  • src/JitCompiler/IR/Operations/GradReshapeOp.cs
  • src/JitCompiler/IR/Operations/GradSELUOp.cs
  • src/JitCompiler/IR/Operations/GradScaledTanhOp.cs
  • src/JitCompiler/IR/Operations/GradSigmoidOp.cs
  • src/JitCompiler/IR/Operations/GradSliceOp.cs
  • src/JitCompiler/IR/Operations/GradSoftPlusOp.cs
  • src/JitCompiler/IR/Operations/GradSoftSignOp.cs
  • src/JitCompiler/IR/Operations/GradSoftmaxOp.cs
  • src/JitCompiler/IR/Operations/GradSpMVOp.cs
  • src/JitCompiler/IR/Operations/GradSparsemaxOp.cs
  • src/JitCompiler/IR/Operations/GradSubtractOp.cs
  • src/JitCompiler/IR/Operations/GradSumOp.cs
  • src/JitCompiler/IR/Operations/GradSwishOp.cs
  • src/JitCompiler/IR/Operations/GradTanhOp.cs
  • src/JitCompiler/IR/Operations/GradThresholdedReLUOp.cs
  • src/JitCompiler/IR/Operations/GradTransposeOp.cs
  • src/JitCompiler/IR/Operations/GridSampleOp.cs
  • src/JitCompiler/IR/Operations/HardSigmoidOp.cs
  • src/JitCompiler/IR/Operations/GraphConvOp.cs
  • src/JitCompiler/IR/Operations/LiSHTOp.cs
  • src/JitCompiler/IR/Operations/LogOp.cs
  • src/JitCompiler/IR/Operations/NormOp.cs
  • src/JitCompiler/IR/Operations/MobiusAddOp.cs
  • src/JitCompiler/IR/Operations/OctonionMultiplyOp.cs
  • src/JitCompiler/IR/Operations/MeanOp.cs
  • src/JitCompiler/IR/Operations/LogSoftminOp.cs
  • src/JitCompiler/IR/Operations/MatMulOp.cs
  • src/JitCompiler/IR/Operations/NegateOp.cs
  • src/JitCompiler/IR/Operations/MishOp.cs
  • src/JitCompiler/IR/Operations/PReLUOp.cs
  • src/JitCompiler/IR/Operations/PoincareLogMapOp.cs
  • src/JitCompiler/IR/Operations/SignOp.cs
  • src/Configuration/JitCompilationConfig.cs
  • src/Genetics/ModelIndividual.cs
  • src/Interfaces/IAiModelBuilder.cs
  • src/Interfaces/IJitCompilable.cs
  • src/JitCompiler/CodeGen/FP16Kernels.cs
  • src/JitCompiler/CodeGen/GPUKernelLibrary.cs
  • src/JitCompiler/CodeGen/IGPURuntime.cs
  • src/JitCompiler/CodeGen/MockGPURuntime.cs
  • src/JitCompiler/CodeGen/RecurrentOps.cs
  • src/JitCompiler/CodeGen/SIMDCapabilities.cs
  • src/JitCompiler/CodeGen/SIMDOptimizer.cs
  • src/JitCompiler/CodeGen/SIMDStats.cs
  • src/JitCompiler/CodeGen/WorkspaceCodeGenerator.cs
  • src/JitCompiler/CompilationStats.cs
  • src/JitCompiler/HybridCompilationResult.cs
  • src/JitCompiler/IR/IRGraph.cs
  • src/JitCompiler/IR/Operations/ConstantOp.cs
  • src/JitCompiler/IR/Operations/DifferentiableApproximationOps.cs
  • src/JitCompiler/IR/Operations/FusedAddReLUOp.cs
  • src/JitCompiler/IR/Operations/GradConv2DOp.cs
  • src/JitCompiler/IR/Operations/GradConvTranspose2DOp.cs
  • src/JitCompiler/IR/Operations/GradRReLUOp.cs
  • src/JitCompiler/IR/Operations/GradSpMMOp.cs
  • src/JitCompiler/IR/Operations/HardTanhOp.cs
  • src/JitCompiler/IR/Operations/GradPadOp.cs
  • src/JitCompiler/IR/Operations/GradUpsampleOp.cs
  • src/JitCompiler/IR/Operations/HierarchicalSoftmaxOp.cs
  • src/JitCompiler/IR/Operations/ISRUOp.cs
  • src/JitCompiler/IR/Operations/GroupNormOp.cs
  • src/JitCompiler/IR/Operations/LeakyReLUOp.cs
  • src/JitCompiler/IR/Operations/LSTMCellOp.cs
  • src/JitCompiler/IR/Operations/LayerNormOp.cs
  • src/JitCompiler/IR/Operations/MultiHeadAttentionOp.cs
  • src/JitCompiler/IR/Operations/LocallyConnectedConv2DOp.cs
  • src/JitCompiler/IR/Operations/LogSoftmaxOp.cs
  • src/JitCompiler/IR/Operations/MaxPool2DOp.cs
  • src/JitCompiler/IR/Operations/OctonionMatMulOp.cs
  • src/JitCompiler/IR/Operations/PixelShuffleOp.cs
  • src/JitCompiler/IR/Operations/PowerOp.cs
  • src/JitCompiler/IR/Operations/FusedConvBatchNormOp.cs
  • src/JitCompiler/IR/Operations/PadOp.cs
  • src/JitCompiler/IR/Operations/MaxoutOp.cs
  • src/JitCompiler/IR/Operations/ReduceMaxOp.cs
  • src/JitCompiler/IR/Operations/ScaledDotProductAttentionOp.cs
  • src/JitCompiler/IR/Operations/ReduceMeanOp.cs
  • src/JitCompiler/IR/Operations/SoftSignOp.cs
  • src/JitCompiler/IR/Operations/SELUOp.cs
  • src/JitCompiler/IR/Operations/SqrtOp.cs
  • src/JitCompiler/IR/Operations/SQRBFOp.cs
  • src/JitCompiler/IR/Operations/SquashOp.cs
  • src/JitCompiler/IR/Operations/ScaledTanhOp.cs
  • src/JitCompiler/IR/Operations/ThresholdedReLUOp.cs
  • src/JitCompiler/IR/Operations/RBFKernelOp.cs
  • src/JitCompiler/CodeGen/CodeGenerator.cs
  • src/JitCompiler/IR/IROp.cs
  • src/JitCompiler/IR/Operations/FusedElementwiseChainOp.cs
  • src/JitCompiler/IR/Operations/FusedResidualBlockOp.cs
  • src/JitCompiler/IR/Operations/PoincareExpMapOp.cs
  • src/JitCompiler/IR/Operations/ReLUOp.cs
  • src/JitCompiler/IR/Operations/RReLUOp.cs
  • src/JitCompiler/IR/Operations/SpMMOp.cs
  • src/JitCompiler/IR/Operations/ReshapeOp.cs
  • src/JitCompiler/IR/Operations/SoftminOp.cs
  • src/JitCompiler/IR/Operations/ScalarConstantOp.cs
  • src/JitCompiler/IR/Operations/ReduceLogVarianceOp.cs
  • src/JitCompiler/IR/Operations/SphericalSoftmaxOp.cs
  • src/JitCompiler/IR/Operations/SigmoidOp.cs
  • src/JitCompiler/IR/Operations/SpMVOp.cs
  • src/JitCompiler/IR/Operations/SplitOp.cs
  • src/JitCompiler/Memory/TensorRental.cs
  • src/JitCompiler/IR/Operations/SumOp.cs
  • src/JitCompiler/IR/Operations/UpsampleOp.cs
  • src/JitCompiler/IR/Operations/WedgeProductOp.cs
  • src/JitCompiler/Memory/TensorPool.cs
  • src/JitCompiler/IR/Operations/TanhOp.cs
  • src/JitCompiler/IR/Operations/GradSplitOp.cs
  • src/JitCompiler/IR/Operations/SubtractOp.cs
  • src/JitCompiler/IR/Operations/GradLiSHTOp.cs
  • src/JitCompiler/IR/Operations/SquareOp.cs
  • src/JitCompiler/IR/Operations/TransposeOp.cs
  • src/JitCompiler/IR/Operations/SwishOp.cs
  • src/JitCompiler/IR/Operations/SoftmaxOp.cs
  • src/JitCompiler/Memory/TensorPoolStats.cs
  • src/JitCompiler/JitCompiler.cs
  • src/JitCompiler/IR/Operations/SliceOp.cs
  • src/JitCompiler/IR/Operations/SoftPlusOp.cs
  • src/JitCompiler/IR/Operations/SparsemaxOp.cs
  • src/JitCompiler/IR/Operations/TaylorSoftmaxOp.cs
  • src/JitCompiler/JitCompatibilityResult.cs
  • src/JitCompiler/IR/TensorShape.cs
  • src/JitCompiler/CodeGen/VectorHelper.cs
  • src/JitCompiler/IR/Operations/VectorizedOps.cs
  • src/JitCompiler/JitCompilerOptions.cs
  • src/JitCompiler/IRBuilder.cs
  • src/JitCompiler/CodeGen/GradientOps.cs

Comment thread src/Interpretability/Helpers/GPUExplainerHelper.cs
Comment thread src/Interpretability/Helpers/GPUExplainerHelper.cs
Rejects zero or negative values with ArgumentOutOfRangeException.
Addresses review comment about accepting invalid maxParallelism.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings April 7, 2026 11:22

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 257 out of 309 changed files in this pull request and generated 5 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

/// </para>
/// </remarks>
public bool IsGPUEnabled => _useGPU && _gpuRuntime != null;
public bool IsGPUEnabled => false;

Copilot AI Apr 7, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changing DeviceInfo from a concrete GPUDeviceInfo? to object? is a breaking API change and makes the contract unclear for consumers. If this type is part of the public API, consider (mandatory) either removing DeviceInfo entirely, or keeping a strongly-typed property via an engine-level device info abstraction (e.g., IGpuDeviceInfo) and returning null when unavailable; alternatively mark the old property [Obsolete] and introduce a new well-typed replacement to avoid object.

Copilot uses AI. Check for mistakes.
/// </para>
/// </remarks>
public GPUCodeGenerator.GPUDeviceInfo? DeviceInfo => _gpuRuntime?.DeviceInfo;
public object? DeviceInfo => null;

Copilot AI Apr 7, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changing DeviceInfo from a concrete GPUDeviceInfo? to object? is a breaking API change and makes the contract unclear for consumers. If this type is part of the public API, consider (mandatory) either removing DeviceInfo entirely, or keeping a strongly-typed property via an engine-level device info abstraction (e.g., IGpuDeviceInfo) and returning null when unavailable; alternatively mark the old property [Obsolete] and introduce a new well-typed replacement to avoid object.

Copilot uses AI. Check for mistakes.
/// is now handled at the Tensors engine level. This helper uses CPU parallelism.
/// </remarks>
public GPUExplainerHelper(IGPURuntime? gpuRuntime = null, int? maxParallelism = null)
public GPUExplainerHelper(int? maxParallelism = null)

Copilot AI Apr 7, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changing DeviceInfo from a concrete GPUDeviceInfo? to object? is a breaking API change and makes the contract unclear for consumers. If this type is part of the public API, consider (mandatory) either removing DeviceInfo entirely, or keeping a strongly-typed property via an engine-level device info abstraction (e.g., IGpuDeviceInfo) and returning null when unavailable; alternatively mark the old property [Obsolete] and introduce a new well-typed replacement to avoid object.

Copilot uses AI. Check for mistakes.
Comment on lines 99 to 103
public static GPUExplainerHelper<T> CreateWithAutoDetect()
{
// For now, use MockGPURuntime for consistent behavior
// In production, this could detect CUDA, OpenCL, or Metal availability
return new GPUExplainerHelper<T>(new MockGPURuntime());
// GPU runtime has been removed — returns CPU-only helper
return new GPUExplainerHelper<T>();
}

Copilot AI Apr 7, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CreateWithAutoDetect() no longer performs detection and always returns a CPU-only helper, so the method name is now misleading. Consider (mandatory) renaming it to something like CreateDefault() / CreateCPUOnly() (or removing it and keeping CreateCPUOnly) to avoid incorrect expectations from callers.

Copilot uses AI. Check for mistakes.
Comment on lines +505 to 510
public virtual bool SupportsJitCompilation => false;

return InterfaceGuard.JitCompilable(WrappedModel).SupportsJitCompilation;
}
}

/// <summary>
/// Exports the computation graph for JIT compilation by delegating to the wrapped model.
/// </summary>
/// <param name="inputNodes">List to populate with input computation nodes.</param>
/// <returns>The output computation node representing the model's prediction.</returns>
/// <remarks>
/// <para>
/// Sharded models delegate graph export to their wrapped model.
/// The computation graph represents the full model's forward pass, independent of parameter sharding.
/// </para>
/// <para><b>For Beginners:</b> This creates a computation graph from the wrapped model.
///
/// Even though parameters are distributed (sharded) across multiple processes:
/// - The computation graph structure is the same for all processes
/// - Each process compiles the same graph into fast code
/// - The only difference is which parameter values each process uses
///
/// This allows distributed models to benefit from JIT compilation while maintaining
/// their distributed training capabilities.
/// </para>
/// </remarks>
/// <exception cref="ArgumentNullException">Thrown when inputNodes is null.</exception>
/// <exception cref="NotSupportedException">
/// Thrown when the wrapped model does not support JIT compilation.
/// </exception>
public virtual ComputationNode<T> ExportComputationGraph(List<ComputationNode<T>> inputNodes)
{
if (inputNodes == null)
throw new ArgumentNullException(nameof(inputNodes));

if (WrappedModel is null || WrappedModel == null)
throw new InvalidOperationException(
"Cannot export computation graph: Wrapped model is null.");

if (!InterfaceGuard.JitCompilable(WrappedModel).SupportsJitCompilation)
throw new NotSupportedException(
$"The wrapped model of type {WrappedModel.GetType().Name} does not support JIT compilation. " +
"JIT compilation availability depends on the wrapped model's capabilities.");

return InterfaceGuard.JitCompilable(WrappedModel).ExportComputationGraph(inputNodes);
throw new NotSupportedException("JIT compilation has been removed.");
}

Copilot AI Apr 7, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that IJitCompilable<T> has been removed, keeping SupportsJitCompilation/ExportComputationGraph members (especially with JIT-centric naming) increases confusion and ongoing maintenance burden. Consider (mandatory) removing these members entirely (and any surrounding regions/docs) unless another interface still requires them; if you must keep them temporarily for source compatibility, mark them [Obsolete] with guidance on the engine-level alternative.

Copilot uses AI. Check for mistakes.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (5)
src/Interpretability/Helpers/GPUExplainerHelper.cs (5)

85-103: ⚠️ Potential issue | 🟡 Minor

CreateWithAutoDetect documentation references non-existent GPU detection.

The XML docs still describe GPU auto-detection and reference "Mock GPU" (line 95) which no longer exists. The method now simply returns a CPU-only helper. Update documentation to match reality:

Suggested documentation update
 /// <summary>
-/// Creates a GPU explainer helper with automatic GPU detection.
+/// Creates an explainer helper with default parallelism settings.
 /// </summary>
-/// <returns>A helper configured with the best available compute device.</returns>
+/// <returns>A helper using CPU parallelism with default thread count.</returns>
 /// <remarks>
 /// <para>
-/// <b>For Beginners:</b> This factory method automatically detects if a GPU is available
-/// and configures the helper appropriately. Use this when you want the best performance
-/// without manually managing GPU resources.
-///
-/// Currently returns a CPU-based helper (Mock GPU) since actual GPU detection requires
-/// platform-specific code. Future versions may include actual GPU detection.
+/// <b>For Beginners:</b> This factory method creates a helper with default settings.
+/// GPU acceleration is now handled at the Tensors engine level; this helper
+/// provides CPU parallelism for explainer-specific operations.
 /// </para>
 /// </remarks>
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/Interpretability/Helpers/GPUExplainerHelper.cs` around lines 85 - 103,
Update the XML docs for CreateWithAutoDetect to reflect that there is no GPU
detection or "Mock GPU" and the method returns a CPU-only helper: change the
summary/remarks to state it returns a CPU-only GPUExplainerHelper<T> (no GPU
detection performed), remove references to "Mock GPU" and platform-specific
detection, and ensure the doc clearly advises callers that future versions may
add GPU support if applicable while referencing the CreateWithAutoDetect method
name and GPUExplainerHelper<T> class so the intent is clear.

241-273: ⚠️ Potential issue | 🟠 Major

Blocking: 30+ lines of dead GPU code in coalition computation.

The entire GPU branch (lines 241-273) is unreachable since IsGPUEnabled is always false. This bloats the method and misleads future maintainers into thinking GPU support exists.

Proposed fix: Remove dead GPU branch, keep CPU logic only
     var coalitionPredictions = new T[numCoalitions];

-    if (IsGPUEnabled)
-    {
-        // Build all masked inputs at once for GPU processing
-        var allMaskedInputs = new T[numCoalitions * nBackground, numFeatures];
-
-        for (int c = 0; c < numCoalitions; c++)
-        {
-            var coalition = coalitions[c];
-            for (int b = 0; b < nBackground; b++)
-            {
-                int row = c * nBackground + b;
-                for (int j = 0; j < numFeatures; j++)
-                {
-                    allMaskedInputs[row, j] = coalition[j] ? instance[j] : backgroundData[b, j];
-                }
-            }
-        }
-
-        // Single GPU prediction call
-        var allMaskedMatrix = new Matrix<T>(allMaskedInputs);
-        var allPredictions = predictFunction(allMaskedMatrix);
-
-        // Average predictions for each coalition
-        for (int c = 0; c < numCoalitions; c++)
-        {
-            double sum = 0;
-            for (int b = 0; b < nBackground; b++)
-            {
-                sum += NumOps.ToDouble(allPredictions[c * nBackground + b]);
-            }
-            coalitionPredictions[c] = NumOps.FromDouble(sum / nBackground);
-        }
-    }
-    else
-    {
-        // CPU parallel processing by coalition
+    // CPU parallel processing by coalition
+    Parallel.For(0, numCoalitions, new ParallelOptions { MaxDegreeOfParallelism = _maxParallelism }, c =>
+    {
         // ... existing CPU implementation ...
-    }
+    });
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/Interpretability/Helpers/GPUExplainerHelper.cs` around lines 241 - 273,
The IsGPUEnabled branch contains dead GPU-specific code (building
allMaskedInputs, Matrix<T> usage, predictFunction on a large matrix, and
averaging into coalitionPredictions) that is never executed; remove the entire
if (IsGPUEnabled) { ... } block and its internal symbols (allMaskedInputs,
allMaskedMatrix, allPredictions, and the averaging loop) and keep only the
existing CPU coalition computation path so coalitionPredictions is produced by
the active CPU logic; ensure no remaining references to Matrix<T> or those
temporary variables remain in GPUExplainerHelper.cs and that predictFunction
usage stays with the CPU flow.

152-170: ⚠️ Potential issue | 🟠 Major

Blocking: Unreachable GPU code path is dead code.

IsGPUEnabled is hardcoded to false, making this conditional branch and the BatchPredictGPU method completely unreachable. Dead code violates production readiness requirements and should be removed.

Proposed fix: Remove dead GPU branch
     // Use parallel batch processing
-    if (IsGPUEnabled)
-    {
-        return BatchPredictGPU(predictFunction, inputs);
-    }
-    else
-    {
-        return BatchPredictCPU(predictFunction, inputs);
-    }
+    return BatchPredictCPU(predictFunction, inputs);
 }
-
-/// <summary>
-/// GPU-accelerated batch prediction.
-/// </summary>
-private Vector<T> BatchPredictGPU(Func<Matrix<T>, Vector<T>> predictFunction, Matrix<T> inputs)
-{
-    // The GPU runtime processes the full batch in one call
-    // This is efficient because data transfer overhead is amortized
-    return predictFunction(inputs);
-}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/Interpretability/Helpers/GPUExplainerHelper.cs` around lines 152 - 170,
IsGPUEnabled is hardcoded false so the GPU branch and BatchPredictGPU are dead
code; remove the conditional branch that checks IsGPUEnabled and the private
method BatchPredictGPU, and simplify the caller to always invoke
BatchPredictCPU(predictFunction, inputs); alternatively if GPU support is
intended later, make IsGPUEnabled configurable (not hardcoded) and keep both
paths – reference symbols: IsGPUEnabled, BatchPredictGPU, BatchPredictCPU,
predictFunction.

8-42: ⚠️ Potential issue | 🟡 Minor

Class documentation is misleading—advertises removed GPU capabilities.

The class summary still promotes GPU acceleration benefits ("10-100x speedup", "GPU Matrix Operations", "GPU version can process thousands of inputs simultaneously") that no longer exist. This sets incorrect expectations for users.

Consider updating the documentation to reflect the current CPU-parallel-only reality:

Suggested documentation update
 /// <summary>
-/// Provides GPU acceleration for interpretability explainers.
+/// Provides parallel processing acceleration for interpretability explainers.
 /// </summary>
 /// <typeparam name="T">The numeric type for calculations.</typeparam>
 /// <remarks>
 /// <para>
-/// <b>For Beginners:</b> This helper accelerates interpretability computations using GPU hardware.
+/// <b>For Beginners:</b> This helper accelerates interpretability computations using CPU parallelism.
 /// Many explanation methods (SHAP, Integrated Gradients, etc.) require computing many predictions
-/// or gradients - operations that are perfect for GPU parallelization.
+/// or gradients - operations that benefit from parallel processing.
 ///
 /// The helper provides:
 /// 1. <b>Batch Prediction</b>: Process many inputs simultaneously
 /// 2. <b>Parallel Coalition Processing</b>: For SHAP-style algorithms
-/// 3. <b>GPU Matrix Operations</b>: Fast linear algebra for solving attribution problems
-/// 4. <b>Automatic Fallback</b>: Falls back to CPU if no GPU is available
-///
-/// Benefits of GPU acceleration for explainers:
-/// - 10-100x speedup for batch predictions
-/// - Enables real-time explanations for complex models
-/// - Makes ensemble/sample-based methods practical for large models
+/// 3. <b>Parallel Matrix Operations</b>: Fast linear algebra for solving attribution problems
+///
+/// Note: GPU acceleration is now handled at the Tensors engine level.
+/// This helper provides CPU-based parallelism for explainer-specific operations.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/Interpretability/Helpers/GPUExplainerHelper.cs` around lines 8 - 42,
Update the XML doc for class GPUExplainerHelper<T> to remove misleading
GPU-specific claims and performance numbers and instead clearly state the
current CPU-parallel-only behavior and fallback semantics; mention that
CreateWithAutoDetect, BatchPredict, and ComputeCoalitionPredictions now run on
CPU with parallel processing where applicable, remove phrases like "10-100x
speedup", "GPU Matrix Operations", and "process thousands of inputs
simultaneously", and add a brief note about any automatic GPU detection now
being deprecated or acting as a no-op so users have accurate expectations.

442-491: ⚠️ Potential issue | 🟠 Major

Blocking: Parallel matrix computation branch is unreachable.

The condition m > 10 && IsGPUEnabled is always false because IsGPUEnabled is hardcoded to false. Ironically, this branch uses Parallel.For (CPU parallelism), not GPU—it would actually be useful for large matrices but is permanently disabled.

Either remove the dead code or change the condition to enable CPU parallelism for larger matrices:

Option A: Enable CPU parallelism (recommended)
-    if (m > 10 && IsGPUEnabled)
+    if (m > 10)
     {
         // Use parallel outer products
         Parallel.For(0, m, j1 =>
Option B: Remove dead branch entirely
     // Compute in parallel (for large matrices)
-    if (m > 10 && IsGPUEnabled)
-    {
-        // Use parallel outer products
-        Parallel.For(0, m, j1 =>
-        {
-            // ... parallel implementation ...
-        });
-    }
-    else
-    {
-        // Sequential for small matrices
+    // Sequential computation
         for (int j1 = 0; j1 < m; j1++)
         {
             // ... sequential implementation ...
         }
-    }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/Interpretability/Helpers/GPUExplainerHelper.cs` around lines 442 - 491,
The branch guarded by "m > 10 && IsGPUEnabled" is unreachable because
IsGPUEnabled is hardcoded false, disabling the Parallel.For CPU parallelism;
either remove the dead branch or enable CPU parallelism by changing the
condition to "m > 10" (or a new flag like UseCpuParallelism) so the Parallel.For
block that computes XtWX and XtWy actually runs for large m; update references
in GPUExplainerHelper (the method that fills XtWX/XtWy using NumOps.ToDouble and
Parallel.For) accordingly and ensure symmetry of behavior between the parallel
and sequential loops.
♻️ Duplicate comments (1)
src/Interpretability/Helpers/GPUExplainerHelper.cs (1)

101-102: 🧹 Nitpick | 🔵 Trivial

Factory method implementation is correct but consider renaming.

The implementation is straightforward and correct. However, CreateWithAutoDetect() is now semantically identical to CreateCPUOnly(). Consider whether to deprecate this method or rename it to avoid confusion:

+[Obsolete("GPU auto-detection was removed. Use CreateCPUOnly() instead.")]
 public static GPUExplainerHelper<T> CreateWithAutoDetect()
 {
-    // GPU runtime has been removed — returns CPU-only helper
-    return new GPUExplainerHelper<T>();
+    return CreateCPUOnly();
 }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/Interpretability/Helpers/GPUExplainerHelper.cs` around lines 101 - 102,
CreateWithAutoDetect() currently just returns new GPUExplainerHelper<T>() and is
semantically identical to CreateCPUOnly(); rename or deprecate to avoid
confusion: either rename CreateWithAutoDetect to CreateCPUOnly (or
CreateCPUHelper) and update all callers to the new name, or mark
CreateWithAutoDetect with an [Obsolete] attribute and update its implementation
to forward to CreateCPUOnly() (or vice versa) so there is a single clear factory
method (referencing CreateWithAutoDetect(), CreateCPUOnly(), and
GPUExplainerHelper<T> to locate the code).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@src/Interpretability/Helpers/GPUExplainerHelper.cs`:
- Around line 85-103: Update the XML docs for CreateWithAutoDetect to reflect
that there is no GPU detection or "Mock GPU" and the method returns a CPU-only
helper: change the summary/remarks to state it returns a CPU-only
GPUExplainerHelper<T> (no GPU detection performed), remove references to "Mock
GPU" and platform-specific detection, and ensure the doc clearly advises callers
that future versions may add GPU support if applicable while referencing the
CreateWithAutoDetect method name and GPUExplainerHelper<T> class so the intent
is clear.
- Around line 241-273: The IsGPUEnabled branch contains dead GPU-specific code
(building allMaskedInputs, Matrix<T> usage, predictFunction on a large matrix,
and averaging into coalitionPredictions) that is never executed; remove the
entire if (IsGPUEnabled) { ... } block and its internal symbols
(allMaskedInputs, allMaskedMatrix, allPredictions, and the averaging loop) and
keep only the existing CPU coalition computation path so coalitionPredictions is
produced by the active CPU logic; ensure no remaining references to Matrix<T> or
those temporary variables remain in GPUExplainerHelper.cs and that
predictFunction usage stays with the CPU flow.
- Around line 152-170: IsGPUEnabled is hardcoded false so the GPU branch and
BatchPredictGPU are dead code; remove the conditional branch that checks
IsGPUEnabled and the private method BatchPredictGPU, and simplify the caller to
always invoke BatchPredictCPU(predictFunction, inputs); alternatively if GPU
support is intended later, make IsGPUEnabled configurable (not hardcoded) and
keep both paths – reference symbols: IsGPUEnabled, BatchPredictGPU,
BatchPredictCPU, predictFunction.
- Around line 8-42: Update the XML doc for class GPUExplainerHelper<T> to remove
misleading GPU-specific claims and performance numbers and instead clearly state
the current CPU-parallel-only behavior and fallback semantics; mention that
CreateWithAutoDetect, BatchPredict, and ComputeCoalitionPredictions now run on
CPU with parallel processing where applicable, remove phrases like "10-100x
speedup", "GPU Matrix Operations", and "process thousands of inputs
simultaneously", and add a brief note about any automatic GPU detection now
being deprecated or acting as a no-op so users have accurate expectations.
- Around line 442-491: The branch guarded by "m > 10 && IsGPUEnabled" is
unreachable because IsGPUEnabled is hardcoded false, disabling the Parallel.For
CPU parallelism; either remove the dead branch or enable CPU parallelism by
changing the condition to "m > 10" (or a new flag like UseCpuParallelism) so the
Parallel.For block that computes XtWX and XtWy actually runs for large m; update
references in GPUExplainerHelper (the method that fills XtWX/XtWy using
NumOps.ToDouble and Parallel.For) accordingly and ensure symmetry of behavior
between the parallel and sequential loops.

---

Duplicate comments:
In `@src/Interpretability/Helpers/GPUExplainerHelper.cs`:
- Around line 101-102: CreateWithAutoDetect() currently just returns new
GPUExplainerHelper<T>() and is semantically identical to CreateCPUOnly(); rename
or deprecate to avoid confusion: either rename CreateWithAutoDetect to
CreateCPUOnly (or CreateCPUHelper) and update all callers to the new name, or
mark CreateWithAutoDetect with an [Obsolete] attribute and update its
implementation to forward to CreateCPUOnly() (or vice versa) so there is a
single clear factory method (referencing CreateWithAutoDetect(),
CreateCPUOnly(), and GPUExplainerHelper<T> to locate the code).

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 54112edd-e853-4740-88ab-197ac5533f3e

📥 Commits

Reviewing files that changed from the base of the PR and between 9ee83bc and 5267642.

📒 Files selected for processing (1)
  • src/Interpretability/Helpers/GPUExplainerHelper.cs

@ooples
ooples merged commit fa43233 into master Apr 7, 2026
14 of 16 checks passed
@ooples
ooples deleted the refactor/remove-per-layer-jit branch April 7, 2026 15:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants