CUDA文件编译错误

EmuDebug编译通过,而在Release下出现的编译错误

 

 

tmpxft_000011f8_00000000-3.gpu
tmpxft_000011f8_00000000-7.gpu
### Assertion failure at line 907 of ../../be/cg/NVISA/cgemit_targ.cxx:
### Compiler Error in file C:/DOCUME~1/CDW/LOCALS~1/Temp/tmpxft_000011f8_00000000-8.i during Assembly phase:
### NYI initv kind 1
nvopencc ERROR: d:/CUDA/bin/../open64/lib//be.exe returned non-zero status 1

错误原因:

typedef  struct  STU_t 
{
    
int a;
    
struct STU_t *p;
}
 STU;

__device__ STU_t stu1[
2 =  
{
    
{1, NULL},
    
//{2, &stu1[0]},//error 可能无法取得地址
    {2, NULL},//ok,需要以后进行初始化
}
;

 

 

 

tmpxft_00000e18_00000000-3.gpu
tmpxft_00000e18_00000000-7.gpu
"C:/DOCUME~1/CDW/LOCALS~1/Temp/tmpxft_00000e18_00000000-8.i", line 374: Advisory: Cannot tell what pointer points to, assuming global memory space
### Assertion failure at line 907 of ../../be/cg/NVISA/cgemit_targ.cxx:
### Compiler Error in file C:/DOCUME~1/CDW/LOCALS~1/Temp/tmpxft_00000e18_00000000-8.i during Assembly phase:
### NYI initv kind 1
nvopencc ERROR: d:/CUDA/bin/../open64/lib//be.exe returned non-zero status 1

错误原因:

  1. 可能是在device函数中引用或访问了属于Host memory的内存地址
  2. 结构体内仍包含结构体指针,CUDA无法解析,如下代码;
typedef  struct  teacher_t
{
    
int age;
    
char *name;
    state_t 
*p_states;
}
Teacher;

__global__ 
void  test3(teacher_t  * teacher)
{
    teacher->name = "davidchan";  //ok
    teacher->p_states->qeval = 123;//error 无法解析地址
}

 

 

你可能感兴趣的:(struct,CUDA,File,assembly,null,compiler)