Enable large scratch on GFX8.

Ensure system release fence is set on GFX8 large scratch using packets.

Change-Id: I13cfdcd35969482ea6e95e0b352f5cb3a0454b86


[ROCm/ROCR-Runtime commit: 5f25619bb7]
This commit is contained in:
Sean Keely
2018-04-20 18:09:50 -05:00
förälder e3f55212ed
incheckning 57cbf865ce
3 ändrade filer med 13 tillägg och 5 borttagningar
@@ -75,8 +75,7 @@ struct AqlPacket {
std::string string() const {
std::stringstream string;
uint8_t type = ((dispatch.header >> HSA_PACKET_HEADER_TYPE) &
((1 << HSA_PACKET_HEADER_WIDTH_TYPE) - 1));
uint8_t type = this->type();
const char* type_names[] = {
"HSA_PACKET_TYPE_VENDOR_SPECIFIC", "HSA_PACKET_TYPE_INVALID",
@@ -746,7 +746,7 @@ bool AqlQueue::DynamicScratchHandler(hsa_signal_value_t error_code, void* arg) {
uint64_t pkt_slot_idx =
queue->amd_queue_.read_dispatch_id & (queue->amd_queue_.hsa_queue.size - 1);
const core::AqlPacket& pkt =
core::AqlPacket& pkt =
((core::AqlPacket*)queue->amd_queue_.hsa_queue.base_address)[pkt_slot_idx];
uint32_t scratch_request = pkt.dispatch.private_segment_size;
@@ -771,8 +771,17 @@ bool AqlQueue::DynamicScratchHandler(hsa_signal_value_t error_code, void* arg) {
errorCode = HSA_STATUS_ERROR_OUT_OF_RESOURCES;
} else {
// Mark large scratch allocation for single use.
if (scratch.large)
if (scratch.large) {
queue->amd_queue_.queue_properties |= AMD_QUEUE_PROPERTIES_USE_SCRATCH_ONCE;
// Set system release fence to flush scratch stores with older firmware versions.
if ((queue->agent_->isa()->GetMajorVersion() == 8) &&
(queue->agent_->GetMicrocodeVersion() < 729)) {
pkt.dispatch.header &= ~(((1 << HSA_PACKET_HEADER_WIDTH_SCRELEASE_FENCE_SCOPE) - 1)
<< HSA_PACKET_HEADER_SCRELEASE_FENCE_SCOPE);
pkt.dispatch.header |=
(HSA_FENCE_SCOPE_SYSTEM << HSA_PACKET_HEADER_SCRELEASE_FENCE_SCOPE);
}
}
// Reset scratch memory related entities for the queue
queue->InitScratchSRD();
// Restart the queue.
@@ -976,7 +976,7 @@ void GpuAgent::AcquireQueueScratch(ScratchInfo& scratch) {
ScopedAcquire<KernelMutex> lock(&scratch_lock_);
bool large = (scratch.size > 6 * 1024 * 1024) ||
(scratch_pool_.size() - scratch_pool_.remaining() > 24 * 6 * 1024 * 1024);
large = (isa_->GetMajorVersion() < 9) ? false : large;
large = (isa_->GetMajorVersion() < 8) ? false : large;
if (large)
scratch.queue_base = scratch_pool_.alloc_high(scratch.size);
else