Implement MonitoredChannel#718
Draft
jchmura-sc wants to merge 23 commits into
Draft
Conversation
Collaborator
Author
|
/unit_test |
Contributor
GiGL Automation@ 21:34:08UTC : 🔄 @ 21:35:52UTC : ✅ Workflow completed successfully. |
Contributor
GiGL Automation@ 21:34:10UTC : 🔄 @ 21:43:27UTC : ✅ Workflow completed successfully. |
Contributor
GiGL Automation@ 21:34:10UTC : 🔄 |
jchmura-sc
commented
Jul 23, 2026
Comment on lines
+45
to
+46
| # 32 - 39 | write_block_id_ | size_t | 8 bytes | Total messages enqueued <-- READ HERE | ||
| # 40 - 47 | read_block_id_ | size_t | 8 bytes | Total messages dequeued <-- READ HERE |
Collaborator
Author
There was a problem hiding this comment.
These are monotonically increasing sequence numbers, not wraparound array indices. Hence we can compute queue size as write_block_id_ - read_block_id_
jchmura-sc
commented
Jul 23, 2026
| logger.warning( | ||
| "initialize_metrics() was not called, using NopMetricsPulisher as default" | ||
| task_config_uri = os.environ.get(TASK_CONFIG_URI_ENV_KEY) | ||
| service_name = os.environ.get(JOB_NAME_GROUPING_ENV_KEY) or os.environ.get( |
Collaborator
Author
There was a problem hiding this comment.
It's actually "GIGL_APPLIED_TASK_IDENTIFIER" this serves as the appropriate service name based on frozen config. Should double check if "GBML_JOB_NAME" is set and if so then this can be simplified
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose
The purpose of this PR is to add telemetry to our
ShmChannel.We want to know how many
SampleMessage's are in each of our channels at any given time, since an empty channel implies a blockingrecv, which implies a dataloader bottleneck. Conversely, if our channels staying comfortably above some low watermark then any changes upstream ofdataloader.__next__is unlikely to improve throughput.Context (Colocated-Mode)
Each of our
N_replicasreplicas launchN_localtraining workers. Each training worker initializes one or more data loaders (e.g.DistABLPLoader,DistNeighborLoader). Each dataloader is associated with aShmChannel. For a given dataloader, multiple sampling workers (e.g.DistNeighborSampler,DistPPRNeighborSampler) push data into the queue.The channel is roughly used like:
Challenge
There is no direct way to gauge the queue size since GLT's
ShmChanneldoes not expose the size to python.PR Changes
SizedShmChannel(ShmChannel): addsqsize()method toShmChannelby attaching to the channels memory region and inspecting the C++ struct layout. It calculates queue size as the delta between the circular buffer's write and read pointers.MonitoredShmChannel(SizedShmChannel): a subclass that automatically integrates with the GiGL metrics service, pushing theqsizeas a gauge on everyrecv()call.MonitoredShmChannelinstead of aShmChannelinitialize_metrics()in the GiGL runtime setup but this doesn't propogate to the processes which actually own theMonitoredChannel. I've made it such thatget_metrics_service_instanceattempts to implicitly callinitialize_metrics(task_config_uri, service_name)if the relevant environment variables are set (which they are in the VAI workers). This enables us to integrate with anOpsMetricPublisherfrom the training code.Things to Verify / Test
ShmChannelqueue size.ShmChannel.Updated Changelog.md? NO
Ready for code review?: NO