From cd47e5563b1bc6d621bbf56573f9b5ca0150ae03 Mon Sep 17 00:00:00 2001 From: Tyson Jones Date: Sun, 16 Aug 2026 23:35:15 -0400 Subject: [PATCH] add AMD bug guard --- quest/src/api/qureg.cpp | 6 ++++++ quest/src/core/errors.cpp | 11 +++++++++++ quest/src/core/errors.hpp | 8 ++++++++ 3 files changed, 25 insertions(+) diff --git a/quest/src/api/qureg.cpp b/quest/src/api/qureg.cpp index 84bcd2bd0..683ca183d 100644 --- a/quest/src/api/qureg.cpp +++ b/quest/src/api/qureg.cpp @@ -168,6 +168,12 @@ Qureg validateAndCreateCustomQureg(int numQubits, int isDensMatr, int useDistrib freeAllMemoryIfAnyAllocsFailed(qureg); validate_newQuregAllocs(qureg, __func__); + // TODO / DEBUG: + // TEMPORARILY FORBID HIP GPU ACCELERATION OF > 2^32 AMPS PER NODE, + // SINCE THIS WILL LEAD TO LATER KERNEL LAUNCH FAILURES; see issue #815 + if (useGpuAccel && gpu_isHipCompiled() && qureg.numAmpsPerNode >= (1LL << 32)) + error_quregTooLargeForHipGpuAccel(); + // initialise state to |0> or |0><0| initZeroState(qureg); diff --git a/quest/src/core/errors.cpp b/quest/src/core/errors.cpp index 807cad105..c78f1c727 100644 --- a/quest/src/core/errors.cpp +++ b/quest/src/core/errors.cpp @@ -58,6 +58,17 @@ void raiseInternalError(string errorMsg) { +/* + * TEMPORARY / DEBUG ERRORS + */ + +void error_quregTooLargeForHipGpuAccel() { + + raiseInternalError("The created Qureg contains more than 2^32 amplitudes per GPU, which would later trigger a current bug/limitation in QuEST's execution on AMD GPUs. See Github issue #815."); +} + + + /* * VALIDATION ERRORS */ diff --git a/quest/src/core/errors.hpp b/quest/src/core/errors.hpp index f91f890b0..7db4e69f5 100644 --- a/quest/src/core/errors.hpp +++ b/quest/src/core/errors.hpp @@ -27,6 +27,14 @@ using std::string; +/* + * TEMPORARY / DEBUG ERRORS + */ + +void error_quregTooLargeForHipGpuAccel(); + + + /* * VALIDATION ERRORS */