Skip to content

Conversation

@Waqar-ukaea
Copy link
Collaborator

This is an attempt at closing #145. The issue at hand is consolidating the two sets of plucker intersection logic between Embree and GPRT into one function that can be applied to both so we don't have to maintain two.

My approach here was to essentially create a header which has a namespace dp which is conditionally defined depending on if we are compiling slang or C++ code. So the namespace acts as a wrapper that typedefs a new dp::vec3 type to either a double3 (Slang) or a xdg::vec3da (C++) and then the function plucker_intersection_test() makes use of this dp::vec3 which maps to the respective type depending on where the header is included. The function has also of course been written in the subset of C which can compile in both C++ and Slang.

There may absolutely be a more elegant way to do this kind of single function across languages/architectures but I haven't come up with one just yet.

Templating is a nice idea and Slang does support it's own version of templates called generics but I'm not sure how I would go about combining the two cross languages/architectures.

Copy link
Collaborator

@gonuke gonuke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like a great addition - thanks @Waqar-ukaea !!

I have a couple of minor suggestions/queries on the implementation details, but nothing substantive.

Copy link
Collaborator

@gonuke gonuke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me - thanks for the discussion @Waqar-ukaea

Copy link
Collaborator

@pshriwise pshriwise left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As this is critical code, I'm going to run this through our benchmarks to ensure we don't see a difference on production models before we merge. I'll do so as soon as I can. Placing a hold here for now.

@Waqar-ukaea Waqar-ukaea linked an issue Oct 27, 2025 that may be closed by this pull request
@Waqar-ukaea Waqar-ukaea added the Ray Tracing Changes made to the core ray tracing interface affecting both Embree and GPRT implementations. label Nov 20, 2025
@Waqar-ukaea Waqar-ukaea marked this pull request as draft December 4, 2025 12:40
@Waqar-ukaea
Copy link
Collaborator Author

I've marked this as a draft as when stress testing the GPRT intersection logic implemented in main I am seeing some degenerate intersections causing GPU hangs which I don't appear to be seeing when using Embree (more testing required to confirm). Therefore I am a bit hesitant to merge this change as it is consolidating the Embree plucker intersection to match the GPRT version.

I need to do some more testing with the GPRT plucker intersections on main/batch-query-api to confirm if there is a difference between Embree/GPRT implementations there first before we can safely merge this PR.

@Waqar-ukaea
Copy link
Collaborator Author

Waqar-ukaea commented Dec 4, 2025

I need to do some more testing with the GPRT plucker intersections on main/batch-query-api to confirm if there is a difference between Embree/GPRT implementations there first before we can safely merge this PR.

Curiously, rebasing the changes from this branch into my batch-query-api branch has actually fixed the degenerate intersections I was seeing. So I'll have to figure out what the differences implemented in the plucker intersection logic here vs the plucker intersection logic in main for GPRT.

And it actually seems to perform slightly better too :/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Ray Tracing Changes made to the core ray tracing interface affecting both Embree and GPRT implementations.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Consolidate plucker tests

3 participants