Why i can't enter the Intersetion Program?

I am working on a project in which I place a set of triangles on a straight line and emit a ray from one end to traverse all the triangles. I hope to record the index of all triangles in the intersection program. What should I do? There is my intersection program code:

extern "C" __global__ void __intersection__is(){
    const unsigned int ix=optixGetLaunchIndex().x;
    const unsigned int primitive_id=optixGetPrimitiveIndex();
    unsigned int point_count=optixGetPayload_0();
    printf("IS: primiive id = %u\n",primitive_id);
    printf("IS: point id = %u\n",params.map_id[primitive_id]);

But i found this program was not called. Thank you!

Please read all threads on this OptiX sub-forum discussing methods how to gather all hits along a ray:

For performance reasons, you should not use a custom intersection program for triangles.
OptiX 7 supports built-in triangle primitives and intersections with them are fully hardware accelerated on RTX boards.

Custom intersection programs like yours are only used for custom primitives.
That requires that you built the acceleration structure with per-primitive AABBs inside an OptixBuildInputCustomPrimitiveArray
Please read this OptiX Programming Guide chapter: https://raytracing-docs.nvidia.com/optix7/guide/index.html#acceleration_structures#accelstruct

Intersection programs are part of the hit record inside the Shader Binding Table (SBT).
The hit record can have an intersection, anyhit, and closesthit program.

Built-in triangles have their own implicit intersection program, you never set that inside the SBT hit record.
Built-in curves and spheres must use one of the built-in intersection programs fetched with optixBuiltinISModuleGet.
Only custom primitives allow implementing own intersection programs which need to be set on the SBT’s hit record for those primitives or they can’t be hit.

Means you either used the wrong AS build-input (no custom primitives), or
didn’t set the intersection program in the correct SBT hit record, or
you didn’t add the right OptixPipelineCompileOptions usesPrimitiveTypeFlags, or
if you only looked at the printf maybe ran into a known issue in R530 drivers:

Your intersection program would currently not intersect with triangle primitives themselves but with the full AABB around them.

Note that the intersection and anyhit programs are not called in the ray direction order but in the BVH acceleration structure traversal order which is ray dependent.
If you need the intersections in ray direction order, it would be simpler to just implement an iterative path tracer which uses the same ray origin and direction with different (t_min, t_max) intervals or different ray origins defined by the previous hit until there is no more hit, as described in some of the threads of the above sub-forum search results.