{"title":"PeachPy meets Opcodes: direct machine code generation from Python","authors":"Marat Dukhan","doi":"10.1145/2835857.2835860","DOIUrl":null,"url":null,"abstract":"We introduce Opcodes, a Python package which presents x86 and x86-64 instruction sets as a set of high-level objects. Opcodes provides information about instruction names, implicit and explicit operands, and instruction encoding. We use the Opcodes package to auto-generate instruction classes for PeachPy, an x86-64 assembler embedded in Python, and enable new functionality.\n The new PeachPy functionality lets low-level optimization experts write high-performance assembly kernels in Python, load them as callable Python functions, test the kernels using numpy and generate object files for Windows, Linux, and Mac OS X entirely within Python. Additionally, the new PeachPy can generate and run assembly code inside Chromium-based browsers by leveraging Native Client technology. Beyond that, PeachPy gained ability to target Google Go toolchain, by generating either source listing for Go assembler, or object files that can be linked with Go toolchain.\n With backends for Windows, Linux, Mac OS X, Native Client, and Go, PeachPy is the most portable way to write high-performance kernels for x86-64 architecture.","PeriodicalId":171838,"journal":{"name":"Workshop on Python for High-Performance and Scientific Computing","volume":"294 1","pages":"0"},"PeriodicalIF":0.0000,"publicationDate":"2015-11-15","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"4","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"Workshop on Python for High-Performance and Scientific Computing","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/10.1145/2835857.2835860","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
引用次数: 4
Abstract
We introduce Opcodes, a Python package which presents x86 and x86-64 instruction sets as a set of high-level objects. Opcodes provides information about instruction names, implicit and explicit operands, and instruction encoding. We use the Opcodes package to auto-generate instruction classes for PeachPy, an x86-64 assembler embedded in Python, and enable new functionality.
The new PeachPy functionality lets low-level optimization experts write high-performance assembly kernels in Python, load them as callable Python functions, test the kernels using numpy and generate object files for Windows, Linux, and Mac OS X entirely within Python. Additionally, the new PeachPy can generate and run assembly code inside Chromium-based browsers by leveraging Native Client technology. Beyond that, PeachPy gained ability to target Google Go toolchain, by generating either source listing for Go assembler, or object files that can be linked with Go toolchain.
With backends for Windows, Linux, Mac OS X, Native Client, and Go, PeachPy is the most portable way to write high-performance kernels for x86-64 architecture.
我们将介绍Opcodes,这是一个Python包,它将x86和x86-64指令集表示为一组高级对象。操作码提供有关指令名称、隐式和显式操作数以及指令编码的信息。我们使用Opcodes包为PeachPy(一个嵌入在Python中的x86-64汇编器)自动生成指令类,并启用新功能。新的PeachPy功能允许低级优化专家在Python中编写高性能的汇编内核,将它们加载为可调用的Python函数,使用numpy测试内核,并完全在Python中为Windows, Linux和Mac OS X生成对象文件。此外,新的PeachPy可以利用Native Client技术在基于chromium的浏览器中生成和运行汇编代码。除此之外,PeachPy通过生成Go汇编器的源代码清单或可以与Go工具链链接的目标文件,获得了针对谷歌Go工具链的能力。对于Windows, Linux, Mac OS X, Native Client和Go的后端,PeachPy是为x86-64架构编写高性能内核的最可移植的方式。