Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Incomplete type when compiling a wmma::fragment type with jitify #8155

@mrakgr

Description

@mrakgr

I'm not sure whether this is an issue with CuPy, but I am running into another problem. It works when jitify=False. But as it is, I'm just getting an incomplete type error. Compiling just the kernel code for the following does work with NVCC even though the Intellisense is messed up when loaded in Visual Studio.

import cupy as cp

kernel_code = r'''
#include <mma.h>
using namespace nvcuda;
extern "C" __global__ void mykernel() {
    wmma::fragment<wmma::accumulator, 16, 16, 8, float> v16;
    return ;
}
'''
module = cp.RawModule(code=kernel_code, backend='nvrtc', jitify=True, enable_cooperative_groups=True)
module.get_function('mykernel')((1,),(1,),())
PS D:\Users\Marko\Source\Repos\The Spiral Language\Spiral Compilation Tests>  d:; cd 'd:\Users\Marko\Source\Repos\The Spiral Language\Spiral Compilation Tests'; & 'C:\Users\mrakg\AppData\Local\Programs\Python\Python311\python.exe' 'c:\Users\mrakg\.vscode\extensions\ms-python.python-2023.22.1\pythonFiles\lib\python\debugpy\adapter/../..\debugpy\launcher' '53548' '--' 'D:\Users\Marko\Source\Repos\The Spiral Language\Spiral Compilation Tests\cuda_experiments\tensor1\bug_mma.py' 
---------------------------------------------------
--- JIT compile log for C:\Users\mrakg\AppData\Local\Temp\tmpu7gc6bb7\2983982998ae8febc0583032d61861b2579068a4.cubin.cu ---
---------------------------------------------------
C:\Users\mrakg\AppData\Local\Temp\tmpu7gc6bb7\2983982998ae8febc0583032d61861b2579068a4.cubin.cu(7): error: incomplete type is not allowed
      wmma::fragment<wmma::accumulator, 16, 16, 8, float> v16;
                                                          ^

1 error detected in the compilation of "C:\Users\mrakg\AppData\Local\Temp\tmpu7gc6bb7\2983982998ae8febc0583032d61861b2579068a4.cubin.cu".

---------------------------------------------------
Traceback (most recent call last):
  File "C:\Users\mrakg\AppData\Local\Programs\Python\Python311\Lib\site-packages\cupy\cuda\compiler.py", line 250, in _jitify_prep
    name, options, headers, include_names = jitify.jitify(source, options)
                                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "cupy\cuda\jitify.pyx", line 240, in cupy.cuda.jitify.jitify
  File "cupy\cuda\jitify.pyx", line 264, in cupy.cuda.jitify.jitify
RuntimeError: Runtime compilation failed

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "D:\Users\Marko\Source\Repos\The Spiral Language\Spiral Compilation Tests\cuda_experiments\tensor1\bug_mma.py", line 12, in <module>
    module.get_function('mykernel')((1,),(1,),())
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "cupy\_core\raw.pyx", line 487, in cupy._core.raw.RawModule.get_function
  File "cupy\_core\raw.pyx", line 100, in cupy._core.raw.RawKernel.kernel.__get__
  File "cupy\_core\raw.pyx", line 117, in cupy._core.raw.RawKernel._kernel
  File "cupy\_util.pyx", line 64, in cupy._util.memoize.decorator.ret
  File "cupy\_core\raw.pyx", line 538, in cupy._core.raw._get_raw_module
  File "cupy\_core\core.pyx", line 2236, in cupy._core.core.compile_with_cache
  File "cupy\_core\core.pyx", line 2254, in cupy._core.core.compile_with_cache
  File "C:\Users\mrakg\AppData\Local\Programs\Python\Python311\Lib\site-packages\cupy\cuda\compiler.py", line 484, in _compile_module_with_cache
    return _compile_with_cache_cuda(
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\mrakg\AppData\Local\Programs\Python\Python311\Lib\site-packages\cupy\cuda\compiler.py", line 562, in _compile_with_cache_cuda
    ptx, mapping = compile_using_nvrtc(
                   ^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\mrakg\AppData\Local\Programs\Python\Python311\Lib\site-packages\cupy\cuda\compiler.py", line 319, in compile_using_nvrtc
    return _compile(source, options, cu_path,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\mrakg\AppData\Local\Programs\Python\Python311\Lib\site-packages\cupy\cuda\compiler.py", line 284, in _compile
    options, headers, include_names = _jitify_prep(
                                      ^^^^^^^^^^^^^
  File "C:\Users\mrakg\AppData\Local\Programs\Python\Python311\Lib\site-packages\cupy\cuda\compiler.py", line 257, in _jitify_prep
    raise JitifyException(str(cex)) from e
cupy.cuda.compiler.JitifyException: Runtime compilation failed

Originally posted by @mrakgr in #8146 (comment)

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions