[None][infra] Mount triton cache#11301
Conversation
Signed-off-by: Matt Lefebvre <mlefebvre@nvidia.com>
|
/bot run |
📝 WalkthroughWalkthroughA data mount for ENROOT container runtime is added to the Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes 🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@jenkins/L0_Test.groovy`:
- Around line 903-906: The Triton compiler cache mount (the entry that maps
"/home/svc_tensorrt/.triton" into the container via the mounts list using
cluster.scratchPath and the explicit "/home/svc_tensorrt/.triton:/root/.triton"
mapping) can cause concurrent write races; either make the mount read-only if it
is a pre-populated shared cache (add :ro to
"/home/svc_tensorrt/.triton:/root/.triton") or, if jobs may populate the cache,
implement one of the recommended mitigations: upgrade Triton to a version with
the concurrency fixes, switch to NVIDIA Megatron-Core’s
ParallelFileCacheManager, or configure per-job unique TRITON_CACHE_DIRs (so each
job uses a local unique cache path) and remove the shared writable mount—apply
the chosen strategy consistently wherever mounts is constructed and where
TRITON_CACHE_DIR is set.
| mounts += [ | ||
| "${cluster.scratchPath}:/scratch.trt_llm_data:ro", | ||
| "/home/svc_tensorrt/.triton:/root/.triton", | ||
| ] |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
# First, let's examine the file to confirm the context
head -n 920 jenkins/L0_Test.groovy | tail -n 25Repository: NVIDIA/TensorRT-LLM
Length of output: 1170
🌐 Web query:
Triton compiler cache concurrent writes safety thread safety
💡 Result:
Triton’s compiler cache has historically been not fully safe under concurrent multi-process writes to the same cache directory (common in distributed training / TP>1 on a shared filesystem).
- Triton’s cache
put()uses a “write temp →os.replace()to final name” pattern (atomic rename/replace), but other processes can still observe and act on transient temp files (e.g., via directoryglob/listing) and then fail when those temp files get replaced, causingFileNotFoundErrorin multi-process runs. This exact failure mode is reported in triton-lang/triton issue trtllm-build llama3.1-8b failed #2688. (github.com) - Two upstream fixes addressed concurrency hazards:
- PR
#3544: avoids temp-file name collisions across distributed setups (e.g., same PID/seed across nodes) by using UUIDs. (github.com) - PR
#4295: changes the cache manager to write into a process-private temp directory, so directory scans don’t pick up another process’s temp artifacts (and explains the race in detail). (github.com)
- PR
- NVIDIA Megatron-Core ships a patched
ParallelFileCacheManagerexplicitly to “prevent errors related to the building of the Triton compiler cache” under parallel ranks and on filesystems like Lustre, and notes it implements Triton PRs#3544and#4295(and suggests these changes should land in Triton 3.2). (docs.nvidia.com)
Practical guidance
- If you see cache
FileNotFoundError/ odd behavior under distributed compilation: upgrade Triton to a version that includes PRs#3544and#4295, or use Megatron-Core’sParallelFileCacheManager, or ensure each process/rank uses a distinctTRITON_CACHE_DIR(ideally on local disk, not shared NFS/Lustre). (docs.nvidia.com)
Citations:
- 1: Encountering FileNotFoundError while Compiling Triton Kernel in Distributed Training triton-lang/triton#2688
- 2: [RUNTIME] Replace random number with UUID triton-lang/triton#3544
- 3: [RUNTIME] Replace random number with UUID triton-lang/triton#3544
- 4: https://docs.nvidia.com/megatron-core/developer-guide/0.15.0/apidocs/core/core.ssm.triton_cache_manager.html
- 5: https://docs.nvidia.com/megatron-core/developer-guide/0.15.0/apidocs/core/core.ssm.triton_cache_manager.html
🏁 Script executed:
# Let's also search for any other references to the .triton mount or cache handling in the codebase
rg "\.triton|triton.*cache" --type groovy -i -A 2 -B 2Repository: NVIDIA/TensorRT-LLM
Length of output: 339
Address Triton compiler cache concurrency safety with proper mitigation.
The Triton compiler cache at Line 905 does not specify an access mode, allowing concurrent writes from multiple SLURM jobs. This is a known issue in Triton's cache implementation—concurrent multi-process writes to the same cache directory can cause race conditions (FileNotFoundError) and cache corruption, particularly in distributed settings.
Simply adding :ro is insufficient if the cache needs to be populated dynamically. The proper upstream solutions are:
- Upgrade Triton to a version that includes concurrency fixes (PRs
#3544and#4295, expected in Triton 3.2+) - Use NVIDIA Megatron-Core's
ParallelFileCacheManager(explicitly designed to prevent cache corruption under parallel ranks) - Use per-process cache directories on local disk by setting distinct
TRITON_CACHE_DIRper job, rather than sharing a single cache
If this cache is intended as a pre-populated shared read-only resource, then adding :ro is appropriate. If jobs populate it dynamically, clarify the concurrency handling strategy and implement one of the upstream mitigations above.
🤖 Prompt for AI Agents
In `@jenkins/L0_Test.groovy` around lines 903 - 906, The Triton compiler cache
mount (the entry that maps "/home/svc_tensorrt/.triton" into the container via
the mounts list using cluster.scratchPath and the explicit
"/home/svc_tensorrt/.triton:/root/.triton" mapping) can cause concurrent write
races; either make the mount read-only if it is a pre-populated shared cache
(add :ro to "/home/svc_tensorrt/.triton:/root/.triton") or, if jobs may populate
the cache, implement one of the recommended mitigations: upgrade Triton to a
version with the concurrency fixes, switch to NVIDIA Megatron-Core’s
ParallelFileCacheManager, or configure per-job unique TRITON_CACHE_DIRs (so each
job uses a local unique cache path) and remove the shared writable mount—apply
the chosen strategy consistently wherever mounts is constructed and where
TRITON_CACHE_DIR is set.
|
PR_Github #34903 [ run ] triggered by Bot. Commit: |
|
PR_Github #34903 [ run ] completed with state
|
Summary by CodeRabbit
Release Notes
No user-facing changes in this release. This update includes infrastructure and testing configuration improvements.
Description
Test Coverage
PR Checklist
Please review the following before submitting your PR:
PR description clearly explains what and why. If using CodeRabbit's summary, please make sure it makes sense.
PR Follows TRT-LLM CODING GUIDELINES to the best of your knowledge.
Test cases are provided for new code paths (see test instructions)
Any new dependencies have been scanned for license and vulnerabilities
CODEOWNERS updated if ownership changes
Documentation updated as needed
Update tava architecture diagram if there is a significant design change in PR.
The reviewers assigned automatically/manually are appropriate for the PR.
Please check this after reviewing the above items as appropriate for this PR.
GitHub Bot Help
/bot [-h] ['run', 'kill', 'skip', 'reuse-pipeline'] ...Provide a user friendly way for developers to interact with a Jenkins server.
Run
/bot [-h|--help]to print this help message.See details below for each supported subcommand.
Details
run [--reuse-test (optional)pipeline-id --disable-fail-fast --skip-test --stage-list "A10-PyTorch-1, xxx" --gpu-type "A30, H100_PCIe" --test-backend "pytorch, cpp" --add-multi-gpu-test --only-multi-gpu-test --disable-multi-gpu-test --post-merge --extra-stage "H100_PCIe-TensorRT-Post-Merge-1, xxx" --detailed-log --debug(experimental)]Launch build/test pipelines. All previously running jobs will be killed.
--reuse-test (optional)pipeline-id(OPTIONAL) : Allow the new pipeline to reuse build artifacts and skip successful test stages from a specified pipeline or the last pipeline if no pipeline-id is indicated. If the Git commit ID has changed, this option will be always ignored. The DEFAULT behavior of the bot is to reuse build artifacts and successful test results from the last pipeline.--disable-reuse-test(OPTIONAL) : Explicitly prevent the pipeline from reusing build artifacts and skipping successful test stages from a previous pipeline. Ensure that all builds and tests are run regardless of previous successes.--disable-fail-fast(OPTIONAL) : Disable fail fast on build/tests/infra failures.--skip-test(OPTIONAL) : Skip all test stages, but still run build stages, package stages and sanity check stages. Note: Does NOT update GitHub check status.--stage-list "A10-PyTorch-1, xxx"(OPTIONAL) : Only run the specified test stages. Examples: "A10-PyTorch-1, xxx". Note: Does NOT update GitHub check status.--gpu-type "A30, H100_PCIe"(OPTIONAL) : Only run the test stages on the specified GPU types. Examples: "A30, H100_PCIe". Note: Does NOT update GitHub check status.--test-backend "pytorch, cpp"(OPTIONAL) : Skip test stages which don't match the specified backends. Only support [pytorch, cpp, tensorrt, triton]. Examples: "pytorch, cpp" (does not run test stages with tensorrt or triton backend). Note: Does NOT update GitHub pipeline status.--only-multi-gpu-test(OPTIONAL) : Only run the multi-GPU tests. Note: Does NOT update GitHub check status.--disable-multi-gpu-test(OPTIONAL) : Disable the multi-GPU tests. Note: Does NOT update GitHub check status.--add-multi-gpu-test(OPTIONAL) : Force run the multi-GPU tests in addition to running L0 pre-merge pipeline.--post-merge(OPTIONAL) : Run the L0 post-merge pipeline instead of the ordinary L0 pre-merge pipeline.--extra-stage "H100_PCIe-TensorRT-Post-Merge-1, xxx"(OPTIONAL) : Run the ordinary L0 pre-merge pipeline and specified test stages. Examples: --extra-stage "H100_PCIe-TensorRT-Post-Merge-1, xxx".--detailed-log(OPTIONAL) : Enable flushing out all logs to the Jenkins console. This will significantly increase the log volume and may slow down the job.--debug(OPTIONAL) : Experimental feature. Enable access to the CI container for debugging purpose. Note: Specify exactly one stage in thestage-listparameter to access the appropriate container environment. Note: Does NOT update GitHub check status.For guidance on mapping tests to stage names, see
docs/source/reference/ci-overview.mdand the
scripts/test_to_stage_mapping.pyhelper.kill
killKill all running builds associated with pull request.
skip
skip --comment COMMENTSkip testing for latest commit on pull request.
--comment "Reason for skipping build/test"is required. IMPORTANT NOTE: This is dangerous since lack of user care and validation can cause top of tree to break.reuse-pipeline
reuse-pipelineReuse a previous pipeline to validate current commit. This action will also kill all currently running builds associated with the pull request. IMPORTANT NOTE: This is dangerous since lack of user care and validation can cause top of tree to break.