optix acceleration structure

BVH or k-d tree makes geometry query time complextity log(N).
If I don’t use acceleration, is that N?
If I use, I think to reach log(N), structure must be ray-dependent. Is acceleration structure built for each ray in runtime?

Thanks!

Yes, query time without an acceleration structure is O(n).

No. The acceleration structure is built once at the beginning of rtContextLaunch*D if it is marked dirty.

Is this statement correct:
“These structures allow the rays to only query objects along their line instead
of having to query all objects.”
That makes me think acceleration structures are ray-dependent and if ray direction is changed while tracing, acceleration will fail.

Sort of. The acceleration structure prevents queries of object that are definitely not on the ray’s line. What this means depends on the type of acceleration structure.

I don’t know if ray-dependent acceleration structures exist, but none of the acceleration structure types used by OptiX depend on ray direction. You should read more about the specific types of acceleration structures you are trying to use. I just googled “Bounding Volume Hierarchy” and found a bunch of good explanations of how a BVH works.