Skip to content

Ray population callback#13

Merged
Waqar-ukaea merged 9 commits intobatch-query-apifrom
ray-population-callback
Jan 28, 2026
Merged

Ray population callback#13
Waqar-ukaea merged 9 commits intobatch-query-apifrom
ray-population-callback

Conversation

@Waqar-ukaea
Copy link
Owner

@Waqar-ukaea Waqar-ukaea commented Jan 19, 2026

Exploring the idea of exposing ray buffers populating them directly rather than array based versions of the existing API.

I think the array based versions are useful for small test cases but they inherently require host-to-device transfers which does severely limit their actual usability. Any production code on a GPU will never actually want to use these code paths since they end up being very expensive in device transfers.

I was already moving towards an API which exposes ray buffers directly as that is what I had implemented inside of the ray-benchmark miniapp. But I think I have landed on something which is a lot nicer for doing so here.

I'm trying to make use of a callback method within XDG that exposes the ray buffer directly so a downstream code can provide that callback to populate the buffer. Right now I've only tested this with my miniapp writing its own GPRT callback but it does work.

So the downstream app runs something like:

  • Call `xdg::populate_external_rays(callback, num_rays)
    • XDG allocates device memory for rays (if not already large enough)
    • XDG passes device pointers to the callback
    • User's callback populates the buffers using their preferred compute kernel/shader
    • User's callback returns (XDG assumes buffers are now populated)
  • Call XDG::ray_fire_prepared() to trace the populated rays

I still need to write an equivalent point_in_volume_prepared()

This avoids the unnecessary host-device transfers that the array versions of ray_fire() and point_in_volume() suffer from by allowing users to write directly to XDG's device buffers without any host-side transfers. I don't actually know if the callback approach would play nicely with OpenMP though, we'll have to see...

@Waqar-ukaea Waqar-ukaea merged commit e758e69 into batch-query-api Jan 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant