Skip to content

Commit

Permalink
update popart api to 2.3.1 & optimize logs (#715)
Browse files Browse the repository at this point in the history
* update to poplar 2.3.1 & remove useless code

* update log message & add open log option

Co-authored-by: yanwei <[email protected]>
  • Loading branch information
yanwei-gr and yanwei authored Dec 2, 2021
1 parent 389c131 commit 97f5a65
Show file tree
Hide file tree
Showing 10 changed files with 11 additions and 150 deletions.
2 changes: 1 addition & 1 deletion .github/actions/build/build_in_docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ DOCKER_ID=`docker ps -aq -f name=$CONTAINER_NAME -f status=running`
gid=$(id -g ${USER})
group=$(id -g -n ${USER})
uid=$(id -u ${USER})
extra_mnt="-v /opt/poplar_sdk-ubuntu_18_04-2.2.2+711-26aba6cf16:/opt/poplar_sdk:ro"
extra_mnt="-v /opt/poplar_sdk-ubuntu_18_04-2.3.1_793:/opt/poplar_sdk:ro"
mkdir -p /tmp/ubuntu.cache
extra_mnt="$extra_mnt -v /tmp/ubuntu.cache:/cache"

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ jobs:
$image_registry/computation/halo:$image_tag \
/bin/bash -c 'source scl_source enable devtoolset-7 && cd /build && cmake -G Ninja /host/halo -DHALO_USE_TIDY_CHECK=OFF -DHALO_GEN_DOCS=OFF -DODLA_BUILD_POPART_USE_CXX11ABI=OFF -DODLA_BUILD_POPART_CUSTOM_OPS=ON -DODLA_BUILD_TRT=OFF -DODLA_BUILD_XNNPACK=OFF -DODLA_BUILD_EIGEN=OFF -DODLA_BUILD_DNNL=OFF -DHALO_BUILD_RTLIB=OFF -DHALO_USE_STATIC_PROTOBUF=ON -DCPACK_SYSTEM_NAME=centos-i686 && ninja && source /opt/poplar_sdk/poplar/enable.sh && ninja check-halo && ninja package && cp /build/*.bz2 /build/*.rpm /host/output_centos'
env:
poplar_sdk: /opt/poplar_sdk-centos_7_6-2.2.2+711-26aba6cf16
poplar_sdk: /opt/poplar_sdk-centos_7_6-2.3.1_793
repo_name : heterogeneity-aware-lowering-and-optimization
image_registry : registry-intl.us-west-1.aliyuncs.com
image_tag : latest-devel-x86_64-centos7
Expand Down
2 changes: 1 addition & 1 deletion ODLA/platforms/odla_popart/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ set(POPART_ROOT ${POPART_ROOT} PARENT_SCOPE)

list(APPEND CMAKE_PREFIX_PATH ${POPLAR_ROOT})
list(APPEND CMAKE_PREFIX_PATH ${POPART_ROOT})
find_package(popart 2.2.1... REQUIRED CONFIG COMPONENTS popart-only REQUIRED)
find_package(popart 2.3.0... REQUIRED CONFIG COMPONENTS popart-only REQUIRED)

message(STATUS "Found popart, version: ${popart_VERSION}")

Expand Down
1 change: 0 additions & 1 deletion ODLA/platforms/odla_popart/custom_ops/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
# ==============================================================================

add_odla_library(custom_ops SHARED
erf.cc
rsqrt.cc
postprocess.cc
attention_mask.cc
Expand Down
136 changes: 0 additions & 136 deletions ODLA/platforms/odla_popart/custom_ops/erf.cc

This file was deleted.

Binary file removed ODLA/platforms/odla_popart/custom_ops/erf_test
Binary file not shown.
6 changes: 3 additions & 3 deletions ODLA/platforms/odla_popart/custom_ops/rsqrt.cc
Original file line number Diff line number Diff line change
Expand Up @@ -59,18 +59,18 @@ static popart::OpCreator<RsqrtOp> rsqrtOpCreator(popart::OpDefinitions({
class RsqrtOpx : public popart::popx::ElementWiseUnaryOpx {
public:
RsqrtOpx(popart::Op*, popart::popx::Devicex*);
void grow(poplar::program::Sequence&) const final;
void grow(snap::program::Sequence&) const final;
};

RsqrtOpx::RsqrtOpx(popart::Op* op, popart::popx::Devicex* devicex)
: popart::popx::ElementWiseUnaryOpx(op, devicex) {
verifyOp<RsqrtOp>(op, CustomOperators::Rsqrt_1);
}

void RsqrtOpx::grow(poplar::program::Sequence& prog) const {
void RsqrtOpx::grow(snap::program::Sequence& prog) const {
auto result =
popops::map(graph().getPoplarGraph(), popops::expr::UnaryOpType::RSQRT,
getInTensor(0).getPoplarTensor(), prog, debugContext());
getInTensor(0).getPoplarTensor(), prog.getPoplarSequence(), debugContext());
setOutTensor(0, snap::Tensor{result, graph()});
}

Expand Down
3 changes: 3 additions & 0 deletions ODLA/platforms/odla_popart/odla_compute.cc
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,13 @@ odla_status odla_SetComputationItem(odla_computation comp, odla_item_type type,
comp->opts.cache_dir = (reinterpret_cast<char*>(value));
break;
case 1001: // load cache directly, need set path of cache file
popart::logging::info("set load_or_save_cache");
PopartConfig::instance()->set_load_or_save_cache(true);
PopartConfig::instance()->set_cache_path(
(std::string) reinterpret_cast<char*>(value));
break;
case 1002:
setenv("POPART_LOG_LEVEL", "INFO", 1);
default:
std::cerr << "Unsupported property type: " << type << std::endl;
return ODLA_UNSUPPORTED_DATATYPE;
Expand Down
5 changes: 0 additions & 5 deletions ODLA/platforms/odla_popart/odla_ops.cc
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,6 @@ odla_value odla_Div(odla_value lhs, odla_value rhs, const odla_value_id id) {
odla_value odla_Erf(odla_value input, const odla_value_id id) {
const auto& name = id ? std::string(reinterpret_cast<const char*>(id)) : "";

// const popart::OperatorIdentifier erf(popart::Domain::ai_graphcore, "Erf",
// 1,
// 1, 1);
// auto result = g_comp->builder->customOp(erf, 1, {input->tensor_id}, 1, {},
// name)[0];
auto result = g_comp->builder->aiOnnxOpset10().erf({input->tensor_id}, name);

return new _odla_value(result,
Expand Down
4 changes: 2 additions & 2 deletions ODLA/platforms/odla_popart/odla_popart.cc
Original file line number Diff line number Diff line change
Expand Up @@ -288,10 +288,10 @@ odla_status _odla_computation::init(bool is_compile) {
"Poplar unrecoverable_runtime_error exception caught");
return ODLA_UNRECOVERABLE_ERR;
} catch (poplar::unknown_runtime_error& e) {
popart::logging::info("Poplar unknown runtime exception caught}");
popart::logging::err("Poplar unknown runtime exception caught");
return ODLA_UNRECOVERABLE_ERR;
} catch (...) {
popart::logging::info("Poplar unknown exception caught");
popart::logging::err("Poplar unknown exception caught");
return ODLA_UNRECOVERABLE_ERR;
}
// If in parallel mode, start the thread
Expand Down

0 comments on commit 97f5a65

Please sign in to comment.