Skip to content

Commit 3cb6c35

Browse files
committed
opt and fix mtp
1 parent ce625e5 commit 3cb6c35

2 files changed

Lines changed: 7 additions & 4 deletions

File tree

custom_ops/gpu_ops/append_attention/attention_func.cuh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,7 @@ __device__ __forceinline__ void mask_s(const bool* attn_mask,
411411
const int* mask_offset = nullptr,
412412
const int sliding_window = 0) {
413413
const uint32_t tx = threadIdx.x;
414-
#pragma unroll
414+
#pragma unroll 1
415415
for (uint32_t fx = 0; fx < num_frags_x; ++fx) {
416416
#pragma unroll
417417
for (uint32_t fz = 0; fz < num_frags_z; ++fz) {
@@ -768,7 +768,7 @@ __device__ __forceinline__ void write_o_reg_gmem_multi_warps(
768768
// [num_warps * num_frags_x * 16, num_frags_y * 16]
769769
if (ty == 0) {
770770
// [num_frags_x * 16, num_frags_y * 16]
771-
#pragma unroll
771+
#pragma unroll 1
772772
for (uint32_t fx = 0; fx < num_frags_x; ++fx) {
773773
#pragma unroll
774774
for (uint32_t fy = 0; fy < num_frags_y; ++fy) {
@@ -793,7 +793,7 @@ __device__ __forceinline__ void write_o_reg_gmem_multi_warps(
793793
smem_t::get_permuted_offset<num_vecs_per_head>(ty * 4 + tx / 8, tx % 8);
794794

795795
const uint32_t tx_offset = tx / 8;
796-
#pragma unroll
796+
#pragma unroll 1
797797
for (uint32_t fx = 0; fx < num_frags_x; ++fx) {
798798
const uint32_t base_offset = o_idx_base + fx * 16 + tx_offset;
799799
#pragma unroll

fastdeploy/spec_decode/mtp.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,10 @@ def _initialize_attn_backend(
408408
).cpu()
409409

410410
# Decode attention split ops buffers
411-
if "decode_block_indices" in self.target_model_inputs:
411+
if (
412+
"decode_block_indices" in self.target_model_inputs
413+
and self.target_model_inputs["decode_block_indices"] is not None
414+
):
412415
self.model_inputs["decode_block_indices"] = paddle.zeros_like(
413416
self.target_model_inputs["decode_block_indices"]
414417
)

0 commit comments

Comments
 (0)