Skip to content

Commit ff0160e

Browse files
authored
[XPU] fix XPU linking error on Clang (#71852)
1 parent 8c5c40a commit ff0160e

File tree

7 files changed

+9
-10
lines changed

7 files changed

+9
-10
lines changed

paddle/phi/kernels/custom/c_embedding_grad_kernel.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ void CEmbeddingGradKernel(const Context& dev_ctx,
3131
int64_t start_index,
3232
DenseTensor* w_grad) {
3333
w_grad->Resize(w.dims());
34-
dev_ctx.template Alloc(w_grad, w.dtype());
34+
dev_ctx.Alloc(w_grad, w.dtype());
3535
const auto& index_type = ids.dtype();
3636
if (index_type == phi::DataType::INT32 ||
3737
index_type == phi::DataType::INT64) {

paddle/phi/kernels/xpu/c_concat_kernel.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ void CConcatKernel(const Context& dev_ctx,
5858
phi::DDim temp_out_dims = x->dims();
5959
temp_out_dims[0] *= nranks;
6060
temp_out.Resize(temp_out_dims);
61-
dev_ctx.template Alloc(&temp_out, x->dtype());
61+
dev_ctx.Alloc(&temp_out, x->dtype());
6262

6363
XPUStream stream = nullptr;
6464
phi::distributed::BKCLCommContext* comm_ctx = nullptr;
@@ -86,7 +86,7 @@ void CConcatKernel(const Context& dev_ctx,
8686

8787
phi::funcs::ConcatFunctor<phi::XPUContext, T> functor;
8888
out->Resize(out_dims);
89-
dev_ctx.template Alloc(out, x->dtype());
89+
dev_ctx.Alloc(out, x->dtype());
9090
functor(dev_ctx, inputs, axis, out);
9191
#else
9292
PADDLE_THROW(common::errors::PreconditionNotMet(

paddle/phi/kernels/xpu/c_embedding_kernel_grad.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ void CEmbeddingGradKernel(const Context& dev_ctx,
2929
int64_t start_index,
3030
DenseTensor* w_grad) {
3131
w_grad->Resize(w.dims());
32-
dev_ctx.template Alloc(w_grad, w.dtype());
32+
dev_ctx.Alloc(w_grad, w.dtype());
3333
T* table_grad_data = static_cast<T*>(w_grad->data());
3434
using XPUType = typename XPUTypeTrait<T>::Type;
3535

paddle/phi/kernels/xpu/c_softmax_with_cross_entropy_kernel.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,8 @@ struct CSoftmaxWithCrossEntropyFunctor<phi::XPUContext, T> {
161161
stream = dev_ctx.stream();
162162

163163
// allocate memory on device.
164-
dev_ctx.template Alloc(softmax, logits->dtype());
165-
dev_ctx.template Alloc(loss, logits->dtype());
164+
dev_ctx.Alloc(softmax, logits->dtype());
165+
dev_ctx.Alloc(loss, logits->dtype());
166166

167167
const auto& logits_dims = logits->dims();
168168

paddle/phi/kernels/xpu/c_split_kernel.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ void CSplitKernel(const Context& dev_ctx,
5959

6060
dims[dims_size - 1] /= nranks;
6161
out->Resize(dims);
62-
dev_ctx.template Alloc(out, x.dtype());
62+
dev_ctx.Alloc(out, x.dtype());
6363

6464
std::vector<XPUType*> output_list(nranks, nullptr);
6565
output_list.at(rank) = reinterpret_cast<XPUType*>(out->data<T>());

paddle/phi/kernels/xpu/embedding_grad_kernel.cc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,7 @@ void EmbeddingSparseGradKernel(const Context& ctx,
9393
std::vector<int64_t> ids;
9494
DenseTensor ids_cpu;
9595
ids_cpu.Resize(input.dims());
96-
ctx.template HostAlloc(
97-
&ids_cpu, input.dtype(), input.numel() * sizeof(int64_t));
96+
ctx.HostAlloc(&ids_cpu, input.dtype(), input.numel() * sizeof(int64_t));
9897
if (input.dtype() == phi::DataType::INT64) {
9998
phi::Copy(ctx, input, CPUPlace(), false, &ids_cpu);
10099

paddle/phi/kernels/xpu/reduce_sum_grad_kernel.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ void ReduceSumGradKernel(const Context& dev_ctx,
3333
using XPUType = typename XPUTypeTrait<T>::Type;
3434
reduce_all = recompute_reduce_all(x, dims_arr, reduce_all);
3535
auto dims = dims_arr.GetData();
36-
dev_ctx.template Alloc(x_grad, x.dtype());
36+
dev_ctx.Alloc(x_grad, x.dtype());
3737
auto* out_data = reinterpret_cast<const XPUType*>(out_grad.data());
3838
auto* x_grad_data = reinterpret_cast<XPUType*>(x_grad->data());
3939
const auto& input_dim_size = x.dims().size();

0 commit comments

Comments
 (0)