Files
paddlepaddle--paddle/paddle/phi/kernels/primitive/helper_primitives.h
T
2026-07-13 12:40:42 +08:00

68 lines
1.7 KiB
C++

// Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#pragma once
namespace phi {
namespace kps {
#ifdef PADDLE_WITH_XPU_KP
struct dim3 {
int x;
int y;
int z;
explicit inline dim3(int split_x = 1, int split_y = 1, int split_z = 1) {
x = split_x;
y = split_y;
z = split_z;
}
};
#endif
struct DimConfig {
int64_t split_num_x;
int64_t split_num_y;
int64_t split_num_z;
int64_t deal_size_x;
int64_t deal_size_y;
int64_t deal_size_z;
int64_t rem_x;
int64_t rem_y;
int64_t rem_z;
HOSTDEVICE explicit inline DimConfig(int64_t split_x,
int64_t split_y,
int64_t split_z,
int64_t size_x,
int64_t size_y,
int64_t size_z) {
split_num_x = split_x;
split_num_y = split_y;
split_num_z = split_z;
deal_size_x = size_x;
deal_size_y = size_y;
deal_size_z = size_z;
}
HOSTDEVICE void SetRem(int64_t rem_nx, int64_t rem_ny, int64_t rem_nz) {
rem_x = rem_nx;
rem_y = rem_ny;
rem_z = rem_nz;
}
};
} // namespace kps
} // namespace phi