microsoft / antares

Antares: an automatic engine for multi-platform kernel generation and optimization. Supporting CPU, CUDA, ROCm, DirectX12, GraphCore, SYCL for CPU/GPU, OpenCL for AMD/NVIDIA, Android CPU/GPU backends.
Other
448 stars 45 forks source link

Lack operator implementation for DirectX: torch.abs() #375

Closed PedroMagar closed 3 months ago

PedroMagar commented 10 months ago

I was trying to run ComfyUI on antares and end up with the following message:

RuntimeError: 0 INTERNAL ASSERT FAILED at "C:\\Users\\weicu\\Desktop\\antares\\nextgen\\torch-setup\\autort-wheel\\autort_extensions.h":1593, please report a bug to PyTorch. __abs

My user is not 'weicu' so I believe that is a personal path.

I did not personally compiled the antares, I installed using 'Quick Installation of AutoRT' and it did work with the tests.

The full log is:

To see the GUI go to: http://127.0.0.1:8188 got prompt model_type EPS adm 2816 Using split attention in VAE Working with z of shape (1, 4, 32, 32) = 4096 dimensions. Using split attention in VAE missing {'cond_stage_model.clip_l.text_projection', 'cond_stage_model.clip_l.logit_scale'} left over keys: dict_keys(['cond_stage_model.clip_l.transformer.text_model.embeddings.position_ids']) Requested to load SDXLClipModel Loading 1 new model Requested to load SDXL Loading 1 new model ERROR:root:!!! Exception during processing !!! ERROR:root:Traceback (most recent call last): File "C:\AI\ComfyUI\execution.py", line 155, in recursive_execute output_data, output_ui = get_output_data(obj, input_data_all) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\AI\ComfyUI\execution.py", line 85, in get_output_data return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\AI\ComfyUI\execution.py", line 78, in map_node_over_list results.append(getattr(obj, func)(**slice_dict(input_data_all, i))) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\AI\ComfyUI\nodes.py", line 1300, in sample return common_ksampler(model, seed, steps, cfg, sampler_name, scheduler, positive, negative, latent_image, denoise=denoise) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\AI\ComfyUI\nodes.py", line 1270, in common_ksampler samples = comfy.sample.sample(model, noise, steps, cfg, sampler_name, scheduler, positive, negative, latent_image, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\AI\ComfyUI\comfy\sample.py", line 100, in sample sampler = comfy.samplers.KSampler(real_model, steps=steps, device=model.load_device, sampler=sampler_name, scheduler=scheduler, denoise=denoise, model_options=model.model_options) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\AI\ComfyUI\comfy\samplers.py", line 670, in init self.set_steps(steps, denoise) File "C:\AI\ComfyUI\comfy\samplers.py", line 691, in set_steps self.sigmas = self.calculate_sigmas(steps).to(self.device) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\AI\ComfyUI\comfy\samplers.py", line 682, in calculate_sigmas sigmas = calculate_sigmas_scheduler(self.model, self.scheduler, steps) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\AI\ComfyUI\comfy\samplers.py", line 635, in calculate_sigmas_scheduler sigmas = normal_scheduler(model, steps) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\AI\ComfyUI\comfy\samplers.py", line 314, in normal_scheduler start = s.timestep(s.sigma_max) ^^^^^^^^^^^^^^^^^^^^^^^ File "C:\AI\ComfyUI\comfy\model_sampling.py", line 76, in timestep return dists.abs().argmin(dim=0).view(sigma.shape).to(sigma.device) ^^^^^^^^^^^ RuntimeError: 0 INTERNAL ASSERT FAILED at "C:\Users\weicu\Desktop\antares\nextgen\torch-setup\autort-wheel\autort_extensions.h":1593, please report a bug to PyTorch. __abs

Prompt executed in 9.44 seconds

ghostplant commented 10 months ago

Thanks, obviously you run custom applications using Windows Pytorch version. Currently, the Pytorch for DirectX/Vulkan doesn't have a large operator coverage being handled, so applications outside our integrated examples may suffer from missing operator implementation and raise errors. We still keep increasing operator coverage for those backends, or you have to use something like autort.export(ir="abs_xx[N] = data[N].when(data[N] >= 0, -data[N])", inputs=[..]) to invent them for DirectX by yourself.

If your application is open source, that would be great as we can test that app and support missing DirectX operators for that model in newer version.

ghostplant commented 3 months ago

This issue should be solved by 0.9.6.x