SWDEV-508004 - Improve hipEventRecord
- Resolve stream once for event record. We should avoid calling
getStream again in addMarker
Change-Id: I78448c4f151ae10a5c8e8c248b2f4078b84191cb
[ROCm/clr commit: a22c45d635]
Dieser Commit ist enthalten in:
@@ -237,7 +237,9 @@ hipError_t Event::recordCommand(amd::Command*& command, amd::HostQueue* stream,
|
||||
// ================================================================================================
|
||||
hipError_t Event::enqueueRecordCommand(hipStream_t stream, amd::Command* command, bool record) {
|
||||
command->enqueue();
|
||||
if (event_ == &command->event()) return hipSuccess;
|
||||
if (event_ == &command->event()) {
|
||||
return hipSuccess;
|
||||
}
|
||||
if (event_ != nullptr) {
|
||||
event_->release();
|
||||
}
|
||||
@@ -250,7 +252,9 @@ hipError_t Event::enqueueRecordCommand(hipStream_t stream, amd::Command* command
|
||||
// ================================================================================================
|
||||
hipError_t Event::addMarker(hipStream_t stream, amd::Command* command,
|
||||
bool record, bool batch_flush) {
|
||||
hip::Stream* hip_stream = hip::getStream(stream);
|
||||
// Skip wait as we should not be resolving stream in this sub
|
||||
constexpr bool kSkipWait = true;
|
||||
hip::Stream* hip_stream = hip::getStream(stream, kSkipWait);
|
||||
// Keep the lock always at the beginning of this to avoid a race. SWDEV-277847
|
||||
amd::ScopedLock lock(lock_);
|
||||
hipError_t status = recordCommand(command, hip_stream, 0, batch_flush);
|
||||
|
||||
@@ -106,7 +106,6 @@ class Event {
|
||||
|
||||
Event(uint32_t flags) : flags_(flags), lock_(true) /* hipEvent_t lock*/,
|
||||
event_(nullptr), unrecorded_(false), stream_(nullptr) {
|
||||
// No need to init event_ here as addMarker does that
|
||||
device_id_ = hip::getCurrentDevice()->deviceId(); // Created in current device ctx
|
||||
}
|
||||
|
||||
|
||||
@@ -97,7 +97,7 @@ Heap::SortedMap::iterator Heap::EraseAllocaton(Heap::SortedMap::iterator& it) {
|
||||
const device::Memory* dev_mem = memory->getDeviceMemory(*device_->devices()[0]);
|
||||
void* dev_mem_vaddr = reinterpret_cast<void*>(dev_mem->virtualAddress());
|
||||
total_size_ -= it->first.first;
|
||||
|
||||
|
||||
if (dev_mem_vaddr != nullptr) {
|
||||
amd::SvmBuffer::free(memory->getContext(), dev_mem_vaddr);
|
||||
} else {
|
||||
|
||||
In neuem Issue referenzieren
Einen Benutzer sperren