diff --git a/src/ops/residual_layer_norm.cpp b/src/ops/residual_layer_norm.cpp index 582e0752ef..ed973b4f71 100644 --- a/src/ops/residual_layer_norm.cpp +++ b/src/ops/residual_layer_norm.cpp @@ -176,6 +176,8 @@ void ResidualLayerNorm::inference_kernel(ResidualLayerNormMeta const *m, beta_ptr, output_ptr); } + +#ifdef DEADCODE template void save_inference_tensors(ResidualLayerNormMeta const *m) { if (m->inference_debugging) { @@ -206,6 +208,7 @@ void save_inference_tensors(ResidualLayerNormMeta const *m) { filename3.c_str()); } } +#endif /*static*/ void ResidualLayerNorm::inference_kernel_wrapper( @@ -314,15 +317,15 @@ void ResidualLayerNorm::inference_kernel_wrapper( } } - if (m->inference_debugging) { - if (m->input_type[0] == DT_FLOAT) { - save_inference_tensors(m); - } else if (m->input_type[0] == DT_HALF) { - save_inference_tensors(m); - } else { - assert(false && "unsupport datatype in layernorm"); - } - } + // if (m->inference_debugging) { + // if (m->input_type[0] == DT_FLOAT) { + // save_inference_tensors(m); + // } else if (m->input_type[0] == DT_HALF) { + // save_inference_tensors(m); + // } else { + // assert(false && "unsupport datatype in layernorm"); + // } + // } if (m->profiling) { checkCUDA(hipEventRecord(t_end, stream)); diff --git a/src/ops/residual_layer_norm.cu b/src/ops/residual_layer_norm.cu index 8cdf87a92c..50c81d2099 100644 --- a/src/ops/residual_layer_norm.cu +++ b/src/ops/residual_layer_norm.cu @@ -174,6 +174,8 @@ void ResidualLayerNorm::inference_kernel(ResidualLayerNormMeta const *m, beta_ptr, output_ptr); } + +#ifdef DEADCODE template void save_inference_tensors(ResidualLayerNormMeta const *m) { if (m->inference_debugging) { @@ -204,6 +206,7 @@ void save_inference_tensors(ResidualLayerNormMeta const *m) { filename3.c_str()); } } +#endif /*static*/ void ResidualLayerNorm::inference_kernel_wrapper( @@ -312,15 +315,15 @@ void ResidualLayerNorm::inference_kernel_wrapper( } } - if (m->inference_debugging) { - if (m->input_type[0] == DT_FLOAT) { - save_inference_tensors(m); - } else if (m->input_type[0] == DT_HALF) { - save_inference_tensors(m); - } else { - assert(false && "unsupport datatype in layernorm"); - } - } + // if (m->inference_debugging) { + // if (m->input_type[0] == DT_FLOAT) { + // save_inference_tensors(m); + // } else if (m->input_type[0] == DT_HALF) { + // save_inference_tensors(m); + // } else { + // assert(false && "unsupport datatype in layernorm"); + // } + // } if (m->profiling) { cudaEventRecord(t_end, stream); diff --git a/src/runtime/cuda_helper.cu b/src/runtime/cuda_helper.cu index 386a0c940b..42b3946f8c 100644 --- a/src/runtime/cuda_helper.cu +++ b/src/runtime/cuda_helper.cu @@ -278,6 +278,10 @@ __host__ void host_ptr, ptr, sizeof(float) * num_elements, cudaMemcpyDeviceToHost)); FILE *tensor_file; tensor_file = fopen(file_name, "w"); + if (!tensor_file) { + fprintf(stderr, "Error %i creating file %s\n", errno, file_name); + assert(false); + } assert(tensor_file != NULL); for (unsigned i = 0; i < num_elements; i++) { if (i < num_elements - 1) { @@ -299,6 +303,10 @@ __host__ void host_ptr, ptr, sizeof(half) * num_elements, cudaMemcpyDeviceToHost)); FILE *tensor_file; tensor_file = fopen(file_name, "w"); + if (!tensor_file) { + fprintf(stderr, "Error %i creating file %s\n", errno, file_name); + assert(false); + } assert(tensor_file != NULL); for (unsigned i = 0; i < num_elements; i++) { if (i < num_elements - 1) { @@ -321,6 +329,10 @@ __host__ void save_tensor(int32_t const *ptr, host_ptr, ptr, sizeof(int32_t) * num_elements, cudaMemcpyDeviceToHost)); FILE *tensor_file; tensor_file = fopen(file_name, "w"); + if (!tensor_file) { + fprintf(stderr, "Error %i creating file %s\n", errno, file_name); + assert(false); + } assert(tensor_file != NULL); for (unsigned i = 0; i < num_elements; i++) { if (i < num_elements - 1) { @@ -343,6 +355,10 @@ __host__ void save_tensor(int64_t const *ptr, host_ptr, ptr, sizeof(int64_t) * num_elements, cudaMemcpyDeviceToHost)); FILE *tensor_file; tensor_file = fopen(file_name, "w"); + if (!tensor_file) { + fprintf(stderr, "Error %i creating file %s\n", errno, file_name); + assert(false); + } assert(tensor_file != NULL); for (unsigned i = 0; i < num_elements; i++) { if (i < num_elements - 1) {