diff --git a/hpvm/projects/onnx_frontend/frontend/graph_ir.py b/hpvm/projects/onnx_frontend/frontend/graph_ir.py index f62371c7a7b990c2a2a83573256647ee41be3040..9eb2ebf5f6cf9229c786f318fae51ca0c419422e 100644 --- a/hpvm/projects/onnx_frontend/frontend/graph_ir.py +++ b/hpvm/projects/onnx_frontend/frontend/graph_ir.py @@ -130,7 +130,7 @@ class Conv2DNode(DFGNode): def hpvm_codegen(self): return ( - "__visc__tensor_convolution", + "__hpvm__tensor_convolution", [self.pads, self.pads, *self.strides], ) @@ -168,7 +168,7 @@ class _Pool2DNode(DFGNode, abc.ABC): def hpvm_codegen(self): return ( - "__visc__tensor_pool_max", + "__hpvm__tensor_pool_max", [*self.kernel_shape, *self.pads, *self.strides], ) @@ -190,7 +190,7 @@ class BiasAddNode(DFGNode): return "tensorAdd", [] def hpvm_codegen(self): - return "__visc__tensor_add", [] + return "__hpvm__tensor_add", [] class MatMulNode(DFGNode): @@ -200,7 +200,7 @@ class MatMulNode(DFGNode): return "tensorGemmGPU", [] def hpvm_codegen(self): - return "__visc__tensor_mul", [] + return "__hpvm__tensor_mul", [] @staticmethod def gemm_transpose(onnx_gemm_node, predec): @@ -232,7 +232,7 @@ class SoftMaxNode(DFGNode): return "tensorSoftmax", [] def hpvm_codegen(self): - return "__visc__tensor_softmax", [] + return "__hpvm__tensor_softmax", [] class AddNode(DFGNode): @@ -242,7 +242,7 @@ class AddNode(DFGNode): return "tensorAdd", [] def hpvm_codegen(self): - return "__visc__tensor_add", [] + return "__hpvm__tensor_add", [] class ReluNode(DFGNode): @@ -252,7 +252,7 @@ class ReluNode(DFGNode): return "tensorRelu", [] def hpvm_codegen(self): - return "__visc__tensor_relu", [] + return "__hpvm__tensor_relu", [] class TanhNode(DFGNode): @@ -262,7 +262,7 @@ class TanhNode(DFGNode): return "tensorTanh", [] def hpvm_codegen(self): - return "__visc__tensor_tanh", [] + return "__hpvm__tensor_tanh", [] class BatchNormalizationNode(DFGNode): @@ -276,7 +276,7 @@ class BatchNormalizationNode(DFGNode): return "tensorBatchNorm", [self.epsilon] def hpvm_codegen(self): - return "__visc__tensor_batchnorm", [self.epsilon] + return "__hpvm__tensor_batchnorm", [self.epsilon] class FlattenNode(DFGNode): diff --git a/hpvm/projects/onnx_frontend/frontend/template_hpvm.cpp.in b/hpvm/projects/onnx_frontend/frontend/template_hpvm.cpp.in index e4d13c84ece354d561b141693a3b4ec40a68974a..7f6785c41a623012787b68c3d8a438024979ad14 100644 --- a/hpvm/projects/onnx_frontend/frontend/template_hpvm.cpp.in +++ b/hpvm/projects/onnx_frontend/frontend/template_hpvm.cpp.in @@ -1,5 +1,5 @@ #include <string> -#include <visc.h> +#include <hpvm.h> #include <tensorTypes.h> #include <tensorUtils.h> @@ -8,14 +8,14 @@ void {{node.name}}_node( {%- for n in range(node.input_size) -%} void *t{{n}}, size_t bytes_t{{n}}{{", " if not loop.last}} {%- endfor %}) { - __visc__hint(visc::CUDNN_TARGET); - __visc__attributes({{node.input_size}}, {% for n in range(node.input_size) -%} + __hpvm__hint(hpvm::CUDNN_TARGET); + __hpvm__attributes({{node.input_size}}, {% for n in range(node.input_size) -%} t{{n}}{{", " if not loop.last}} {%- endfor %}, 0); void *r = {{node.call_name}}({% for n in range(node.input_size) -%} t{{n}}{{", " if not loop.last}} {%- endfor %}{{", " if node.call_args}}{{node.call_args|join(", ")}}); - __visc__return(2, r, (size_t) 0); + __hpvm__return(2, r, (size_t) 0); } {% endfor -%} @@ -23,26 +23,26 @@ t{{n}}{{", " if not loop.last}} void root(void *__output, {%- for n in root_inputs -%} void *{{n}}, size_t {{n}}_bytes{{", " if not loop.last}} {%- endfor %}) { - __visc__hint(visc::CPU_TARGET); - __visc__attributes({{root_inputs|length}}, {% for n in root_inputs -%} + __hpvm__hint(hpvm::CPU_TARGET); + __hpvm__attributes({{root_inputs|length}}, {% for n in root_inputs -%} {{n}}{{", " if not loop.last}} {%- endfor %}, 0); {% for node in nodes %} - void* {{node.name}} = __visc__createNodeND(0, {{node.name}}_node); + void* {{node.name}} = __hpvm__createNodeND(0, {{node.name}}_node); {% for edge in node.edges %} {% if edge.is_bindin %} - __visc__bindIn({{node.name}}, {{edge.input_idx * 2 + 1}}, {{edge.edge_idx * 2}}, 0); - __visc__bindIn({{node.name}}, {{edge.input_idx * 2 + 2}}, {{edge.edge_idx * 2 + 1}}, 0); + __hpvm__bindIn({{node.name}}, {{edge.input_idx * 2 + 1}}, {{edge.edge_idx * 2}}, 0); + __hpvm__bindIn({{node.name}}, {{edge.input_idx * 2 + 2}}, {{edge.edge_idx * 2 + 1}}, 0); {% else %} - __visc__edge({{edge.input_node}}, {{node.name}}, 1, 0, {{edge.edge_idx * 2}}, 0); - __visc__edge({{edge.input_node}}, {{node.name}}, 1, 1, {{edge.edge_idx * 2 + 1}}, 0); + __hpvm__edge({{edge.input_node}}, {{node.name}}, 1, 0, {{edge.edge_idx * 2}}, 0); + __hpvm__edge({{edge.input_node}}, {{node.name}}, 1, 1, {{edge.edge_idx * 2 + 1}}, 0); {% endif %} {% endfor %} {% endfor %} - __visc__bindOut({{root_output}}, 0, 0, 0); - __visc__bindOut({{root_output}}, 1, 1, 0); + __hpvm__bindOut({{root_output}}, 0, 0, 0); + __hpvm__bindOut({{root_output}}, 1, 1, 0); } struct ret_t { @@ -78,14 +78,14 @@ int main(){ args->{{n}}_bytes = 0; {% endfor %} - __visc__init(); + __hpvm__init(); startMemTracking(); for (int i = 0; i < batch_count; i++){ int start = i * batch_size, end = start + batch_size; copyInputBatch(input_path.c_str(), start, end, {{input_shape|join(', ')}}, {{input_name}}); - void* dfg = __visc__launch(0, root, (void*) args); - __visc__wait(dfg); + void* dfg = __hpvm__launch(0, root, (void*) args); + __hpvm__wait(dfg); void *result = static_cast<RootIn*>(args)->__output; hpvm_request_tensor(result, 0); @@ -93,6 +93,6 @@ int main(){ computeAccuracy3(labels, result); freeBatchMemory(); } - __visc__cleanup(); + __hpvm__cleanup(); return 0; }