* [PATCH 1/1] Add test for hsaKmtAvailableMemory available memory inquiry
@ 2022-01-10 21:48 Daniel Phillips
2022-01-10 23:46 ` Felix Kuehling
0 siblings, 1 reply; 2+ messages in thread
From: Daniel Phillips @ 2022-01-10 21:48 UTC (permalink / raw)
To: amd-gfx, dri-devel; +Cc: Daniel Phillips
Basic test for the new hsaKmtAvailableMemory library call. This is
a standalone test, does not modify any of the other tests just to
be on the safe side. More elaborate tests coming soon.
Change-Id: I738600d4b74cc5dba6b857e4c793f6b14b7d2283
Signed-off-by: Daniel Phillips <daniel.phillips@amd.com>
---
tests/kfdtest/src/KFDMemoryTest.cpp | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/tests/kfdtest/src/KFDMemoryTest.cpp b/tests/kfdtest/src/KFDMemoryTest.cpp
index 9f62727..1f93928 100644
--- a/tests/kfdtest/src/KFDMemoryTest.cpp
+++ b/tests/kfdtest/src/KFDMemoryTest.cpp
@@ -595,6 +595,23 @@ TEST_F(KFDMemoryTest, MemoryAlloc) {
TEST_END
}
+// Basic test for hsaKmtAllocMemory
+TEST_F(KFDMemoryTest, MemoryAllocAll) {
+ TEST_START(TESTPROFILE_RUNALL)
+
+ unsigned int* pBig = NULL;
+ unsigned int* pSmall = NULL;
+ m_MemoryFlags.ui32.NoNUMABind = 1;
+ HSAuint64 available;
+ EXPECT_SUCCESS(hsaKmtAvailableMemory(0 /* system */, &available));
+ EXPECT_SUCCESS(hsaKmtAllocMemory(0 /* system */, available, m_MemoryFlags, reinterpret_cast<void**>(&pBig)));
+ EXPECT_NE(HSAKMT_STATUS_SUCCESS, hsaKmtAllocMemory(0 /* system */, PAGE_SIZE, m_MemoryFlags, reinterpret_cast<void**>(&pSmall)));
+ EXPECT_SUCCESS(hsaKmtFreeMemory(pBig, available));
+ EXPECT_SUCCESS(hsaKmtAllocMemory(0 /* system */, PAGE_SIZE, m_MemoryFlags, reinterpret_cast<void**>(&pSmall)));
+
+ TEST_END
+}
+
TEST_F(KFDMemoryTest, AccessPPRMem) {
TEST_START(TESTPROFILE_RUNALL)
--
2.34.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH 1/1] Add test for hsaKmtAvailableMemory available memory inquiry
2022-01-10 21:48 [PATCH 1/1] Add test for hsaKmtAvailableMemory available memory inquiry Daniel Phillips
@ 2022-01-10 23:46 ` Felix Kuehling
0 siblings, 0 replies; 2+ messages in thread
From: Felix Kuehling @ 2022-01-10 23:46 UTC (permalink / raw)
To: Daniel Phillips, amd-gfx, dri-devel
On 2022-01-10 4:48 p.m., Daniel Phillips wrote:
> Basic test for the new hsaKmtAvailableMemory library call. This is
> a standalone test, does not modify any of the other tests just to
> be on the safe side. More elaborate tests coming soon.
>
> Change-Id: I738600d4b74cc5dba6b857e4c793f6b14b7d2283
> Signed-off-by: Daniel Phillips <daniel.phillips@amd.com>
> ---
> tests/kfdtest/src/KFDMemoryTest.cpp | 17 +++++++++++++++++
> 1 file changed, 17 insertions(+)
>
> diff --git a/tests/kfdtest/src/KFDMemoryTest.cpp b/tests/kfdtest/src/KFDMemoryTest.cpp
> index 9f62727..1f93928 100644
> --- a/tests/kfdtest/src/KFDMemoryTest.cpp
> +++ b/tests/kfdtest/src/KFDMemoryTest.cpp
> @@ -595,6 +595,23 @@ TEST_F(KFDMemoryTest, MemoryAlloc) {
> TEST_END
> }
>
> +// Basic test for hsaKmtAllocMemory
> +TEST_F(KFDMemoryTest, MemoryAllocAll) {
> + TEST_START(TESTPROFILE_RUNALL)
> +
> + unsigned int* pBig = NULL;
> + unsigned int* pSmall = NULL;
> + m_MemoryFlags.ui32.NoNUMABind = 1;
> + HSAuint64 available;
> + EXPECT_SUCCESS(hsaKmtAvailableMemory(0 /* system */, &available));
I don't think you've even implemented this API for system memory. The
system memory node doesn't have a valid GPUID, so the ioctl will fail.
I'd expect this test to work only for VRAM.
> + EXPECT_SUCCESS(hsaKmtAllocMemory(0 /* system */, available, m_MemoryFlags, reinterpret_cast<void**>(&pBig)));
> + EXPECT_NE(HSAKMT_STATUS_SUCCESS, hsaKmtAllocMemory(0 /* system */, PAGE_SIZE, m_MemoryFlags, reinterpret_cast<void**>(&pSmall)));
> + EXPECT_SUCCESS(hsaKmtFreeMemory(pBig, available));
> + EXPECT_SUCCESS(hsaKmtAllocMemory(0 /* system */, PAGE_SIZE, m_MemoryFlags, reinterpret_cast<void**>(&pSmall)));
You're leaking pSmall here.
Regards,
Felix
> +
> + TEST_END
> +}
> +
> TEST_F(KFDMemoryTest, AccessPPRMem) {
> TEST_START(TESTPROFILE_RUNALL)
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-01-10 23:47 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-10 21:48 [PATCH 1/1] Add test for hsaKmtAvailableMemory available memory inquiry Daniel Phillips
2022-01-10 23:46 ` Felix Kuehling
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.