Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions csrc/api/sparse_decode.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#pragma once

#include <memory>

#include "common.h"

#include "params.h"
Expand Down Expand Up @@ -359,23 +361,23 @@ sparse_attn_decode_interface(
features.push_back(DecodeFeatures::EXTRA_TOPK_LENGTH);
}

DecodeImplBase* impl;
std::unique_ptr<DecodeImplBase> impl;
if (arch.is_sm100f()) {
if (h_q == 64) {
impl = new Decode_Sm100_Head64_Impl();
impl = std::make_unique<Decode_Sm100_Head64_Impl>();
} else if (h_q == 128) {
if (d_qk == 576) {
impl = new Decode_Sm100_Head64x2_Impl();
impl = std::make_unique<Decode_Sm100_Head64x2_Impl>();
} else if (d_qk == 512) {
impl = new Decode_Sm100_Head128_Impl();
impl = std::make_unique<Decode_Sm100_Head128_Impl>();
} else {
TORCH_CHECK(false, "Unsupported d_qk: ", d_qk);
}
} else {
TORCH_CHECK(false, "Unsupported h_q: ", h_q);
}
} else if (arch.is_sm90a()) {
impl = new Decode_Sm90_Impl();
impl = std::make_unique<Decode_Sm90_Impl>();
} else {
TORCH_CHECK(false, "Unsupported architecture for sparse decode fwd");
}
Expand Down Expand Up @@ -489,7 +491,5 @@ sparse_attn_decode_interface(
};
smxx::decode::run_flash_mla_combine_kernel<bf16>(combine_params);

delete impl;

return {out, lse.transpose(1, 2), tile_scheduler_metadata, num_splits};
}
Loading