“30499a7654d450f1129c8d0989ded4a0e0eb0069”上不存在“paddlespeech/s2t/modules/ctc.py”
提交 bf8531f2 编写于 作者: L Liangliang He

Fix opencl future nullptr issue

上级 f50ea028
......@@ -84,12 +84,14 @@ static void AddN(const std::vector<const Tensor *> &input_tensors,
params_generator,
func,
&timer);
future->wait_fn = [runtime, event](CallStats *stats) {
event.wait();
if (stats != nullptr) {
runtime->GetCallStats(event, stats);
}
};
if (future != nullptr) {
future->wait_fn = [runtime, event](CallStats *stats) {
event.wait();
if (stats != nullptr) {
runtime->GetCallStats(event, stats);
}
};
}
}
template <typename T>
......
......@@ -96,12 +96,14 @@ void BatchNormFunctor<DeviceType::OPENCL, T>::operator()(
params_generator,
func,
&timer);
future->wait_fn = [runtime, event](CallStats *stats) {
event.wait();
if (stats != nullptr) {
runtime->GetCallStats(event, stats);
}
};
if (future != nullptr) {
future->wait_fn = [runtime, event](CallStats *stats) {
event.wait();
if (stats != nullptr) {
runtime->GetCallStats(event, stats);
}
};
}
}
template
......
......@@ -50,12 +50,14 @@ void BiasAddFunctor<DeviceType::OPENCL, T>::operator()(
cl::NDRange(lws[0], lws[1], lws[2]),
nullptr, &event);
MACE_CHECK(error == CL_SUCCESS);
future->wait_fn = [runtime, event](CallStats *stats) {
event.wait();
if (stats != nullptr) {
runtime->GetCallStats(event, stats);
}
};
if (future != nullptr) {
future->wait_fn = [runtime, event](CallStats *stats) {
event.wait();
if (stats != nullptr) {
runtime->GetCallStats(event, stats);
}
};
}
}
template
......
......@@ -73,12 +73,14 @@ void BufferToImageFunctor<DeviceType::OPENCL, T>::operator()(Tensor *buffer,
nullptr, &event);
MACE_CHECK(error == CL_SUCCESS) << "Error code: " << error;
future->wait_fn = [runtime, event](CallStats *stats) {
event.wait();
if (stats != nullptr) {
runtime->GetCallStats(event, stats);
}
};
if (future != nullptr) {
future->wait_fn = [runtime, event](CallStats *stats) {
event.wait();
if (stats != nullptr) {
runtime->GetCallStats(event, stats);
}
};
}
}
template struct BufferToImageFunctor<DeviceType::OPENCL, float>;
......
......@@ -97,12 +97,14 @@ static void Concat2(const Tensor *input0,
params_generator,
func,
&timer);
future->wait_fn = [runtime, event](CallStats *stats) {
event.wait();
if (stats != nullptr) {
runtime->GetCallStats(event, stats);
}
};
if (future != nullptr) {
future->wait_fn = [runtime, event](CallStats *stats) {
event.wait();
if (stats != nullptr) {
runtime->GetCallStats(event, stats);
}
};
}
}
template<typename T>
......
......@@ -114,12 +114,14 @@ void Conv1x1(const Tensor *input,
params_generator,
func,
&timer);
future->wait_fn = [runtime, event](CallStats *stats) {
event.wait();
if (stats != nullptr) {
runtime->GetCallStats(event, stats);
}
};
if (future != nullptr) {
future->wait_fn = [runtime, event](CallStats *stats) {
event.wait();
if (stats != nullptr) {
runtime->GetCallStats(event, stats);
}
};
}
}
extern void Conv2dOpenclK1x1S1(const Tensor *input,
......
......@@ -107,12 +107,14 @@ static void Conv2d3x3S12(const Tensor *input, const Tensor *filter,
func,
&timer);
future->wait_fn = [runtime, event](CallStats *stats) {
event.wait();
if (stats != nullptr) {
runtime->GetCallStats(event, stats);
}
};
if (future != nullptr) {
future->wait_fn = [runtime, event](CallStats *stats) {
event.wait();
if (stats != nullptr) {
runtime->GetCallStats(event, stats);
}
};
}
}
void Conv2dOpenclK3x3S1(const Tensor *input,
const Tensor *filter,
......
......@@ -109,12 +109,14 @@ void Conv2dOpencl(const Tensor *input, const Tensor *filter,
func,
&timer);
future->wait_fn = [runtime, event](CallStats *stats) {
event.wait();
if (stats != nullptr) {
runtime->GetCallStats(event, stats);
}
};
if (future != nullptr) {
future->wait_fn = [runtime, event](CallStats *stats) {
event.wait();
if (stats != nullptr) {
runtime->GetCallStats(event, stats);
}
};
}
}
} // namespace kernels
......
......@@ -66,12 +66,14 @@ static void InnerDepthwiseConvOpenclK3x3S12(const Tensor *input,
nullptr, &event);
MACE_CHECK(error == CL_SUCCESS);
future->wait_fn = [runtime, event](CallStats *stats) {
event.wait();
if (stats != nullptr) {
runtime->GetCallStats(event, stats);
}
};
if (future != nullptr) {
future->wait_fn = [runtime, event](CallStats *stats) {
event.wait();
if (stats != nullptr) {
runtime->GetCallStats(event, stats);
}
};
}
}
extern void DepthwiseConvOpenclK3x3S1(const Tensor *input,
......
......@@ -110,12 +110,14 @@ static void Pooling(const Tensor *input,
func,
&timer);
future->wait_fn = [runtime, event](CallStats *stats) {
event.wait();
if (stats != nullptr) {
runtime->GetCallStats(event, stats);
}
};
if (future != nullptr) {
future->wait_fn = [runtime, event](CallStats *stats) {
event.wait();
if (stats != nullptr) {
runtime->GetCallStats(event, stats);
}
};
}
}
template<typename T>
......
......@@ -97,12 +97,14 @@ void ReluFunctor<DeviceType::OPENCL, T>::operator()(const Tensor *input,
params_generator,
func,
&timer);
future->wait_fn = [runtime, event](CallStats *stats) {
event.wait();
if (stats != nullptr) {
runtime->GetCallStats(event, stats);
}
};
if (future != nullptr) {
future->wait_fn = [runtime, event](CallStats *stats) {
event.wait();
if (stats != nullptr) {
runtime->GetCallStats(event, stats);
}
};
}
}
template
......
......@@ -102,12 +102,14 @@ void ResizeBilinearFunctor<DeviceType::OPENCL, T>::operator()(
params_generator,
func,
&timer);
future->wait_fn = [runtime, event](CallStats *stats) {
event.wait();
if (stats != nullptr) {
runtime->GetCallStats(event, stats);
}
};
if (future != nullptr) {
future->wait_fn = [runtime, event](CallStats *stats) {
event.wait();
if (stats != nullptr) {
runtime->GetCallStats(event, stats);
}
};
}
}
template struct ResizeBilinearFunctor<DeviceType::OPENCL, float>;
......
......@@ -50,12 +50,14 @@ void SpaceToBatchFunctor<DeviceType::OPENCL, float>::operator()(Tensor *space_te
cl::NDRange(lws[0], lws[1], lws[2]),
nullptr, &event);
MACE_CHECK(error == CL_SUCCESS);
future->wait_fn = [runtime, event](CallStats *stats) {
event.wait();
if (stats != nullptr) {
runtime->GetCallStats(event, stats);
}
};
if (future != nullptr) {
future->wait_fn = [runtime, event](CallStats *stats) {
event.wait();
if (stats != nullptr) {
runtime->GetCallStats(event, stats);
}
};
}
}
} // namespace kernels
......
......@@ -42,5 +42,5 @@ for device in `adb devices | grep "^[A-Za-z0-9]\+[[:space:]]\+device$"| cut -f1`
adb -s ${device} shell "mkdir -p $DEVICE_PATH"
adb -s ${device} push $CL_PATH $DEVICE_CL_PATH && \
adb -s ${device} push $BAZEL_BIN_PATH/$BIN_NAME $DEVICE_PATH && \
adb -s ${device} shell "MACE_KERNEL_PATH=$DEVICE_CL_PATH MACE_CPP_MIN_VLOG_LEVEL=0$VLOG_LEVEL $DEVICE_PATH/$BIN_NAME $@"
adb -s ${device} shell "MACE_KERNEL_PATH=$DEVICE_CL_PATH MACE_CPP_MIN_VLOG_LEVEL=$VLOG_LEVEL $DEVICE_PATH/$BIN_NAME $@"
done
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册