SWDEV-469825 - Modified the kernel argument readback to use a pointer to volatile

This change modifies the readback mechanism to use a pointer to volatile
instead of a volatile pointer. This ensures that the compiler does not
optimize away the read operation.

Change-Id: I79ff925d615aa8cc4f950e8ff4b7e608fcb179a4


[ROCm/clr commit: ea50d2c0c2]
Этот коммит содержится в:
Ioannis Assiouras
2024-07-05 13:01:49 +01:00
родитель 0678768fd3
Коммит 376da06e2f
2 изменённых файлов: 4 добавлений и 3 удалений
+2 -2
Просмотреть файл
@@ -469,11 +469,11 @@ hipError_t GraphExec::CaptureAQLPackets() {
kernarg_graph_.back().kernarg_pool_addr_ != 0) {
address dev_ptr = kernarg_graph_.back().kernarg_pool_addr_ +
kernarg_graph_.back().kernarg_pool_size_;
auto kSentinel = *reinterpret_cast<volatile address>(dev_ptr - 1);
auto kSentinel = *reinterpret_cast<volatile unsigned char*>(dev_ptr - 1);
_mm_sfence();
*(dev_ptr - 1) = kSentinel;
_mm_mfence();
kSentinel = *reinterpret_cast<volatile address>(dev_ptr - 1);
kSentinel = *reinterpret_cast<volatile unsigned char*>(dev_ptr - 1);
}
}
}
+2 -1
Просмотреть файл
@@ -3259,7 +3259,8 @@ bool VirtualGPU::submitKernelInternal(const amd::NDRangeContainer& sizes,
_mm_sfence();
*(argBuffer + argSize - 1) = *(parameters + argSize - 1);
_mm_mfence();
auto kSentinel = *reinterpret_cast<volatile address>(argBuffer + argSize - 1);
auto kSentinel = *reinterpret_cast<volatile unsigned char*>(
argBuffer + argSize - 1);
}
}
}