Skip to content

[None][fix] Add mutex to avoid potentially concurrent modifications to std::unordered_map#16439

Open
yihwang-nv wants to merge 3 commits into
NVIDIA:mainfrom
yihwang-nv:yihwang/add_mutx_for_thop_attn
Open

[None][fix] Add mutex to avoid potentially concurrent modifications to std::unordered_map#16439
yihwang-nv wants to merge 3 commits into
NVIDIA:mainfrom
yihwang-nv:yihwang/add_mutx_for_thop_attn

Conversation

@yihwang-nv

@yihwang-nv yihwang-nv commented Jul 15, 2026

Copy link
Copy Markdown
Collaborator

Summary by CodeRabbit

Bug Fixes / Improvements

  • Updated hashing utilities in cpp/tensorrt_llm/common/opUtils.h by removing the prior internal hash_helper/common::op::hash mechanism and introducing an internal OpCustomHash (anonymous namespace) with:
    • hash_combine helper
    • recursive support for std::set<T> and std::tuple<Args...> (implemented via OpCustomHash + index expansion)
    • default fallback for other types via inheritance from std::hash<T>
  • Improved concurrency safety for the per-call-site attention op cache in cpp/tensorrt_llm/thop/attentionOp.cpp:
    • added static std::shared_mutex op_cache_mutex
    • shared-lock lookup + exclusive-lock recheck/insert using try_emplace
    • switched the unordered_map key hasher from hash<CacheKey> to OpCustomHash<CacheKey>
  • Refactored the per-CUDA-context/per-thread weak-observer cache in cpp/tensorrt_llm/common/opUtils.cpp:
    • changed the observer storage to std::unique_ptr<CacheTy> (was raw pointer with manual new/delete)
    • updated the unordered_map key hasher to OpCustomHash<CacheKey>

Dev Engineer Review

  • Attention cache concurrency: Verify correctness of the shared-lock lookup + exclusive-lock try_emplace flow. On a miss, a thread may still do op->initialize() / runner->prepare(*op) before acquiring the exclusive lock; if another thread inserted first, the prepared op is discarded—confirm this is acceptable for performance and does not cause unintended side effects.
  • Remaining unordered_map writes without synchronization: attention_supports_nvfp4_output(...) still uses a function-local static std::unordered_map<..., OpCustomHash<...>> op_cache and writes via op_cache[cache_key] = ... without any visible locking. If this function can be called concurrently, this is a potential remaining data race / concurrent modification risk.
  • Hashing stability / collisions: OpCustomHash for std::set and std::tuple relies on hash_combine and XOR-based accumulation. Confirm this satisfies any project expectations around hash consistency (across runs if needed) and that it works correctly for the actual cache key types used.
  • Observer lifetime safety: In opUtils.cpp, the weak-observer deleter lambda captures this and accesses mObservers. Double-check that cached shared_ptr instances cannot outlive the PerCudaCtxPerThreadSingletonCreator object during shutdown/static destruction (to avoid use-after-free).

QA Engineer Review

No test changes.

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)

  • If PR introduces API changes, an appropriate PR label is added - either api-compatible or api-breaking. For api-breaking, include BREAKING in the PR title.

  • 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

To see a list of available CI bot commands, please comment /bot help.

@yihwang-nv

Copy link
Copy Markdown
Collaborator Author

/bot run

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #59474 [ run ] triggered by Bot. Commit: e5a9953 Link to invocation

@coderabbitai

coderabbitai Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

The PR replaces the removed custom hash functor with internal OpCustomHash support for sets and tuples, updates cache hash types and observer ownership, and adds synchronized lookup and insertion for the attention operation cache.

Changes

Hashing and cache infrastructure

Layer / File(s) Summary
Custom hashing and observer cache wiring
cpp/tensorrt_llm/common/opUtils.h, cpp/tensorrt_llm/common/opUtils.cpp
Set and tuple hashing now uses OpCustomHash; the observer cache uses that hash type and stores its map through std::unique_ptr.
Attention cache synchronization
cpp/tensorrt_llm/thop/attentionOp.cpp
Attention caches use OpCustomHash, while cache misses use shared and exclusive locking with a second lookup before try_emplace.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Suggested reviewers: cascade812, yunruis

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description only contains the template comments and lacks filled Description and Test Coverage sections. Add a brief issue/solution summary and list relevant tests in the Description and Test Coverage sections.
Docstring Coverage ⚠️ Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise, specific, and matches the main change.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
cpp/tensorrt_llm/thop/attentionOp.cpp (1)

1309-1313: 🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

Populate the cache on a miss. The locked branch only assigns when op_cache.find(cache_key) != op_cache.end(), so new entries are never inserted and this cache never hits.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@cpp/tensorrt_llm/thop/attentionOp.cpp` around lines 1309 - 1313, Update the
attention operation cache logic around op_cache.find so a cache miss creates or
obtains the attention operation and inserts it under cache_key, while preserving
assignment from it->second on hits. Ensure the newly populated entry is
available for subsequent lookups.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@cpp/tensorrt_llm/common/opUtils.h`:
- Around line 110-122: Rename the helper variable templates __is_tuple_like and
__is_iterable to non-reserved identifiers, and update every reference to those
traits consistently. Preserve their existing tuple and iterable detection
behavior.
- Around line 135-169: Extract the duplicated hash-combine literal 0x9e3779b9
into a shared named constant using the k-prefixed camelCase convention, then
replace both uses in hash_helper’s iterable specialization and tuple
specialization with that constant.

In `@cpp/tensorrt_llm/thop/attentionOp.cpp`:
- Line 1308: Rename the newly introduced mutex from op_cache_mutex to
opCacheMutex in the surrounding function, and update its use at the
corresponding lock site to match the lower camel case naming convention.
- Around line 1320-1323: The cache insertion condition in the op cache update
block is inverted, preventing missing entries from being stored. Update the
logic around op_cache_mutex to insert op only when cache_key is absent, while
preserving any value already populated by another thread.

---

Outside diff comments:
In `@cpp/tensorrt_llm/thop/attentionOp.cpp`:
- Around line 1309-1313: Update the attention operation cache logic around
op_cache.find so a cache miss creates or obtains the attention operation and
inserts it under cache_key, while preserving assignment from it->second on hits.
Ensure the newly populated entry is available for subsequent lookups.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: fc101a8a-d31e-4b13-a090-4f637a61e683

📥 Commits

Reviewing files that changed from the base of the PR and between 0623958 and e5a9953.

📒 Files selected for processing (2)
  • cpp/tensorrt_llm/common/opUtils.h
  • cpp/tensorrt_llm/thop/attentionOp.cpp

Comment thread cpp/tensorrt_llm/common/opUtils.h Outdated
Comment on lines +110 to +122
template <class Tuple>
inline constexpr bool __is_tuple_like = false;

template <class... Args>
inline constexpr bool __is_tuple_like<std::tuple<Args...>> = true;

template <class T, class Enable = void>
inline constexpr bool __is_iterable = false;

template <class T>
inline constexpr bool
__is_iterable<T, std::void_t<decltype(std::begin(std::declval<T&>())), decltype(std::end(std::declval<T&>()))>>
= true;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Inspect the relevant portion of the header.
sed -n '100,190p' cpp/tensorrt_llm/common/opUtils.h | cat -n

# Find all uses of the double-underscore traits in the repo.
rg -n "__is_tuple_like|__is_iterable" cpp/tensorrt_llm

# Check the repository guidance file if present.
fd -a "CODING_GUIDELINES.md" .

Repository: NVIDIA/TensorRT-LLM

Length of output: 3760


Rename __is_tuple_like and __is_iterable. Double-underscore identifiers are reserved to the implementation, even inside this anonymous namespace.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@cpp/tensorrt_llm/common/opUtils.h` around lines 110 - 122, Rename the helper
variable templates __is_tuple_like and __is_iterable to non-reserved
identifiers, and update every reference to those traits consistently. Preserve
their existing tuple and iterable detection behavior.

Comment thread cpp/tensorrt_llm/common/opUtils.h Outdated
Comment thread cpp/tensorrt_llm/thop/attentionOp.cpp Outdated
Comment thread cpp/tensorrt_llm/thop/attentionOp.cpp Outdated
@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #59474 [ run ] completed with state SUCCESS. Commit: e5a9953
/LLM/main/L0_MergeRequest_PR pipeline #47939 completed with status: 'FAILURE'

CI Report

⚠️ Action Required:

  • Please check the failed tests and fix your PR
  • If you cannot view the failures, ask the CI triggerer to share details
  • Once fixed, request an NVIDIA team member to trigger CI again

CI Agent Failure Analysis

Link to invocation

Comment thread cpp/tensorrt_llm/thop/attentionOp.cpp Outdated
Comment thread cpp/tensorrt_llm/common/opUtils.h Outdated
@tongyuantongyu tongyuantongyu changed the title [None][fix] Add mutx to avoid potentially concurrent modifications to std::unordered_map [None][fix] Add mutex to avoid potentially concurrent modifications to std::unordered_map Jul 16, 2026
Comment thread cpp/tensorrt_llm/thop/attentionOp.cpp Outdated
@yihwang-nv

Copy link
Copy Markdown
Collaborator Author

/bot run

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #60265 [ run ] triggered by Bot. Commit: ccc1bc2 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #60265 [ run ] completed with state FAILURE. Commit: ccc1bc2
/LLM/main/L0_MergeRequest_PR pipeline #48624 completed with status: 'FAILURE'

CI Report

⚠️ Action Required:

  • Please check the failed tests and fix your PR
  • If you cannot view the failures, ask the CI triggerer to share details
  • Once fixed, request an NVIDIA team member to trigger CI again

CI Agent Failure Analysis

Link to invocation

@yihwang-nv

Copy link
Copy Markdown
Collaborator Author

/bot run

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #60285 [ run ] triggered by Bot. Commit: ccc1bc2 Link to invocation

Comment thread cpp/tensorrt_llm/common/opUtils.h Outdated
Comment thread cpp/tensorrt_llm/thop/attentionOp.cpp Outdated
@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #60285 [ run ] completed with state SUCCESS. Commit: ccc1bc2
/LLM/main/L0_MergeRequest_PR pipeline #48639 completed with status: 'FAILURE'

CI Report

⚠️ Action Required:

  • Please check the failed tests and fix your PR
  • If you cannot view the failures, ask the CI triggerer to share details
  • Once fixed, request an NVIDIA team member to trigger CI again

CI Agent Failure Analysis

Link to invocation

@yihwang-nv

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #60324 [ run ] triggered by Bot. Commit: 23d89f9 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #60324 [ run ] completed with state FAILURE. Commit: 23d89f9
/LLM/main/L0_MergeRequest_PR pipeline #48669 completed with status: 'FAILURE'

CI Report

⚠️ Action Required:

  • Please check the failed tests and fix your PR
  • If you cannot view the failures, ask the CI triggerer to share details
  • Once fixed, request an NVIDIA team member to trigger CI again

CI Agent Failure Analysis

Link to invocation

@yihwang-nv

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #60400 [ run ] triggered by Bot. Commit: 23d89f9 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #60400 [ run ] completed with state SUCCESS. Commit: 23d89f9
/LLM/main/L0_MergeRequest_PR pipeline #48739 completed with status: 'FAILURE'

CI Report

⚠️ Action Required:

  • Please check the failed tests and fix your PR
  • If you cannot view the failures, ask the CI triggerer to share details
  • Once fixed, request an NVIDIA team member to trigger CI again

CI Agent Failure Analysis

Link to invocation

@yihwang-nv

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #60599 [ run ] triggered by Bot. Commit: 23d89f9 Link to invocation

@yihwang-nv

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #60666 [ run ] triggered by Bot. Commit: 5f13434 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #60599 [ run ] completed with state ABORTED. Commit: 23d89f9

Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #60666 [ run ] completed with state FAILURE. Commit: 5f13434
/LLM/main/L0_MergeRequest_PR pipeline #48962 completed with status: 'FAILURE'

CI Report

⚠️ Action Required:

  • Please check the failed tests and fix your PR
  • If you cannot view the failures, ask the CI triggerer to share details
  • Once fixed, request an NVIDIA team member to trigger CI again

CI Agent Failure Analysis

Link to invocation

@yihwang-nv

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #60859 [ run ] triggered by Bot. Commit: 5f13434 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #60859 [ run ] completed with state SUCCESS. Commit: 5f13434
/LLM/main/L0_MergeRequest_PR pipeline #49131 completed with status: 'SUCCESS'

CI Report

Link to invocation

@yihwang-nv
yihwang-nv requested a review from yuxianq July 22, 2026 05:53
Comment thread cpp/tensorrt_llm/common/opUtils.h Outdated
size_t operator()(T const& v) const
{
return hash_helper<T>{}(v);
return hash_helper<T>::hash(v);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why we need hash-related change in this file?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These changes was used to simplify the implementation of partial specialization hash_helper for tuple-like containers (Eg. std::tuple/std::pair), and generalize the partial specialization hash_helper for iterable containers(Eg. std::set).

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We intentionally don't make it a general hasher so that nobody can use low-perf iterable containers for cache key. For all list-like cases, we should always use std::tuple; for all set-like cases, we should always use std::set.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we want to restrict developers to using only std::set and std::tuple, then we should be able to remove the entire hash_helper and only add a std::hash specialization.

@yuxianq yuxianq Jul 23, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't want to override the default hasher for any type, so we do not use std::hash specialization. We just define a common::op::hash custom hash functor and use it in std::unordered_map<CacheKey, std::shared_ptr<AttentionOp>, hash<CacheKey>> op_cache; in cpp/tensorrt_llm/thop/attentionOp.cpp to use it.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add two custom specialization of std::hash, then we don't need an extra hash_helper/hash classes.

Comment thread cpp/tensorrt_llm/thop/attentionOp.cpp Outdated
Signed-off-by: Yihan Wang <yihwang@nvidia.com>
@yihwang-nv
yihwang-nv force-pushed the yihwang/add_mutx_for_thop_attn branch from 9819e12 to d98d0b5 Compare July 23, 2026 08:29
Signed-off-by: Yihan Wang <yihwang@nvidia.com>
@yihwang-nv
yihwang-nv force-pushed the yihwang/add_mutx_for_thop_attn branch from 1ed6ebd to 9819e12 Compare July 23, 2026 08:37

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
cpp/tensorrt_llm/common/opUtils.h (1)

146-150: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Use the required C++ naming convention.

Rename hash_combine to hashCombine and seed to a k-prefixed camel-case constant name. As per coding guidelines: “local variables/functions/namespaces in lower camelCase” and constants use “the k-prefixed camelCase names.”

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@cpp/tensorrt_llm/common/opUtils.h` around lines 146 - 150, Rename the
function hash_combine to hashCombine and update every reference to it; rename
the local constant seed to a k-prefixed camelCase name such as kSeed while
preserving its constexpr value and hashing behavior.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@cpp/tensorrt_llm/common/opUtils.h`:
- Around line 156-185: Remove the std::hash<std::set<T>> and
std::hash<std::tuple<Args...>> specializations from opUtils.h. Introduce or
reuse project-owned hash functors for these types, then update the mObservers
unordered_map declaration in opUtils.cpp to pass the appropriate hash functor
explicitly while preserving its existing hashing behavior.

---

Nitpick comments:
In `@cpp/tensorrt_llm/common/opUtils.h`:
- Around line 146-150: Rename the function hash_combine to hashCombine and
update every reference to it; rename the local constant seed to a k-prefixed
camelCase name such as kSeed while preserving its constexpr value and hashing
behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: e4806ae3-e58d-4e52-8762-d4839fa92f99

📥 Commits

Reviewing files that changed from the base of the PR and between e5a9953 and b45eb6d.

📒 Files selected for processing (2)
  • cpp/tensorrt_llm/common/opUtils.cpp
  • cpp/tensorrt_llm/common/opUtils.h

Comment thread cpp/tensorrt_llm/common/opUtils.h Outdated
Signed-off-by: Yihan Wang <yihwang@nvidia.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
cpp/tensorrt_llm/common/opUtils.h (1)

115-120: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Apply the repository naming and const conventions.

Rename hash_combine/hash_impl to lower camel case, hash_value to hashValue, and seed to a k-prefixed constant such as kHashCombineSeed. The copied-but-unmodified hash parameter should also be const.

Proposed adjustment
-inline size_t hash_combine(size_t hash, T const& value)
+inline size_t hashCombine(size_t const hash, T const& value)
 {
-    static constexpr size_t seed = 0x9e3779b9ULL;
+    static constexpr size_t kHashCombineSeed = 0x9e3779b9ULL;

As per coding guidelines, “local variables/functions/namespaces [use] lower camelCase,” unmodified variables are const, and constants use the k-prefixed convention.

Also applies to: 128-132, 141-145

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@cpp/tensorrt_llm/common/opUtils.h` around lines 115 - 120, Apply the naming
and const conventions consistently across hash_combine, hash_impl, and
hash_value: rename them to lower camel case (hashCombine, hashImpl, and
hashValue), make the unmodified hash parameter const, and rename the seed
constant to a k-prefixed name such as kHashCombineSeed. Update all references in
the affected hash utilities accordingly.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@cpp/tensorrt_llm/common/opUtils.h`:
- Around line 115-120: Apply the naming and const conventions consistently
across hash_combine, hash_impl, and hash_value: rename them to lower camel case
(hashCombine, hashImpl, and hashValue), make the unmodified hash parameter
const, and rename the seed constant to a k-prefixed name such as
kHashCombineSeed. Update all references in the affected hash utilities
accordingly.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: ee7bfc6f-e51c-45b6-84ea-19d3131703ec

📥 Commits

Reviewing files that changed from the base of the PR and between b45eb6d and 40f2f31.

📒 Files selected for processing (3)
  • cpp/tensorrt_llm/common/opUtils.cpp
  • cpp/tensorrt_llm/common/opUtils.h
  • cpp/tensorrt_llm/thop/attentionOp.cpp
🚧 Files skipped from review as they are similar to previous changes (1)
  • cpp/tensorrt_llm/thop/attentionOp.cpp

@yihwang-nv

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #61532 [ run ] triggered by Bot. Commit: 40f2f31 Link to invocation


namespace
{
using tensorrt_llm::common::op::hash;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move the new using tensorrt_llm::common::op::OpCustomHash; here inside anonymous namespace.

// CUDA resources are per-context and per-thread.
using CacheKey = std::tuple<CUcontext, std::thread::id>;
std::unordered_map<CacheKey, std::weak_ptr<T>, hash<CacheKey>>* mObservers;
using CacheTy = std::unordered_map<CacheKey, std::weak_ptr<T>, OpCustomHash<CacheKey>>;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use CacheType instead of CacheTy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants