Commit 24054d8e authored by fenglei.tian's avatar fenglei.tian

clang-format-3.9

parent 938329f0
......@@ -21,8 +21,8 @@
#include <vector>
#include <cuda_runtime.h>
#include "cublas_v2.h"
#include <cudnn.h>
#include "cublas_v2.h"
#include "ngraph/function.hpp"
#include "ngraph/runtime/call_frame.hpp"
......
......@@ -17,16 +17,16 @@
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cublas_v2.h>
#include <cuda.h>
#include <cuda_runtime.h>
#include <cudnn_v7.h>
#include <iostream>
#include <nvrtc.h>
#include <string>
#include <typeindex>
#include <unordered_map>
#include <vector>
#include <nvrtc.h>
#include <cuda.h>
#include <cuda_runtime.h>
#include <cublas_v2.h>
#include <cudnn_v7.h>
#include "ngraph/node.hpp"
#include "ngraph/ops/broadcast.hpp"
......@@ -51,29 +51,30 @@
using namespace std;
using namespace ngraph;
#define NVRTC_SAFE_CALL(x) \
do { \
do \
{ \
nvrtcResult result = x; \
if (result != NVRTC_SUCCESS) { \
std::cerr << "\nerror: " #x " failed with error " \
<< nvrtcGetErrorString(result) << '\n'; \
if (result != NVRTC_SUCCESS) \
{ \
std::cerr << "\nerror: " #x " failed with error " << nvrtcGetErrorString(result) \
<< '\n'; \
exit(1); \
} \
} while(0)
} while (0)
#define CUDA_SAFE_CALL(x) \
do { \
do \
{ \
CUresult result = x; \
if (result != CUDA_SUCCESS) { \
const char *msg; \
if (result != CUDA_SUCCESS) \
{ \
const char* msg; \
cuGetErrorName(result, &msg); \
std::cerr << "\nerror: " #x " failed with error " \
<< msg << '\n'; \
std::cerr << "\nerror: " #x " failed with error " << msg << '\n'; \
exit(1); \
} \
} while(0)
} while (0)
void runtime::gpu::GPU_Emitter::EmitNop(codegen::CodeWriter& writer,
const ngraph::Node* n,
......@@ -122,14 +123,11 @@ cudnnSetOpTensorDescriptor(opTensorDesc,
writer << "cudnnOpTensor(cudnn_handle,"
<< "opTensorDesc,"
<< "&alpha1,"
<< "descriptor,"
<< args[0].get_name() << ","
<< "descriptor," << args[0].get_name() << ","
<< "&alpha2,"
<< "descriptor,"
<< args[1].get_name() << ","
<< "descriptor," << args[1].get_name() << ","
<< "&beta,"
<< "descriptor,"
<< out[0].get_name() << ");\n";
<< "descriptor," << out[0].get_name() << ");\n";
writer.indent--;
writer << "}\n";
}
......@@ -247,12 +245,11 @@ void runtime::gpu::GPU_Emitter::EmitDot(codegen::CodeWriter& writer,
// clang-format on
writer.indent--;
writer << "}\n";
}
else
{
}
else
{
// General ND Call?
}
}
}
void runtime::gpu::GPU_Emitter::EmitDivide(codegen::CodeWriter& writer,
......@@ -344,14 +341,11 @@ cudnnSetOpTensorDescriptor(opTensorDesc,
writer << "cudnnOpTensor(cudnn_handle,"
<< "opTensorDesc,"
<< "&alpha1,"
<< "descriptor,"
<< args[0].get_name() << ","
<< "descriptor," << args[0].get_name() << ","
<< "&alpha2,"
<< "descriptor,"
<< args[1].get_name() << ","
<< "descriptor," << args[1].get_name() << ","
<< "&beta,"
<< "descriptor,"
<< out[0].get_name() << ");\n";
<< "descriptor," << out[0].get_name() << ");\n";
writer.indent--;
writer << "}\n";
}
......@@ -388,17 +382,13 @@ cudnnSetOpTensorDescriptor(opTensorDesc,
writer << "cudnnOpTensor(cudnn_handle,"
<< "opTensorDesc,"
<< "&alpha1,"
<< "descriptor,"
<< args[0].get_name() << ","
<< "descriptor," << args[0].get_name() << ","
<< "&alpha2,"
<< "descriptor,"
<< args[1].get_name() << ","
<< "descriptor," << args[1].get_name() << ","
<< "&beta,"
<< "descriptor,"
<< out[0].get_name() << ");\n";
<< "descriptor," << out[0].get_name() << ");\n";
writer.indent--;
writer << "}\n";
}
void runtime::gpu::GPU_Emitter::EmitNegative(
......@@ -434,14 +424,11 @@ cudnnSetOpTensorDescriptor(opTensorDesc,
writer << "cudnnOpTensor(cudnn_handle,"
<< "opTensorDesc,"
<< "&alpha1,"
<< "descriptor,"
<< args[0].get_name() << ","
<< "descriptor," << args[0].get_name() << ","
<< "&alpha2,"
<< "descriptor,"
<< args[0].get_name() << ","
<< "descriptor," << args[0].get_name() << ","
<< "&beta,"
<< "descriptor,"
<< out[0].get_name() << ");\n";
<< "descriptor," << out[0].get_name() << ");\n";
writer.indent--;
writer << "}\n";
}
......
......@@ -23,10 +23,10 @@
#include <typeinfo>
#include <unordered_map>
#include <cuda_runtime.h>
#include <cudnn_v7.h>
#include "cublas_v2.h"
#include "cuda.h"
#include <cuda_runtime.h>
#include <cudnn_v7.h>
#include "cublas_v2.h"
#include "cuda.h"
#include "ngraph/codegen/code_writer.hpp"
#include "ngraph/codegen/compiler.hpp"
......@@ -359,8 +359,9 @@ void runtime::gpu::GPU_ExternalFunction::compile()
writer << "// Declare all functions\n";
for (shared_ptr<Function> f : pass_manager.get_state().get_functions())
{
writer << "extern \"C\" void " << f->get_name()
<< "(void** inputs, void** outputs, cublasHandle_t& cublas_handle, cudnnHandle_t& cudnn_handle);\n";
writer << "extern \"C\" void " << f->get_name() << "(void** inputs, void** outputs, "
"cublasHandle_t& cublas_handle, "
"cudnnHandle_t& cudnn_handle);\n";
}
writer << "\n";
......@@ -478,7 +479,8 @@ void runtime::gpu::GPU_ExternalFunction::compile()
}
writer << "extern \"C\" void " << current_function->get_name();
writer << "(void** inputs, void** outputs, cublasHandle_t& cublas_handle, cudnnHandle_t& cudnn_handle)\n";
writer << "(void** inputs, void** outputs, cublasHandle_t& cublas_handle, cudnnHandle_t& "
"cudnn_handle)\n";
writer << "{\n";
writer.indent++;
......
......@@ -41,7 +41,7 @@ runtime::gpu::GPU_TensorView::GPU_TensorView(const ngraph::element::Type& elemen
m_buffer_size = m_descriptor->get_tensor_view_layout()->get_size() * element_type.size();
if (m_buffer_size > 0)
{
cudaMalloc((void**) &m_allocated_buffer_pool, m_buffer_size);
cudaMalloc((void**)&m_allocated_buffer_pool, m_buffer_size);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment