From f4e322ff2573a5336c6ca2868d9d21c6411bae42 Mon Sep 17 00:00:00 2001 From: HuangShiqing Date: Fri, 1 Dec 2023 15:24:16 +0800 Subject: [PATCH] abacus-aibox-906 remove the debug info --- cmake/external/xpu.cmake | 2 +- paddle/fluid/operators/index_select_op_xpu.cc | 99 ------------------- 2 files changed, 1 insertion(+), 100 deletions(-) diff --git a/cmake/external/xpu.cmake b/cmake/external/xpu.cmake index 7649af9a0ccfd..3e3d3849b8e0d 100644 --- a/cmake/external/xpu.cmake +++ b/cmake/external/xpu.cmake @@ -106,7 +106,7 @@ if (WITH_BOX_PS OR WITH_XPU_KP) CACHE STRING "" FORCE) #"https://klx-sdk-release-public.su.bcebos.com/xdnn/release/2.6.0.1/${XPU_XDNN_DIR_NAME}.tar.gz" set(XPU_XDNN_URL - "https://klx-sdk-release-public.su.bcebos.com/xdnn_train/dev/paddlebox/20231115/${XPU_XDNN_DIR_NAME}.tar.gz" + "https://klx-sdk-release-public.su.bcebos.com/xdnn_train/dev/paddlebox/20231201/${XPU_XDNN_DIR_NAME}.tar.gz" CACHE STRING "" FORCE) set(SCALOPUS_URL "https://klx-sdk-release-public.su.bcebos.com/xdnn_train/dev/paddlebox/20230306/scalopus.tar.gz" diff --git a/paddle/fluid/operators/index_select_op_xpu.cc b/paddle/fluid/operators/index_select_op_xpu.cc index 8e59a54df9de6..3c4172e7abfcb 100644 --- a/paddle/fluid/operators/index_select_op_xpu.cc +++ b/paddle/fluid/operators/index_select_op_xpu.cc @@ -48,32 +48,6 @@ class IndexSelectXPUKernel : public framework::OpKernel { phi::DataType::INT32, phi::DataType::INT64)); - // static int target_id = std::getenv("HSQ_XPURT_TARGET_DEVICE")!=NULL ? - // std::stoi(std::string(std::getenv("HSQ_XPURT_TARGET_DEVICE"))) : - // 0; - // int dev_id = ctx.GetPlace().GetDeviceId(); - // // if(dev_id == target_id) { - // // printf("[hsq] input shape: %d, %d\n", (int)x->dims()[0], (int)x->dims()[1]); - // // printf("[hsq] index_len: %d\n", index_len); - // // printf("[hsq] out shape: %d, %d\n", (int)out->dims()[0], (int)out->dims()[1]); - // // } - - // auto cpu_device_ctx = platform::DeviceContextPool::Instance().Get(phi::CPUPlace()); - // framework::ExecutionContext cpu_execution_ctx(ctx.GetOp(), ctx.scope(), *cpu_device_ctx, ctx.Context()); - - // LoDTensor x_cpu_copy; - // framework::TensorCopySync(*x, platform::CPUPlace(), &x_cpu_copy); - // LoDTensor index_cpu_copy; - // framework::TensorCopySync(*index, platform::CPUPlace(), &index_cpu_copy); - // LoDTensor out_cpu_copy; - // framework::TensorCopySync(*out, platform::CPUPlace(), &out_cpu_copy); - - // if (index_type == phi::DataType::INT32) { - // IndexSelectInner(cpu_execution_ctx, &x_cpu_copy, index_cpu_copy, &out_cpu_copy, dim); - // } else if (index_type == phi::DataType::INT64) { - // IndexSelectInner(cpu_execution_ctx, &x_cpu_copy, index_cpu_copy, &out_cpu_copy, dim); - // } - int r = -1; std::vector xshape = phi::vectorize(x->dims()); if (index_type == phi::DataType::INT64) { @@ -84,25 +58,6 @@ class IndexSelectXPUKernel : public framework::OpKernel { r = xpu::gather(xpu_context, x_data, index_data, out_data, xshape, index_len, dim); } - // LoDTensor out_ref_cpu_copy; - // framework::TensorCopySync(*out, platform::CPUPlace(), &out_ref_cpu_copy); - // bool correct = true; - // float diff = 1e-5; - // for (int i = 0; i < out_ref_cpu_copy.numel(); i++) { - // T* ref_data = out_ref_cpu_copy.data(); - // T* cpu_data = out_cpu_copy.data(); - // if(std::abs(*(ref_data + i) - *(cpu_data+i)) > diff) { - // correct = false; - // printf("[hsq] error in %d, out_ref_cpu_copy[%d]=%f, out_cpu_copy[%d]=%f\n", i, i, *(ref_data+i), i, *(cpu_data+i)); - // break; - // } - // } - // if(dev_id == target_id) { - // if(correct) { - // printf("[hsq] index_select op test passed\n"); - // } - // } - PADDLE_ENFORCE_EQ(r, xpu::Error_t::SUCCESS, platform::errors::External( "The index_select XPU OP return wrong value[%d %s]", @@ -139,43 +94,9 @@ class IndexSelectGradXPUKernel : public framework::OpKernel { const T* out_grad_data = out_grad->data(); T* x_grad_data = x_grad->mutable_data(place); - // auto cpu_device_ctx = platform::DeviceContextPool::Instance().Get(phi::CPUPlace()); - // framework::ExecutionContext cpu_execution_ctx(ctx.GetOp(), ctx.scope(), *cpu_device_ctx, ctx.Context()); - - // LoDTensor out_grad_cpu_copy; - // framework::TensorCopySync(*out_grad, platform::CPUPlace(), &out_grad_cpu_copy); - // LoDTensor index_cpu_copy; - // framework::TensorCopySync(*index, platform::CPUPlace(), &index_cpu_copy); - // LoDTensor x_grad_cpu_copy; - // framework::TensorCopySync(*x_grad, platform::CPUPlace(), &x_grad_cpu_copy); - // if (index_type == phi::DataType::INT32) { - // IndexSelectGradInner(cpu_execution_ctx, out_grad_cpu_copy, index_cpu_copy, &x_grad_cpu_copy, dim); - // } else if (index_type == phi::DataType::INT64) { - // IndexSelectGradInner( - // cpu_execution_ctx, out_grad_cpu_copy, index_cpu_copy, &x_grad_cpu_copy, dim); - // } - int r = -1; std::vector out_grad_shape = phi::vectorize(out_grad->dims()); std::vector x_grad_shape = phi::vectorize(x_grad->dims()); - - // static int target_id = std::getenv("HSQ_XPURT_TARGET_DEVICE")!=NULL ? - // std::stoi(std::string(std::getenv("HSQ_XPURT_TARGET_DEVICE"))) : - // 0; - // int dev_id = ctx.GetPlace().GetDeviceId(); - // // if(dev_id == target_id) { - // // printf("[hsq] out_grad_shape:["); - // // for(int i = 0; i < (int)out_grad_shape.size(); i++) { - // // printf("%d, ", (int)out_grad_shape[i]); - // // } - // // printf("]\n"); - - // // printf("[hsq] x_grad_shape:["); - // // for(int i = 0; i < (int)x_grad_shape.size(); i++) { - // // printf("%d, ", (int)x_grad_shape[i]); - // // } - // // printf("]\n"); - // // } if (index_type == phi::DataType::INT64) { const int64_t* index_data = index->data(); r = xpu::index_select_grad(xpu_context, @@ -202,26 +123,6 @@ class IndexSelectGradXPUKernel : public framework::OpKernel { platform::errors::External( "The index_select_grad XPU OP return wrong value[%d %s]", r, XPUAPIErrorMsg[r])); - - // LoDTensor x_grad_ref_cpu_copy; - // framework::TensorCopySync(*x_grad, platform::CPUPlace(), &x_grad_ref_cpu_copy); - // bool correct = true; - // float diff = 1e-5; - // for (int i = 0; i < x_grad_ref_cpu_copy.numel(); i++) { - // T* ref_data = x_grad_ref_cpu_copy.data(); - // T* cpu_data = x_grad_cpu_copy.data(); - // if(std::abs(*(ref_data + i) - *(cpu_data+i)) > diff) { - // correct = false; - // printf("[hsq] error in %d, out_ref_cpu_copy[%d]=%f, out_cpu_copy[%d]=%f\n", i, i, *(ref_data+i), i, *(cpu_data+i)); - // break; - // } - // } - - // if(dev_id == target_id) { - // if(correct) { - // printf("[hsq] index_select_grad op test passed\n"); - // } - // } } };