aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/stream_executor/stream.cc
diff options
context:
space:
mode:
authorGravatar A. Unique TensorFlower <gardener@tensorflow.org>2017-01-19 12:47:08 -0800
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2017-01-19 13:08:19 -0800
commit598583c20dba57e4c99430d345b88dc63bc662f0 (patch)
tree02940d56fee0e548f81f8861786cd9c45fe97507 /tensorflow/stream_executor/stream.cc
parent82542b6128c30aecd51d776f2be636993f99bd6a (diff)
Add convolve quantized ops to StreamExecutor API
Change: 144996696
Diffstat (limited to 'tensorflow/stream_executor/stream.cc')
-rw-r--r--tensorflow/stream_executor/stream.cc60
1 files changed, 60 insertions, 0 deletions
diff --git a/tensorflow/stream_executor/stream.cc b/tensorflow/stream_executor/stream.cc
index 980d544b01..7712a3697c 100644
--- a/tensorflow/stream_executor/stream.cc
+++ b/tensorflow/stream_executor/stream.cc
@@ -468,6 +468,66 @@ Stream &Stream::ThenConvolve(
output, /*scratch_allocator=*/nullptr);
}
+Stream &Stream::ThenConvolveQuantized(
+ const dnn::BatchDescriptor &input_descriptor,
+ const DeviceMemory<float> &input_data,
+ const dnn::FilterDescriptor &filter_descriptor,
+ const DeviceMemory<int8> &filter_coefficients,
+ const DeviceMemory<float> &coefficient_scales,
+ const dnn::ConvolutionDescriptor &convolution_descriptor,
+ const dnn::BatchDescriptor &output_descriptor,
+ DeviceMemory<float> *output) {
+ VLOG_CALL(PARAM(input_descriptor), PARAM(input_data),
+ PARAM(filter_descriptor), PARAM(filter_coefficients),
+ PARAM(coefficient_scales), PARAM(convolution_descriptor),
+ PARAM(output_descriptor), PARAM(output));
+
+ if (ok()) {
+ if (dnn::DnnSupport *dnn = parent_->AsDnn()) {
+ CheckError(dnn->DoConvolveQuantized(
+ this, input_descriptor, input_data, filter_descriptor,
+ filter_coefficients, coefficient_scales, convolution_descriptor,
+ output_descriptor, output));
+ } else {
+ SetError();
+ LOG(WARNING)
+ << "attempting to perform DNN operation using StreamExecutor "
+ "without DNN support";
+ }
+ }
+ return *this;
+}
+
+Stream &Stream::ThenConvolveQuantized(
+ const dnn::BatchDescriptor &input_descriptor,
+ const DeviceMemory<float> &input_data,
+ const dnn::FilterDescriptor &filter_descriptor,
+ const DeviceMemory<int16> &filter_coefficients,
+ const DeviceMemory<float> &coefficient_scales,
+ const dnn::ConvolutionDescriptor &convolution_descriptor,
+ const dnn::BatchDescriptor &output_descriptor,
+ DeviceMemory<float> *output) {
+ VLOG_CALL(PARAM(input_descriptor), PARAM(input_data),
+ PARAM(filter_descriptor), PARAM(filter_coefficients),
+ PARAM(coefficient_scales), PARAM(convolution_descriptor),
+ PARAM(output_descriptor), PARAM(output));
+
+ if (ok()) {
+ if (dnn::DnnSupport *dnn = parent_->AsDnn()) {
+ CheckError(dnn->DoConvolveQuantized(
+ this, input_descriptor, input_data, filter_descriptor,
+ filter_coefficients, coefficient_scales, convolution_descriptor,
+ output_descriptor, output));
+ } else {
+ SetError();
+ LOG(WARNING)
+ << "attempting to perform DNN operation using StreamExecutor "
+ "without DNN support";
+ }
+ }
+ return *this;
+}
+
Stream &Stream::ThenSeparableConvolve(
const dnn::BatchDescriptor &batch_descriptor,
const DeviceMemory<float> &input_data,