pym
pymult
pypi i pymult
pym

pymult

An example Python package written in x86-64 assembly.

by Anthony Shaw

0.0.2 (see all)License:BSD-2-Clause
pypi i pymult
Readme

Building Python Extension Modules in Assembly

GitHub Actions

This repository is a proof-of-concept to demonstrate how you can create a Python Extension in 100% assembly.

Demonstrates:

  • How to write a Python module in pure assembly
  • How to write a function in pure assembly and call it from Python with Python objects
  • How to call the C API to create a PyObject and parse PyTuple (arguments) into raw pointers
  • How to pass data back into Python
  • How to register a module from assembly
  • How to create a method definition in assembly
  • How to write back to the Python stack using the dynamic module loader
  • How to package a NASM/Assembly Python extension with distutils

The simple proof-of-concept function takes 2 parameters,

>>> import pymult
>>> pymult.multiply(2, 4)
8  

But, Why?

Just because it can be done.

Also, I want to see if some AVX/AVX2 instructions (high-performance matrix multiplication especially) can be used directly from Python.

VersionTagPublished
0.0.2
2yrs ago
0.0.1
2yrs ago
0.0.0
2yrs ago
No alternatives found
No tutorials found
Add a tutorial
No dependencies found

Rate & Review

100
No reviews found
Be the first to rate