diff --git a/apps/stable_diffusion/src/schedulers/shark_eulerdiscrete.py b/apps/stable_diffusion/src/schedulers/shark_eulerdiscrete.py index 5d7272a83c..85aba5d870 100644 --- a/apps/stable_diffusion/src/schedulers/shark_eulerdiscrete.py +++ b/apps/stable_diffusion/src/schedulers/shark_eulerdiscrete.py @@ -84,9 +84,6 @@ def forward(self, noise_pred, sigma, latent, dt): iree_flags.append( f"-iree-vulkan-target-triple={args.iree_vulkan_target_triple}" ) - # Disable bindings fusion to work with moltenVK. - if sys.platform == "darwin": - iree_flags.append("-iree-stream-fuse-binding=false") def _import(self): scaling_model = ScalingModel() diff --git a/apps/stable_diffusion/src/utils/utils.py b/apps/stable_diffusion/src/utils/utils.py index d97c6b8507..6bf8f0f31b 100644 --- a/apps/stable_diffusion/src/utils/utils.py +++ b/apps/stable_diffusion/src/utils/utils.py @@ -535,10 +535,6 @@ def get_opt_flags(model, precision="fp16"): "--iree-codegen-linalg-max-constant-fold-elements=9223372036854775807" ) - # Disable bindings fusion to work with moltenVK. - if sys.platform == "darwin": - iree_flags.append("-iree-stream-fuse-binding=false") - if "default_compilation_flags" in opt_flags[model][is_tuned][precision]: iree_flags += opt_flags[model][is_tuned][precision][ "default_compilation_flags" diff --git a/setup_venv.sh b/setup_venv.sh index dcd7f821b6..3df95b6e2c 100755 --- a/setup_venv.sh +++ b/setup_venv.sh @@ -86,6 +86,7 @@ $PYTHON -m pip install --upgrade -r "$TD/requirements.txt" if [ "$torch_mlir_bin" = true ]; then if [[ $(uname -s) = 'Darwin' ]]; then echo "MacOS detected. Installing torch-mlir from .whl, to avoid dependency problems with torch." + $PYTHON -m pip uninstall -y timm #TEMP FIX FOR MAC $PYTHON -m pip install --pre --no-cache-dir torch-mlir -f https://llvm.github.io/torch-mlir/package-index/ -f https://download.pytorch.org/whl/nightly/torch/ else $PYTHON -m pip install --pre torch-mlir -f https://llvm.github.io/torch-mlir/package-index/ @@ -128,7 +129,13 @@ if [[ ! -z "${IMPORTER}" ]]; then fi fi -$PYTHON -m pip install --no-warn-conflicts -e . -f https://llvm.github.io/torch-mlir/package-index/ -f ${RUNTIME} -f https://download.pytorch.org/whl/nightly/cpu/ +if [[ $(uname -s) = 'Darwin' ]]; then + PYTORCH_URL=https://download.pytorch.org/whl/nightly/torch/ +else + PYTORCH_URL=https://download.pytorch.org/whl/nightly/cpu/ +fi + +$PYTHON -m pip install --no-warn-conflicts -e . -f https://llvm.github.io/torch-mlir/package-index/ -f ${RUNTIME} -f ${PYTORCH_URL} if [[ $(uname -s) = 'Linux' && ! -z "${IMPORTER}" ]]; then T_VER=$($PYTHON -m pip show torch | grep Version) diff --git a/shark/iree_utils/metal_utils.py b/shark/iree_utils/metal_utils.py index 8704709fb2..21dfee8481 100644 --- a/shark/iree_utils/metal_utils.py +++ b/shark/iree_utils/metal_utils.py @@ -89,24 +89,10 @@ def get_metal_triple_flag(device_name="", device_num=0, extra_args=[]): def get_iree_metal_args(device_num=0, extra_args=[]): - # res_metal_flag = ["--iree-flow-demote-i64-to-i32"] - + # Add any metal spefic compilation flags here res_metal_flag = [] - metal_triple_flag = None - for arg in extra_args: - if "-iree-metal-target-platform=" in arg: - print(f"Using target triple {arg} from command line args") - metal_triple_flag = arg - break - - if metal_triple_flag is None: - metal_triple_flag = get_metal_triple_flag(extra_args=extra_args) - - if metal_triple_flag is not None: - vulkan_target_env = get_vulkan_target_env_flag( - "-iree-vulkan-target-triple=m1-moltenvk-macos" - ) - res_metal_flag.append(vulkan_target_env) + if len(extra_args) > 0: + res_metal_flag.extend(extra_args) return res_metal_flag