Introduction to AVX2KI
Overview
AVX To Kunpeng Intrinsic (AVX2KI) is an interface collection library providing Arm implementations of Intel intrinsic functions. It re-implements the intrinsic interface collection of conventional platforms using Kunpeng instructions and encapsulates them into independent interface modules (via C header files) to reduce the repetitive development workload in porting projects. Users can continue to use the intrinsic functions of conventional platforms by importing the header files into their applications.
AVX2KI provides an x86 SIMD intrinsic compatibility layer targeting Arm/AArch64 platforms. Through NEON, SVE 256-bit, and SVE 512-bit backends, it offers a porting foundation for code that uses Intel-style intrinsic interfaces, helping services complete compilation and runtime adaptation on the Kunpeng Arm platform with minimal source code changes.
Based on the public header files and implementation code in the current repository, the positioning of AVX2KI mainly includes:
- Provides compatibility definitions for
__m64,__m128,__m128i,__m128d, and wider vector types. - Provides declarations and implementations for a large number of
_mm_*,_mm256_*, and_mm512_*style interfaces. - Provides vector operator overloading for C++ scenarios to reduce the adaptation cost of porting code.
- Provides version query interfaces as well as testing frameworks for functional tests, performance tests, and randomized tests.
Application scenario: Adapt and port Intel intrinsic instructions to Kunpeng processors.
Core Modules
- Type and macro definition module:
include/avx2ki_type.hdefines vector types, mask types, comparison constants, status codes, and version structures, serving as the foundation of the entire compatibility layer. - Core interface module:
include/avx2ki_core.hexposesAVX2KI_GetProductVersionfor retrieving component and software version information. - Intrinsic declaration module:
include/avx.hdeclares a large number of x86 intrinsic interfaces, acting as the primary entry point directly included and invoked by service code. - C++ operator overloading module:
include/operatoroverload.hprovides+,-,*,/, and bitwise operation overloading for vector types under Arm C++ compilation scenarios. - NEON backend module:
src/avx2neon/provides Arm NEON-based compatibility implementations and serves as one of the shared foundations for SVE/SVE512 targets. - SVE/SVE512 backend module:
src/avx2sve/andsrc/avx2sve512/supplement wider vector backend capabilities on top of the common NEON implementation. - Common capability module:
src/common/provides version implementations, CPU features, general logic, and common data structures. - Test module:
test/includes functional tests, performance tests, randomized tests, comparison data, and automation scripts.
Core External API Functions
The following table provides representative examples of APIs filtered from public header files to illustrate the capabilities of AVX2KI. This is not an exhaustive list of all APIs.
| Module | Interface Function/Capability | Description |
|---|---|---|
| Version information | AVX2KI_GetProductVersion |
Retrieves information such as product name, component name, component version, software name, and software version. |
| Basic vector operations | _mm_add_epi32, _mm_sub_epi64, _mm_mul_pd, _mm_div_ps |
Provides scalar/vector integer and floating-point arithmetic capabilities. |
| Logic and comparison | _mm_and_si128, _mm_or_si128, _mm_xor_si128, _mm_cmpeq_epi32 |
Supports bitwise operations and common comparison operations. |
| Data movement | _mm_loadu_si128, _mm_storeu_si128, _mm_load_pd, _mm_store_ps |
Supports common load, store, and type conversion APIs. |
| Extended vector APIs | _mm256_hadds_epi16, _mm512_mulhi_epi32, _mm512_fixupnan_ps |
Provides AVX2/AVX-512 style wide-vector compatibility APIs. |
| Memory APIs | _mm_malloc, _mm_free |
Provides aligned memory allocation and deallocation capabilities. |
| C++ usability | operator +, operator -, operator &, etc. |
Provides operator overloading for __m64, __m128i, __m128, and __m128d under C++. |
Directory Structure
# Documentation directory
README_EN.md # Project introduction
LICENSE # Repository license
docs/
└── en/
├── api_reference.md # API reference
├── installation_guide.md # Installation guide
├── quick_start.md # Quick start guide
└── release_note.md # Release notes
# Code directory
include/
├── avx.h # Public intrinsic interface declarations
├── avx2ki.h # Main entry header file
├── avx2ki_core.h # Version and core interfaces
├── avx2ki_type.h # Types, enums, status codes, and macro definitions
└── operatoroverload.h # C++ operator overloading
src/
├── avx2neon/ # NEON backend implementation
├── avx2sve/ # SVE 256-bit backend implementation
├── avx2sve512/ # SVE 512-bit backend implementation
├── common/ # Common implementations
├── CMakeLists.txt # Subdirectory build entry
└── unsupport.txt # One of the current implementation files
test/
├── avx2ki/ # Functional and performance test cases
├── build/ # Makefile build entry
├── common/ # Common code for testing
├── gtest-download/ # GoogleTest download script
├── gtest-parallel/ # Parallel testing tool
└── scripts/ # Data preparation and automation scripts
build.sh # Main build script
CMakeLists.txt # Top-level CMake configuration
config.cmake.in # Compilation options and version configuration
avx2kiver.h.in # Version header templateRelease Notes
For details about version mapping and the current repository status, see Release Notes.
Environment Deployment
For details about the compilation environment, dependency preparation, and target library build and installation, see Installation Guide.
Quick Start
For details about minimum examples, version query, and vector API usage, see Quick Start.
Documentation
| Document Name | Description |
|---|---|
| Release Notes | Provides the default version, document update time, and known restrictions of the AVX2KI repository. |
| Installation Guide | Provides the dependencies, environment variables, build commands, product directories, and installation methods for AVX2KI. |
| Quick Start | Provides minimum compilation examples, version query, and intrinsic call examples of AVX2KI. |
| API Reference | Provides the main header files, version structures, status codes, and representative APIs of AVX2KI. |
Disclaimer
To AVX2KI Users
This software is intended solely for debugging and development. You are responsible for any risks and should carefully review the following information:
- Data processing and deletion: Users are responsible for managing and deleting any data generated while using this software. You are advised to promptly delete any related data after use to prevent information leaks.
- Data confidentiality and transmission: Users understand and agree not to share or transmit any data generated by this software. Neither the software nor its developers are responsible for any information leaks, data breaches, or other negative consequences.
- User input security: Users are responsible for the security of any commands they enter and for any risks or losses resulting from improper input. The software and its developers are not liable for issues caused by incorrect command usage.
Disclaimer scope: This disclaimer applies to all individuals and entities using this software. By using the software, you acknowledge and accept this statement and assume all risks and responsibilities arising from its use. If you do not agree, please stop using the software immediately.
Before using this software, please read and understand the preceding disclaimer. If you have any questions, contact the developer.
To Data Owners
If you do not want your dataset to be mentioned in the AVX2KI repository, or if you wish to update its description, please submit an issue on GitCode. We will delete or update your description according to your request. Thank you for your understanding and support.
License
The code in this repository is licensed under the MIT License. For details, see LICENSE.
Unless otherwise specified, the content of this documentation is released and maintained together with the repository code.
Contribution Statement
We welcome feedback, additional test cases, implementation improvements, or documentation enhancements through issues or pull requests. If you plan to submit code, it is recommended to specify at least the following details prior to submission:
- Target backend:
avx2neon,avx2sve, oravx2sve512 - Impact scope: header file declarations, common implementations, test cases, or performance data
- Verification method: functional tests, randomized tests, performance tests, or application-side verification
Acknowledgments
The AVX2KI code and documentation reflect engineering practices related to Kunpeng BoostKit, and rely on the continuous dedication of community contributors to SIMD compatibility migration on the Arm platform.
We express our gratitude to all developers who have contributed implementations, test cases, issue reports, and documentation improvements to AVX2KI.