"...python/git@developer.sourcefind.cn:change/sglang.git" did not exist on "252dc4e112a6ba6a20c2ccb743171f0e8a81c0fb"
Unverified Commit 538bdaac authored by Mashiro's avatar Mashiro Committed by GitHub
Browse files

[Fix] Fix c++/cuda lint failed (#2528)

* Fix c/cuda lint failed

* minor refine

* minor refine
parent 73856344
...@@ -3,93 +3,73 @@ ...@@ -3,93 +3,73 @@
using namespace NPU_NAME_SPACE; using namespace NPU_NAME_SPACE;
using namespace std; using namespace std;
void psamask_forward_npu(const int psa_type, void psamask_forward_npu(const int psa_type, const Tensor x, Tensor y,
const Tensor x, const int num, const int h_feature,
Tensor y, const int w_feature, const int h_mask,
const int num, const int w_mask, const int half_h_mask,
const int h_feature, const int half_w_mask) {
const int w_feature, int64_t psa_type_i64 = psa_type;
const int h_mask, int64_t num_i64 = num;
const int w_mask, int64_t h_feature_i64 = h_feature;
const int half_h_mask, int64_t w_feature_i64 = w_feature;
const int half_w_mask) { int64_t h_mask_i64 = h_mask;
int64_t psa_type_i64 = psa_type; int64_t w_mask_i64 = w_mask;
int64_t num_i64 = num; int64_t half_h_mask_i64 = half_h_mask;
int64_t h_feature_i64 = h_feature; int64_t half_w_mask_i64 = half_w_mask;
int64_t w_feature_i64 = w_feature; OpCommand cmd;
int64_t h_mask_i64 = h_mask; cmd.Name("PSAMask")
int64_t w_mask_i64 = w_mask; .Input(x)
int64_t half_h_mask_i64 = half_h_mask; .Output(y)
int64_t half_w_mask_i64 = half_w_mask; .Attr("psa_type", psa_type_i64)
OpCommand cmd; .Attr("num", num_i64)
cmd.Name("PSAMask") .Attr("h_feature", h_feature_i64)
.Input(x) .Attr("w_feature", w_feature_i64)
.Output(y) .Attr("h_mask", h_mask_i64)
.Attr("psa_type", psa_type_i64) .Attr("w_mask", w_mask_i64)
.Attr("num", num_i64) .Attr("half_h_mask", half_h_mask_i64)
.Attr("h_feature", h_feature_i64) .Attr("half_w_mask", half_w_mask_i64)
.Attr("w_feature", w_feature_i64) .Run();
.Attr("h_mask", h_mask_i64)
.Attr("w_mask", w_mask_i64)
.Attr("half_h_mask", half_h_mask_i64)
.Attr("half_w_mask", half_w_mask_i64)
.Run();
} }
void psamask_forward_impl(const int psa_type, void psamask_forward_impl(const int psa_type, const Tensor x, Tensor y,
const Tensor x, const int num, const int h_feature,
Tensor y, const int w_feature, const int h_mask,
const int num, const int w_mask, const int half_h_mask,
const int h_feature, const int half_w_mask);
const int w_feature,
const int h_mask,
const int w_mask,
const int half_h_mask,
const int half_w_mask);
void psamask_backward_npu(const int psa_type, void psamask_backward_npu(const int psa_type, const Tensor y_grad,
const Tensor y_grad, Tensor x_grad, const int num, const int h_feature,
Tensor x_grad, const int w_feature, const int h_mask,
const int num, const int w_mask, const int half_h_mask,
const int h_feature, const int half_w_mask) {
const int w_feature, int64_t psa_type_i64 = psa_type;
const int h_mask, int64_t num_i64 = num;
const int w_mask, int64_t h_feature_i64 = h_feature;
const int half_h_mask, int64_t w_feature_i64 = w_feature;
const int half_w_mask) { int64_t h_mask_i64 = h_mask;
int64_t psa_type_i64 = psa_type; int64_t w_mask_i64 = w_mask;
int64_t num_i64 = num; int64_t half_h_mask_i64 = half_h_mask;
int64_t h_feature_i64 = h_feature; int64_t half_w_mask_i64 = half_w_mask;
int64_t w_feature_i64 = w_feature; OpCommand cmd;
int64_t h_mask_i64 = h_mask; cmd.Name("PSAMaskGrad")
int64_t w_mask_i64 = w_mask; .Input(y_grad)
int64_t half_h_mask_i64 = half_h_mask; .Output(x_grad)
int64_t half_w_mask_i64 = half_w_mask; .Attr("psa_type", psa_type_i64)
OpCommand cmd; .Attr("num", num_i64)
cmd.Name("PSAMaskGrad") .Attr("h_feature", h_feature_i64)
.Input(y_grad) .Attr("w_feature", w_feature_i64)
.Output(x_grad) .Attr("h_mask", h_mask_i64)
.Attr("psa_type", psa_type_i64) .Attr("w_mask", w_mask_i64)
.Attr("num", num_i64) .Attr("half_h_mask", half_h_mask_i64)
.Attr("h_feature", h_feature_i64) .Attr("half_w_mask", half_w_mask_i64)
.Attr("w_feature", w_feature_i64) .Run();
.Attr("h_mask", h_mask_i64)
.Attr("w_mask", w_mask_i64)
.Attr("half_h_mask", half_h_mask_i64)
.Attr("half_w_mask", half_w_mask_i64)
.Run();
} }
void psamask_backward_impl(const int psa_type, void psamask_backward_impl(const int psa_type, const Tensor y_grad,
const Tensor y_grad, Tensor x_grad, const int num, const int h_feature,
Tensor x_grad, const int w_feature, const int h_mask,
const int num, const int w_mask, const int half_h_mask,
const int h_feature, const int half_w_mask);
const int w_feature,
const int h_mask,
const int w_mask,
const int half_h_mask,
const int half_w_mask);
REGISTER_NPU_IMPL(psamask_forward_impl, psamask_forward_npu); REGISTER_NPU_IMPL(psamask_forward_impl, psamask_forward_npu);
REGISTER_NPU_IMPL(psamask_backward_impl, psamask_backward_npu); REGISTER_NPU_IMPL(psamask_backward_impl, psamask_backward_npu);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment