From d0a4e42ad03e29344b5182ca510fa14dc4e136d1 Mon Sep 17 00:00:00 2001 From: Sylvester Kaczmarek <16242628+sylvesterkaczmarek@users.noreply.github.com> Date: Thu, 10 Sep 2026 10:42:36 +0100 Subject: [PATCH] Fix SVR zero-delta kernel cache state Signed-off-by: Sylvester Kaczmarek <16242628+sylvesterkaczmarek@users.noreply.github.com> --- cpp/src/svm/kernelcache.cuh | 4 +++- python/cuml/tests/test_svm.py | 11 +++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/cpp/src/svm/kernelcache.cuh b/cpp/src/svm/kernelcache.cuh index 9883ca0f01..a50fda00d6 100644 --- a/cpp/src/svm/kernelcache.cuh +++ b/cpp/src/svm/kernelcache.cuh @@ -484,7 +484,9 @@ class KernelCache { */ void InitWorkingSet(const int* ws_idx) { - ASSERT(cache_state != CacheState::WS_INITIALIZED, "Working set has already been initialized!"); + // A block solve can produce no coefficient updates, in which case full-tile batching is + // skipped and the previous working set remains initialized. Replacing it is safe because + // no cache update is in progress. ASSERT(cache_state != CacheState::BATCHING_INITIALIZED, "Previous batching step incomplete!"); this->ws_idx = ws_idx; if (svmType == EPSILON_SVR) { diff --git a/python/cuml/tests/test_svm.py b/python/cuml/tests/test_svm.py index e5b381c9da..ee13ecc1b2 100644 --- a/python/cuml/tests/test_svm.py +++ b/python/cuml/tests/test_svm.py @@ -445,6 +445,17 @@ def test_svr_skl_cmp(params, dataset, n_rows, n_cols): compare_svr(cuSVR, sklSVR, X_test, y_test) +def test_svr_poly_zero_delta_working_set(): + X = np.arange(5, dtype=np.float32).reshape(-1, 1) + y = np.arange(5, dtype=np.float32) + + model = cu_svm.SVR(kernel="poly", degree=10).fit(X, y) + pred = np.asarray(model.predict(np.array([[2.0]], dtype=np.float32))) + + assert pred.shape == (1,) + assert np.isfinite(pred).all() + + def test_svr_skl_cmp_weighted(): """Compare to Sklearn SVR, use sample weights""" X, y = make_regression(