Skip to content
Snippets Groups Projects
Commit 91d9cd17 authored by Hashim Sharif's avatar Hashim Sharif
Browse files

Merging in FIX for hpvm-clang (-O3 usage)

parents 11068a0e b2231780
No related branches found
No related tags found
No related merge requests found
...@@ -12,6 +12,9 @@ ...@@ -12,6 +12,9 @@
#include "hpvm.h" #include "hpvm.h"
// Max file extension size
#define MAX_EXT_SIZE 20
int NUM_TEST_CASES; int NUM_TEST_CASES;
int NUM_CLASSES; int NUM_CLASSES;
int INPUT_DIM; int INPUT_DIM;
...@@ -875,29 +878,33 @@ int main(int argc, char *argv[]) { ...@@ -875,29 +878,33 @@ int main(int argc, char *argv[]) {
// Output the image. // Output the image.
// NOTE: We deliberately perform this file I/O outside of the kernel. // NOTE: We deliberately perform this file I/O outside of the kernel.
char str[50], base_str[50]; const int len = strlen(args.args[OUTPUT_IMAGE_BIN]);
const char *base_str = args.args[OUTPUT_IMAGE_BIN];
char *str = malloc(sizeof(char)*(len + MAX_EXT_SIZE + 1)); // Handles the extensions below
strcpy(base_str, args.args[OUTPUT_IMAGE_BIN]); strcpy(base_str, args.args[OUTPUT_IMAGE_BIN]);
strcpy(str, base_str); strcpy(str, base_str);
strcat(str, ".bin"); strncat(str, ".bin", MAX_EXT_SIZE);
printf("Writing output image to %s\n", str); printf("Writing output image to %s\n", str);
write_image_to_binary(str, image_out, row_size, col_size); write_image_to_binary(str, image_out, row_size, col_size);
strcpy(str, base_str); strcpy(str, base_str);
strcat(str, "_gamut.bin"); strncat(str, "_gamut.bin", MAX_EXT_SIZE);
printf("Writing output image to %s\n", str); printf("Writing output image to %s\n", str);
write_image_to_binary(str, image_out_gamut, row_size, col_size); write_image_to_binary(str, image_out_gamut, row_size, col_size);
strcpy(str, base_str); strcpy(str, base_str);
strcat(str, "_demosaic.bin"); strncat(str, "_demosaic.bin", MAX_EXT_SIZE);
printf("Writing output image to %s\n", str); printf("Writing output image to %s\n", str);
write_image_to_binary(str, image_out_demosaic, row_size, col_size); write_image_to_binary(str, image_out_demosaic, row_size, col_size);
strcpy(str, base_str); strcpy(str, base_str);
strcat(str, "_denoise.bin"); strncat(str, "_denoise.bin", MAX_EXT_SIZE);
printf("Writing output image to %s\n", str); printf("Writing output image to %s\n", str);
write_image_to_binary(str, image_out_denoise, row_size, col_size); write_image_to_binary(str, image_out_denoise, row_size, col_size);
strcpy(str, base_str); strcpy(str, base_str);
strcat(str, "_transform.bin"); strncat(str, "_transform.bin", MAX_EXT_SIZE);
printf("Writing output image to %s\n", str); printf("Writing output image to %s\n", str);
write_image_to_binary(str, image_out_transform, row_size, col_size); write_image_to_binary(str, image_out_transform, row_size, col_size);
free(str);
__hpvm__cleanup(); __hpvm__cleanup();
return 0; return 0;
......
...@@ -229,8 +229,8 @@ See option -b for that.""" ...@@ -229,8 +229,8 @@ See option -b for that."""
help="[clang emit-llvm] clang++ flags (such as -ffastmath)" help="[clang emit-llvm] clang++ flags (such as -ffastmath)"
) )
parser.add_argument( parser.add_argument(
"-O", type=str, default="0", metavar="level", "-O", type=str, default="1", metavar="level",
help="[clang emit-llvm] Optimization level" help="[clang emit-llvm] Optimization level. Note that default is -O1."
) )
parser.add_argument( parser.add_argument(
"--std", type=str, "--std", type=str,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment