Return nullptr when block index is invalid (#1649)

[ROCm/composable_kernel commit: 13332998a4]
This commit is contained in:
Po Yen Chen
2024-11-11 09:28:32 +08:00
committed by GitHub
parent 77f0f4ee48
commit c6de3e22d0

View File

@@ -230,7 +230,15 @@ struct PageBlockNavigator
CK_TILE_HOST_DEVICE
DataType* get_block_ptr(index_t block_index) const
{
return physical_blocks + physical_block_indices[block_index] * block_stride + fixed_offset;
if(block_index < num_blocks)
{
return physical_blocks + physical_block_indices[block_index] * block_stride +
fixed_offset;
}
else
{
return nullptr;
}
}
CK_TILE_HOST_DEVICE int32_t get_block_index(const WindowOrigin& global_window_origin) const