Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add SDXL EulerDiscreteScheduler compilation test #19315

Merged
merged 3 commits into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,12 @@ class VmfbManager:
sdxl_punet_int8_fp16_rocm_vmfb = None
sdxl_punet_int8_fp8_rocm_vmfb = None
sdxl_unet_fp16_cpu_pipeline_vmfb = None
sdxl_scheduler_cpu_vmfb = None
sdxl_unet_fp16_rocm_pipeline_vmfb = None
sd3_clip_cpu_vmfb = None
sd3_vae_cpu_vmfb = None
sd3_mmdit_cpu_vmfb = None
sd3_clip_rocm_vmfb = None
sd3_vae_rocm_vmfb = None
sd3_mmdit_rocm_vmfb = None
sdxl_scheduler_rocm_vmfb = None
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# Copyright 2024 The IREE Authors
#
# Licensed under the Apache License v2.0 with LLVM Exceptions.
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

import pytest
from ireers_tools import *
import os
from conftest import VmfbManager
from pathlib import Path

rocm_chip = os.getenv("ROCM_CHIP", default="gfx90a")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is ROCM_CHIP always set in the builders? I think in test_unet.py is defaulted to gfx942, is there any reason we use gfx90a instead?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah it's always set as part of the workflow file, so runners always get gfx942. This default is more for end users. I just changed all defaults to gfx942, so it's consistent though

vmfb_dir = os.getenv("TEST_OUTPUT_ARTIFACTS", default=Path.cwd())

###############################################################################
# Fixtures
###############################################################################

sdxl_scheduler_mlir = fetch_source_fixture(
"https://sharkpublic.blob.core.windows.net/sharkpublic/sai/sdxl-scheduler/11-26-2024/model.mlir",
group="sdxl_scheduler",
)

CPU_COMPILE_FLAGS = [
"--iree-hal-target-backends=llvm-cpu",
"--iree-llvmcpu-target-cpu-features=host",
"--iree-llvmcpu-fail-on-out-of-bounds-stack-allocation=false",
"--iree-llvmcpu-distribution-size=32",
"--iree-opt-const-eval=false",
"--iree-opt-strip-assertions=true",
"--iree-llvmcpu-enable-ukernels=all",
"--iree-global-opt-enable-quantized-matmul-reassociation",
]


ROCM_COMPILE_FLAGS = [
"--iree-hal-target-backends=rocm",
f"--iree-hip-target={rocm_chip}",
"--iree-opt-const-eval=false",
"--iree-global-opt-propagate-transposes=true",
"--iree-llvmgpu-enable-prefetch=true",
"--iree-execution-model=async-external",
"--iree-preprocessing-pass-pipeline=builtin.module(iree-preprocessing-transpose-convolution-pipeline,iree-preprocessing-pad-to-intrinsics)",
"--iree-scheduling-dump-statistics-format=json",
"--iree-scheduling-dump-statistics-file=compilation_info.json",
]

###############################################################################
# CPU
###############################################################################


def test_compile_scheduler_cpu(sdxl_scheduler_mlir):
VmfbManager.sdxl_scheduler_cpu_vmfb = iree_compile(
sdxl_scheduler_mlir,
CPU_COMPILE_FLAGS,
Path(vmfb_dir)
/ Path("sdxl_scheduler_vmfbs")
/ Path(sdxl_scheduler_mlir.path.name).with_suffix(f".cpu.vmfb"),
)


###############################################################################
# ROCM
###############################################################################


def test_compile_scheduler_rocm(sdxl_scheduler_mlir):
VmfbManager.sdxl_scheduler_rocm_vmfb = iree_compile(
sdxl_scheduler_mlir,
ROCM_COMPILE_FLAGS,
Path(vmfb_dir)
/ Path("sdxl_scheduler_vmfbs")
/ Path(sdxl_scheduler_mlir.path.name).with_suffix(f".rocm_{rocm_chip}.vmfb"),
)
Loading