1
0
mirror of https://github.com/paboyle/Grid.git synced 2026-05-26 03:54:17 +01:00

tests/debug: test hipMemset variant before cache is populated

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Peter Boyle
2026-05-19 22:10:16 -04:00
parent ea57bd8f03
commit 3f0fdbb597
+9 -6
View File
@@ -51,20 +51,23 @@ int main(void) {
hipfftDoubleComplex *buf = nullptr; hipfftDoubleComplex *buf = nullptr;
hipMalloc(&buf, nelems * sizeof(hipfftDoubleComplex)); hipMalloc(&buf, nelems * sizeof(hipfftDoubleComplex));
// A: hipMalloc only, no GPU work // Tests ordered so each runs before a prior success can populate the cache.
hipfftResult rvA = makePlan(G, howmany);
printf("G=%-4d A) hipMalloc only : %s\n", G, res(rvA));
// B: hipMalloc + hipMemset (async GPU work in flight) // B first: hipMalloc + hipMemset (async GPU work in flight)
// If this fails, A (no hipMemset) will pass, confirming hipMemset is the trigger.
hipMemset(buf, 0, nelems * sizeof(hipfftDoubleComplex)); hipMemset(buf, 0, nelems * sizeof(hipfftDoubleComplex));
hipfftResult rvB = makePlan(G, howmany); hipfftResult rvB = makePlan(G, howmany);
printf("G=%-4d B) hipMalloc + hipMemset : %s\n", G, res(rvB)); printf("G=%-4d B) hipMalloc + hipMemset : %s\n", G, res(rvB));
// C: hipMalloc + hipMemset + sync before plan // C: hipMalloc + hipMemset + sync — does syncing before plan creation fix it?
hipMemset(buf, 0, nelems * sizeof(hipfftDoubleComplex)); hipMemset(buf, 0, nelems * sizeof(hipfftDoubleComplex));
hipDeviceSynchronize(); hipDeviceSynchronize();
hipfftResult rvC = makePlan(G, howmany); hipfftResult rvC = makePlan(G, howmany);
printf("G=%-4d C) hipMalloc + hipMemset + sync: %s\n\n", G, res(rvC)); printf("G=%-4d C) hipMalloc + hipMemset + sync: %s\n", G, res(rvC));
// A last: hipMalloc only, no async GPU work — should always pass
hipfftResult rvA = makePlan(G, howmany);
printf("G=%-4d A) hipMalloc only : %s\n\n", G, res(rvA));
hipFree(buf); hipFree(buf);
} }