Introducing MemoryTier #18040
Replies: 4 comments 1 reply
|
Thanks for starting this discussion! There is a library being developed by some colleagues at NVIDIA called cuCascade (https://github.com/NVIDIA/cuCascade). It is also designed for memory tiers, though it incorporates some additional features like topology discovery that helps with defining the hierarchy and making performance-aware choices. Maybe there are ideas worth borrowing here. We have considered similar approaches in Velox but no implementation to my knowledge. @devavret may have more to say on this topic. In general I am cautious about global registries, it is easy to lose flexibility in atypical use cases. I’m glad to hear there will be some customization points (per-operator, etc.). |
|
I created two PRs that implemented this proposal. PR #18121 creates Operator-scoped registry. Wiring MemoryTier with Operator-scoped registry could be a third PR or in-place with PR #18122. I would appreciate any feedback. Thank you! |
|
Update. PR #18121 is closed now. We reached an agreement that Operator-level Memory Tier isn't necessary as the compute backend will be switched at plan fragment level. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Motivation
In PR #17529, we introduced CustomMemoryResource where an extension can register and use custom memory allocator and arbitrator. In PR #17960, we implemented CxlMemoryResource using the CustomMemoryResource, and in PR #18000, we implemented CXL-aware Hash Aggregation using CxlMemoryResource. The PR #17529 and #17960 are merged, and PR #18000 is being reviewed.
So, that's the history of development for those who weren't tracking. When I was developing PR #18000, I felt inconvenient of using CustomMemoryResource because after registering a memory resource, you need to keep the resource tag somewhere to use it in the operator. Either you have to sink that tag through QueryCtx or you have to statically define a field in QueryConfig for operator to be able to retrieve that tag. This is not a great idea because, first extensions that wants to add custom memory resource will have to add tag fields all the time, and second it strongly couples the custom memory resource and the extension that wants to use the memory resource.
What we need is a hierarchy of memory resources, based on the memory latency from the current compute. We can picture it like CPU cache hierarchy, where we have L1/L2/L3 and the compute uses L1 first, then L2, then L3 as each layer fills up. This hierarchy should also support operator-level scope because extensions that use DriverAdapter would want different hierarchy than the normal paths.
Design
That's why I'm suggesting two things:
Implementation
1. MemoryTier
2. Operator-level registry
3. DriverAdapter Integration
The operator fetches its effective
MemoryTierand picks the next tier below the one it is filling.What do you think? I appreciate all the feedbacks!
All reactions