Skip to content

Instantly share code, notes, and snippets.

@IanWood1
Created August 11, 2024 17:29
Show Gist options
  • Save IanWood1/bf44ce18cc815587ec6606fd0230fcb2 to your computer and use it in GitHub Desktop.
Save IanWood1/bf44ce18cc815587ec6606fd0230fcb2 to your computer and use it in GitHub Desktop.
#!/bin/bash
set -xeuo pipefail
echo "Started!"
iree-compile ./dispatch_84_conv.mlir --iree-hal-target-backends=rocm --iree-rocm-target-chip=gfx942 --iree-rocm-bc-dir=./../bitcode-6.1.2 --iree-opt-const-eval=false --iree-opt-data-tiling=false --iree-global-opt-propagate-transposes=true --iree-opt-aggressively-propagate-transposes=true --iree-opt-outer-dim-concat=true --iree-vm-target-truncate-unsupported-floats --iree-codegen-llvmgpu-use-vector-distribution --iree-llvmgpu-enable-prefetch --iree-codegen-gpu-native-math-precision=true --iree-codegen-transform-dialect-library=./specs/attention_and_matmul_spec.mlir '--iree-preprocessing-pass-pipeline=builtin.module(util.func(iree-global-opt-raise-special-ops, iree-flow-canonicalize), iree-preprocessing-transpose-convolution-pipeline, util.func(iree-preprocessing-pad-to-intrinsics), util.func(iree-preprocessing-generalize-linalg-matmul-experimental))' --iree-hal-dump-executable-configurations-to=./configurations-yes-aggressive/punet --iree-hal-dump-executable-intermediates-to=./intermediates-yes-aggressive/punet --iree-hal-dump-executable-sources-to=./sources-yes-aggressive/punet --iree-hal-dump-executable-binaries-to=./binaries/punet --iree-hal-dump-executable-benchmarks-to=./benchmarks-yes-aggressive/punet --iree-scheduling-dump-statistics-file=./tmp-yes-aggressive/punet_scheduling_stats.txt --iree-scheduling-dump-statistics-format=csv -o ./punet-yes-aggressive.vmfb --iree-flow-enable-aggressive-fusion &
iree-compile ./dispatch_84_conv.mlir --iree-hal-target-backends=rocm --iree-rocm-target-chip=gfx942 --iree-rocm-bc-dir=./../bitcode-6.1.2 --iree-opt-const-eval=false --iree-opt-data-tiling=false --iree-global-opt-propagate-transposes=true --iree-opt-aggressively-propagate-transposes=true --iree-opt-outer-dim-concat=true --iree-vm-target-truncate-unsupported-floats --iree-codegen-llvmgpu-use-vector-distribution --iree-llvmgpu-enable-prefetch --iree-codegen-gpu-native-math-precision=true --iree-codegen-transform-dialect-library=./specs/attention_and_matmul_spec.mlir '--iree-preprocessing-pass-pipeline=builtin.module(util.func(iree-global-opt-raise-special-ops, iree-flow-canonicalize), iree-preprocessing-transpose-convolution-pipeline, util.func(iree-preprocessing-pad-to-intrinsics), util.func(iree-preprocessing-generalize-linalg-matmul-experimental))' --iree-hal-dump-executable-configurations-to=./configurations-no-aggressive/punet --iree-hal-dump-executable-intermediates-to=./intermediates-no-aggressive/punet --iree-hal-dump-executable-sources-to=./sources-no-aggressive/punet --iree-hal-dump-executable-binaries-to=./binaries-no-aggressive/punet --iree-hal-dump-executable-benchmarks-to=./benchmarks-no-aggressive/punet --iree-scheduling-dump-statistics-file=./tmp-no-aggressive/punet_scheduling_stats.txt --iree-scheduling-dump-statistics-format=csv -o ./punet-no-aggressive.vmfb &
echo "Waiting for mlir to compile..."
wait
echo "Finished compiling!"
#INPUTS=" --input=2x66x66x640xi8=1 --input=3x3x640x640xi8=1 --input=640xi32=1 --input=640xf32=1.0 --input=2x640xf32=1.0 --input=640xf16=1.0 --input=2x640x64x64xf16=1.0"
INPUTS=" --input=@input1.npy --input=@input2.npy --input=@input3.npy --input=@input4.npy --input=@input5.npy --input=@input6.npy --input=@input7.npy"
iree-run-module --device=hip://0 --hip_use_streams=true --hip_allow_inline_execution=true --device_allocator=caching --module=punet-yes-aggressive.vmfb --function=main $INPUTS --output=@out_yes_aggressive_fusion.npy &
iree-run-module --device=hip://0 --hip_use_streams=true --hip_allow_inline_execution=true --device_allocator=caching --module=punet-no-aggressive.vmfb --function=main $INPUTS --output=@out_no_aggressive_fusion.npy &
echo "Waiting for model to run.."
wait
echo "Finished running!"
python3 compare.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment