Skip to content

Conversation

@aka-nse
Copy link
Owner

@aka-nse aka-nse commented Aug 29, 2025

No description provided.

@aka-nse aka-nse requested a review from Copilot August 29, 2025 11:44
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces an experimental interceptor generator feature for SmartVectorDotNet that enables automatic vectorization of lambda expressions. The changes add a source generator that can intercept calls to Vectorization.Calculate methods and generate optimized vectorized implementations.

  • Adds VectorizationCalculatorGenerator source generator with interceptor support
  • Updates visibility of core classes (Guard, Vectorization) to public with appropriate hiding attributes
  • Creates example project demonstrating the interceptor functionality

Reviewed Changes

Copilot reviewed 19 out of 19 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/SmartVectorDotNet/Vectorization/Vectorization.cs Makes EnsureSourceSafe method public and adds documentation
src/SmartVectorDotNet/Guard.cs Changes visibility to public and adds comprehensive XML documentation
src/SmartVectorDotNet.slnx Reorganizes solution folder structure
src/SmartVectorDotNet.Generators/VectorizationCalculatorGenerator.cs Implements the main source generator with interceptor functionality
src/SmartVectorDotNet.Generators/.props/.targets Adds MSBuild support files for interceptor configuration
src/SmartVectorDotNet.Example/ Creates example project demonstrating the new interceptor feature
README.md Updates documentation with new usage examples

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

aka-nse and others added 3 commits August 29, 2025 20:45
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@aka-nse aka-nse merged commit 3ad3bae into develop Aug 29, 2025
1 check passed
aka-nse added a commit that referenced this pull request Aug 30, 2025
* fixes document and package

* add new feature to vectorize arbitary operation

* add test

* removes using of SIMD APIs which requires immediate value

* fix the codepath when x=0

* fix test

* fix auto collection for VectorizationTest

* feature/ScalarMath/support-CountLeadingZeros-legacy (#15)

* implement CLZ for legacy

* improves test base

* adds lacked APIs

* implements tests

* feature/remove-byref-argument-from-strategy  (#16)

* rename IVectorizationStrategy.tt -> IVectorizationFormula.tt

* remove in modifier

* fix modifier

---------

Co-authored-by: aka-nse <nakased.1220@gmail.com>

* update nuget packages reference (#17)

Co-authored-by: aka-nse <nakased.1220@gmail.com>

* feature/add-logo (#18)

* add logo

* modify readme

* add workflow

* adapts to BenchmarkDotNet API changes

---------

Co-authored-by: aka-nse <nakased.1220@gmail.com>

* fix charset (#19)

* add Guard class (#20)

* add measure coverage script (#21)

* update document (#22)

Co-authored-by: aka-nse <nakased.1220@gmail.com>

* hotfix/fix-buffer-overlap (#23)

* add temporary buffer type

* add internal method `EnsureSourceSafe`

* implement buffer overlap support

* add test base & fix logic

* arrange test code with template method

* fix implementations

* improve test

* arrange T4 templates

* supports test case serialization

---------

Co-authored-by: aka-nse <nakased.1220@gmail.com>

* feature/op-saturate (#25)

* implement VectorOp.AddSaturate & VectorOp.SubtractSaturate

* implement ScalarOp.AddSaturate & ScalarOp.SubtractSaturate

* implement Vectorization.AddSaturate & Vectorization.SubtractSaturate

* feature/integrate-op-and-math (#26)

* merge ScaraMath into ScalarOp

* merge VectorMath into VectorOp

* move files into new arranged positions

* change APIs for constant of ScalarOp

* move test files

* rename generic specializing overload & remove extra usings

* fix test

* fix test

* fixes exp saturation for Single & relaxes accuracy threshold (#27)

* fixes formula of VectorOp.Asin (#28)

* feature/VectorOp/add-vector-ops (#29)

* add Blend method

* fix Permute

* add Gather method

* move overloads into T4

* improve range check logic

* implement Vectorization.Gather

* add Vectorization.Gather test

* fix Vectorization overlap validation logic

* feature/ScalarOp/remove-in-modifier (#30)

* add ScalarOp.Convert test

* remove in modifier

* rename files

* rename files

* adds DivideLike tests and fixes logic

* replace ScalarOp.Convert test

* feature/VectorOp/publish-Emulate (#31)

* rename into feature file

* recreate utility file

* refactor and publish VectorOp.Emulate

* add GeneratedCodeAttribute into T4 codes

* add benchmark of evaluation strategy

* fix constant initialization

* modify alignment

* publish Emulate

* refactor/coding-rules (#32)

* implement default & parallel iteration strategy

* remove ref modifier

* add .editorconfig

* add header

* add parallel API

* fix text encoding into UTF-8N

* fix package informations (#33)

* feature/migrate-generic-specialization-to-generator (#34)

* update dependency version

* add package reference to GenericSpecializationGenerator

* migrates generic specialization to generator for ScalarOp.BitOperations

* migrates generic specialization to generator for ScalarOp.Sign

* migrate ScalarOp.FusedMultiplyAdd

* migrate ScalarOp.[Abs, Min, Max, Clamp]

* migrate ScalarOp._Math.Real

* migrates ScalarOp.[DivideFloor, DivideCeiling, DivRem]

* moves reference source of GenericSpecializationGenerator from NuGet package to local subrepos

* migrates generic specialization to generator for binary operators in ScalarOp

* migrates ScalarOp.[Equals, Compare]

* migrates ScalarOp.[ShiftLeft, ShiftRight]

* migrates ScalarOp.[UnaryPlus, UnaryMinus, Not, Complement]

* migrates ScalarOp.[AddSaturate, SubtractSaturate]

* migrates VectorOp.[*]

* add .gitmodules

* update GitHub Actions script

* migrate slnx

* fix workflow

* fix subrepo version

* feature/add-non-generic-methods (#35)

* separate non generic methods for ScalarOp.Abs, Min, Max, Clamp

* separate non generic methods for real functions in ScalarOp

* separate non generic methods for divide-like functions in ScalarOp

* separate non generic methods for binary operator functions in ScalarOp

* separate non generic methods for bit operations functions in ScalarOp

* fix tests

* separate non generic methods for operator functions in ScalarOp

* migrate implementation of ScalarOp.[Decompose,Scale] to GenericSpecializationGenerator

* migrate implementation of constants in ScalarOp to GenericSpecializationGenerator

* modifies comment

* switches subrepo version

* refactor/update-dependencies (#36)

* updates GenericSpecializationGenerator

* fixes trivia handling in using directives

* hotfix/tendency-to-throw-in-vectorization (#37)

* adds test

* adds test

* adds zero support

* switchs reference of GenericSpecializationGenerator into via NuGet

* adds type checks

* adds type guard

* fixes script

* adds code coverage config (#38)

* hotfix/ArrayNumericUtils-Linspace (#39)

* improves Linspace

* adds test

* hotfix/ArrayNumericUtils-Linspace  (#40)

* improves Linspace

* adds test

* adds tests

* feature/task-parallelization (#41)

* adds compatibility support for infrastructure

* adds ParallelVectirozation

* refactor/adds-test (#42)

* removes extra code

* removes extra code

* adds test

* improves VectorOp.Permute4 test

* fixes script

* adds ExcludeFromCodeCoverageAttribute

* adds test

* fixes csproj (#43)

* feature/interceptor-generator (#44)

* configures project base

* implements base of the interceptor generator feature

* implements interceptor

* updates readme

* adds examples

* Update src/SmartVectorDotNet/Vectorization/Vectorization.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update src/SmartVectorDotNet/Guard.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update src/SmartVectorDotNet/Guard.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* updates csproj

* updates readme

---------

Co-authored-by: aka-nse <nakased.1220@gmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
aka-nse added a commit that referenced this pull request Aug 30, 2025
* fixes document and package

* add new feature to vectorize arbitary operation

* add test

* removes using of SIMD APIs which requires immediate value

* fix the codepath when x=0

* fix test

* fix auto collection for VectorizationTest

* feature/ScalarMath/support-CountLeadingZeros-legacy (#15)

* implement CLZ for legacy

* improves test base

* adds lacked APIs

* implements tests

* feature/remove-byref-argument-from-strategy  (#16)

* rename IVectorizationStrategy.tt -> IVectorizationFormula.tt

* remove in modifier

* fix modifier

---------



* update nuget packages reference (#17)



* feature/add-logo (#18)

* add logo

* modify readme

* add workflow

* adapts to BenchmarkDotNet API changes

---------



* fix charset (#19)

* add Guard class (#20)

* add measure coverage script (#21)

* update document (#22)



* hotfix/fix-buffer-overlap (#23)

* add temporary buffer type

* add internal method `EnsureSourceSafe`

* implement buffer overlap support

* add test base & fix logic

* arrange test code with template method

* fix implementations

* improve test

* arrange T4 templates

* supports test case serialization

---------



* feature/op-saturate (#25)

* implement VectorOp.AddSaturate & VectorOp.SubtractSaturate

* implement ScalarOp.AddSaturate & ScalarOp.SubtractSaturate

* implement Vectorization.AddSaturate & Vectorization.SubtractSaturate

* feature/integrate-op-and-math (#26)

* merge ScaraMath into ScalarOp

* merge VectorMath into VectorOp

* move files into new arranged positions

* change APIs for constant of ScalarOp

* move test files

* rename generic specializing overload & remove extra usings

* fix test

* fix test

* fixes exp saturation for Single & relaxes accuracy threshold (#27)

* fixes formula of VectorOp.Asin (#28)

* feature/VectorOp/add-vector-ops (#29)

* add Blend method

* fix Permute

* add Gather method

* move overloads into T4

* improve range check logic

* implement Vectorization.Gather

* add Vectorization.Gather test

* fix Vectorization overlap validation logic

* feature/ScalarOp/remove-in-modifier (#30)

* add ScalarOp.Convert test

* remove in modifier

* rename files

* rename files

* adds DivideLike tests and fixes logic

* replace ScalarOp.Convert test

* feature/VectorOp/publish-Emulate (#31)

* rename into feature file

* recreate utility file

* refactor and publish VectorOp.Emulate

* add GeneratedCodeAttribute into T4 codes

* add benchmark of evaluation strategy

* fix constant initialization

* modify alignment

* publish Emulate

* refactor/coding-rules (#32)

* implement default & parallel iteration strategy

* remove ref modifier

* add .editorconfig

* add header

* add parallel API

* fix text encoding into UTF-8N

* fix package informations (#33)

* feature/migrate-generic-specialization-to-generator (#34)

* update dependency version

* add package reference to GenericSpecializationGenerator

* migrates generic specialization to generator for ScalarOp.BitOperations

* migrates generic specialization to generator for ScalarOp.Sign

* migrate ScalarOp.FusedMultiplyAdd

* migrate ScalarOp.[Abs, Min, Max, Clamp]

* migrate ScalarOp._Math.Real

* migrates ScalarOp.[DivideFloor, DivideCeiling, DivRem]

* moves reference source of GenericSpecializationGenerator from NuGet package to local subrepos

* migrates generic specialization to generator for binary operators in ScalarOp

* migrates ScalarOp.[Equals, Compare]

* migrates ScalarOp.[ShiftLeft, ShiftRight]

* migrates ScalarOp.[UnaryPlus, UnaryMinus, Not, Complement]

* migrates ScalarOp.[AddSaturate, SubtractSaturate]

* migrates VectorOp.[*]

* add .gitmodules

* update GitHub Actions script

* migrate slnx

* fix workflow

* fix subrepo version

* feature/add-non-generic-methods (#35)

* separate non generic methods for ScalarOp.Abs, Min, Max, Clamp

* separate non generic methods for real functions in ScalarOp

* separate non generic methods for divide-like functions in ScalarOp

* separate non generic methods for binary operator functions in ScalarOp

* separate non generic methods for bit operations functions in ScalarOp

* fix tests

* separate non generic methods for operator functions in ScalarOp

* migrate implementation of ScalarOp.[Decompose,Scale] to GenericSpecializationGenerator

* migrate implementation of constants in ScalarOp to GenericSpecializationGenerator

* modifies comment

* switches subrepo version

* refactor/update-dependencies (#36)

* updates GenericSpecializationGenerator

* fixes trivia handling in using directives

* hotfix/tendency-to-throw-in-vectorization (#37)

* adds test

* adds test

* adds zero support

* switchs reference of GenericSpecializationGenerator into via NuGet

* adds type checks

* adds type guard

* fixes script

* adds code coverage config (#38)

* hotfix/ArrayNumericUtils-Linspace (#39)

* improves Linspace

* adds test

* hotfix/ArrayNumericUtils-Linspace  (#40)

* improves Linspace

* adds test

* adds tests

* feature/task-parallelization (#41)

* adds compatibility support for infrastructure

* adds ParallelVectirozation

* refactor/adds-test (#42)

* removes extra code

* removes extra code

* adds test

* improves VectorOp.Permute4 test

* fixes script

* adds ExcludeFromCodeCoverageAttribute

* adds test

* fixes csproj (#43)

* feature/interceptor-generator (#44)

* configures project base

* implements base of the interceptor generator feature

* implements interceptor

* updates readme

* adds examples

* Update src/SmartVectorDotNet/Vectorization/Vectorization.cs



* Update src/SmartVectorDotNet/Guard.cs



* Update src/SmartVectorDotNet/Guard.cs



---------



* updates csproj

* updates readme

---------

Co-authored-by: aka-nse <nakased.1220@gmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@aka-nse aka-nse deleted the feature/interceptor-generator branch September 21, 2025 09:29
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.

2 participants