[STF] Name green context data places by handle and support VMM mem_create#9706
[STF] Name green context data places by handle and support VMM mem_create#9706caugonnet wants to merge 4 commits into
Conversation
Green context data places on the same device were previously indistinguishable by name and could not back VMM (localized array) allocations. Include the green context handle in green_ctx_data_place_impl::to_string() and override mem_create() to allocate device-pinned physical memory bound to the green context's device. Add a co-located unittest verifying to_string() distinguishes different green contexts on the same device, and extend data_place_vmm.cu to exercise the green_ctx mem_create() override through the full VMM map/access/kernel path.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughSummary by CodeRabbit
WalkthroughAdds green-context-aware pinned memory creation, updates place naming to include the green context handle, and extends VMM coverage with a green-context allocation path. ChangesGreen Context mem_create Support
Related PRs: None specified. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: 5916dbe3-1c2e-485a-b50c-dc2a1b9237b5
📒 Files selected for processing (2)
cudax/include/cuda/experimental/__places/exec/green_context.cuhcudax/test/places/data_place_vmm.cu
|
/ok to test c331ae8 |
Add cuda_try(cudaGetLastError()) after each init/check kernel launch so a non-sticky launch failure cannot silently leave the result flag at zero and mask a failing EXPECT. Applied consistently across the device, multi-segment, and green context VMM tests.
|
/ok to test f07a610 |
This comment has been minimized.
This comment has been minimized.
| { | ||
| return "green_ctx(dev=" + ::std::to_string(view_.devid) + ")"; | ||
| return "green_ctx(dev=" + ::std::to_string(view_.devid) | ||
| + ", ctx=" + ::std::to_string(reinterpret_cast<::std::uintptr_t>(view_.g_ctx)) + ")"; |
There was a problem hiding this comment.
Wouldn't make sense to return ctx=/*green-context-id*/ that can be queried by cuGreenCtxGetId?
There was a problem hiding this comment.
Agreed, that's better — done in 0f1e695. to_string() now emits ctx=<green-context-id> using the queryable unique id (via the existing get_cuda_context_id helper, i.e. cuCtxFromGreenCtx + cuCtxGetId) instead of the raw handle pointer. This also matches the naming already used by the green-context exec_place. I reused that helper rather than calling cuGreenCtxGetId directly to stay compatible across the CTK >= 12.4 range the header supports; I hoisted the helper overloads above the class so the inline to_string() can see them.
Use the green context's queryable unique id (via cuCtxFromGreenCtx + cuCtxGetId, exposed by the existing get_cuda_context_id helper) in green_ctx_data_place_impl::to_string() instead of the raw handle pointer. This mirrors the exec_place green context naming and gives a stable, meaningful identifier. The helper overloads are hoisted above the class so the inline to_string() can see them.
|
/ok to test 0f1e695 |
🥳 CI Workflow Results🟩 Finished in 1h 06m: Pass: 100%/55 | Total: 1d 01h | Max: 1h 06m | Hits: 16%/163654See results here. |
Summary
green_ctx_data_place_impl::to_string()now includes the green context handle in addition to the device id, so two green contexts on the same device produce distinct names (previously they were indistinguishable).green_ctx_data_place_impl::mem_create()to allocate device-pinned physical memory bound to the green context's device, enabling green context data places to back VMM (localized array) allocations.Tests
green_context.cuh(green context data_place to_string distinguishes contexts on the same device) asserting the name embedsdev=/ctx=and differs between two green contexts on the same device, while being stable for the same context.cudax/test/places/data_place_vmm.cuwithtest_green_ctx_vmm_allocation()which exercises the green contextmem_create()override end-to-end: create physical memory, reserve/map VA, set device access, run init/check kernels, and verify.Test plan
ninja cudax.test.places.data_place_vmmbuilds and runs green (CTK 13.0, local GPU).ninja cudax.test.places.unittest_headers.__places.exec.green_contextbuilds and runs green.pre-commit(clang-format, codespell, ...) passes on both files.