From c6de3e22d095817dfc16d4611d5f562fe253eb16 Mon Sep 17 00:00:00 2001 From: Po Yen Chen Date: Mon, 11 Nov 2024 09:28:32 +0800 Subject: [PATCH] Return nullptr when block index is invalid (#1649) [ROCm/composable_kernel commit: 13332998a4ca6dcc8cc5fcd401ca900529e5e65c] --- .../ck_tile/ops/fmha/block/page_block_navigator.hpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/include/ck_tile/ops/fmha/block/page_block_navigator.hpp b/include/ck_tile/ops/fmha/block/page_block_navigator.hpp index e8abdc579b..5d158f9fb3 100644 --- a/include/ck_tile/ops/fmha/block/page_block_navigator.hpp +++ b/include/ck_tile/ops/fmha/block/page_block_navigator.hpp @@ -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