SWDEV-364604 - Add support for hipEventDisableSystemFence

Change-Id: I1a6451c873fb22729ac61e4e80f8531251e990f0


[ROCm/clr commit: 7fc5ae2226]
Bu işleme şunda yer alıyor:
Saleel Kudchadker
2023-01-20 15:35:25 -08:00
ebeveyn 24bf83f808
işleme 9fdbbe53dc
3 değiştirilmiş dosya ile 33 ekleme ve 12 silme
+16 -10
Dosyayı Görüntüle
@@ -222,13 +222,12 @@ hipError_t Event::recordCommand(amd::Command*& command, amd::HostQueue* stream,
uint32_t ext_flags ) {
if (command == nullptr) {
int32_t releaseFlags = ((ext_flags == 0) ? flags : ext_flags) &
(hipEventReleaseToSystem | hipEventReleaseToDevice);
if (releaseFlags & hipEventReleaseToDevice) {
releaseFlags = amd::Device::kCacheStateAgent;
} else if (releaseFlags & hipEventReleaseToSystem) {
releaseFlags = amd::Device::kCacheStateSystem;
} else {
(hipEventReleaseToDevice | hipEventReleaseToSystem |
hipEventDisableSystemFence);
if (releaseFlags & hipEventDisableSystemFence) {
releaseFlags = amd::Device::kCacheStateIgnore;
} else {
releaseFlags = amd::Device::kCacheStateInvalid;
}
// Always submit a EventMarker.
command = new hip::EventMarker(*stream, !kMarkerDisableFlush, true, releaseFlags);
@@ -279,14 +278,21 @@ bool isValid(hipEvent_t event) {
// ================================================================================================
hipError_t ihipEventCreateWithFlags(hipEvent_t* event, unsigned flags) {
unsigned supportedFlags = hipEventDefault | hipEventBlockingSync | hipEventDisableTiming |
hipEventReleaseToDevice | hipEventReleaseToSystem | hipEventInterprocess;
hipEventReleaseToDevice | hipEventReleaseToSystem |
hipEventInterprocess | hipEventDisableSystemFence;
const unsigned releaseFlags = (hipEventReleaseToDevice | hipEventReleaseToSystem);
const unsigned releaseFlags = (hipEventReleaseToDevice | hipEventReleaseToSystem |
hipEventDisableSystemFence);
// can't set any unsupported flags.
// can't set both release flags
// can set only one of the release flags.
// if hipEventInterprocess flag is set, then hipEventDisableTiming flag also must be set
const bool illegalFlags = (flags & ~supportedFlags) ||
((flags & releaseFlags) == releaseFlags) ||
([](unsigned int num){
unsigned int bitcount;
for (bitcount = 0; num; bitcount++) {
num &= num - 1;
}
return bitcount; } (flags & releaseFlags) > 1) ||
((flags & hipEventInterprocess) && !(flags & hipEventDisableTiming));
if (!illegalFlags) {
hip::Event* e = nullptr;
+9 -2
Dosyayı Görüntüle
@@ -388,11 +388,18 @@ hipError_t ihipModuleLaunchKernel(hipFunction_t f, uint32_t globalWorkSizeX,
}
}
command->enqueue();
if (stopEvent != nullptr) {
hip::Event* eStop = reinterpret_cast<hip::Event*>(stopEvent);
if (eStop->flags & hipEventDisableSystemFence) {
command->setEventScope(amd::Device::kCacheStateIgnore);
} else {
command->setEventScope(amd::Device::kCacheStateSystem);
}
// Enqueue Dispatch and bind the stop event
command->enqueue();
eStop->BindCommand(*command, false);
} else {
command->enqueue();
}
if (command->status() == CL_INVALID_OPERATION) {
+8
Dosyayı Görüntüle
@@ -225,6 +225,14 @@ void iHipWaitActiveStreams(hip::Stream* blocking_stream, bool wait_null_stream)
command->enqueue();
command->release();
}
//Reset the dirty flag for all streams now that the marker is submitted
for (const auto& stream : streamSet) {
amd::HostQueue* active_queue = stream->asHostQueue();
if (active_queue->vdev()->isFenceDirty()) {
active_queue->vdev()->resetFenceDirty();
}
}
}
// Release all active commands. It's safe after the marker was enqueued