← Back to Pull requests

fix(miopen): Warn about network-backed caches and databases (ROCM-33335) #15406

Open
unknown opened this pull request with 650 lines diff across 8 files
View on GitHub
unknown unknown commented on Nov 09, 2026 21:09 UTC
Author

fix(miopen): Warn about network-backed caches and databases (ROCM-33335)

JIRA ID : ROCM-33335

Motivation

ROCM-33335 reports algorithm finds timing out after 150 seconds when the kernel cache is on NFS. MIOpen silently redirected recognized network-backed default paths, while explicit overrides could remain on network storage without a warning.

Make writable-cache placement visible and identify the environment variable that moves each path to node-local storage. Network-filesystem safety and database-locking changes remain outside this PR's scope.

Technical Details

  • Check selected user kernel-cache and find/performance database paths, including MIOPEN_CUSTOM_CACHE_DIR and MIOPEN_USER_DB_PATH overrides. Emit non-quiet Warning-level diagnostics, honor MIOPEN_LOG_LEVEL, and print path strings without filesystem-stream escaping.

  • Preserve explicit overrides and existing non-development temporary-directory fallbacks. Development builds warn without redirecting when the relevant path is resolved.

  • Share owning kernel-cache path state between GetCachePath and SQLite GetDb. Initialize it through std::call_once and retain it through process teardown; test-only resets reconstruct the state after all consumers have finished.

  • Inspect the working directory when a missing relative path has no existing named ancestor. The recognized filesystem-type list is unchanged; no GPFS, BeeGFS, PanFS or 9p classification is added.

  • Replace incidental path checks and mock-echo tests with diagnostics/path-selection cases, concurrent initialization, real-filesystem ancestor checks and late SQLite payload reads. The shutdown regression uses native Google Test re-execution and inherited environment, including paths containing spaces.

  • Update the cache-storage documentation and condensed changelog entries.
  • The actual PR diff contains eight MIOpen files. Public API signatures, GPU kernels, solver selection, database formats and dependencies are unchanged.

    Risk Assessment

    Risk Level: 🔴 High

    The change modifies shared kernel-cache initialization and process-teardown lifetime to fix a shutdown use-after-free. A synchronization or ownership regression in this core runtime cache can affect compiled-kernel loading, so the lifetime path requires close review despite the contained file scope.

    Impacted Components

  • User kernel-cache and find/performance database path resolution.

  • SQLite kernel-cache consumers, shared path state and startup diagnostics.

  • CPU regression tests and cache documentation.
  • Potential Side Effects

  • Recognized network-backed writable paths emit warnings, including during quiet warmup, unless the configured log level suppresses them.

  • Existing default-path redirection can make compiled kernels and tuning results non-persistent. Explicit overrides remain unchanged; temporary storage is not guaranteed node-local.

  • Cached path storage remains allocated through process termination. Test resets invalidate previous path references and require quiescent consumers.
  • Mitigation Steps

  • Preserve override precedence and fallback policy; use standard single-flight initialization.

  • Cover warning visibility/frequency, explicit suppression, path selection, concurrent cold access, relative paths and late SQLite reads with behavioral tests.

  • Recorded before/after comparisons reproduced the old path-lifetime and subprocess failures and passed with the fixes.
  • Test Plan

    Local verification used a fresh Linux HIPNOGPU Release build of the merged source tree later committed as 282bfaedf97, with BUILD_DEV=OFF and SQLite/kernel caching enabled. Standard HIP/BLAS settings were enabled; CK, hipconv and AI were disabled.

    Equivalent focused-suite commands, from the configured build directory:

    ./bin/test_db_paths --reset-sharding
    ./bin/test_filesystem_checker --reset-sharding
    ./bin/test_cache --reset-sharding
    ./bin/test_perfdb --reset-sharding
    ./bin/test_unit_lib_env_var --reset-sharding
    

    The recorded direct cache smoke compared current-directory and missing-relative-path filesystem classification, preserved relative overrides, and saved/loaded an exact SQLite payload under a directory containing spaces. Earlier comparisons also exercised a spaced executable path and checked the original SQLite use-after-free under ASan.

    Test Result

    | Suite | Passed | Failed | Skipped |
    |---|---:|---:|---:|
    | test_db_paths | 29 | 0 | 0 |
    | test_filesystem_checker | 2 | 0 | 0 |
    | test_cache | 7 | 0 | 0 |
    | test_perfdb | 3 | 0 | 1 |
    | test_unit_lib_env_var | 8 | 0 | 0 |
    | Total | 49 | 0 | 1 |

  • The skipped perf-db entry is the child worker invoked without worker arguments; all three parent tests passed.

  • The direct cache smoke preserved relative overrides and round-tripped six exact bytes.

  • Earlier comparisons detected the old SQLite cached-path heap-use-after-free and the old subprocess failure with spaces (exit 127); corrected cases passed.

  • Prior ASan verification used a temporary LeakSanitizer suppression matching allocations in unchanged libhsa-runtime64.so.1. Use-after-free checks remained enabled; no suppression was added to the repository or CI, and whole-process leak freedom is not claimed.
  • Diff: 650 lines (+487 / -163) across 8 files Reviewer: JonathanLichtnerAMD Review duration: 30845m
    All Vouch review confidence checks passed
    Residual risk 0.28 = Change Risk (0.52) × (1 − Review Confidence (0.47)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.52 · 650 lines diff across 8 files
    0.52
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    46%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.388
    Shallow Review Depth shallow_review_depth
    0.344
    Real PR Conversation Timeline
    1 comments
    "Review active on #15406"
    general weight: 0.35
    Assignees
    Unassigned
    Labels
    risk: low confidence: 46.7% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 52% (MEDIUM) · Higher = larger blast radius
    52%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 46.7% · Lower = rushed or shallow review
    46.7%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 27.7% · Safe to merge
    27.7%