- name
- vectorization
- description
- Design, implement, optimize, and review SIMD code in .NET. USE FOR: vectorizing scalar loops with TensorPrimitives, Vector64/128/256/512, or platform hardware intrinsics; reviewing existing SIMD code, including the generic Vector type, for contract equivalence, tail handling, memory safety, portability, fallbacks, and measured performance. DO NOT USE FOR: performance work unrelated to SIMD or vectorization.
- license
- MIT
.NET SIMD vectorization
Produce a portable optimization that preserves the scalar contract, remains memory-safe at every length, and earns its complexity with measured results. Read the official SIMD and hardware-intrinsics guidance first and follow its comprehensive implementation templates. In particular, use its self-contained per-width dispatch, dedicated small-input handling, loop, and remainder shapes rather than reducing them to a chain of width checks. This skill supplies the decision rules and validation checks to apply while changing real code.
Inputs and prerequisites
Discover these from the repository before asking the user:
Do not add a package merely because an API exists there. First check the target framework and the project's existing dependency/versioning policy.
Core rules
- Use the highest-level API that matches the contract, then stop.
Span<T>andstringoperations,TensorPrimitives, and tensor types already accelerate many operations. LINQ reductions such asSum,Min,Max, andAveragecan also accelerate when the source exposes its underlying span. Verify empty-input and floating-point behavior rather than assuming similarly named operations are interchangeable. Once an existing API preserves the contract, use it instead of continuing into handwritten SIMD. Before writing an explicit loop, name the framework APIs considered and why none applies. Fixed-shape types remain appropriate for graphics and similar domains.