Skip to content

Commit 21e188f

Browse files
【CUDA Kernel No.18】skip_layernorm算子Kernel修复 -part (#75542)
* 【CUDA Kernel No.18】skip_layernorm算子Kernel修复 -part * fix 仅在gpu中发现此kernel,把头文件和kernel实现放在同级目录下
1 parent 7e7a9e3 commit 21e188f

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed

paddle/phi/kernels/fusion/gpu/skip_layernorm_kernel.cu

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15+
#include "paddle/phi/kernels/fusion/gpu/skip_layernorm_kernel.h"
1516
#include "paddle/common/errors.h"
1617
#include "paddle/phi/core/kernel_registry.h"
1718
#include "paddle/phi/core/tensor_utils.h"
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
// Copyright (c) 2023 PaddlePaddle Authors. All Rights Reserved.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
#pragma once
16+
17+
#include "paddle/phi/core/dense_tensor.h"
18+
#include "paddle/phi/core/kernel_registry.h"
19+
20+
namespace phi {
21+
namespace fusion {
22+
23+
template <typename T, typename Context>
24+
void SkipLayerNormKernel(const Context& dev_ctx,
25+
const DenseTensor& x,
26+
const DenseTensor& y,
27+
const DenseTensor& scale,
28+
const DenseTensor& bias,
29+
const float epsilon,
30+
const int begin_norm_axis,
31+
DenseTensor* out);
32+
33+
} // namespace fusion
34+
} // namespace phi

0 commit comments

Comments
 (0)