Skip to content

Commit 69f91ec

Browse files
saiendurigiacs-epic
authored andcommitted
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]> Signed-off-by: Giacomo Serafini <[email protected]>
1 parent 2308de2 commit 69f91ec

File tree

7 files changed

+84
-6
lines changed

7 files changed

+84
-6
lines changed

experimental/regression_suite/shark-test-suite-models/conftest.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,15 @@ class VmfbManager:
99
sdxl_clip_cpu_vmfb = None
1010
sdxl_vae_cpu_vmfb = None
1111
sdxl_unet_fp16_cpu_vmfb = None
12+
sdxl_unet_fp16_cpu_pipeline_vmfb = None
13+
sdxl_scheduler_cpu_vmfb = None
1214
sdxl_clip_rocm_vmfb = None
1315
sdxl_vae_rocm_vmfb = None
1416
sdxl_unet_fp16_rocm_vmfb = None
1517
sdxl_punet_int8_fp16_rocm_vmfb = None
1618
sdxl_punet_int8_fp8_rocm_vmfb = None
17-
sdxl_unet_fp16_cpu_pipeline_vmfb = None
1819
sdxl_unet_fp16_rocm_pipeline_vmfb = None
20+
sdxl_scheduler_rocm_vmfb = None
1921
sd3_clip_cpu_vmfb = None
2022
sd3_vae_cpu_vmfb = None
2123
sd3_mmdit_cpu_vmfb = None

experimental/regression_suite/shark-test-suite-models/sd3/test_clip.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from conftest import VmfbManager
1111
from pathlib import Path
1212

13-
rocm_chip = os.getenv("ROCM_CHIP", default="gfx90a")
13+
rocm_chip = os.getenv("ROCM_CHIP", default="gfx942")
1414
vmfb_dir = os.getenv("TEST_OUTPUT_ARTIFACTS", default=Path.cwd())
1515

1616
###############################################################################

experimental/regression_suite/shark-test-suite-models/sd3/test_mmdit.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from pathlib import Path
1111
from conftest import VmfbManager
1212

13-
rocm_chip = os.getenv("ROCM_CHIP", default="gfx90a")
13+
rocm_chip = os.getenv("ROCM_CHIP", default="gfx942")
1414
vmfb_dir = os.getenv("TEST_OUTPUT_ARTIFACTS", default=Path.cwd())
1515

1616
###############################################################################

experimental/regression_suite/shark-test-suite-models/sd3/test_vae.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from conftest import VmfbManager
1111
from pathlib import Path
1212

13-
rocm_chip = os.getenv("ROCM_CHIP", default="gfx90a")
13+
rocm_chip = os.getenv("ROCM_CHIP", default="gfx942")
1414
vmfb_dir = os.getenv("TEST_OUTPUT_ARTIFACTS", default=Path.cwd())
1515

1616
###############################################################################

experimental/regression_suite/shark-test-suite-models/sdxl/test_clip.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from conftest import VmfbManager
1111
from pathlib import Path
1212

13-
rocm_chip = os.getenv("ROCM_CHIP", default="gfx90a")
13+
rocm_chip = os.getenv("ROCM_CHIP", default="gfx942")
1414
vmfb_dir = os.getenv("TEST_OUTPUT_ARTIFACTS", default=Path.cwd())
1515

1616
###############################################################################
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# Copyright 2024 The IREE Authors
2+
#
3+
# Licensed under the Apache License v2.0 with LLVM Exceptions.
4+
# See https://llvm.org/LICENSE.txt for license information.
5+
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
7+
import pytest
8+
from ireers_tools import *
9+
import os
10+
from conftest import VmfbManager
11+
from pathlib import Path
12+
13+
rocm_chip = os.getenv("ROCM_CHIP", default="gfx942")
14+
vmfb_dir = os.getenv("TEST_OUTPUT_ARTIFACTS", default=Path.cwd())
15+
16+
###############################################################################
17+
# Fixtures
18+
###############################################################################
19+
20+
sdxl_scheduler_mlir = fetch_source_fixture(
21+
"https://sharkpublic.blob.core.windows.net/sharkpublic/sai/sdxl-scheduler/11-26-2024/model.mlir",
22+
group="sdxl_scheduler",
23+
)
24+
25+
CPU_COMPILE_FLAGS = [
26+
"--iree-hal-target-backends=llvm-cpu",
27+
"--iree-llvmcpu-target-cpu-features=host",
28+
"--iree-llvmcpu-fail-on-out-of-bounds-stack-allocation=false",
29+
"--iree-llvmcpu-distribution-size=32",
30+
"--iree-opt-const-eval=false",
31+
"--iree-opt-strip-assertions=true",
32+
"--iree-llvmcpu-enable-ukernels=all",
33+
"--iree-global-opt-enable-quantized-matmul-reassociation",
34+
]
35+
36+
37+
ROCM_COMPILE_FLAGS = [
38+
"--iree-hal-target-backends=rocm",
39+
f"--iree-hip-target={rocm_chip}",
40+
"--iree-opt-const-eval=false",
41+
"--iree-global-opt-propagate-transposes=true",
42+
"--iree-llvmgpu-enable-prefetch=true",
43+
"--iree-execution-model=async-external",
44+
"--iree-preprocessing-pass-pipeline=builtin.module(iree-preprocessing-transpose-convolution-pipeline,iree-preprocessing-pad-to-intrinsics)",
45+
"--iree-scheduling-dump-statistics-format=json",
46+
"--iree-scheduling-dump-statistics-file=compilation_info.json",
47+
]
48+
49+
###############################################################################
50+
# CPU
51+
###############################################################################
52+
53+
54+
def test_compile_scheduler_cpu(sdxl_scheduler_mlir):
55+
VmfbManager.sdxl_scheduler_cpu_vmfb = iree_compile(
56+
sdxl_scheduler_mlir,
57+
CPU_COMPILE_FLAGS,
58+
Path(vmfb_dir)
59+
/ Path("sdxl_scheduler_vmfbs")
60+
/ Path(sdxl_scheduler_mlir.path.name).with_suffix(f".cpu.vmfb"),
61+
)
62+
63+
64+
###############################################################################
65+
# ROCM
66+
###############################################################################
67+
68+
69+
def test_compile_scheduler_rocm(sdxl_scheduler_mlir):
70+
VmfbManager.sdxl_scheduler_rocm_vmfb = iree_compile(
71+
sdxl_scheduler_mlir,
72+
ROCM_COMPILE_FLAGS,
73+
Path(vmfb_dir)
74+
/ Path("sdxl_scheduler_vmfbs")
75+
/ Path(sdxl_scheduler_mlir.path.name).with_suffix(f".rocm_{rocm_chip}.vmfb"),
76+
)

experimental/regression_suite/shark-test-suite-models/sdxl/test_vae.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from conftest import VmfbManager
1111
from pathlib import Path
1212

13-
rocm_chip = os.getenv("ROCM_CHIP", default="gfx90a")
13+
rocm_chip = os.getenv("ROCM_CHIP", default="gfx942")
1414
vmfb_dir = os.getenv("TEST_OUTPUT_ARTIFACTS", default=Path.cwd())
1515

1616
###############################################################################

0 commit comments

Comments
 (0)