Skip to content

Instantly share code, notes, and snippets.

View saulshanabrook's full-sized avatar
🏊

Saul Shanabrook saulshanabrook

🏊
View GitHub Profile
@saulshanabrook
saulshanabrook / README.md
Created October 19, 2016 14:20
Saving Web Crypto Keys using indexedDB

This is a working example on how to store CryptoKeys locally in your browser. We are able to save the objects, without serializing them. This means we can keep them not exportable (which might be more secure?? not sure what attack vectors this prevents).

To try out this example, first make sure you are in a browser that has support for async...await and indexedDB (latest chrome canary with chrome://flags "Enable Experimental Javascript" works). Load some page and copy and paste this code into the console. Then call encryptDataSaveKey(). This will create a private/public key pair and encrypted some random data with the private key. Then save both of them. Now reload the page, copy in the code, and run loadKeyDecryptData(). It will load the keys and encrypted data and decrypt it. You should see the same data logged both times.

diff --git a/src/mlir_egglog/jit_engine.py b/src/mlir_egglog/jit_engine.py
index de9ac2f..e3b3aa0 100644
--- a/src/mlir_egglog/jit_engine.py
+++ b/src/mlir_egglog/jit_engine.py
@@ -10,7 +10,6 @@ from egglog import RewriteOrRule, Ruleset
import llvmlite.binding as llvm
from mlir_egglog.llvm_runtime import (
- create_execution_engine,
init_llvm,
$ pytest -vvv tests
==================================================================================================================== test session starts =====================================================================================================================
platform darwin -- Python 3.12.3, pytest-8.3.5, pluggy-1.5.0 -- /usr/local/Caskroom/miniconda/base/envs/mlir-egglog/bin/python3.12
cachedir: .pytest_cache
rootdir: /Users/saul/p/mlir-egglog
configfile: pyproject.toml
collected 15 items
tests/test_basic_expressions.py::TestBasicExpressions::test_arithmetic_expression PASSED [ 6%]
tests/test_basic_expressions.py::TestBasicExpressions::test_constants_and_sqrt PASSED [ 13%]

UV Run

$ uv run pytest -x tests
==================================================================================== test session starts ====================================================================================
platform darwin -- Python 3.12.5, pytest-8.3.5, pluggy-1.5.0
rootdir: /Users/saul/p/mlir-egglog
configfile: pyproject.toml
collected 15 items                                                                                                                                                                          
$ git diff
diff --git a/src/mlir_egglog/mlir_backend.py b/src/mlir_egglog/mlir_backend.py
index 6ab6867..91f3f53 100644
--- a/src/mlir_egglog/mlir_backend.py
+++ b/src/mlir_egglog/mlir_backend.py
@@ -49,6 +49,7 @@ COMMON_INITIAL_OPTIONS = (
"-convert-vector-to-scf",
"-convert-linalg-to-loops",
"-lower-affine",
+ "--convert-arith-to-llvm",
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@saulshanabrook
saulshanabrook / output.sh
Created April 6, 2025 23:47
mlir egglog logs
$ uv run pytest -x
==================================================================== test session starts ====================================================================
platform darwin -- Python 3.12.5, pytest-8.3.5, pluggy-1.5.0
rootdir: /Users/saul/p/mlir-egglog
configfile: pyproject.toml
collected 15 items
tests/test_basic_expressions.py F
========================================================================= FAILURES ==========================================================================
This file has been truncated, but you can view the full file.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>IPyWidget export</title>
</head>
<body>
<!-- Load require.js. Delete this if your page already loads require.js -->
This file has been truncated, but you can view the full file.
{
"id": "--eclipse-layout-kernel-root",
"layoutOptions": {
"elk.algorithm": "layered",
"elk.direction": "DOWN",
"elk.layered.nodePlacement.strategy": "NETWORK_SIMPLEX",
"elk.layered.mergeEdges": "true",
"elk.aspectRatio": 4.56
},
"children": [
{
"id": "--eclipse-layout-kernel-root",
"layoutOptions": {
"elk.algorithm": "layered",
"elk.layered.spacing.nodeNodeBetweenLayers": "100",
"elk.spacing.nodeNode": "80",
"elk.direction": "DOWN",
"elk.portConstraints": "FIXED_SIDE",
"elk.hierarchyHandling": "INCLUDE_CHILDREN"
},