Rmsnorm - #136
Merged
Merged
Conversation
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Describe the intent of your PR here.
This PR adds support for RMSNorm (Root Mean Square Normalization) operation to the Deeploy framework's Generic platform. RMSNorm is a critical normalization technique used in modern Transformer architectures and large language models. To enable RMSNorm deployment on embedded systems, this PR implements the necessary mathematical primitives (Pow and Sqrt operations) and integrates them into Deeploy's compilation pipeline.
The implementation follows Deeploy's operator decomposition approach, where RMSNorm is constructed from basic mathematical operations rather than as a monolithic kernel. This design provides flexibility and maintainability while supporting both float32 and float16 precision for resource-constrained embedded devices.
Added
Pow (Power) operation support
FloatPowTemplate.py: Mako template for C code generationPow_fp32.cKernel implementations for both precisionskernel/Pow.h: Kernel interface definitionsSqrt (Square Root) operation support
FloatSqrtTemplate.py: Mako template for C code generationSqrt_fp32.c: Kernel implementationskernel/Sqrt.h: Kernel interface definitionsComprehensive test suites
testFloatPow: Pow operator tests with ONNX models and reference datatestFloatSqrt: Sqrt operator teststestFloatRMSNorm: End-to-end RMSNorm tests demonstrating operator compositionChanged
Framework integration files
Deeploy/Targets/Generic/Parsers.py: Added PowParser and SqrtParser for ONNX graph parsingDeeploy/Targets/Generic/Layers.py: Added corresponding Layer classes for both operationsDeeploy/Targets/Generic/Bindings.py: Added type checking and binding registrationDeeploy/Targets/Generic/Platform.py: Registered new operations in platform mappingRuntime library headers
TargetLibraries/Generic/inc/DeeployBasicMath.h: Extended with Pow and Sqrt function declarationsTargetLibraries/Generic/inc/types.h: Updated type definitions for consistencyCI/CD configuration
.github/workflows/ci-platform-generic.yml: Updated to include new test cases in automated testing pipelineFixed
PR Merge Checklist
develcommit and pointing todevel.CHANGELOG.mdfile has been updated.