Skip to content

Commit

Permalink
ARCH/X86: Use UCS function to count leading zeros
Browse files Browse the repository at this point in the history
  • Loading branch information
tvegas1 committed Feb 26, 2025
1 parent 58368cb commit 1b01ddd
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 9 deletions.
9 changes: 3 additions & 6 deletions contrib/test_jenkins.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1128,12 +1128,9 @@ run_release_mode_tests() {
# Run nt_buffer_transfer tests
#
run_nt_buffer_transfer_tests() {
if lscpu | grep -q 'AuthenticAMD'
then
build release --enable-gtest --enable-optimizations
echo "==== Running nt_buffer_transfer tests ===="
./test/gtest/gtest --gtest_filter="test_arch.nt_buffer_transfer_*"
fi
build release --enable-gtest --enable-optimizations
echo "==== Running test_arch tests with optimizations ===="
./test/gtest/gtest --gtest_filter="test_arch.*"
}

set_ucx_common_test_env() {
Expand Down
2 changes: 1 addition & 1 deletion src/ucs/arch/x86_64/cpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -1061,7 +1061,7 @@ size_t ucs_x86_nt_src_buffer_transfer(void *dst, const void *src, size_t len)
}

static UCS_F_ALWAYS_INLINE
void ucs_x86_copy_bytes_le_128(void *dst, const void *src, size_t len)
void ucs_x86_copy_bytes_le_128(void *dst, const void *src, uint32_t len)
{
__m256i y0, y1, y2, y3;
/* Handle lengths that fall usually within eager short range */
Expand Down
17 changes: 15 additions & 2 deletions test/gtest/ucs/arch/test_x86_64.cc
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,12 @@ class test_arch : public ucs::test {
test_window_size = 8 * 1024;
hole_size = 2 * align;

auto msg = [&]() {
std::stringstream ss;
ss << "using length=" << len << " src_align=" << i << " dst_align=" << j;
return ss.str();
};

/*
* Allocate a hole above and below the test_window_size
* to check for writes beyond the designated area.
Expand Down Expand Up @@ -113,14 +119,20 @@ class test_arch : public ucs::test {
/* Perform the transfer */
ucs_x86_nt_buffer_transfer(dst + i, src + j, len, hint, len);
result = memcmp(src + j, dst + i, len);
EXPECT_EQ(0, result);
EXPECT_EQ(0, result) << msg();
if (result) {
goto terminate;
}

/* reset the copied region back to zero */
memset(dst + i, 0x0, len);

/* check for any modifications in the holes */
result = memcmp(test_window_dst, dup, total_size);
EXPECT_EQ(0, result);
EXPECT_EQ(0, result) << msg();
if (result) {
goto terminate;
}
}
}
/* Check for each len for less than 1k sizes
Expand All @@ -133,6 +145,7 @@ class test_arch : public ucs::test {
}
}

terminate:
free(dup);

dup_fail:
Expand Down

0 comments on commit 1b01ddd

Please sign in to comment.