mirror of
https://github.com/nod-ai/SHARK-Studio.git
synced 2026-04-20 03:00:34 -04:00
21 lines
628 B
Python
21 lines
628 B
Python
from apps.stable_diffusion.src.utils.stable_args import args
|
|
|
|
|
|
# Helper function to profile the vulkan device.
|
|
def start_profiling(file_path="foo.rdc", profiling_mode="queue"):
|
|
from shark.parser import shark_args
|
|
|
|
if shark_args.vulkan_debug_utils and "vulkan" in args.device:
|
|
import iree
|
|
|
|
print(f"Profiling and saving to {file_path}.")
|
|
vulkan_device = iree.runtime.get_device(args.device)
|
|
vulkan_device.begin_profiling(mode=profiling_mode, file_path=file_path)
|
|
return vulkan_device
|
|
return None
|
|
|
|
|
|
def end_profiling(device):
|
|
if device:
|
|
return device.end_profiling()
|