Skip to content

Commit 38eda2a

Browse files
committed
fix: flush frozen state for regular blocks
1 parent 9c63b3e commit 38eda2a

3 files changed

Lines changed: 20 additions & 0 deletions

File tree

src/rdpq/rdpq.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -614,6 +614,9 @@ extern inline void __rdpq_tracking_state_reset(rdpq_tracking_t *state);
614614
/** @brief Autosync engine: mark certain resources as in use */
615615
extern inline void __rdpq_autosync_use(uint32_t res);
616616

617+
/** @brief Flush stale frozen-block DMEM state before a block CALL is enqueued */
618+
extern inline void __rdpq_block_run_prepare(rdpq_block_t *block);
619+
617620
/**
618621
* @brief Autosync engine: mark certain resources as being changed.
619622
*

src/rdpq/rdpq_internal.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,19 @@ inline void __rdpq_autosync_use(uint32_t res)
234234
__rdpq_frozen_flush_pending_mode();
235235
}
236236
}
237+
238+
/**
239+
* @brief Notify the rdpq engine that a rspq block is about to run, before its CALL command is enqueued.
240+
* This intern *may* flush out pending DMEM states form a frozen blocks
241+
*/
242+
inline void __rdpq_block_run_prepare(rdpq_block_t *block)
243+
{
244+
if (__builtin_expect(
245+
__rdpq_frozen_dmem_pending && !block->frozen && !rdpq_block_state.frozen, 0)
246+
) {
247+
__rdpq_frozen_sync_dmem(RDPQ_WRITE_READS_RDP_STATE);
248+
}
249+
}
237250
void __rdpq_autosync_change(uint32_t res);
238251

239252
void __rdpq_write8(uint32_t cmd_id, uint32_t arg0, uint32_t arg1);

src/rspq/rspq.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1430,6 +1430,10 @@ void rspq_block_run(rspq_block_t *block)
14301430

14311431
assertf(block->nesting_level < block->min_ph_level, "Block nesting level overlaps with used placeholders");
14321432

1433+
// flush any pending DMEM state out (e.g. a frozen block ran before we now submit a normal block)
1434+
if (block->rdp_block)
1435+
__rdpq_block_run_prepare(block->rdp_block);
1436+
14331437
// Write the CALL op. The second argument is the nesting level
14341438
// which is used as stack slot in the RSP to save the current
14351439
// pointer position.

0 commit comments

Comments
 (0)