public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Jeremy Newton <alexjnewt@hotmail.com>
To: git-commits@fedoraproject.org
Subject: [rpms/rocclr] f44: Backport memory leak fix
Date: Mon, 16 Nov 2026 23:07:19 GMT [thread overview]
Message-ID: <179487043911.1.2921527533937279340.rpms-rocclr-85d677968e21@fedoraproject.org> (raw)
A new commit has been pushed.
Repo : rpms/rocclr
Branch : f44
Commit : 85d677968e2161355c746cc31cf8379f6c3a75df
Author : Jeremy Newton <alexjnewt@hotmail.com>
Date : 2026-11-16T17:59:04-05:00
Stats : +136/-0 in 4 file(s)
URL : https://src.fedoraproject.org/rpms/rocclr/c/85d677968e2161355c746cc31cf8379f6c3a75df?branch=f44
Log:
Backport memory leak fix
Signed-off-by: Jeremy Newton <alexjnewt@hotmail.com>
---
diff --git a/6ec7540e14de9ff80cdd375eb6f2eda8b5c5cda9.patch b/6ec7540e14de9ff80cdd375eb6f2eda8b5c5cda9.patch
new file mode 100644
index 0000000..ada7442
--- /dev/null
+++ b/6ec7540e14de9ff80cdd375eb6f2eda8b5c5cda9.patch
@@ -0,0 +1,61 @@
+From: Yeongjun Yoon
+Subject: [PATCH 3/3] clr: drain the direct-dispatch submission batch with a dedicated marker (backport of the HostQueue change in rocm-systems 6ec7540e / PR #4671 to rocm-7.1.1)
+
+Backport of the submission-batch part of ROCm/rocm-systems commit
+6ec7540e14de9ff80cdd375eb6f2eda8b5c5cda9 (#4671; original author as recorded
+in that commit). Over DEBUG_CLR_MAX_BATCH_SIZE, HostQueue::FlushSubmissionBatch()
+enqueues an internal marker whose completion handler releases the whole batch,
+as in rocm-7.2.4. Without it, a loop of synchronous hipMemcpy calls never drains
+the batch (ROCm/legacy-rocm-build#6573).
+
+Not a literal cherry-pick: the final rocm-7.2.4 behaviour is ported to the 7.1.1
+code, which lacks intermediate code present in the commit's parent. The
+rocvirtual.cpp hunk of 6ec7540e is covered by PATCH 2/3 and is not repeated.
+Files: rocclr/platform/commandqueue.hpp, commandqueue.cpp, command.cpp.
+Independent of PATCH 1/3 and 2/3.
+
+--- a/rocclr/platform/commandqueue.hpp
++++ b/rocclr/platform/commandqueue.hpp
+@@ -286,11 +286,7 @@
+ }
+
+ //! Flushes submitted commands if the batch size significantly grew
+- void FlushSubmissionBatch(Command* command) {
+- if (size_ > DEBUG_CLR_MAX_BATCH_SIZE) {
+- command->notifyCmdQueue();
+- }
+- }
++ void FlushSubmissionBatch();
+ //! Reset the command batch list
+ void ResetSubmissionBatch() {
+ head_ = nullptr;
+--- a/rocclr/platform/commandqueue.cpp
++++ b/rocclr/platform/commandqueue.cpp
+@@ -141,6 +141,16 @@
+ return true;
+ }
+
++void HostQueue::FlushSubmissionBatch() {
++ if (size_ > DEBUG_CLR_MAX_BATCH_SIZE) {
++ auto marker = new Marker(*this, false);
++ if (marker != nullptr) {
++ marker->enqueue();
++ marker->release();
++ }
++ }
++}
++
+ void HostQueue::finishCommand(Command* command) {
+ if (command == nullptr) {
+ command = getLastQueuedCommand(true);
+--- a/rocclr/platform/command.cpp
++++ b/rocclr/platform/command.cpp
+@@ -396,7 +396,7 @@
+ queue_->ResetSubmissionBatch();
+ } else {
+ submit(*queue_->vdev());
+- queue_->FlushSubmissionBatch(this);
++ queue_->FlushSubmissionBatch();
+ }
+ } else {
+ queue_->append(*this);
diff --git a/839fb957173fcef0fc29dcd0f7efaab1a797a4b2.patch b/839fb957173fcef0fc29dcd0f7efaab1a797a4b2.patch
new file mode 100644
index 0000000..bf0b8c1
--- /dev/null
+++ b/839fb957173fcef0fc29dcd0f7efaab1a797a4b2.patch
@@ -0,0 +1,39 @@
+From: Yeongjun Yoon
+Subject: [PATCH 1/3] clr: Do not increase signal pool (backport of rocm-systems 839fb957 / PR #1354 to rocm-7.1.1)
+
+Backport of ROCm/rocm-systems commit 839fb957173fcef0fc29dcd0f7efaab1a797a4b2
+("clr: Do not increase signal pool", #1354; original author as recorded in that commit),
+rebased from projects/clr/ to the clr-7.1.1 tarball layout. No functional change
+beyond the upstream commit.
+
+The +2 peek in HwQueueTracker::ActiveSignal() also treated a completed signal whose
+flags_.done_ was never set as busy. In 7.1.x done_ is only set when the host waited on a
+still-busy signal (CpuWaitForSignal) or a Timestamp was processed, so a signal that
+completed before any host wait stays !done_ forever; once it sits at +2, every later call
+inserts a new ProfilingSignal + HSA signal in front of it and nothing is reused until the
+queue is destroyed (ROCr signal pool about 128 B per signal, plus roughly 250-330 B of heap).
+
+diff --git a/rocclr/device/rocm/rocvirtual.cpp b/rocclr/device/rocm/rocvirtual.cpp
+--- a/rocclr/device/rocm/rocvirtual.cpp
++++ b/rocclr/device/rocm/rocvirtual.cpp
+@@ -435,10 +435,8 @@ hsa_signal_t VirtualGPU::HwQueueTracker::ActiveSignal(hsa_signal_value_t init_va
+ // Peep signal +2 ahead to see if its done
+ auto temp_id = (current_id_ + 2) % signal_list_.size();
+
+- // If GPU is still busy with processing or if timestamps havent been saved out,
+- // then add more signals to avoid more frequent stalls
+- if (Hsa::signal_load_relaxed(signal_list_[temp_id]->signal_) > 0 ||
+- !signal_list_[temp_id]->flags_.done_) {
++ // If GPU is still busy with processing, then add more signals to avoid more frequent stalls
++ if (Hsa::signal_load_relaxed(signal_list_[temp_id]->signal_) > 0) {
+ std::unique_ptr<ProfilingSignal> signal(new ProfilingSignal());
+ if ((signal != nullptr) && CreateSignal(signal.get())) {
+ // Find valid new index
+@@ -457,7 +455,6 @@ hsa_signal_t VirtualGPU::HwQueueTracker::ActiveSignal(hsa_signal_value_t init_va
+ // Make sure the previous operation on the current signal is done
+ WaitCurrent();
+
+- size_t next = (current_id_ + 1) % signal_list_.size();
+ // Have to wait the next signal in the queue to avoid a race condition between
+ // a GPU waiter(which may be not triggered yet) and CPU signal reset below
+ WaitNext();
diff --git a/bf75609a3fe6033daeef52b7792bb66e612cb4ae.patch b/bf75609a3fe6033daeef52b7792bb66e612cb4ae.patch
new file mode 100644
index 0000000..65baf95
--- /dev/null
+++ b/bf75609a3fe6033daeef52b7792bb66e612cb4ae.patch
@@ -0,0 +1,25 @@
+From: Yeongjun Yoon
+Subject: [PATCH 2/3] clr: Create the new signal of proper type during the signal swap (backport of rocm-systems bf75609a / PR #4653 to rocm-7.1.1)
+
+Backport of ROCm/rocm-systems commit bf75609a3fe6033daeef52b7792bb66e612cb4ae
+(#4653; original author as recorded in that commit), rebased to the clr-7.1.1
+tarball layout. Applies on top of PATCH 1/3.
+
+When the current slot is still referenced, the replacement signal was always created as a
+non-interrupt signal; this creates it with the proper type.
+
+diff --git a/rocclr/device/rocm/rocvirtual.cpp b/rocclr/device/rocm/rocvirtual.cpp
+--- a/rocclr/device/rocm/rocvirtual.cpp
++++ b/rocclr/device/rocm/rocvirtual.cpp
+@@ -467,7 +467,10 @@ hsa_signal_t VirtualGPU::HwQueueTracker::ActiveSignal(hsa_signal_value_t init_va
+ // The signal was assigned to the global marker's event, hence runtime can't reuse it
+ // and needs a new signal
+ std::unique_ptr<ProfilingSignal> signal(new ProfilingSignal());
+- if ((signal != nullptr) && CreateSignal(signal.get())) {
++
++ // Ensure that signals of the same type are created with the same interrupt flag,
++ // as the tracking list depends on this for reuse.
++ if ((signal != nullptr) && CreateSignal(signal.get(), signal_list_[current_id_]->flags_.interrupt_)) {
+ signal_list_[current_id_]->release();
+ signal_list_[current_id_] = signal.release();
+ } else {
diff --git a/rocclr.spec b/rocclr.spec
index a089c52..8023909 100644
--- a/rocclr.spec
+++ b/rocclr.spec
@@ -116,6 +116,14 @@ patch3: 0001-rocclr-replace-std-filesystem-exists-with-access.patch
# For stdc++ 16
Patch4: 0001-clr-remove-__noinline__-keyword.patch
+# Backports from 7.2 (RHBZ#2564512)
+#https://github.com/ROCm/rocm-systems/commit/839fb957173fcef0fc29dcd0f7efaab1a797a4b2
+Patch5: 839fb957173fcef0fc29dcd0f7efaab1a797a4b2.patch
+#https://github.com/ROCm/rocm-systems/commit/bf75609a3fe6033daeef52b7792bb66e612cb4ae
+Patch6: bf75609a3fe6033daeef52b7792bb66e612cb4ae.patch
+#https://github.com/ROCm/rocm-systems/commit/6ec7540e14de9ff80cdd375eb6f2eda8b5c5cda8
+Patch7: 6ec7540e14de9ff80cdd375eb6f2eda8b5c5cda9.patch
+
BuildRequires: cmake
%if %{with docs}
BuildRequires: doxygen
@@ -425,6 +433,9 @@ rm -f %{buildroot}%{pkg_prefix}/share/doc/hip/LICENSE.md
%endif
%changelog
+* Mon Nov 16 2026 Jeremy Newton <alexjnewt at hotmail dot com> - 7.1.1-4
+- Fix memory leak RHBZ#2564512
+
* Sat Oct 24 2026 Tom Rix <Tom.Rix@amd.com> - 7.1.1-4
- Remove __noinline__ keyword for libstdc++ 16
reply other threads:[~2026-11-16 23:07 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=179487043911.1.2921527533937279340.rpms-rocclr-85d677968e21@fedoraproject.org \
--to=alexjnewt@hotmail.com \
--cc=git-commits@fedoraproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox