67
csrc/ops.h
67
csrc/ops.h
@@ -24,13 +24,6 @@
|
||||
#include "torch_npu/csrc/aten/common/from_blob.h"
|
||||
|
||||
namespace vllm_ascend {
|
||||
extern void rotary_embedding_impl(AscendType type, bool isNeox, void *stream, int64_t *positions, void *queryDst,
|
||||
void *keyDst, void *query, void *key, void *cosSinCache, const int rotDim,
|
||||
const int64_t queryStride, const int64_t keyStride, const int64_t dstQueryStride,
|
||||
const int64_t dstKeyStride, const int numHeads, const int numKvHeads,
|
||||
const int headSize, const int64_t numTokens, const uint32_t loopCnt,
|
||||
uint32_t aivNum);
|
||||
|
||||
extern void get_masked_input_and_mask_impl(
|
||||
void* stream,
|
||||
void* input,
|
||||
@@ -44,22 +37,6 @@ namespace vllm_ascend {
|
||||
const int64_t size,
|
||||
const uint32_t loop_cnt,
|
||||
const uint32_t aiv_num);
|
||||
|
||||
torch::Tensor weak_ref_tensor(torch::Tensor& tensor) {
|
||||
if (!tensor.is_privateuseone()) {
|
||||
throw std::runtime_error("Tensor must be on NPU device");
|
||||
}
|
||||
// Get the raw data pointer
|
||||
void* data_ptr = tensor.data_ptr();
|
||||
// Get tensor sizes and strides
|
||||
std::vector<int64_t> sizes = tensor.sizes().vec();
|
||||
std::vector<int64_t> strides = tensor.strides().vec();
|
||||
// Get tensor options (dtype, device)
|
||||
auto options = tensor.options();
|
||||
// Create a new tensor from the raw data pointer
|
||||
auto new_tensor = at_npu::native::from_blob(data_ptr, sizes, strides, options);
|
||||
return new_tensor;
|
||||
}
|
||||
|
||||
extern void bgmv_shrink_impl(
|
||||
AscendType type,
|
||||
@@ -124,4 +101,48 @@ namespace vllm_ascend {
|
||||
uint32_t output_hidden_dim,
|
||||
uint32_t slice_offset,
|
||||
uint32_t output_full_dim);
|
||||
|
||||
extern void mla_preprocess_impl(
|
||||
void* stream,
|
||||
void* hidden_state,
|
||||
void* quant_scale1,
|
||||
void* quant_offset1,
|
||||
void* wdqkv,
|
||||
void* bias1,
|
||||
void* gamma2,
|
||||
void* beta2,
|
||||
void* quant_scale2,
|
||||
void* quant_offset2,
|
||||
void* gamma3,
|
||||
void* sin1,
|
||||
void* cos1,
|
||||
void* sin2,
|
||||
void* cos2,
|
||||
void* keycache,
|
||||
void* slot_mapping,
|
||||
void* wuq,
|
||||
void* bias2,
|
||||
void* wuk,
|
||||
void* descale1,
|
||||
void* descale2,
|
||||
void* ctkv_scale,
|
||||
void* qnope_scale,
|
||||
void* q,
|
||||
void* keycache_out,
|
||||
void* q2,
|
||||
void* keycache_out2,
|
||||
void* inner_out,
|
||||
void* workspace,
|
||||
void* tiling,
|
||||
const uint32_t block_dim
|
||||
);
|
||||
|
||||
extern void batch_matmul_transpose_impl(
|
||||
void* stream,
|
||||
void* gm_a,
|
||||
void* gm_b,
|
||||
void* gm_c,
|
||||
void* gm_tiling_data,
|
||||
const uint32_t block_dim
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user