Skip to content

feat(rocr): report signal hints in AQL_EXTENSIONS - #15083

Open
lmoriche wants to merge 1 commit into
developfrom
users/lmoriche/aql-ext-signal-hints
Open

lmoriche wants to merge 1 commit into
developfrom
users/lmoriche/aql-ext-signal-hints

Conversation

@lmoriche

@lmoriche lmoriche commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Motivation

ROCr reports the AQL extensions an agent supports in one attribute,
HSA_AMD_AGENT_INFO_AQL_EXTENSIONS, read with hsa_flag_isset64; the
ext kernel dispatch packet is reported there
(HSA_AMD_AQL_PROPERTY_EXT_DISPATCH). Completion signal handle hints
(#12988, #13273) are an AQL extension of the same kind, consumed by the
CP firmware, but #12988 gave them their own boolean query,
HSA_AMD_AGENT_INFO_SIGNAL_HINTS_SUPPORTED. This reports them as an AQL
extension instead and removes that query, so there is one way to ask.

Technical Details

rocr:

  • hsa_ext_amd.h: HSA_AMD_AQL_PROPERTY_SIGNAL_HINTS = (1 << 1) in
    hsa_amd_agent_aql_properties_t, next to
    HSA_AMD_AQL_PROPERTY_EXT_DISPATCH = (1 << 0). Interface version 1.39.
  • GpuAgent::GetAqlInfoProperties sets it when SignalHintsSupported():
    the CP firmware reports AMD_QUEUE_CAPS_CP_SIGNAL_HINTS in the utility
    queue's amd_queue_t.caps, probed once (std::call_once) on the first
    query. Reading the result through the accessor is race-free: every
    caller returns from call_once after the probe's write, so the first
    queries from several threads all see the same answer. The first
    AQL_EXTENSIONS query on a GPU agent now runs the probe (one empty
    barrier-AND on the utility queue), as the removed query did.
  • The flag follows the attribute's documented convention: set with
    setFlag(HSA_AMD_AQL_PROPERTY_SIGNAL_HINTS) and read with
    hsa_flag_isset64(value, HSA_AMD_AQL_PROPERTY_SIGNAL_HINTS), the enum
    value used as the bit index on both sides, as for EXT_DISPATCH (the
    bytes read 04 00 ... for hints, 02 00 ... for ext dispatch). The
    doxygen of hsa_amd_agent_aql_properties_t and
    HSA_AMD_AGENT_INFO_AQL_EXTENSIONS now says so: each enumerator's value
    is a bit index for hsa_flag_isset64, not a mask, and
    value[0] & HSA_AMD_AQL_PROPERTY_* tests another bit.
  • Removes HSA_AMD_AGENT_INFO_SIGNAL_HINTS_SUPPORTED (0xA129), added
    in interface 1.36 by feat(rocr): add signal handle hints and hsa_amd_signal_batch_create #12988: the enum value, its GetInfo case
    (hsa_agent_get_info now returns HSA_STATUS_ERROR_INVALID_ARGUMENT
    for it). No deprecated alias: 1.36-1.38 were never in a release, and the
    version history says so; the 1.36 line keeps the query with "(removed in
    1.39, never released)", and the 1.39 line states that it is removed
    without a deprecation period. 0xA129 is left unused, with a comment, so
    an old binary that still asks gets an error rather than another
    attribute's answer. hsa_amd_signal_set_hints and amd_hsa_signal.h
    now point to the new bit.
  • Release status: feat(rocr): add signal handle hints and hsa_amd_signal_batch_create #12988 (2026-10-16) is on develop and in the
    release/bkc/therock-10.3-20261027 snapshot (and the hip-version_10.3.*
    build tags), but in no release branch: release/therock-10.2 is at
    interface 1.35, and release/therock-10.1 and
    release/bkc/therock-10.2-20261013 do not contain it either. Removing
    the query breaks no released API; a binary built against develop
    1.36-1.38 headers that uses it gets INVALID_ARGUMENT (clr treats that
    as "no hints").
  • In-tree consumers of the removed query: none left. A grep of the whole
    repository finds no use in rocminfo, rocprofiler-sdk, rocprofiler,
    roctracer, rocr-debug-agent, rocdbgapi, the tools or any docs or
    CHANGELOG; the users were clr and rocrtst, both changed here, and the
    runtimes/ mirror below.

clr:

  • Device::populateOCLDeviceConstants reads signal-hint support from
    AQL_EXTENSIONS with hsa_flag_isset64. With a ROCr that does not
    report the bit (including develop before this change), hints stay off.
    Hints stay off with a profiler tool attached, as before.

rocrtst: signal_hints (functional) and signal_hint_cost (performance)
skip unless the agent reports the bit. signal_hints also checks that the
bit matches what the CP reports: it runs one barrier on a queue of its own
and compares AMD_QUEUE_CAPS_CP_SIGNAL_HINTS in that queue's caps with
hsa_flag_isset64(AQL_EXTENSIONS, HSA_AMD_AQL_PROPERTY_SIGNAL_HINTS), so
setFlag and hsa_flag_isset64 are checked to agree on the bit.

Not changed: runtimes/api-headers/include/hsa and the Rust
runtimes/ddi/libhsa provider mirror the AMD extension at revision 1.36
(they do not have 1.37/1.38 either) and answer 0xA129 with false; their
AQL_EXTENSIONS answer is all zero, consistent with "no hints". They
drop 0xA129 when they move to 1.39.

One commit: clr and rocrtst use the enum value the rocr header adds. The
change is mostly ROCr (the API, its runtime and its tests), with one clr
consumer, hence feat(rocr).

Issue Tracking

Test Plan

MI300X with CP firmware that reports AMD_QUEUE_CAPS_CP_SIGNAL_HINTS
(caps bit 2). ROCr, clr and rocrtst built from this branch (based on
develop bee2c57), ROCr and clr from develop bee2c57 (baseline),
against the ROCm 10.1 SDK:

  • An HSA program queries AQL_EXTENSIONS from 8 threads at once (the
    first, probing queries), reads both flags with hsa_flag_isset64, and
    checks that 0xA129 returns INVALID_ARGUMENT.
  • rocrtst rocrtstFunc.Signal_Hints_* and rocrtstPerf.Signal_Hint_Cost;
    the functional tests also on develop's ROCr (a ROCr whose bit does not
    match the caps: the negative control of the new check).
  • clr's init log (AMD_LOG_LEVEL=3, "Signal hints N (profiler tool: N)"):
    this branch; develop; this branch's clr on develop's ROCr; this branch
    under rocprofv3 --kernel-trace.
  • hip-tests Performance_PyFR_Couette_StepSimulation, 3 runs each,
    alternating this branch and develop.

Test Result

  • HSA program, this branch (3 runs): PASS. The 8 threads agree;
    AQL_EXTENSIONS = 04 00 00 00 00 00 00 00 (SIGNAL_HINTS 1,
    EXT_DISPATCH 0); 0xA129 returns INVALID_ARGUMENT.
  • rocrtst: the 3 Signal_Hints_* tests (with the bit-vs-caps check) and
    Signal_Hint_Cost pass on this branch (run, not skipped). On develop's
    ROCr the bit-vs-caps check fails as intended (caps bit 2 set, the bit not
    reported), and the hint subtests skip.
  • clr: "Signal hints 1 (profiler tool: 0)" on this branch and on develop;
    "Signal hints 0" with this branch's clr on develop's ROCr and under
    rocprofv3 (profiler tool: 1).
  • StepSimulation: 0.477 ms per step on this branch (953.5-954.5 ms
    total), 0.477-0.478 ms on develop (954.4-955.9 ms).

Submission Checklist

@therock-pr-bot

therock-pr-bot Bot commented Nov 5, 2026

Copy link
Copy Markdown

✅ All Policy Checks Passed

Check Status Details
📝 PR Description ✅ Pass —
⛔ Forbidden Files ✅ Pass —
🧪 Unit Test ⚠️ Warning Error: Source/code files changed without an accompanying unit test.
Expected: add at least one test file named like test_<name>.py / test_<name>.cpp (or <name>_test.*).
Current: code file(s) changed: projects/clr/rocclr/device/rocm/rocdevice.cpp, projects/rocr-runtime/rocrtst/suites/functional/signal_hints.cc, projects/rocr-runtime/rocrtst/suites/functional/signal_hints.h, projects/rocr-runtime/rocrtst/suites/performance/signal_hint_cost.cc, projects/rocr-runtime/rocrtst/suites/performance/signal_hint_cost.h (+3 more); no test file found
🚫 Draft PR 🔜 To Be Enabled —
🚩 Feature Flag 🔜 To Be Enabled —
📊 Code Coverage 🔜 To Be Enabled —

🎉 All policy checks passed!

📖 Need help? See the Policy FAQ for details on every check and how to fix failures.

🙋 Wish to Override Policy?

@lmoriche
lmoriche marked this pull request as ready for review November 5, 2026 06:27

@mangupta mangupta 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.

🤖 AI-assisted pre-review (for @mangupta)

@cfreeamd cfreeamd 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.

🤖 AI-assisted pre-review (for @cfreeamd)

[Required] Title format: feat(clr,rocr): report signal hints in AQL_EXTENSIONS has a multi-component scope (clr,rocr). ROCm squash-merges, so the PR title becomes the permanent commit title. With 7 ROCr files and 1 CLR file, consider feat(rocr): if ROCr is the primary change, or confirm feat(clr,rocr): is an intentional multi-scope form accepted in this repo. Single-component form (feat(rocr):) is the documented convention.

@lmoriche lmoriche changed the title feat(clr,rocr): report signal hints in AQL_EXTENSIONS feat(rocr): report signal hints in AQL_EXTENSIONS Nov 5, 2026
@lmoriche
lmoriche force-pushed the users/lmoriche/aql-ext-signal-hints branch from 395ae13 to 5933b8b Compare November 5, 2026 20:38
@lmoriche

lmoriche commented Nov 5, 2026

Copy link
Copy Markdown
Contributor Author

@cfreeamd (re: the title): Changed to feat(rocr): report signal hints in AQL_EXTENSIONS (title and
commit subject): the change is the ROCr API, its runtime and its tests,
with one clr consumer.

rocr: add HSA_AMD_AQL_PROPERTY_SIGNAL_HINTS (1 << 1) to
hsa_amd_agent_aql_properties_t, next to
HSA_AMD_AQL_PROPERTY_EXT_DISPATCH. GetAqlInfoProperties sets it in
HSA_AMD_AGENT_INFO_AQL_EXTENSIONS when SignalHintsSupported(): the CP
firmware reports AMD_QUEUE_CAPS_CP_SIGNAL_HINTS, read once from the
utility queue's caps. As for EXT_DISPATCH, the enumerator's value is
the bit index (setFlag, hsa_flag_isset64), not a mask; the header now
documents this for the enum and the attribute.

The bit replaces HSA_AMD_AGENT_INFO_SIGNAL_HINTS_SUPPORTED (0xA129,
added in 1.36 by #12988), which is removed without an alias:
1.36-1.38 were never in a release, as the version history now says.
agent_get_info returns HSA_STATUS_ERROR_INVALID_ARGUMENT for 0xA129,
which is left unused. Interface version 1.39.

clr: the device reads signal-hint support from AQL_EXTENSIONS with
hsa_flag_isset64. With a runtime that does not report the bit, hints
stay off. Hints stay off with a profiler tool attached.

rocrtst: signal_hints and signal_hint_cost skip unless the agent
reports the bit; signal_hints checks that the bit matches the caps
the CP reports on a queue of its own.
@lmoriche
lmoriche force-pushed the users/lmoriche/aql-ext-signal-hints branch from 5933b8b to 2cc65d9 Compare November 5, 2026 20:43
@lmoriche
lmoriche requested a review from a team November 5, 2026 20:46
setFlag(HSA_AMD_AQL_PROPERTY_EXT_DISPATCH);

// Fill the HSA_AMD_AQL_PROPERTY_SIGNAL_HINTS
if (SignalHintsSupported())

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.

[shwetakReviewAgent] automated review on behalf of @shwetagkhatri.
GetAqlInfoProperties now reaches SignalHintsSupported, so the first AQL_EXTENSIONS query submits a barrier-AND and waits with HSA_WAIT_STATE_ACTIVE and an infinite timeout, where the base commit did no GPU work.

@cfreeamd cfreeamd 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.

🤖 AI-assisted pre-review (for @cfreeamd) — follow-up: one new inline question on the first AQL_EXTENSIONS query (see inline).

setFlag(HSA_AMD_AQL_PROPERTY_EXT_DISPATCH);

// Fill the HSA_AMD_AQL_PROPERTY_SIGNAL_HINTS
if (SignalHintsSupported())

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.

🤖 AI-assisted pre-review (for @cfreeamd)

[Question] GetAqlInfoProperties is now on the SignalHintsSupported() path, so the first HSA_AMD_AGENT_INFO_AQL_EXTENSIONS query materialises the lazily-created utility queue, submits a barrier-AND and blocks in WaitAcquire(..., UINT64_MAX, HSA_WAIT_STATE_ACTIVE). Previously this attribute did no GPU work, and only the dedicated (now removed) attribute paid that cost — callers who never cared about hints (e.g. generic agent-info dumps such as rocminfo) now pay it too, and a hung/resetting GPU turns an agent-info query into an unbounded busy-wait.

Could the capability be cached at queue-create / agent init (or the wait given a bounded timeout with a fall-back to false) so that an info query can't block on the device? If the on-demand cost is intentional, a note on the attribute doc that the first query may block would help.

@mangupta

mangupta commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

🤖 AI-assisted pre-review (for @mangupta)

Re-reviewed the updated head (2cc65d93ad74) — no new findings at or above the posting threshold.

This branch has not been deployed

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants