Portable Efficient Assembly Code-generator in Higher-level Python (PEACH-Py)
PEACH-Py is a Python framework for writing high-performance assembly kernels. PEACH-Py is developed to simplify writing optimized assembly kernels while preserving all optimization opportunities of traditional assembly. Some PEACH-Py features:
Automatic register allocation
Stack frame management, including re-aligning of stack frame as needed
Generating versions of a function for different calling conventions from the same source (e.g. functions for Microsoft x64 ABI and System V x86-64 ABI can be generated from the same source)
Allows to define constants in the place where they are used (just like in high-level languages)
Tracking of instruction extensions used in the function.
Multiplexing of multiple instruction streams (helpful for software pipelining)
Example
from peachpy.x64 import *
# Use 'x64-ms' for Microsoft x64 ABI
abi = peachpy.c.ABI('x64-sysv')
assembler = Assembler(abi)
# Implement function void add_1(const uint32_t *src, uint32_t *dst, size_t length)
src_argument = peachpy.c.Parameter("src", peachpy.c.Type("const uint32_t*"))
dst_argument = peachpy.c.Parameter("dst", peachpy.c.Type("uint32_t*"))
len_argument = peachpy.c.Parameter("length", peachpy.c.Type("size_t"))
# This optimized kernel will target Intel Nehalem processors. Any instructions which are not
# supported on Intel Nehalem (e.g. AVX instructions) will generate an error. If you don't have
# a particular target in mind, use "Unknown"
with Function(assembler, "add_1", (src_argument, dst_argument, len_argument), "Nehalem"):
# Load arguments into registers
srcPointer = GeneralPurposeRegister64()
LOAD.PARAMETER( srcPointer, src_argument )
dstPointer = GeneralPurposeRegister64()
LOAD.PARAMETER( dstPointer, dst_argument )
length = GeneralPurposeRegister64()
LOAD.PARAMETER( length, len_argument )
# Main processing loop. Length must be a multiple of 4.
LABEL( 'loop' )
x = SSERegister()
MOVDQU( x, [srcPointer] )
ADD( srcPointer, 16 )
# Add 1 to x
PADDD( x, Constant.uint32x4(1) )
MOVDQU( [dstPointer], x )
ADD( dstPointer, 16 )
SUB( length, 4 )
JNZ( 'loop' )
RETURN()
print assembler
Metadata
Release files for PeachPy 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| PeachPy-0.0.1.zip | 116.9 kB | Without provenance | Details for PeachPy-0.0.1.zip |
Release files / PeachPy-0.0.1.zip
| Download URL | PeachPy-0.0.1.zip |
|---|---|
| Size | 116.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9eaa37c0a914900dd93051080a9510c488fff626a22cc9c855c35045e0ac2843
|
|
BLAKE2b-256 checksum How to use checksums |
de53b576bafe2554e3ea952a1da2959f124d4d79906bddd82cd3275ff98ad498
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for PeachPy 0.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.