Commit a32fdab5 authored by Fenglei's avatar Fenglei Committed by Robert Kimball

fix old style cast error (#632)

parent 490e4e63
......@@ -53,12 +53,12 @@ void cuda_)" + name + "(" + data_type +
//convert runtime ptr to driver api ptr
CUdeviceptr d_ptr_in, d_ptr_out;
d_ptr_in = (CUdeviceptr)in;
d_ptr_out = (CUdeviceptr)out;
d_ptr_in = CUdeviceptr(in);
d_ptr_out = CUdeviceptr(out);
void* args_list[] = {&d_ptr_in, &d_ptr_out, &repeat_size, &repeat_times, &count};
CUDA_SAFE_CALL(cuLaunchKernel(*CudaFunctionPool::instance().get(name).get(),
count,
static_cast<unsigned int>(count),
1,
1, // grid dim
1,
......
......@@ -183,7 +183,6 @@ cudnnSetOpTensorDescriptor(opTensorDesc,
return;
}
const ngraph::op::Dot* dot = static_cast<const ngraph::op::Dot*>(node);
const Shape& arg0_shape = args[0].get_shape();
const Shape& arg1_shape = args[1].get_shape();
if (arg0_shape.empty() || arg1_shape.empty())
......@@ -504,15 +503,11 @@ cudnnSetOpTensorDescriptor(opTensorDesc,
writer.indent++;
auto arg_shape = args[0].get_shape();
auto arg_rank = arg_shape.size();
auto result_shape = out[0].get_shape();
auto& result_element_type = out[0].get_element_type();
auto input_order = reshape->get_input_order();
bool same_layout = is_sorted(input_order.begin(), input_order.end());
size_t result_shape_product = 1;
for (auto i : result_shape)
{
result_shape_product *= i;
......
......@@ -427,9 +427,6 @@ using namespace std;
for (shared_ptr<Function> current_function :
pass_manager.get_state().get_functions())
{
bool temporaries_used = false;
size_t worst_case_tmp_size = 0;
set<string> output_names;
for (shared_ptr<Node> op : current_function->get_results())
{
......@@ -454,18 +451,6 @@ using namespace std;
continue;
}
string match_function_name;
for (size_t j = i + 1; j < op_list.size(); j++)
{
if (0) //op_list[i]->is_functionally_identical(*op_list[j]))
{
if (match_function_name.empty())
{
match_function_name = "func_" + op_list[i]->get_name();
match_functions.insert({op_list[i].get(), match_function_name});
}
match_functions.insert({op_list[j].get(), match_function_name});
}
}
if (!match_function_name.empty())
{
writer << "static void " << match_function_name << "(";
......@@ -545,28 +530,24 @@ using namespace std;
writer << "{\n";
writer.indent++;
for (shared_ptr<Function> current_function :
pass_manager.get_state().get_functions())
for (shared_ptr<Node> node : current_function->get_ordered_ops())
{
for (shared_ptr<Node> node : current_function->get_ordered_ops())
const op::Constant* c = dynamic_cast<op::Constant*>(node.get());
if (c)
{
const op::Constant* c = dynamic_cast<op::Constant*>(node.get());
if (c)
{
shared_ptr<descriptor::TensorView> tv =
node->get_outputs()[0].get_tensor_view();
writer << "if(" << tv->get_tensor().get_name() << " == NULL)\n";
writer << "{\n";
writer.indent++;
writer << "runtime::gpu::cuda_memcpyHtD("
<< tv->get_tensor().get_name() << ", "
<< tv->get_tensor().get_name() << "_cpu, "
<< tv->get_tensor().size() << ");\n";
writer.indent--;
writer << "}\n";
}
shared_ptr<descriptor::TensorView> tv =
node->get_outputs()[0].get_tensor_view();
writer << "if(" << tv->get_tensor().get_name() << " == NULL)\n";
writer << "{\n";
writer.indent++;
writer << "runtime::gpu::cuda_memcpyHtD(" << tv->get_tensor().get_name()
<< ", " << tv->get_tensor().get_name() << "_cpu, "
<< tv->get_tensor().size() << ");\n";
writer.indent--;
writer << "}\n";
}
}
bool temporaries_used = false;
size_t worst_case_tmp_size = 0;
for (shared_ptr<Node> node : current_function->get_ordered_ops())
......
......@@ -41,7 +41,7 @@ runtime::gpu::GPU_TensorView::GPU_TensorView(const ngraph::element::Type& elemen
m_buffer_size = shape_size(shape) * element_type.size();
if (m_buffer_size > 0)
{
cudaMalloc((void**)&m_allocated_buffer_pool, m_buffer_size);
cudaMalloc(static_cast<void**>(&m_allocated_buffer_pool), m_buffer_size);
}
}
......
......@@ -50,7 +50,7 @@ void runtime::gpu::check_cuda_errors(CUresult err)
void* runtime::gpu::create_gpu_buffer(size_t buffer_size)
{
void* allocated_buffer_pool;
cudaMalloc((void**)&allocated_buffer_pool, buffer_size);
cudaMalloc(static_cast<void**>(&allocated_buffer_pool), buffer_size);
return allocated_buffer_pool;
}
......
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