Skip to content

NEC compilers SIGSEGV while explicit template instantiations of many functions in one translation unit #540

@quickwritereader

Description

@quickwritereader

NEC compilers SIGSEGV while explicit template instantiations of many functions in one translation unit

Compiler:

ncc --version
ncc (NCC) 3.0.8 (Build 08:14:57 Aug 26 2020)
Copyright (C) 2018,2020 NEC Corporation.

#We can show it using our codebase


git clone https://github.com/KonduitAI/deeplearning4j
cd deeplearning4j/libnd4j
git checkout sa_aurora


#create an example that fails to compile which have many template instantiations

>example_failure.cpp  cat <<EOF
#include <loops/cpu/reduce/reduce_float.hpp> 
namespace functions {
    namespace reduce {
        BUILD_DOUBLE_TEMPLATE(template class ND4J_EXPORT ReduceFloatFunction, , LIBND4J_TYPES, FLOAT_TYPES_0);
    }
}
EOF

#create an example that compiles

>example_success.cpp  cat <<EOF
#include <loops/cpu/reduce/reduce_float.hpp> 
namespace functions {
    namespace reduce {
        BUILD_DOUBLE_TEMPLATE(template class ND4J_EXPORT ReduceFloatFunction, , LIBND4J_TYPES_0, FLOAT_TYPES_0);
    }
}
EOF


LIBND4J_HOME=`pwd`


#change some headers to skip unnecessary dependencies
sed -i "s|#include <graph/generated/array_generated.h>|//#include <graph/generated/array_generated.h>|" ${LIBND4J_HOME}/include/array/DataTypeUtils.h
sed -i "s|static DataType fromFlatDataType(sd::graph|//static DataType fromFlatDataType(sd::graph|" ${LIBND4J_HOME}/include/array/DataTypeUtils.h
sed -i "s|#include <graph/generated/result_generated.h>|//#include <graph/generated/result_generated.h>|" ${LIBND4J_HOME}/include/array/ResultSet.h
sed -i "s|ResultSet(const sd::graph|//ResultSet(const sd::graph|" ${LIBND4J_HOME}/include/array/ResultSet.h

#Create fake config.h

touch ${LIBND4J_HOME}/include/config.h

#Compilation

COMPILER_ARGS="-I${LIBND4J_HOME}/blasbuild/aurora/include -I${LIBND4J_HOME}/include  -std=gnu++14 -DSD_ALL_OPS=true -fopenmp -w -O3 -fPIC -finline-functions -finline-max-depth=10 -fopenmp -fassociative-math -D_RELEASE=true "


ncc -c example_failure.cpp ${COMPILER_ARGS}

#outputs : ncc: /opt/nec/ve/ncc/3.0.8/libexec/ccom is abnormally terminated by SIGSEGV


ncc -c example_success.cpp ${COMPILER_ARGS}
#compiles just fine

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions