This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ================================================================================ | |
| memref explained through C | |
| ================================================================================ | |
| Docs: https://mlir.llvm.org/docs/Dialects/MemRef/ | |
| SUMMARY | |
| ------- | |
| memref = fat pointer (data pointer + shape + strides) | |
| memref.cast = erase/assert static size. Same pointer, same data. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # /// script | |
| # dependencies = ["exo-lang", "numpy"] | |
| # /// | |
| from __future__ import annotations | |
| import ctypes | |
| import subprocess | |
| import tempfile | |
| from pathlib import Path |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # /// script | |
| # dependencies = ["exo-lang"] | |
| # /// | |
| from __future__ import annotations | |
| import ctypes | |
| import subprocess | |
| import tempfile | |
| from pathlib import Path |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ; $ docker run --rm --platform linux/amd64 -v "$PWD":/app -w /app alpine sh -c "apk add nasm binutils && nasm -f elf64 hello-docker.asm -o hello.o && ld hello.o -o hello && ./hello" | |
| global _start | |
| section .text | |
| _start: | |
| mov rax, 1 ; write( | |
| mov rdi, 1 ; STDOUT_FILENO, | |
| mov rsi, msg ; "Hello, world!\n", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # /// script | |
| # requires-python = "==3.12" | |
| # dependencies = ["waymark"] | |
| # | |
| # [tool.uv.sources] | |
| # waymark = { path = "python", editable = true } | |
| # /// | |
| import asyncio | |
| import os |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # /// script | |
| # dependencies = [ | |
| # "pytest", | |
| # "pytest-asyncio", | |
| # "waymark", | |
| # ] | |
| # /// | |
| import asyncio | |
| import os |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # /// script | |
| # dependencies = [ | |
| # "pytest", | |
| # "pytest-asyncio", | |
| # "waymark", | |
| # ] | |
| # /// | |
| import asyncio | |
| import sys |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| set -euox pipefail | |
| CONTAINER=pg | |
| docker rm -f $CONTAINER 2>/dev/null || true | |
| docker run -d --name $CONTAINER --rm -e POSTGRES_PASSWORD=pass postgres:17-alpine >/dev/null | |
| until docker exec $CONTAINER pg_isready >/dev/null 2>&1; do :; done; sleep 1 | |
| # run stuff | |
| docker exec $CONTAINER psql -U postgres -c "CREATE TABLE fruits (fruit TEXT);" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import csv | |
| from xdsl.dialects import llvm | |
| def get_overflow_flags(): | |
| # nsw, nuw | |
| flags = [f.value for f in llvm.OverflowFlag] | |
| # "none", individual flags, and "nsw, nuw" just to show combination works basically | |
| return ["none"] + flags + ["nsw, nuw"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # /// script | |
| # requires-python = ">=3.11" | |
| # dependencies = [ | |
| # "polars", | |
| # ] | |
| # /// | |
| import itertools | |
| import re | |
| import subprocess |
NewerOlder