Skip to content

Instantly share code, notes, and snippets.

@BruceDai003
BruceDai003 / run_mul_2.sh
Created May 9, 2024 05:57
bash script to compile and run using iree
out=notes/mlir/mul_2
file=mul_2
iree-compile ${out}/${file}.mlir \
--iree-hal-target-backends=llvm-cpu \
--iree-hal-dump-executable-files-to=${out} \
-o ${out}/${file}.vmfb
# --iree-hal-cuda-llvm-target-arch=sm_80 \
# --dump-compilation-phases-to=${out} \
@BruceDai003
BruceDai003 / mul_2.py
Created May 9, 2024 05:56
Simple [0,1,2,3]*2 model using iree
import torch
import torch.nn as nn
import os
import numpy as np
import shark_turbine.aot as aot
torch.manual_seed(42)
torch.cuda.manual_seed(42)
np.random.seed(42)