From 4ef3855745c7f20cdc80507bb025cd0e3c6bcbf3 Mon Sep 17 00:00:00 2001 From: Niko1221 Date: Thu, 15 Oct 2026 09:48:05 +0200 Subject: [PATCH] gdn_chunk_parity: skip (77) on a card whose shared-memory opt-in cannot hold the kkt stage (Pascal), instead of failing --- CMakeLists.txt | 1 + src/kernels/gdn_chunk_parity.cpp | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4545bcc5..1fae7183 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -935,6 +935,7 @@ if(STRATA_ENABLE_CUDA OR STRATA_ENABLE_HIP) target_include_directories(gdn_chunk_parity PRIVATE ${_strata_gpu_include_directories}) target_link_libraries(gdn_chunk_parity PRIVATE strata_prefill ${_strata_gpu_runtime_target}) add_test(NAME gdn_chunk_parity COMMAND gdn_chunk_parity --selftest) + set_tests_properties(gdn_chunk_parity PROPERTIES SKIP_RETURN_CODE 77) # v100/gdn-chunk: the micro benchmark (CUDA events, real GDN shapes): chunked vs recurrent prompt path. add_executable(gdn_chunk_bench bench/gdn_chunk_bench.cpp) diff --git a/src/kernels/gdn_chunk_parity.cpp b/src/kernels/gdn_chunk_parity.cpp index e60fdc84..2a271694 100644 --- a/src/kernels/gdn_chunk_parity.cpp +++ b/src/kernels/gdn_chunk_parity.cpp @@ -258,6 +258,17 @@ int main(int argc, char** argv) { if (std::strcmp(argv[i], "--selftest") == 0) selftest = true; else { std::fprintf(stderr, "usage: gdn_chunk_parity [--selftest]\n"); return 2; } } + { + // the kkt stage needs 2*64*129 floats (66 KB) of dynamic shared memory: a card whose opt-in limit is lower + // (Pascal: 48 KB) cannot launch it, and the engine dispatch never selects the chunked path there + int dev = 0, smem = 0; + cudaGetDevice(&dev); + cudaDeviceGetAttribute(&smem, cudaDevAttrMaxSharedMemoryPerBlockOptin, dev); + if (smem < 2 * 64 * 129 * 4) { + std::printf("gdn_chunk_parity: the card's shared-memory opt-in (%d B) is below the kkt stage's need, skipped\n", smem); + return 77; + } + } if (!strata::prefill::gdn_chunk_available()) std::printf("note: not a V100 (cc 7.0) - the parity still runs; the engine dispatch keeps the recurrence\n"); run_case(64, 1);