SHARK icon indicating copy to clipboard operation
SHARK copied to clipboard

IMG2IMG still not working for me on 6700xt

Open GoZippy opened this issue 1 year ago • 6 comments

It will load and do all the iterations then error out and not save anything...

Prompt was truncated. Try to shorten the prompt or increase max_embeddings_multiples
31it [00:15,  1.95it/s]
WARNING: [Loader Message] Code 0 : Layer VK_LAYER_OBS_HOOK uses API version 1.2 which is older than the application specified API version of 1.3. May cause issues.
WARNING: [Loader Message] Code 0 : Layer VK_LAYER_OBS_HOOK uses API version 1.2 which is older than the application specified API version of 1.3. May cause issues.
WARNING: [Loader Message] Code 0 : Layer VK_LAYER_OBS_HOOK uses API version 1.2 which is older than the application specified API version of 1.3. May cause issues.
Traceback (most recent call last):
  File "gradio\routes.py", line 399, in run_predict
  File "gradio\blocks.py", line 1299, in process_api
  File "gradio\blocks.py", line 1036, in call_function
  File "anyio\to_thread.py", line 31, in run_sync
  File "anyio\_backends\_asyncio.py", line 937, in run_sync_in_worker_thread
  File "anyio\_backends\_asyncio.py", line 867, in run
  File "gradio\utils.py", line 488, in async_iteration
  File "ui\upscaler_ui.py", line 189, in upscaler_inf
  File "apps\stable_diffusion\src\pipelines\pipeline_shark_stable_diffusion_upscaler.py", line 308, in generate_images
  File "apps\stable_diffusion\src\pipelines\pipeline_shark_stable_diffusion_utils.py", line 120, in load_vae
  File "apps\stable_diffusion\src\models\model_wrappers.py", line 674, in vae
  File "apps\stable_diffusion\src\models\model_wrappers.py", line 666, in vae
  File "apps\stable_diffusion\src\models\model_wrappers.py", line 286, in get_vae
  File "apps\stable_diffusion\src\utils\utils.py", line 125, in compile_through_fx
  File "apps\stable_diffusion\src\utils\utils.py", line 52, in _load_vmfb
  File "shark\shark_inference.py", line 207, in load_module
  File "shark\iree_utils\compile_utils.py", line 333, in load_flatbuffer
  File "shark\iree_utils\compile_utils.py", line 309, in get_iree_module
  File "iree\runtime\system_api.py", line 255, in add_vm_module
  File "iree\runtime\system_api.py", line 252, in add_vm_modules
SystemExit: Error registering modules: D:\a\SHARK-Runtime\SHARK-Runtime\c\runtime\src\iree\hal\drivers\vulkan\native_executable.cc:161: UNKNOWN; VkResult=4294967283; while invoking native function hal.executable.create; while calling import;
[ 1]   native hal.executable.create:0 -
[ 0] bytecode module@1:2718 -

GoZippy avatar May 05 '23 15:05 GoZippy

Can you try with AMD_ENABLE_LLPC = '1'?

Like so: image

monorimet avatar May 05 '23 17:05 monorimet

I just added that to system env variable and tried again - still having issues

GoZippy avatar May 05 '23 19:05 GoZippy

The issue is related to resource exhaustion, have you tried the other memory-saving options? --vulkan_large_heap_block_size=0 --device_allocator=caching

monorimet avatar May 05 '23 19:05 monorimet

odd because I have plenty and it works with Auto1111 forked by tiger... I'll look into options to reduce memory use... might be driver issue too as when it crashed it makes me restart radeon software...

GoZippy avatar May 05 '23 20:05 GoZippy

Don't know if this is related but I just noticed something interesting...

I've just been playing with img2img with canny, if I have --device_allocator=caching and then run with multiple batches then there is a VRAM leak. Each image generated in a batch adds more VRAM used by about 1GB to the base allocated once it arrives from the video card. if I hit usage near 16GB (Max VRAM on my card) during the batch it does seem to back and clear it out, but then it starts building again. Whatever is the base after the batch ends it doesn't get fully released, so the next batch eats VRAM on top of that and eventually errors out.

If I don't use --device_allocator=caching then it doesn't seem to leak for each image, so I don't get the problem.

Low VRAM on or off doesn't change the general behaviour just the specific numbers.

Also, I invariably run with --device_allocator=caching because txt2img is consistently about 25% faster with it on.

This is on my own branch I re-based against main a couple of days back, so I don't guarantee it isn't something weirdly specific to me, but I'm only doing UI stuff on my branch so I don't think my changes should have changed VRAM allocation when running a model.

This is with Ye Olde Radeon VII rather than an actual real rdna2 card, even though the target triple it decides to use is rdna2-unknown-windows unless I override it.

one-lithe-rune avatar May 23 '23 18:05 one-lithe-rune

Mine Win10 AMD Radeon R9 M375X same error.

WARNING: [Loader Message] Code 0 : loaderAddLayerProperties: E:\VulkanSDK\1.3.261.1\Bin\VkLayer_api_dump.json invalid layer manifest file version 1.2.0.  May cause errors.
WARNING: [Loader Message] Code 0 : loaderAddLayerProperties: E:\VulkanSDK\1.3.261.1\Bin\VkLayer_gfxreconstruct.json invalid layer manifest file version 1.2.0.  May cause errors.
WARNING: [Loader Message] Code 0 : loaderAddLayerProperties: E:\VulkanSDK\1.3.261.1\Bin\VkLayer_khronos_synchronization2.json invalid layer manifest file version 1.2.0.  May cause errors.
WARNING: [Loader Message] Code 0 : loaderAddLayerProperties: E:\VulkanSDK\1.3.261.1\Bin\VkLayer_khronos_validation.json invalid layer manifest file version 1.2.0.  May cause errors.
WARNING: [Loader Message] Code 0 : loaderAddLayerProperties: E:\VulkanSDK\1.3.261.1\Bin\VkLayer_screenshot.json invalid layer manifest file version 1.2.0.  May cause errors.
WARNING: [Loader Message] Code 0 : loaderAddLayerProperties: E:\VulkanSDK\1.3.261.1\Bin\VkLayer_khronos_profiles.json invalid layer manifest file version 1.2.1.  May cause errors.
WARNING: [Loader Message] Code 0 : loaderAddLayerProperties: E:\VulkanSDK\1.3.261.1\Bin\VkLayer_khronos_shader_object.json invalid layer manifest file version 1.2.0.  May cause errors.
Loading flatbuffer at e:\SharkStudio\clip_1_64_512_512_fp16_tuned_stable-diffusion-2-1-base_vulkan.vmfb as a mmapped file
Traceback (most recent call last):
  File "gradio\routes.py", line 439, in run_predict
  File "gradio\blocks.py", line 1384, in process_api
  File "gradio\blocks.py", line 1103, in call_function
  File "gradio\utils.py", line 343, in async_iteration
  File "gradio\utils.py", line 336, in __anext__
  File "anyio\to_thread.py", line 33, in run_sync
  File "anyio\_backends\_asyncio.py", line 877, in run_sync_in_worker_thread
  File "anyio\_backends\_asyncio.py", line 807, in run
  File "gradio\utils.py", line 319, in run_sync_iterator_async
  File "gradio\utils.py", line 688, in gen_wrapper
  File "ui\txt2img_ui.py", line 186, in txt2img_inf
  File "apps\stable_diffusion\src\pipelines\pipeline_shark_stable_diffusion_txt2img.py", line 123, in generate_images
  File "apps\stable_diffusion\src\pipelines\pipeline_shark_stable_diffusion_utils.py", line 432, in encode_prompts_weight
  File "apps\stable_diffusion\src\pipelines\pipeline_shark_stable_diffusion_utils.py", line 96, in load_clip
  File "apps\stable_diffusion\src\models\model_wrappers.py", line 777, in clip
  File "apps\stable_diffusion\src\models\model_wrappers.py", line 770, in clip
  File "apps\stable_diffusion\src\models\model_wrappers.py", line 690, in get_clip
  File "apps\stable_diffusion\src\utils\utils.py", line 132, in compile_through_fx
  File "apps\stable_diffusion\src\utils\utils.py", line 55, in _load_vmfb
  File "shark\shark_inference.py", line 208, in load_module
  File "shark\iree_utils\compile_utils.py", line 438, in load_flatbuffer
  File "shark\iree_utils\compile_utils.py", line 382, in load_vmfb_using_mmap
  File "iree\runtime\system_api.py", line 271, in add_vm_module
  File "iree\runtime\system_api.py", line 268, in add_vm_modules
SystemExit: Error registering modules: D:\a\SHARK-Runtime\SHARK-Runtime\c\runtime\src\iree\hal\drivers\vulkan\native_executable.cc:160: UNKNOWN; VkResult=4294967283; while invoking native function hal.executable.create; while calling import;
[ 1]   native hal.executable.create:0 -
[ 0] bytecode module@1:862 -

tomphan avatar Sep 07 '23 01:09 tomphan