Skip to content

Commit 7090681

Browse files
authored
fix: uint32_t with uint64_t comparisons (#343)
* apply consts Signed-off-by: Kozlowski, Marek <[email protected]>
1 parent 9ea42ac commit 7090681

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

conformance_tests/core/test_module/src/test_module.cpp

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1329,14 +1329,14 @@ void zeKernelLaunchTests::RunGivenBufferLargerThan4GBWhenExecutingFunction(
13291329
ZE_RELAXED_ALLOCATION_LIMITS_EXP_FLAG_MAX_SIZE;
13301330
void *pNext = &relaxed_allocation_limits_desc;
13311331

1332-
auto mem_properties = lzt::get_memory_properties(device);
1333-
auto total_mem = mem_properties[0].totalSize;
1334-
uint64_t available_host_mem = lzt::total_available_host_memory();
1332+
const auto mem_properties = lzt::get_memory_properties(device);
1333+
const uint64_t total_mem = mem_properties[0].totalSize;
1334+
const uint64_t available_host_mem = lzt::total_available_host_memory();
13351335

1336-
size_t alloc_size = (1ULL << 30) * 5ULL /*5 GiB*/;
1336+
const uint64_t alloc_size = (1ULL << 30) * 5ULL /*5 GiB*/;
13371337

1338-
size_t head = 4096;
1339-
size_t reference_buffer_size = 4096 * 1024;
1338+
const uint64_t head = 4096;
1339+
const uint64_t reference_buffer_size = 4096 * 1024;
13401340

13411341
LOG_INFO << "Memory Properties: " << mem_properties.size();
13421342
LOG_INFO << "Total device memory: " << total_mem;
@@ -1373,8 +1373,9 @@ void zeKernelLaunchTests::RunGivenBufferLargerThan4GBWhenExecutingFunction(
13731373
memset(reference_buffer, pattern, reference_buffer_size);
13741374
memset(head_buffer, 0xAE, head);
13751375

1376-
auto device_buffer = lzt::allocate_shared_memory(alloc_size, 0, context);
1377-
std::memset(device_buffer, pattern, alloc_size);
1376+
auto device_buffer =
1377+
lzt::allocate_shared_memory(static_cast<size_t>(alloc_size), 0, context);
1378+
std::memset(device_buffer, pattern, static_cast<size_t>(alloc_size));
13781379

13791380
if (::testing::Test::HasFailure()) {
13801381
delete[] reference_buffer;
@@ -1411,7 +1412,7 @@ void zeKernelLaunchTests::RunGivenBufferLargerThan4GBWhenExecutingFunction(
14111412
lzt::execute_and_sync_command_bundle(bundle, UINT64_MAX);
14121413

14131414
// validate
1414-
size_t offset;
1415+
uint64_t offset = 0ULL;
14151416
auto break_error = false;
14161417

14171418
ASSERT_EQ(0, memcmp(device_buffer, head_buffer, head));
@@ -1424,7 +1425,7 @@ void zeKernelLaunchTests::RunGivenBufferLargerThan4GBWhenExecutingFunction(
14241425
if (comparison) {
14251426
LOG_DEBUG << "Failed at offset: " << offset << std::endl;
14261427
LOG_DEBUG << "Finding Incorrect Value";
1427-
for (size_t j = 0; j < alloc_size; j++) {
1428+
for (uint64_t j = 0; j < alloc_size; j++) {
14281429
if (device_buffer_ptr[offset + j] != reference_buffer[j]) {
14291430
LOG_DEBUG << "index: " << std::dec << offset + j
14301431
<< " val: " << std::hex

0 commit comments

Comments
 (0)