Move --shm-name from MPServerConfig to L1MemoryManagerConfig#310
Closed
Copilot wants to merge 2 commits into
Closed
Move --shm-name from MPServerConfig to L1MemoryManagerConfig#310Copilot wants to merge 2 commits into
--shm-name from MPServerConfig to L1MemoryManagerConfig#310Copilot wants to merge 2 commits into
Conversation
- Remove shm_name field and --shm-name arg from MPServerConfig/add_mp_server_args - Add --shm-name to add_storage_manager_args (L1 Memory Manager group) - Pass shm_name into L1MemoryManagerConfig in parse_args_to_config - non_gpu_transfer.py and server.py were already clean (no override logic needed)
Copilot
AI
changed the title
[WIP] Move --shm-name to L1MemoryManagerConfig
Move May 27, 2026
--shm-name from MPServerConfig to L1MemoryManagerConfig
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.
--shm-namewas parsed intoMPServerConfig.shm_namebut never propagated toL1MemoryManagerConfig.shm_namebeforeStorageManagerwas created. Result: the allocator created the SHM segment under the default pid-based name while_compute_shm_pool_inforeturned the user-specified name — worker gotFileNotFoundError.Changes
lmcache/v1/multiprocess/config.py: Removeshm_namefield fromMPServerConfig, remove--shm-namefromadd_mp_server_args, removeshm_name=args.shm_namefromparse_args_to_mp_server_config.lmcache/v1/distributed/config.py: Add--shm-nametoadd_storage_manager_args(L1 Memory Manager group). Inparse_args_to_config, pass it directly intoL1MemoryManagerConfig:The conditional unpacking is intentional:
L1MemoryManagerConfig.shm_nameuses adefault_factoryfor the pid-based name; passingNonewould suppress it. Empty string""explicitly disables SHM; a name uses that segment.The CLI invocation is unchanged —
--shm-namemoves transparently from the MP Server arg group to the L1 Memory Manager arg group.Original prompt
Move
--shm-namefromMPServerConfig/add_mp_server_argstoL1MemoryManagerConfig/add_storage_manager_argsso that the allocator directly uses the user-specified SHM name.Current problem
--shm-nameis parsed intoMPServerConfig.shm_namebut never written intoL1MemoryManagerConfig.shm_namebefore theStorageManageris created. The allocator creates a segment with the default pid-based name (lmcache_l1_pool_{pid}) while_compute_shm_pool_inforeturns the user-specified name → worker getsFileNotFoundError.Required changes
lmcache/v1/multiprocess/config.py: Remove--shm-namefromadd_mp_server_argsand removeshm_namefield fromMPServerConfig. Removeshm_name=args.shm_namefromparse_args_to_mp_server_config.lmcache/v1/distributed/config.py:--shm-nameargument toadd_storage_manager_argsin the "L1 Memory Manager" group:parse_args_to_config, passshm_nameintoL1MemoryManagerConfigwhen provided:lmcache/v1/multiprocess/modules/non_gpu_transfer.py: Remove the_shm_name_overridelogic fromNonGPUTransferModule.__init__and the override branch in_compute_shm_pool_info. Revert__init__signature to just(self, ctx: MPCacheEngineContext)(nomp_configparameter). Remove theMPServerConfigimport.lmcache/v1/multiprocess/server.py:NonGPUTransferModule(ctx, mp_config)back toNonGPUTransferModule(ctx).if mp_config.shm_name is not None:override block if present.Update tests in
tests/v1/multiprocess/test_non_cuda_data_transfer.py: Remove or update tests that referenceMPServerConfig(shm_name=...)inNonGPUTransferModuleconstruction. The tests for_compute_shm_pool_infoshould now just setstorage_manager_config.l1_manager_config.memory_config.shm_namedirectly.Branch
Base branch:
ww21_PR_shmThe following is the prior conversation context from the user's chat exploration (may be truncated):
User: 怎么又改server,能不在这层改吗
Assistant: 改在
parse_args_to_config那层,让--shm-name直接写进L1MemoryManagerConfig.shm_name。看
config.py第 294-299 行,parse_args_to_config构造L1MemoryManagerConfig时没传shm_name。但--shm-name是在mp_server_args里定义的,不在storage_manager_args里。最干净的改法:把
shm_name加到add_storage_manager_args里,parse_args_to_config直接传进去。但如果你不想改
storage_manager的 arg 定义(因为它是通用的),那就改MPServerConfig的调用方 —— 在parse_args_to_mp_server_config之后、创建 context 之前。不管怎样都得在server.py或http_server.py的入口处做。或者,改
MPCacheEngineContext.__init__,让它接收shm_name_override参数:然后
server.py只改传参:这样
server.py只多传一个参数,逻辑全在engine_context.py里。你觉得行吗?User: @hlin99/LMCache/pull/308 这个PR不是已经做了吗
Assistant: 你说得对,PR #308 确实改了
_compute_shm_pool_info让它返回 override 的名字。但问题是这只改了"告诉 worker 用什么名字",没改"allocator 实际用什么名字创建 segment"。
PR #308 的改法:
_compute_shm_pool_info返回lmcache_l1_pool_hlin✅StorageManager创建时 config 里的shm_name还是默...This pull request was created from Copilot chat.