forked from iree-org/iree
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add SDXL EulerDiscreteScheduler compilation test (iree-org#19315)
This commit adds a compilation test for the scheduler used in sdxl. We can iterate on this and add some tests that runs the different functions as well (`run_initialize`, `run_scale`, `run_step`) and checks for accuracy. ci-exactly: build_packages, regression_test --------- Signed-off-by: saienduri <[email protected]>
- Loading branch information
Showing
7 changed files
with
84 additions
and
6 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
76 changes: 76 additions & 0 deletions
76
experimental/regression_suite/shark-test-suite-models/sdxl/test_scheduler.py
This file contains 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
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="gfx942") | ||
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"), | ||
) |
This file contains 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