Archived
aql: the prefetch stream takes the half-lap system acquire too
The expert-prefetch stream (rad_xp_stream_create, agent_only) downgraded every system-scope acquire to agent scope because it reads no host-written data. Its kernel arguments are host-written into its own ring, though: after a wrap, an agent-scope acquire leaves the slot's old line in the L2 and the launch runs with the previous lap's arguments. Keep the exemption for host writes and epochs; take the system acquire on the ring's half lap (one in 2048 prefetch launches). New device test: launches on a prefetch stream across three ring laps read their own arguments -- 8709 of 12805 stale without the fix, 0 with it. Fixes #491 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
01f08152dc
commit
946a6f9e2b
2 files changed
+33
-3
No files matched your search
+7
-3
@@ -1245,9 +1245,13 @@ inline int acquire_scope(Stream* s, uint64_t idx, bool forced, bool* asked) {
|
||||
if (*asked) {
|
||||
s->last_sys_acq = (int64_t)idx;
|
||||
s->epoch = ep;
|
||||
/* The prefetch stream reads nothing the host writes; a system acquire there would only
|
||||
* invalidate the L2 under the compute stream. */
|
||||
if (s->agent_only && !forced) return HSA_FENCE_SCOPE_AGENT;
|
||||
/* The prefetch stream reads no data the host writes, so a host write or epoch does not
|
||||
* make it acquire at system scope (that would only invalidate the L2 under the compute
|
||||
* stream). Its own kernel arguments are host-written into its ring like any stream's,
|
||||
* though: after the ring laps, an agent-scope acquire leaves the slot's old line in the
|
||||
* L2 and a launch could run with the previous lap's arguments. The half lap keeps the
|
||||
* system acquire: one in 2048 prefetch launches. */
|
||||
if (s->agent_only && !forced && !lap) return HSA_FENCE_SCOPE_AGENT;
|
||||
return HSA_FENCE_SCOPE_SYSTEM;
|
||||
}
|
||||
return HSA_FENCE_SCOPE_AGENT;
|
||||
|
||||
Reference in new issue
Block a user