Skip to main content

AscendNPU IR Compiler

Python bindings for the bishengir-compile compiler.

Installation

pip install ascendnpu-ir

Usage

import ascendnpuir

mlir_str = """
module {
  func.func @add(%arg0: memref<16xi16, #hivm.address_space<gm>>, %arg1: memref<16xi16, #hivm.address_space<gm>>, %arg2: memref<16xi16, #hivm.address_space<gm>>) attributes {hacc.entry, hacc.function_kind = #hacc.function_kind<DEVICE>} {
    %alloc = memref.alloc() : memref<16xi16, #hivm.address_space<ub>>
    hivm.hir.load ins(%arg0 : memref<16xi16, #hivm.address_space<gm>>) outs(%alloc : memref<16xi16, #hivm.address_space<ub>>)
    %alloc_0 = memref.alloc() : memref<16xi16, #hivm.address_space<ub>>
    hivm.hir.load ins(%arg1 : memref<16xi16, #hivm.address_space<gm>>) outs(%alloc_0 : memref<16xi16, #hivm.address_space<ub>>)
    %alloc_1 = memref.alloc() : memref<16xi16, #hivm.address_space<ub>>
    hivm.hir.vadd ins(%alloc, %alloc_0 : memref<16xi16, #hivm.address_space<ub>>, memref<16xi16, #hivm.address_space<ub>>) outs(%alloc_1 : memref<16xi16, #hivm.address_space<ub>>)
    hivm.hir.store ins(%alloc_1 : memref<16xi16, #hivm.address_space<ub>>) outs(%arg2 : memref<16xi16, #hivm.address_space<gm>>)
    return
  }
}
"""
output_path = "example.o"
options = [
    "-enable-hivm-compile=true",
]

# Compile a model
res = ascendnpuir.compile(
    mlir_str,
    output_path=output_path,
    option=options,
)
print(f"Compiled to: {output_path}")

Building from Source

To build the wheel package from source, you need to first build the bishengir-compile binary:

# Build the compiler
cd build-tools
./build.sh

# Build the wheel package
./build_wheel.sh

The wheel package will be created in the bishengir/python/wheel/dist directory.

License

Apache License 2.0

Metadata

Release files for ascendnpu-ir 1.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ascendnpu-ir 1.2.0
File Size Uploaded Provenance
ascendnpu_ir-1.2.0.tar.gz 5.7 kB Without provenance Details

Built distributions (wheels)

Table of built distributions (wheels) for ascendnpu-ir 1.2.0
File
ascendnpu_ir-1.2.0-cp313-cp313-manylinux_2_28_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.28+ x86-64 Details
ascendnpu_ir-1.2.0-cp313-cp313-manylinux_2_28_aarch64.whl CPython 3.13 CPython 3.13 Linux glibc 2.28+ ARM64 Details
ascendnpu_ir-1.2.0-cp312-cp312-manylinux_2_28_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.28+ x86-64 Details
ascendnpu_ir-1.2.0-cp312-cp312-manylinux_2_28_aarch64.whl CPython 3.12 CPython 3.12 Linux glibc 2.28+ ARM64 Details
ascendnpu_ir-1.2.0-cp311-cp311-manylinux_2_28_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.28+ x86-64 Details
ascendnpu_ir-1.2.0-cp311-cp311-manylinux_2_28_aarch64.whl CPython 3.11 CPython 3.11 Linux glibc 2.28+ ARM64 Details
ascendnpu_ir-1.2.0-cp310-cp310-manylinux_2_28_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.28+ x86-64 Details
ascendnpu_ir-1.2.0-cp310-cp310-manylinux_2_28_aarch64.whl CPython 3.10 CPython 3.10 Linux glibc 2.28+ ARM64 Details

Total release size: 1.2 GB

Release files / ascendnpu_ir-1.2.0.tar.gz

Download URL ascendnpu_ir-1.2.0.tar.gz
Size 5.7 kB
Tags Source
SHA-256 checksum
How to use checksums
860b253781edb97c5c84fe9aba11ff0158d47d4086d0543009301e9a039cac1f
BLAKE2b-256 checksum
How to use checksums
1c16afdb1aa1eabedaf387c717a5aa054c079cb9b509527138993285614a65fe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.9

Release files / ascendnpu_ir-1.2.0-cp313-cp313-manylinux_2_28_x86_64.whl

Download URL ascendnpu_ir-1.2.0-cp313-cp313-manylinux_2_28_x86_64.whl
Size 161.2 MB
Tags CPython 3.13 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
11db65643cf8528a3da9aa13802d57a258385ae97deafcdc1ff4ff19f04db4a6
BLAKE2b-256 checksum
How to use checksums
ec12a1ec61625c623f904849cd738f578c947727a83b29f1c9fd7819f6a8a1ea
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.9

Release files / ascendnpu_ir-1.2.0-cp313-cp313-manylinux_2_28_aarch64.whl

Download URL ascendnpu_ir-1.2.0-cp313-cp313-manylinux_2_28_aarch64.whl
Size 134.3 MB
Tags CPython 3.13 Linux glibc 2.28+ ARM64
SHA-256 checksum
How to use checksums
fcc8ab0a513493da5b61bb7b7837a7e90da2b73934723bb67d7706eac7d161d3
BLAKE2b-256 checksum
How to use checksums
bd9ff5709d60b86ea4f55a734414356415c63800da55414c3c559197d8d971d9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.9

Release files / ascendnpu_ir-1.2.0-cp312-cp312-manylinux_2_28_x86_64.whl

Download URL ascendnpu_ir-1.2.0-cp312-cp312-manylinux_2_28_x86_64.whl
Size 161.2 MB
Tags CPython 3.12 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
5a1e4a9ac83c66760d1ee3862206bdc9edae1f212e5ceb569b96926e27b4f2c9
BLAKE2b-256 checksum
How to use checksums
85542d47a59e634ddb410dd8ff485284eb391eee58799d6fd86f7537a7482087
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.9

Release files / ascendnpu_ir-1.2.0-cp312-cp312-manylinux_2_28_aarch64.whl

Download URL ascendnpu_ir-1.2.0-cp312-cp312-manylinux_2_28_aarch64.whl
Size 134.3 MB
Tags CPython 3.12 Linux glibc 2.28+ ARM64
SHA-256 checksum
How to use checksums
44bf314a819ad6678f07fa954d7c5d622734cc404a373698d588d8f87d75a144
BLAKE2b-256 checksum
How to use checksums
cd4be89fa589bd1b2aa8fc8580f19c7a7267b945b29f332087c93e5fdc654e33
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.9

Release files / ascendnpu_ir-1.2.0-cp311-cp311-manylinux_2_28_x86_64.whl

Download URL ascendnpu_ir-1.2.0-cp311-cp311-manylinux_2_28_x86_64.whl
Size 161.2 MB
Tags CPython 3.11 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
d4e5bfab877ee4ba7b312885f4f5bf646072fd47c88d5aa96f6a11f67d3e8522
BLAKE2b-256 checksum
How to use checksums
1522d9c197e80cd87916f1cdd6159ef03bcba84f395f99cfbd27c4928129d4ae
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.9

Release files / ascendnpu_ir-1.2.0-cp311-cp311-manylinux_2_28_aarch64.whl

Download URL ascendnpu_ir-1.2.0-cp311-cp311-manylinux_2_28_aarch64.whl
Size 134.3 MB
Tags CPython 3.11 Linux glibc 2.28+ ARM64
SHA-256 checksum
How to use checksums
76aaaedd3c4a08148a690f1bdddf2e2668f484989ab261fdb7e19cdba5d0f957
BLAKE2b-256 checksum
How to use checksums
95471fe683928045acb6544b3abb9c93119b30aeff81d6c4fd8eff2239abc193
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.9

Release files / ascendnpu_ir-1.2.0-cp310-cp310-manylinux_2_28_x86_64.whl

Download URL ascendnpu_ir-1.2.0-cp310-cp310-manylinux_2_28_x86_64.whl
Size 161.2 MB
Tags CPython 3.10 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
2de850a55d4029d30d3d09c7f1f6bbc36e5c8730c09126370eb01ae0cdd4e9f0
BLAKE2b-256 checksum
How to use checksums
35443d25b48053db322c1c50db1f0febc4f1dfc0e6c356a65edb82f8209375b2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.9

Release files / ascendnpu_ir-1.2.0-cp310-cp310-manylinux_2_28_aarch64.whl

Download URL ascendnpu_ir-1.2.0-cp310-cp310-manylinux_2_28_aarch64.whl
Size 134.3 MB
Tags CPython 3.10 Linux glibc 2.28+ ARM64
SHA-256 checksum
How to use checksums
4676f8102b5ff9068fb744145d3ad3eec6ed6b0f01e890074ba2cd14c8a8fdb2
BLAKE2b-256 checksum
How to use checksums
62c47d8c3ea8af3f29d337aa65a28384af759c165cf536a173a8967915922f9a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.9

Security for ascendnpu-ir 1.2.0

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page