Skip to content

Commit 391f139

Browse files
committed
fix cast issue for Vulkan allocation sizes
1 parent dbd3579 commit 391f139

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

backends/vulkan/runtime/api/containers/Tensor.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -687,8 +687,9 @@ vkapi::VulkanBuffer allocate_buffer(
687687
// otherwise read past the end of the buffer, which silently zeroes the value
688688
// on NVIDIA GPUs. This only grows the allocation; the tensor's
689689
// physical_numel() is unchanged.
690-
const size_t alloc_nbytes =
691-
utils::align_up(element_size(dtype) * numel, static_cast<size_t>(16));
690+
const size_t alloc_nbytes = utils::align_up(
691+
element_size(dtype) * static_cast<size_t>(numel),
692+
static_cast<size_t>(16));
692693

693694
// TODO: this check is incorrect. max_buffer_numel() returns
694695
// maxStorageBufferRange, which is a size in bytes, so the comparison should

0 commit comments

Comments
 (0)