remove third_party/Opencl and support depthwise batch>1
This commit is contained in:
parent
d988e13fb5
commit
00a1369d4e
|
@ -4,9 +4,3 @@
|
|||
[submodule "graphengine"]
|
||||
path = graphengine
|
||||
url = https://gitee.com/mindspore/graphengine.git
|
||||
[submodule "third_party/OpenCL-CLHPP"]
|
||||
path = third_party/OpenCL-CLHPP
|
||||
url = https://github.com/KhronosGroup/OpenCL-CLHPP.git
|
||||
[submodule "third_party/OpenCL-Headers"]
|
||||
path = third_party/OpenCL-Headers
|
||||
url = https://github.com/KhronosGroup/OpenCL-Headers.git
|
||||
|
|
58
build.sh
58
build.sh
|
@ -492,63 +492,6 @@ checkddk() {
|
|||
fi
|
||||
}
|
||||
|
||||
gene_clhpp() {
|
||||
CL_SRC_DIR="${BASEPATH}/mindspore/lite/src/runtime/kernel/opencl/cl"
|
||||
if [ ! -d "${CL_SRC_DIR}" ]; then
|
||||
return
|
||||
fi
|
||||
cd ${CL_SRC_DIR}/
|
||||
rm -rf *.inc
|
||||
echo "$(cd "$(dirname $0)"; pwd)"
|
||||
for file_path in "${CL_SRC_DIR}"/*
|
||||
do
|
||||
file="$(basename ${file_path})"
|
||||
inc_file=$(echo ${CL_SRC_DIR}/${file} | sed 's/$/.inc/')
|
||||
sed 's/\\/\\\\/g;s/\"/\\\"/g;s/^/\"/;s/$/\\n\" \\/' ${CL_SRC_DIR}/${file} > ${inc_file}
|
||||
kernel_name=$(echo ${file} | sed s'/.\{3\}$//')
|
||||
sed -i "1i\static const char *${kernel_name}_source =\"\\n\" \\" ${inc_file}
|
||||
sed -i '$a\;' ${inc_file}
|
||||
done
|
||||
}
|
||||
|
||||
gene_ocl_program() {
|
||||
OCL_SRC_DIR="${BASEPATH}/mindspore/lite/src/runtime/kernel/opencl/cl"
|
||||
SPIRV_DIR=build/spirv
|
||||
[ -n "${SPIRV_DIR}" ] && rm -rf ${SPIRV_DIR}
|
||||
mkdir -pv ${SPIRV_DIR}
|
||||
if [ ! -d "${OCL_SRC_DIR}" ]; then
|
||||
return
|
||||
fi
|
||||
for file_path in "${OCL_SRC_DIR}"/*
|
||||
do
|
||||
ocl_file="$(basename ${file_path})"
|
||||
if [ "${ocl_file##*.}" != "cl" ]; then
|
||||
continue
|
||||
fi
|
||||
clang -Xclang -finclude-default-header -cl-std=CL2.0 --target=spir64-unknown-unknown -emit-llvm \
|
||||
-c -O0 -o ${SPIRV_DIR}/${ocl_file%.*}.bc ${OCL_SRC_DIR}/${ocl_file}
|
||||
done
|
||||
|
||||
bcs=$(ls ${SPIRV_DIR}/*.bc)
|
||||
llvm-link ${bcs} -o ${SPIRV_DIR}/program.bc
|
||||
llvm-spirv -o ${SPIRV_DIR}/program.spv ${SPIRV_DIR}/program.bc
|
||||
|
||||
CL_PROGRAM_PATH="${BASEPATH}/mindspore/lite/src/runtime/kernel/opencl/cl/program.inc"
|
||||
echo "#include <vector>" > ${CL_PROGRAM_PATH}
|
||||
echo "std::vector<unsigned char> g_program_binary = {" >> ${CL_PROGRAM_PATH}
|
||||
#hexdump -v -e '16/1 "0x%02x, " "\n"' ${SPIRV_DIR}/program.spv >> ${CL_PROGRAM_PATH}
|
||||
hexdump -v -e '1/1 "0x%02x, "' ${SPIRV_DIR}/program.spv >> ${CL_PROGRAM_PATH}
|
||||
echo "};" >> ${CL_PROGRAM_PATH}
|
||||
echo "Compile SPIRV done"
|
||||
}
|
||||
|
||||
get_opencl() {
|
||||
cd ${BASEPATH}
|
||||
git submodule update --init third_party/OpenCL-Headers
|
||||
git submodule update --init third_party/OpenCL-CLHPP
|
||||
}
|
||||
|
||||
|
||||
get_version() {
|
||||
VERSION_MAJOR=$(grep "const int ms_version_major =" ${BASEPATH}/mindspore/lite/include/version.h | tr -dc "[0-9]")
|
||||
VERSION_MINOR=$(grep "const int ms_version_minor =" ${BASEPATH}/mindspore/lite/include/version.h | tr -dc "[0-9]")
|
||||
|
@ -568,7 +511,6 @@ build_lite()
|
|||
|
||||
if [ "${ENABLE_GPU}" == "on" ] && [ "${LITE_PLATFORM}" == "arm64" ] || [ $1 == "arm64" ]; then
|
||||
echo "start get opencl"
|
||||
get_opencl
|
||||
fi
|
||||
if [ "${ENABLE_NPU}" == "on" ]; then
|
||||
checkddk
|
||||
|
|
|
@ -161,8 +161,8 @@ if (SUPPORT_GPU)
|
|||
if (OFFLINE_COMPILE)
|
||||
add_compile_definitions(PROGRAM_WITH_IL)
|
||||
endif ()
|
||||
include_directories(${TOP_DIR}/third_party/OpenCL-Headers)
|
||||
include_directories(${TOP_DIR}/third_party/OpenCL-CLHPP/include)
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/build/_deps/opencl-headers-src/)
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/build/_deps/opencl-clhpp-src/include)
|
||||
endif ()
|
||||
|
||||
if (WIN32)
|
||||
|
|
|
@ -197,7 +197,7 @@ void DepthwiseConv2dOpenCLKernel::SetGlobalLocal() {
|
|||
// set global
|
||||
size_t CO4 = UP_DIV(out_tensors_[0]->Channel(), C4NUM * block_size_[2]);
|
||||
global_size_ = {CO4, (size_t)UP_DIV(out_tensors_[0]->Width(), block_size_[1]),
|
||||
(size_t)UP_DIV(out_tensors_[0]->Height(), block_size_[0])};
|
||||
(size_t)UP_DIV(out_tensors_[0]->Height() * out_tensors_[0]->Batch(), block_size_[0])};
|
||||
// set local
|
||||
const int max_group_size = ocl_runtime_->DeviceMaxWorkGroupSize();
|
||||
int z = global_size_[0];
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
Subproject commit 524f5ca96c3b9775f9d1debbdbcc2666bcce5c07
|
|
@ -1 +0,0 @@
|
|||
Subproject commit 879576679f7cf319d4f27ed6639a85207dd91e07
|
Loading…
Reference in New Issue