nod-ai / SHARK-Studio

SHARK Studio -- Web UI for SHARK+IREE High Performance Machine Learning Distribution
Apache License 2.0
1.42k stars 171 forks source link

Cannot run the program (Arch Linux, RX 7900 XTX, AMDGPU PRO drivers) #1187

Closed CRBl69 closed 1 year ago

CRBl69 commented 1 year ago

My setup

Command

VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/amd_pro_icd64.json python apps/stable_diffusion/scripts/txt2img.py --precision=fp16 --device=vulkan --prompt="tajmahal, oil on canvas, sunflowers, 4k, uhd"

I also tried the web UI. The UI itself starts, but when I try to generate something, the end result is the same.

Related issues

This issue seems to be very similar to #1061 but not quite the same. At first, we seem to get the same output. He then creates $HOME/.local/shark_tank and gets a segfault. The directory already exists for me, so I don't think this is the same issue.

Installation process

git clone https://github.com/nod-ai/SHARK.git
cd SHARK
./setup_venv.sh
source shark.venv/bin/activate

Output

I provide two versions of the output: unified and separated in STDOUT and STDERR.

Unified

shark_tank local cache is located at /home/crbl/.local/shark_tank/ . You may change this by setting the --local_tank_cache= flag
Found device AMD Radeon RX 7900 XTX. Using target triple rdna3-7900-linux.
Using tuned models for stabilityai/stable-diffusion-2-1-base/fp16/vulkan://00000000-2f00-0000-0000-000000000000.
Using cached models from /home/crbl/.local/shark_tank/...
100%|██████████| 640/640 [00:00<00:00, 5.53kB/s]
100%|██████████| 640/640 [00:00<00:00, 150kB/s]
loading existing vmfb from: /home/crbl/SHARK/euler_scale_model_input_fp16.vmfb
Using cached models from /home/crbl/.local/shark_tank/...
100%|██████████| 640/640 [00:00<00:00, 5.70kB/s]
100%|██████████| 640/640 [00:00<00:00, 111kB/s]
loading existing vmfb from: /home/crbl/SHARK/euler_step_fp16.vmfb
Using cached models from /home/crbl/.local/shark_tank/...
100%|██████████| 640/640 [00:00<00:00, 115kB/s]
100%|██████████| 640/640 [00:00<00:00, 118kB/s]
/home/crbl/SHARK/shark.venv/lib/python3.10/site-packages/safetensors/torch.py:99: UserWarning: TypedStorage is deprecated. It will be removed in the future and UntypedStorage will be the only storage class. This should only matter to you if you are using storages directly.  To access UntypedStorage directly, use tensor.untyped_storage() instead of tensor.storage()
  with safe_open(filename, framework="pt", device=device) as f:
/home/crbl/SHARK/shark.venv/lib/python3.10/site-packages/torch/_utils.py:776: UserWarning: TypedStorage is deprecated. It will be removed in the future and UntypedStorage will be the only storage class. This should only matter to you if you are using storages directly.  To access UntypedStorage directly, use tensor.untyped_storage() instead of tensor.storage()
  return self.fget.__get__(instance, owner)()
/home/crbl/SHARK/shark.venv/lib/python3.10/site-packages/torch/storage.py:899: UserWarning: TypedStorage is deprecated. It will be removed in the future and UntypedStorage will be the only storage class. This should only matter to you if you are using storages directly.  To access UntypedStorage directly, use tensor.untyped_storage() instead of tensor.storage()
  storage = cls(wrap_storage=untyped_storage)
/home/crbl/SHARK/shark.venv/lib/python3.10/site-packages/torch/jit/_check.py:172: UserWarning: The TorchScript type system doesn't support instance-level annotations on empty non-base types in `__init__`. Instead, either 1) use a type annotation in the class body, or 2) wrap the type in `torch.jit.Attribute`.
  warnings.warn("The TorchScript type system doesn't support "
No vmfb found. Compiling and saving to /home/crbl/SHARK/vae2base_19dec_fp16_tuned.vmfb
Using target triple -iree-vulkan-target-triple=rdna3-7900-linux from command line args
download pipeline failed, falling back to import_mlir
use_tuned? sharkify: True
_1_64_512_512_fp16_tuned_stable-diffusion-2-1-base
Inferring base model configuration.
Loading Winograd config file from  /home/crbl/.local/shark_tank/configs/unet_winograd_vulkan.json
100%|██████████| 107/107 [00:00<00:00, 940B/s]
100%|██████████| 107/107 [00:00<00:00, 18.3kB/s]
Loading lowering config file from  /home/crbl/.local/shark_tank/configs/unet_v2_1base_fp16_vulkan.json
100%|██████████| 29.9k/29.9k [00:00<00:00, 140kB/s]
100%|██████████| 29.9k/29.9k [00:00<00:00, 5.18MB/s]
/home/crbl/SHARK/shark.venv/lib/python3.10/site-packages/safetensors/torch.py:99: UserWarning: TypedStorage is deprecated. It will be removed in the future and UntypedStorage will be the only storage class. This should only matter to you if you are using storages directly.  To access UntypedStorage directly, use tensor.untyped_storage() instead of tensor.storage()
  with safe_open(filename, framework="pt", device=device) as f:
/home/crbl/SHARK/shark.venv/lib/python3.10/site-packages/torch/_utils.py:776: UserWarning: TypedStorage is deprecated. It will be removed in the future and UntypedStorage will be the only storage class. This should only matter to you if you are using storages directly.  To access UntypedStorage directly, use tensor.untyped_storage() instead of tensor.storage()
  return self.fget.__get__(instance, owner)()
/home/crbl/SHARK/shark.venv/lib/python3.10/site-packages/torch/storage.py:899: UserWarning: TypedStorage is deprecated. It will be removed in the future and UntypedStorage will be the only storage class. This should only matter to you if you are using storages directly.  To access UntypedStorage directly, use tensor.untyped_storage() instead of tensor.storage()
  storage = cls(wrap_storage=untyped_storage)
Applying tuned configs on unet_1_64_512_512_fp16_tuned_stable-diffusion-2-1-base_vulkan
No vmfb found. Compiling and saving to /home/crbl/SHARK/unet_1_64_512_512_fp16_tuned_stable-diffusion-2-1-base_vulkan.vmfb
Using target triple -iree-vulkan-target-triple=rdna3-7900-linux from command line args
Retrying with a different base model configuration
Retrying with a different base model configuration
Retrying with a different base model configuration
Retrying with a different base model configuration
Cannot compile the model. Please create an issue with the detailed log at https://github.com/nod-ai/SHARK/issues

STDOUT

shark_tank local cache is located at /home/crbl/.local/shark_tank/ . You may change this by setting the --local_tank_cache= flag
Found device AMD Radeon RX 7900 XTX. Using target triple rdna3-7900-linux.
Using tuned models for stabilityai/stable-diffusion-2-1-base/fp16/vulkan://00000000-2f00-0000-0000-000000000000.
Using cached models from /home/crbl/.local/shark_tank/...
loading existing vmfb from: /home/crbl/SHARK/euler_scale_model_input_fp16.vmfb
Using cached models from /home/crbl/.local/shark_tank/...
loading existing vmfb from: /home/crbl/SHARK/euler_step_fp16.vmfb
Using cached models from /home/crbl/.local/shark_tank/...
No vmfb found. Compiling and saving to /home/crbl/SHARK/vae2base_19dec_fp16_tuned.vmfb
Using target triple -iree-vulkan-target-triple=rdna3-7900-linux from command line args
download pipeline failed, falling back to import_mlir
use_tuned? sharkify: True
_1_64_512_512_fp16_tuned_stable-diffusion-2-1-base
Inferring base model configuration.
Loading Winograd config file from  /home/crbl/.local/shark_tank/configs/unet_winograd_vulkan.json
Loading lowering config file from  /home/crbl/.local/shark_tank/configs/unet_v2_1base_fp16_vulkan.json
Applying tuned configs on unet_1_64_512_512_fp16_tuned_stable-diffusion-2-1-base_vulkan
No vmfb found. Compiling and saving to /home/crbl/SHARK/unet_1_64_512_512_fp16_tuned_stable-diffusion-2-1-base_vulkan.vmfb
Using target triple -iree-vulkan-target-triple=rdna3-7900-linux from command line args
Retrying with a different base model configuration
Retrying with a different base model configuration
Retrying with a different base model configuration
Retrying with a different base model configuration

STDERR

100%|██████████| 640/640 [00:00<00:00, 109kB/s]
100%|██████████| 640/640 [00:00<00:00, 114kB/s]
100%|██████████| 640/640 [00:00<00:00, 126kB/s]
100%|██████████| 640/640 [00:00<00:00, 98.1kB/s]
100%|██████████| 640/640 [00:00<00:00, 5.17kB/s]
100%|██████████| 640/640 [00:00<00:00, 108kB/s]
/home/crbl/SHARK/shark.venv/lib/python3.10/site-packages/safetensors/torch.py:99: UserWarning: TypedStorage is deprecated. It will be removed in the future and UntypedStorage will be the only storage class. This should only matter to you if you are using storages directly.  To access UntypedStorage directly, use tensor.untyped_storage() instead of tensor.storage()
  with safe_open(filename, framework="pt", device=device) as f:
/home/crbl/SHARK/shark.venv/lib/python3.10/site-packages/torch/_utils.py:776: UserWarning: TypedStorage is deprecated. It will be removed in the future and UntypedStorage will be the only storage class. This should only matter to you if you are using storages directly.  To access UntypedStorage directly, use tensor.untyped_storage() instead of tensor.storage()
  return self.fget.__get__(instance, owner)()
/home/crbl/SHARK/shark.venv/lib/python3.10/site-packages/torch/storage.py:899: UserWarning: TypedStorage is deprecated. It will be removed in the future and UntypedStorage will be the only storage class. This should only matter to you if you are using storages directly.  To access UntypedStorage directly, use tensor.untyped_storage() instead of tensor.storage()
  storage = cls(wrap_storage=untyped_storage)
/home/crbl/SHARK/shark.venv/lib/python3.10/site-packages/torch/jit/_check.py:172: UserWarning: The TorchScript type system doesn't support instance-level annotations on empty non-base types in `__init__`. Instead, either 1) use a type annotation in the class body, or 2) wrap the type in `torch.jit.Attribute`.
  warnings.warn("The TorchScript type system doesn't support "
100%|██████████| 107/107 [00:00<00:00, 952B/s]
100%|██████████| 107/107 [00:00<00:00, 18.4kB/s]
100%|██████████| 29.9k/29.9k [00:00<00:00, 4.08MB/s]
100%|██████████| 29.9k/29.9k [00:00<00:00, 6.10MB/s]
/home/crbl/SHARK/shark.venv/lib/python3.10/site-packages/safetensors/torch.py:99: UserWarning: TypedStorage is deprecated. It will be removed in the future and UntypedStorage will be the only storage class. This should only matter to you if you are using storages directly.  To access UntypedStorage directly, use tensor.untyped_storage() instead of tensor.storage()
  with safe_open(filename, framework="pt", device=device) as f:
/home/crbl/SHARK/shark.venv/lib/python3.10/site-packages/torch/_utils.py:776: UserWarning: TypedStorage is deprecated. It will be removed in the future and UntypedStorage will be the only storage class. This should only matter to you if you are using storages directly.  To access UntypedStorage directly, use tensor.untyped_storage() instead of tensor.storage()
  return self.fget.__get__(instance, owner)()
/home/crbl/SHARK/shark.venv/lib/python3.10/site-packages/torch/storage.py:899: UserWarning: TypedStorage is deprecated. It will be removed in the future and UntypedStorage will be the only storage class. This should only matter to you if you are using storages directly.  To access UntypedStorage directly, use tensor.untyped_storage() instead of tensor.storage()
  storage = cls(wrap_storage=untyped_storage)
Cannot compile the model. Please create an issue with the detailed log at https://github.com/nod-ai/SHARK/issues

Please let me know if I can provide anything else to solve this problem.

powderluv commented 1 year ago

Please pass the flag python index.py --iree_vulkan_target_triple=rdna2-7900-linux when you start to run in SIMT only mode. The 7900xtx wmma pieces are not yet in the current driver.

CRBl69 commented 1 year ago

I can confirm this works !

Thank you very much !

Maybe this should be put in the README.

Problem fixed so I'm closing the issue.

powderluv commented 1 year ago

We are tracking the issue with AMD. Once it is fixed you should be able to use it normally (~22 it/s)