From 2a9317f6000790950941260a9b0fea9abcf10d33 Mon Sep 17 00:00:00 2001 From: Jose Lopez Date: Tue, 16 Jun 2026 17:29:03 +0100 Subject: [PATCH] Fix invalid alignment value for _aligned_malloc in Windows (#2671) The Device Maximum Alignment is set up to zero when using the USM wrapper to allocate a System type allocation. This value is used for the `alignment` param in the `_aligned_malloc` function if the test is run on Windows. In this case, `alignment` must be a power of 2 [_aligned_malloc](https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/aligned-malloc?view=msvc-170) : > If alignment isn't a power of 2 or size is zero, this function invokes the invalid parameter handler, as described in [Parameter validation](https://learn.microsoft.com/en-us/cpp/c-runtime-library/parameter-validation?view=msvc-170). --- test_conformance/SVM/unified_svm_fixture.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test_conformance/SVM/unified_svm_fixture.h b/test_conformance/SVM/unified_svm_fixture.h index 5a62ecf1..fa96fbf0 100644 --- a/test_conformance/SVM/unified_svm_fixture.h +++ b/test_conformance/SVM/unified_svm_fixture.h @@ -94,8 +94,10 @@ public: else { // For now, just unconditionally align to the device maximum - data = static_cast( - align_malloc(count * sizeof(T), deviceMaxAlignment)); + const auto alignment = + deviceMaxAlignment ? deviceMaxAlignment : 1; + data = + static_cast(align_malloc(count * sizeof(T), alignment)); test_assert_error_ret(data != nullptr, "Failed to allocate memory", CL_OUT_OF_RESOURCES);