HEIR Jupyter playground
This is a way to start running HEIR compiler passes in a Jupyter notebook or IPython notebook without having to build the entire HEIR project from scratch.
Uses the nightly HEIR build.
Usage
Load Jupyter:
jupyter notebook
In Jupyter:
%pip install heir_play
%load_ext heir_play
%%heir_opt --convert-if-to-select --canonicalize
func.func @secret_condition_with_non_secret_int(%inp: i16, %cond: !secret.secret<i1>) -> !secret.secret<i16> {
%0 = secret.generic ins(%inp, %cond : i16, !secret.secret<i1>) {
^bb0(%copy_inp: i16, %secret_cond: i1):
%1 = scf.if %secret_cond -> (i16) {
%2 = arith.addi %copy_inp, %copy_inp : i16
scf.yield %2 : i16
} else {
scf.yield %copy_inp : i16
}
secret.yield %1 : i16
} -> !secret.secret<i16>
return %0 : !secret.secret<i16>
}
The cell should output something similar to
Running heir-opt...
module {
func.func @secret_condition_with_non_secret_int(%arg0: i16, %arg1: !secret.secret<i1>) -> !secret.secret<i16> {
%0 = arith.addi %arg0, %arg0 : i16
%1 = secret.generic ins(%arg1 : !secret.secret<i1>) {
^bb0(%arg2: i1):
%2 = arith.select %arg2, %0, %arg0 : i16
secret.yield %2 : i16
} -> !secret.secret<i16>
return %1 : !secret.secret<i16>
}
}
Limitations
Right now, heir-opt as a standalone binary is not able to run lowerings to
boolean TFHE schemes due to an external dependency on ABC (see
#885). If you try to run any
pipeline requiring the yosys-optimizer pass, will see the following error from
ABC:
ERROR: ABC: execution of command ""external/edu_berkeley_abc/abc" -s -f /tmp/yosys-abc-iEdp1F/abc.script 2>&1" failed: return code 127.
Metadata
Release files for heir-play 0.0.4
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 |
|---|---|---|---|---|
| heir_play-0.0.4.tar.gz | 8.1 kB | Without provenance | Details for heir_play-0.0.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| heir_play-0.0.4-py3-none-any.whl | Python 3 | none | any | Details for heir_play-0.0.4-py3-none-any.whl |
Total release size: 23.1 kB
Release files / heir_play-0.0.4.tar.gz
| Download URL | heir_play-0.0.4.tar.gz |
|---|---|
| Size | 8.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8e8cb229173edd5691a6a8dd137a6ae6303160107cf553b408bb77910754bd1d
|
|
BLAKE2b-256 checksum How to use checksums |
fe1dca1d22cd1238706ac17b64d1da8a0d72c0ba9bec048a412a9eb4a77cadbc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.10.12
|
Release files / heir_play-0.0.4-py3-none-any.whl
| Download URL | heir_play-0.0.4-py3-none-any.whl |
|---|---|
| Size | 15.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8e017eeb75ffd37445e3ef35cd6c3dd74817cbef6c97d6329975dab637f65c3e
|
|
BLAKE2b-256 checksum How to use checksums |
7000243a69a21db8a0e91dd25804a9ff270eaed5774b0ad325c2410e60f6a128
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.10.12
|
Security for heir-play 0.0.4
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.