-
Notifications
You must be signed in to change notification settings - Fork 554
misc: Add the keyword "template" to member template specialization #1246
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
yzh119
merged 2 commits into
flashinfer-ai:main
from
tomflinda:refine_code_to_follow_c++_standard
Sep 7, 2025
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -295,7 +295,7 @@ __device__ __forceinline__ void produce_kv(smem_t<KTraits::SWIZZLE_MODE_KV> smem | |
| for (uint32_t i = 0; i < NUM_MMA_KV * 4 / NUM_WARPS_Q; ++i) { | ||
| #pragma unroll | ||
| for (uint32_t j = 0; j < NUM_MMA_D / (8 / sizeof(DTypeKV)); ++j) { | ||
| smem.load_128b_async<fill_mode>(*smem_offset, *gptr, kv_idx < kv_len); | ||
| smem.template load_128b_async<fill_mode>(*smem_offset, *gptr, kv_idx < kv_len); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| *smem_offset = smem.template advance_offset_by_column<8>(*smem_offset, j); | ||
| *gptr += 8 * upcast_size<DTypeKV>(); | ||
| } | ||
|
|
@@ -434,7 +434,7 @@ __device__ __forceinline__ void load_q_global_smem( | |
| const uint32_t lane_idx = tid.x, warp_idx_x = get_warp_idx_q<KTraits>(tid.y); | ||
|
|
||
| if (get_warp_idx_kv<KTraits>(tid.z) == 0) { | ||
| uint32_t q_smem_offset_w = q_smem->get_permuted_offset<UPCAST_STRIDE_Q>( | ||
| uint32_t q_smem_offset_w = q_smem->template get_permuted_offset<UPCAST_STRIDE_Q>( | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| warp_idx_x * KTraits::NUM_MMA_Q * 16 + lane_idx / 8, lane_idx % 8); | ||
|
|
||
| #pragma unroll | ||
|
|
@@ -449,8 +449,8 @@ __device__ __forceinline__ void load_q_global_smem( | |
| #pragma unroll | ||
| for (uint32_t mma_do = 0; mma_do < KTraits::NUM_MMA_D_QK / 4; ++mma_do) { | ||
| // load q fragment from gmem to smem | ||
| q_smem->load_128b_async<SharedMemFillMode::kNoFill>(q_smem_offset_w, q_ptr, | ||
| q_idx < qo_upper_bound); | ||
| q_smem->template load_128b_async<SharedMemFillMode::kNoFill>(q_smem_offset_w, q_ptr, | ||
| q_idx < qo_upper_bound); | ||
| q_smem_offset_w = q_smem->template advance_offset_by_column<8>(q_smem_offset_w, mma_do); | ||
| q_ptr += 8 * upcast_size<DTypeQ>(); | ||
| } | ||
|
|
@@ -1258,12 +1258,12 @@ __device__ __forceinline__ void write_o_reg_gmem( | |
| vec_cast<DTypeO, float>::cast<8>((DTypeO*)o_frag_f16, o_frag[mma_q][mma_d]); | ||
|
|
||
| #ifdef FLASHINFER_STMATRIX_M8N8X4_ENABLED | ||
| uint32_t o_smem_offset_w = o_smem->get_permuted_offset<UPCAST_STRIDE_O>( | ||
| uint32_t o_smem_offset_w = o_smem->template get_permuted_offset<UPCAST_STRIDE_O>( | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| (warp_idx_x * KTraits::NUM_MMA_Q + mma_q) * 16 + lane_idx % 16, | ||
| mma_d * 2 + lane_idx / 16); | ||
| o_smem->stmatrix_m8n8x4(o_smem_offset_w, o_frag_f16); | ||
| #else | ||
| uint32_t o_smem_offset_w = o_smem->get_permuted_offset<UPCAST_STRIDE_O>( | ||
| uint32_t o_smem_offset_w = o_smem->template get_permuted_offset<UPCAST_STRIDE_O>( | ||
| (warp_idx_x * KTraits::NUM_MMA_Q + mma_q) * 16 + lane_idx / 4, mma_d * 2); | ||
| ((uint32_t*)(o_smem->base + o_smem_offset_w))[lane_idx % 4] = o_frag_f16[0]; | ||
| ((uint32_t*)(o_smem->base + o_smem_offset_w + 8 * UPCAST_STRIDE_O))[lane_idx % 4] = | ||
|
|
@@ -1275,7 +1275,7 @@ __device__ __forceinline__ void write_o_reg_gmem( | |
| } | ||
| } | ||
|
|
||
| uint32_t o_smem_offset_w = o_smem->get_permuted_offset<UPCAST_STRIDE_O>( | ||
| uint32_t o_smem_offset_w = o_smem->template get_permuted_offset<UPCAST_STRIDE_O>( | ||
| warp_idx_x * KTraits::NUM_MMA_Q * 16 + lane_idx / 8, lane_idx % 8); | ||
|
|
||
| #pragma unroll | ||
|
|
@@ -1419,7 +1419,7 @@ __device__ __forceinline__ void SinglePrefillWithKVCacheDevice( | |
| ? o + chunk_idx * o_stride_n + (kv_head_idx * group_size) * o_stride_h | ||
| : o + (kv_head_idx * group_size) * o_stride_h; | ||
|
|
||
| uint32_t q_smem_offset_r = qo_smem.get_permuted_offset<UPCAST_STRIDE_Q>( | ||
| uint32_t q_smem_offset_r = qo_smem.template get_permuted_offset<UPCAST_STRIDE_Q>( | ||
| get_warp_idx_q<KTraits>(tid.y) * NUM_MMA_Q * 16 + lane_idx % 16, lane_idx / 16); | ||
| load_q_global_smem<KTraits>(qo_packed_idx_base, qo_len, q_ptr_base, q_stride_n, q_stride_h, | ||
| group_size, &qo_smem, tid); | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
templatekeyword is added here to specify thatloadis a template method. Consider adding thetemplatekeyword to other template method calls within this file for consistency and to avoid potential compilation issues with strict compilers.