Skip to content

Name the real AITER kwargs in the dlopen hints - #342

Merged
demandal25 merged 3 commits into
amd-integrationfrom
aiter-hint-kwargs
Sep 1, 2026
Merged

Name the real AITER kwargs in the dlopen hints#342
demandal25 merged 3 commits into
amd-integrationfrom
aiter-hint-kwargs

Conversation

@demandal25

Copy link
Copy Markdown
Collaborator

Summary

The three dlopen-failure hints in aiter_loader.cc tell the reader to call an AITER entry point "with matching (dtype=..., is_causal=..., has_lse=...)". has_lse is not a parameter of any of them, so someone debugging a missing .so follows the hint and gets a TypeError rather than the JIT build they wanted. Raised as suppressed comments on #339 after it merged.

Verified against the installed amd-aiter 0.1.20 wheel rather than the review text:

mha_fwd                 aiter/ops/mha.py:209   return_softmax_lse: bool,
mha_varlen_fwd          aiter/ops/mha.py:933   return_softmax_lse: bool,
mha_batch_prefill_func  aiter/ops/mha.py:3885  return_lse=False,

dtype is the same defect one step further, which the review did not reach: it is not a keyword either — it comes from the q/k/v tensors. Relabelled q dtype so everything inside the parentheses is a real keyword and the next reader is not misled by a mixed list.

This is the second round of the same class on this file; #339 corrected causal vs is_causal. The cause is that the hint reads as prose while being a literal call recipe.

What changed

  • csrc/rocm/aiter_loader.cchas_lse= becomes return_softmax_lse= for the mha_fwd and mha_varlen_fwd hints and return_lse= for mha_batch_prefill_func; dtype= becomes q dtype= in all three. Error-message text only, no behaviour change.

Test plan

  • Each keyword read off the installed 0.1.20 wheel in the ROCm 10.0 container, not from a source checkout.
  • pre-commit run -a.
  • No test covers these strings — they are the text of a std::runtime_error raised only when a variant .so is absent.

Every hint told the reader to call an AITER entry point "with matching
(dtype=..., is_causal=..., has_lse=...)", and has_lse is not a parameter of
any of the three. Someone debugging a missing .so follows the hint and gets a
TypeError instead of a build. Measured against the installed 0.1.20 wheel:

    mha_fwd                 aiter/ops/mha.py:209   return_softmax_lse: bool,
    mha_varlen_fwd          aiter/ops/mha.py:933   return_softmax_lse: bool,
    mha_batch_prefill_func  aiter/ops/mha.py:3885  return_lse=False,

dtype is the same defect one step further, which the review did not reach: it
is not a keyword either, it comes from the q/k/v tensors. Relabelled "q dtype"
so the parenthesised list is uniformly real keywords.

This class keeps recurring because the hint reads as prose while being a
literal call recipe. #339 already corrected causal vs is_causal here.
Copilot AI lite review requested due to automatic review settings September 1, 2026 01:33

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Updates the ROCm AITER loader’s dlopen-failure hint strings so they reference the actual AITER keyword arguments, avoiding misleading “copy/paste” call recipes that can throw TypeError instead of triggering AITER’s lazy JIT build.

Changes:

  • Replace the non-existent has_lse= hint with return_softmax_lse= for mha_fwd / mha_varlen_fwd.
  • Replace has_lse= with return_lse= for mha_batch_prefill_func.
  • Relabel dtype= to q dtype= in all three hints to reflect that dtype is inferred from tensor inputs rather than passed as a keyword.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Copilot AI review requested due to automatic review settings September 1, 2026 01:35

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.

Suppressed comments (2)

csrc/rocm/aiter_loader.cc:194

  • The hint now uses q dtype=..., which still reads like a Python keyword argument assignment (and even uses an =) even though the dtype comes from the q/k/v tensors. Consider changing this to a non-assignment form (e.g., q dtype: fp16) to avoid implying a callable kwarg.
    return "  Hint: trigger AITER's lazy JIT build by importing aiter.ops.mha and "
           "calling mha_varlen_fwd with matching (q dtype=" +
           std::string(key.dtype == VariantKey::Dtype::kFp16 ? "fp16" : "bf16") +

csrc/rocm/aiter_loader.cc:207

  • The hint now uses q dtype=..., which still reads like a Python keyword argument assignment even though the dtype comes from the q/k/v tensors. Consider changing this to a non-assignment form (e.g., q dtype: fp16) to avoid implying q dtype is a kwarg.
        return "  Hint: trigger AITER's lazy JIT build by calling "
               "aiter.ops.mha.mha_batch_prefill_func() once with matching (q dtype=" +
               std::string(key.dtype == VariantKey::Dtype::kFp16 ? "fp16" : "bf16") +

Comment thread csrc/rocm/aiter_loader.cc
"q dtype=fp16" still sat inside a parenthesised list of real keywords with an
=, so it read as a kwarg -- the same ambiguity this branch set out to remove,
just one step smaller. A colon separates it from the keywords beside it.
Copilot AI review requested due to automatic review settings September 1, 2026 01:54
@demandal25

Copy link
Copy Markdown
Collaborator Author

Suppressed comments, review 5073132011 (2) — same finding as the inline thread, fixed in 8b56e86a4: q dtype= becomes q dtype: in all three hints, so the = forms inside the parentheses are all real keywords.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

@demandal25
demandal25 merged commit 00945c0 into amd-integration Sep 1, 2026
3 checks passed
@demandal25
demandal25 deleted the aiter-hint-kwargs branch September 1, 2026 01:59
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.

2 participants