PolyPhyHub / PolyPhy

Main repository of the PolyPhy package
https://polyphy.io
MIT License
36 stars 22 forks source link

Calling taichi's zero_field function with default trace size causes Vulkan kernel error #46

Open deehrlic opened 1 year ago

deehrlic commented 1 year ago

Doing testing on the 3D notebooks with a Vulkan/AMD GPU

When using the 3D notebooks and attempting to run a block calling zero_field from taichi with MAX_TRACE_RESOLUTION of 512, taichi spits out this error:

RuntimeError Traceback (most recent call last) Cell In[24], line 1 ----> 1 zero_field(deposit_field) 2 zero_field(trace_field) 3 zero_field(vis_field)

File D:\Anaconda\envs\polyphy\lib\site-packages\taichi\lang\kernel_impl.py:1023, in _kernel_impl..wrapped(*args, kwargs) 1020 @functools.wraps(_func) 1021 def wrapped(*args, *kwargs): 1022 try: -> 1023 return primal(args, kwargs) 1024 except (TaichiCompilationError, TaichiRuntimeError) as e: 1025 raise type(e)('\n' + str(e)) from None

File D:\Anaconda\envs\polyphy\lib\site-packages\taichi\lang\shell.py:27, in _shell_pop_print..new_call(*args, kwargs) 25 @functools.wraps(old_call) 26 def new_call(*args, *kwargs): ---> 27 ret = old_call(args, kwargs) 28 # print's in kernel won't take effect until ti.sync(), discussion: 29 # https://github.com/taichi-dev/taichi/pull/1303#discussion_r444897102 30 print(_ti_core.pop_python_print_buffer(), end='')

File D:\Anaconda\envs\polyphy\lib\site-packages\taichi\lang\kernel_impl.py:950, in Kernel.call(self, *args, *kwargs) 948 impl.current_cfg().opt_level = 1 949 key = self.ensure_compiled(args) --> 950 return self.runtime.compiled_functionskey

File D:\Anaconda\envs\polyphy\lib\site-packages\taichi\lang\kernel_impl.py:853, in Kernel.get_function_body..func__(*args) 851 except Exception as e: 852 e = handle_exception_from_cpp(e) --> 853 raise e from None 855 ret = None 856 ret_dt = self.return_type

File D:\Anaconda\envs\polyphy\lib\site-packages\taichi\lang\kernel_impl.py:850, in Kernel.get_function_body..func__(*args) 845 raise TaichiRuntimeError( 846 f"The number of elements in kernel arguments is too big! Do not exceed 64 on {_ti_core.arch_name(impl.current_cfg().arch)} backend." 847 ) 849 try: --> 850 t_kernel(launch_ctx) 851 except Exception as e: 852 e = handle_exception_from_cpp(e)

RuntimeError: [runtime.cpp:taichi::lang::gfx::GfxRuntime::launch_kernel@576] Dispatch error : RhiResult(-3)


Setting the max trace value to 256 fixes this, but is not a long term fix

https://github.com/taichi-dev/taichi/issues/7674 might be related

OskarElek commented 11 months ago

Needs re-testing. Taichi has made significant progress on the backend interoperability since so this might already be a non-issue.

deehrlic commented 11 months ago

I'm not using a Vulkan GPU anymore, so I'm not in a position to test this myself anymore without Frankensteining my pc :(