Invalidate caches after allocating a code object

Due to a misinterpretation of the HSA specification the microcode has,
until now, been responsible for ensuring a coherent view of the
amd_kernel_code_t object when acquire_fence_scope is set to agent or system.
To correct this the runtime must instead assume this responsibility.

Introduce GpuAgentInt::InvalidateCodeCaches to perform this operation
on-demand. Invoke this after code object allocation. Extend the Queue
implementations to support PM4 command submission, through which the
PM4 command ACQUIRE_MEM can be submitted to perform cache invalidation.
Submit through a runtime-managed queue shared with the blit implementation.

This change depends on microcode support and this is checked against the
running version. Older microcode builds will perform cache invalidation
themselves, so it is acceptable for this change to do nothing in that case.

Change-Id: I268dd2b83af3decdd9ad07430a81df8a2ecb6bd2
Tá an tiomantas seo le fáil i:
Jay Cornwall
2016-07-27 12:39:40 -05:00
tuismitheoir d2a4629c55
tiomantas f76577ae43
D'athraigh 8 comhad le 253 breiseanna agus 2 scriosta
+3
Féach ar an gComhad
@@ -300,6 +300,9 @@ class Queue : public Checked<0xFA3906A679F9DB49>,
virtual hsa_status_t SetCUMasking(const uint32_t num_cu_mask_count,
const uint32_t* cu_mask) = 0;
// @brief Submits a block of PM4 and waits until it has been executed.
virtual void ExecutePM4(uint32_t* cmd_data, size_t cmd_size_b) = 0;
// Handle of AMD Queue struct
amd_queue_t& amd_queue_;