Hello. In my optix project, I have compiled the .cu file by nvrtc ,and I got the PTX string. But some error
occured when I get the programs by rtProgramCreateFromPTXString function.
The error log in optix::Exception show that :
Label expected for argument 0 of instruction ‘call’
Function ‘_rt_trace_mask_flags_64’ not declared in this scope
Call target not recongnized
I have view the PTX String and find that the ‘_rt_trace_mask_flags_64’ are compiled from the optix .cu function ‘rtTrace’.
I dont know why the nvrtc finish the compile work but error occured when get programs.
I will so happy if any one help me kill the error.
Thanks.
The compile options of nvrtc:
“-arch”,
“compute_30”,
“-use_fast_math”,
“-default-device”,
“-rdc”,
“true”,
“-D__x86_64”,
There is the RT_PROGRAM in my .cu file:
//ray type = 0 obj
RT_PROGRAM void closest_hit_cal_ao()
{
float3 p_normal = geometric_normal;
float3 hit_point = ray.origin + t_hit * ray.direction;
prd_radiance.importance = t_hit;
uint sample_importance = 5;
optix::Onb onb(p_normal);
const float inv_sqrt_samples = 1.0f / float(sample_importance);
float all_importance = 0.0f;
for (int i = 0; i < sample_importance; ++i)
{
for (int j = 0; j < sample_importance; ++j)
{
unsigned int seed = tea<4>(launch_dim.x*launch_index.y + launch_index.x, i * 27 + j * 88);
float u1 = (float(i) + rnd(seed))*inv_sqrt_samples;
float u2 = (float(j) + rnd(seed))*inv_sqrt_samples;
float3 dir;
optix::cosine_sample_hemisphere(u1, u2, dir);
onb.inverse_transform(dir);
optix::Ray ray_ao = optix::make_Ray(hit_point, dir, 1, scene_epsilon, ao_length);
PerRayData_occlusion prd;
prd.occlusion = 0.0f;
prd.normal = make_float3(1.0f, 1.0f, 1.0f);
rtTrace(top_object, ray_ao, prd);
float normal_check = dot(p_normal, dir);
all_importance += 1.0f - prd.occlusion;
}
}
all_importance /= float(sample_importance) * float(sample_importance);
float3 ao_color = make_float3(all_importance);
float3 normal_color = p_normal * 0.5f + 0.5f;
prd_radiance.result = ao_color;
}