Skip to content

Commit 5c752df

Browse files
authored
[libomptarget][nextgen-plugin][NFC] Clean-up InputSignal checks (llvm#83458)
Clean-up InputSignal checks.
1 parent b1f2e19 commit 5c752df

File tree

1 file changed

+4
-24
lines changed
  • openmp/libomptarget/plugins-nextgen/amdgpu/src

1 file changed

+4
-24
lines changed

openmp/libomptarget/plugins-nextgen/amdgpu/src/rtl.cpp

+4-24
Original file line numberDiff line numberDiff line change
@@ -715,16 +715,12 @@ struct AMDGPUQueueTy {
715715
std::lock_guard<std::mutex> Lock(Mutex);
716716
assert(Queue && "Interacted with a non-initialized queue!");
717717

718-
// Avoid defining the input dependency if already satisfied.
719-
if (InputSignal && !InputSignal->load())
720-
InputSignal = nullptr;
721-
722718
// Add a barrier packet before the kernel packet in case there is a pending
723719
// preceding operation. The barrier packet will delay the processing of
724720
// subsequent queue's packets until the barrier input signal are satisfied.
725721
// No need output signal needed because the dependency is already guaranteed
726722
// by the queue barrier itself.
727-
if (InputSignal)
723+
if (InputSignal && InputSignal->load())
728724
if (auto Err = pushBarrierImpl(nullptr, InputSignal))
729725
return Err;
730726

@@ -1254,12 +1250,8 @@ struct AMDGPUStreamTy {
12541250
// Consume stream slot and compute dependencies.
12551251
auto [Curr, InputSignal] = consume(OutputSignal);
12561252

1257-
// Avoid defining the input dependency if already satisfied.
1258-
if (InputSignal && !InputSignal->load())
1259-
InputSignal = nullptr;
1260-
12611253
// Issue the async memory copy.
1262-
if (InputSignal) {
1254+
if (InputSignal && InputSignal->load()) {
12631255
hsa_signal_t InputSignalRaw = InputSignal->get();
12641256
return utils::asyncMemCopy(UseMultipleSdmaEngines, Dst, Agent, Src, Agent,
12651257
CopySize, 1, &InputSignalRaw,
@@ -1293,17 +1285,13 @@ struct AMDGPUStreamTy {
12931285
// Consume stream slot and compute dependencies.
12941286
auto [Curr, InputSignal] = consume(OutputSignals[0]);
12951287

1296-
// Avoid defining the input dependency if already satisfied.
1297-
if (InputSignal && !InputSignal->load())
1298-
InputSignal = nullptr;
1299-
13001288
// Setup the post action for releasing the intermediate buffer.
13011289
if (auto Err = Slots[Curr].schedReleaseBuffer(Inter, MemoryManager))
13021290
return Err;
13031291

13041292
// Issue the first step: device to host transfer. Avoid defining the input
13051293
// dependency if already satisfied.
1306-
if (InputSignal) {
1294+
if (InputSignal && InputSignal->load()) {
13071295
hsa_signal_t InputSignalRaw = InputSignal->get();
13081296
if (auto Err = utils::asyncMemCopy(
13091297
UseMultipleSdmaEngines, Inter, Agent, Src, Agent, CopySize, 1,
@@ -1361,12 +1349,8 @@ struct AMDGPUStreamTy {
13611349
// Consume stream slot and compute dependencies.
13621350
auto [Curr, InputSignal] = consume(OutputSignal);
13631351

1364-
// Avoid defining the input dependency if already satisfied.
1365-
if (InputSignal && !InputSignal->load())
1366-
InputSignal = nullptr;
1367-
13681352
// Issue the first step: host to host transfer.
1369-
if (InputSignal) {
1353+
if (InputSignal && InputSignal->load()) {
13701354
// The std::memcpy is done asynchronously using an async handler. We store
13711355
// the function's information in the action but it is not actually a
13721356
// post action.
@@ -1429,10 +1413,6 @@ struct AMDGPUStreamTy {
14291413
// Consume stream slot and compute dependencies.
14301414
auto [Curr, InputSignal] = consume(OutputSignal);
14311415

1432-
// Avoid defining the input dependency if already satisfied.
1433-
if (InputSignal && !InputSignal->load())
1434-
InputSignal = nullptr;
1435-
14361416
// The agents need to have access to the corresponding memory
14371417
// This is presently only true if the pointers were originally
14381418
// allocated by this runtime or the caller made the appropriate

0 commit comments

Comments
 (0)