diff --git a/paddle/fluid/platform/device/ipu/CMakeLists.txt b/paddle/fluid/platform/device/ipu/CMakeLists.txt index f64845c4d57c9b..5f711937a8098b 100644 --- a/paddle/fluid/platform/device/ipu/CMakeLists.txt +++ b/paddle/fluid/platform/device/ipu/CMakeLists.txt @@ -1,20 +1,8 @@ IF(WITH_IPU) FILE(GLOB POPART_CANONICALIZATION_SRC ${PADDLE_SOURCE_DIR}/paddle/fluid/platform/device/ipu/popart_canonicalization/*.cc) - - set(POPART_PATTERNS_SRC - "" - ) - - set(POPART_OPERATORS_SRC - "" - ) - list(APPEND PADDLE_IPU_SRC ${POPART_CANONICALIZATION_SRC}) - list(APPEND PADDLE_IPU_SRC ${POPART_PATTERNS_SRC}) - list(APPEND PADDLE_IPU_SRC ${POPART_OPERATORS_SRC}) set(PADDLE_IPU_LIB "${CMAKE_CURRENT_BINARY_DIR}/libpaddle_ipu.so" CACHE STRING "") set(PADDLE_IPU_LIB_DIR "${CMAKE_CURRENT_BINARY_DIR}" CACHE STRING "") - set(IPU_BACKEND_SRC "ipu_device.cc" "ipu_strategy.cc" diff --git a/paddle/fluid/platform/device/ipu/ipu_compiler.cc b/paddle/fluid/platform/device/ipu/ipu_compiler.cc index b0b924e0fcb5a4..8bedca5c0b82fc 100644 --- a/paddle/fluid/platform/device/ipu/ipu_compiler.cc +++ b/paddle/fluid/platform/device/ipu/ipu_compiler.cc @@ -33,7 +33,10 @@ popart::AdamMode AdamModeFromStr(const std::string& str) { } else if (str == "lamb") { return popart::AdamMode::Lamb; } else { - PADDLE_THROW(platform::errors::InvalidArgument("Uknown AdamMode: %s", str)); + PADDLE_THROW(platform::errors::InvalidArgument( + "Uknown AdamMode: %s, AdamMode must be one of these values: adam, " + "adamax or lamb", + str)); } } @@ -47,8 +50,10 @@ popart::AdaptiveMode AdaptiveModeFromStr(const std::string& str) { } else if (str == "centered_rmsprop") { return popart::AdaptiveMode::CenteredRMSProp; } else { - PADDLE_THROW( - platform::errors::InvalidArgument("Uknown AdaptiveMode: %s", str)); + PADDLE_THROW(platform::errors::InvalidArgument( + "Uknown AdaptiveMode: %s, AdaptiveMode must be one of these values: " + "adadelta, adagrad, rmsprop or centered_rmsprop", + str)); } } @@ -58,8 +63,10 @@ popart::WeightDecayMode WeightDecayModeFromStr(const std::string& str) { } else if (str == "l2_regularization") { return popart::WeightDecayMode::L2Regularization; } else { - PADDLE_THROW( - platform::errors::InvalidArgument("Uknown WeightDecayMode: %s", str)); + PADDLE_THROW(platform::errors::InvalidArgument( + "Uknown WeightDecayMode: %s, WeightDecayMode must be decay or " + "l2_regularization", + str)); } } @@ -215,8 +222,10 @@ void Compiler::LowerBody(const Graph* graph) { if (itr != name_function_.end()) { itr->second(node->Op()); } else { - PADDLE_THROW( - platform::errors::NotFound("%s is not registered", op_type)); + PADDLE_THROW(platform::errors::NotFound( + "%s is not registered, please check for unsupported operators for " + "running on IPU", + op_type)); } } } @@ -250,9 +259,11 @@ void Compiler::InitOutputs(const std::vector& fetch_list) { for (const auto& fetch_name : fetch_list) { fetch_list_.push_back(fetch_name); auto tensor = resources_->tensors.find(fetch_name); - PADDLE_ENFORCE_NE(tensor, resources_->tensors.end(), - platform::errors::NotFound( - "output tensor %s does not exist.", fetch_name)); + PADDLE_ENFORCE_NE( + tensor, resources_->tensors.end(), + platform::errors::NotFound( + "Output tensor %s is not found, please check the model.", + fetch_name)); VLOG(10) << "fetch_name= " << fetch_name; VLOG(10) << "popart output tensor id = " << tensor->second; builder_->addOutputTensor(tensor->second); diff --git a/paddle/fluid/platform/device/ipu/ipu_device.cc b/paddle/fluid/platform/device/ipu/ipu_device.cc index 78e291bd47b673..cd2a628c9abe2b 100644 --- a/paddle/fluid/platform/device/ipu/ipu_device.cc +++ b/paddle/fluid/platform/device/ipu/ipu_device.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved. +/* 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. diff --git a/paddle/fluid/platform/device/ipu/ipu_utils.h b/paddle/fluid/platform/device/ipu/ipu_utils.h index a306d579244fe0..3cd7115b5ebf3a 100644 --- a/paddle/fluid/platform/device/ipu/ipu_utils.h +++ b/paddle/fluid/platform/device/ipu/ipu_utils.h @@ -29,14 +29,14 @@ namespace paddle { namespace platform { namespace ipu { -using platform::float16; -using framework::Tensor; -using framework::LoDTensor; -using framework::Scope; -using framework::OpDesc; -using framework::ir::Graph; -using framework::ir::Node; -using framework::BlockDesc; +using float16 = platform::float16; +using Tensor = framework::Tensor; +using LoDTensor = framework::LoDTensor; +using Scope = framework::Scope; +using OpDesc = framework::OpDesc; +using Graph = framework::ir::Graph; +using Node = framework::ir::Node; +using BlockDesc = framework::BlockDesc; // onnx dtype // https://github.com/onnx/onnx/blob/master/onnx/onnx-ml.proto3 diff --git a/paddle/fluid/platform/device/ipu/supported_ops_custom.h b/paddle/fluid/platform/device/ipu/supported_ops_custom.h index b52230de53b5e2..02d215433c5eeb 100644 --- a/paddle/fluid/platform/device/ipu/supported_ops_custom.h +++ b/paddle/fluid/platform/device/ipu/supported_ops_custom.h @@ -1,4 +1,4 @@ -// Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved. +// 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. @@ -17,3 +17,5 @@ #pragma once OP_DECL(popart_nllloss_v2, aiGraphcoreOpset.nllloss, SIG_ARG(INT32,popart::ReductionType,reduction) OPT_ARG(INT32,ignoreIndex) ARG(BOOL,inputIsLogProbability) ) // NOLINT + +// clang-format on