From 5a038ba2024a88441fea4f0235982516ccf0124b Mon Sep 17 00:00:00 2001 From: Tobias Grosser Date: Fri, 16 Mar 2012 17:14:40 +0100 Subject: [PATCH] Rename gpucode to clast printer There is not really anything gpu specific in these files. Signed-off-by: Tobias Grosser Signed-off-by: Sven Verdoolaege --- Makefile.am | 4 ++-- gpucode.c => clast_printer.c | 12 ++++++------ clast_printer.h | 25 +++++++++++++++++++++++++ cuda.c | 28 ++++++++++++++-------------- cuda.h | 8 ++++---- gpucode.h | 25 ------------------------- 6 files changed, 51 insertions(+), 51 deletions(-) rename gpucode.c => clast_printer.c (95%) create mode 100644 clast_printer.h delete mode 100644 gpucode.h diff --git a/Makefile.am b/Makefile.am index f291b31..9079438 100644 --- a/Makefile.am +++ b/Makefile.am @@ -33,12 +33,12 @@ LDADD = $(LIB_CLOOG) $(LIB_PET) $(LIB_ISL) bin_PROGRAMS = ppcg ppcg_SOURCES = \ + clast_printer.c \ + clast_printer.h \ cuda.c \ cuda.h \ cuda_common.h \ cuda_common.c \ - gpucode.c \ - gpucode.h \ rewrite.c \ rewrite.h \ schedule.c \ diff --git a/gpucode.c b/clast_printer.c similarity index 95% rename from gpucode.c rename to clast_printer.c index aa248f9..9e6a8d7 100644 --- a/gpucode.c +++ b/clast_printer.c @@ -8,7 +8,7 @@ * 91893 Orsay, France */ -#include "gpucode.h" +#include "clast_printer.h" void print_cloog_macros(FILE *dst) { @@ -21,7 +21,7 @@ void print_cloog_macros(FILE *dst) } static void print_expr(struct clast_expr *e, FILE *dst); -static void print_stmt(struct gpucode_info *info, struct clast_stmt *s); +static void print_stmt(struct clast_printer_info *info, struct clast_stmt *s); void print_indent(FILE *dst, int indent) { @@ -150,7 +150,7 @@ static void print_ass(struct clast_assignment *a, FILE *dst, int indent, fprintf(dst, ";\n"); } -static void print_guard(struct gpucode_info *info, struct clast_guard *g) +static void print_guard(struct clast_printer_info *info, struct clast_guard *g) { int i; int n = g->n; @@ -181,7 +181,7 @@ static void print_guard(struct gpucode_info *info, struct clast_guard *g) fprintf(info->dst, "}\n"); } -static void print_for(struct gpucode_info *info, struct clast_for *f) +static void print_for(struct clast_printer_info *info, struct clast_for *f) { assert(f->LB && f->UB); print_indent(info->dst, info->indent); @@ -224,7 +224,7 @@ static void print_user_stmt(struct clast_user_stmt *u, FILE *dst, int indent) fprintf(dst, ");\n"); } -static void print_stmt(struct gpucode_info *info, struct clast_stmt *s) +static void print_stmt(struct clast_printer_info *info, struct clast_stmt *s) { int first_ass = 1; @@ -254,7 +254,7 @@ static void print_stmt(struct gpucode_info *info, struct clast_stmt *s) } } -void gpu_print_host_stmt(struct gpucode_info *info, struct clast_stmt *s) +void print_clast(struct clast_printer_info *info, struct clast_stmt *s) { print_stmt(info, s); } diff --git a/clast_printer.h b/clast_printer.h new file mode 100644 index 0000000..cf5eb0c --- /dev/null +++ b/clast_printer.h @@ -0,0 +1,25 @@ +#ifndef _CLAST_PRINTER_H +#define _CLAST_PRINTER_H + +#include + +struct clast_printer_info { + int indent; + FILE *dst; + void (*print_user_stmt)(struct clast_printer_info *info, + struct clast_user_stmt *s); + void (*print_user_stmt_list)(struct clast_printer_info *info, + struct clast_user_stmt *s); + void (*print_for_head)(struct clast_printer_info *info, struct clast_for *f); + void (*print_for_foot)(struct clast_printer_info *info, struct clast_for *f); + void *user; +}; + +void print_cloog_macros(FILE *dst); +void print_indent(FILE *dst, int indent); +void print_clast(struct clast_printer_info *info, struct clast_stmt *s); + +__isl_give isl_set *extract_host_domain(struct clast_user_stmt *u); +__isl_give isl_set *extract_entire_host_domain(struct clast_stmt *s); + +#endif diff --git a/cuda.c b/cuda.c index 0922a89..fd54cad 100644 --- a/cuda.c +++ b/cuda.c @@ -23,7 +23,7 @@ #include "cuda.h" #include "cuda_common.h" -#include "gpucode.h" +#include "clast_printer.h" #include "schedule.h" #include "ppcg_options.h" @@ -1232,7 +1232,7 @@ static __isl_give isl_union_map *scale_access_tile_loops(struct cuda_gen *gen, */ static void print_cloog_shared_body(struct cuda_gen *gen, __isl_keep isl_set *context, __isl_keep isl_union_map *sched, int len, - void (*print_user_stmt)(struct gpucode_info *info, + void (*print_user_stmt)(struct clast_printer_info *info, struct clast_user_stmt *s), int first_unroll) { @@ -1275,7 +1275,7 @@ static void print_cloog_shared_body(struct cuda_gen *gen, gen->stmt_code.print_for_head = NULL; gen->stmt_code.print_for_foot = NULL; gen->stmt_code.user = gen; - gpu_print_host_stmt(&gen->stmt_code, stmt); + print_clast(&gen->stmt_code, stmt); cloog_clast_free(stmt); cloog_options_free(options); @@ -1333,7 +1333,7 @@ __isl_give isl_set *add_bounded_parameters(__isl_take isl_set *set, static void print_shared_body(struct cuda_gen *gen, __isl_keep isl_set *shared_domain, __isl_keep isl_union_map *sched, - int len, void (*print_user_stmt)(struct gpucode_info *info, + int len, void (*print_user_stmt)(struct clast_printer_info *info, struct clast_user_stmt *s), int first_unroll) { @@ -1606,7 +1606,7 @@ static void print_local_index(FILE *out, * the domain of copy_sched at the current scheduling position * as the index of the array. */ -static void print_copy_statement(struct gpucode_info *code, +static void print_copy_statement(struct clast_printer_info *code, struct clast_user_stmt *u) { struct cuda_gen *gen = code->user; @@ -2132,7 +2132,7 @@ static void print_stmt_body(struct cuda_gen *gen, * We print the statement body, simplifying the accesses based * on the schedule. */ -static void print_statement(struct gpucode_info *code, +static void print_statement(struct clast_printer_info *code, struct clast_user_stmt *u) { struct cuda_gen *gen = code->user; @@ -2443,7 +2443,7 @@ static __isl_give isl_union_map *interchange_for_unroll(struct cuda_gen *gen, * computations and writing from shared memory, with the required * synchronizations. */ -static void print_kernel_user(struct gpucode_info *code, +static void print_kernel_user(struct clast_printer_info *code, struct clast_user_stmt *u) { struct cuda_gen *gen = code->user; @@ -2507,7 +2507,7 @@ static void copy_to_local(struct cuda_gen *gen, __isl_keep isl_set *domain) * * Print copying instructions to shared or private memory if needed. */ -static void print_kernel_for_head(struct gpucode_info *code, +static void print_kernel_for_head(struct clast_printer_info *code, struct clast_for *f) { struct cuda_gen *gen = code->user; @@ -2555,7 +2555,7 @@ static void copy_from_local(struct cuda_gen *gen, __isl_keep isl_set *domain) * * Print copying instructions from shared or private memory if needed. */ -static void print_kernel_for_foot(struct gpucode_info *code, +static void print_kernel_for_foot(struct clast_printer_info *code, struct clast_for *f) { struct cuda_gen *gen = code->user; @@ -2569,7 +2569,7 @@ static void print_kernel_for_foot(struct gpucode_info *code, /* Use CLooG to generate code for the outer gen->shared_first loops * of the local schedule "sched". - * The pretty printing of this code is handled by gpu_print_host_stmt, + * The pretty printing of this code is handled by print_clast, * which calls print_kernel_user for each iteration of the shared tile loops. */ static void print_cloog_kernel_body(struct cuda_gen *gen, @@ -2614,7 +2614,7 @@ static void print_cloog_kernel_body(struct cuda_gen *gen, gen->kernel_code.print_for_foot = &print_kernel_for_foot; gen->kernel_code.user = gen; copy_to_local(gen, context); - gpu_print_host_stmt(&gen->kernel_code, stmt); + print_clast(&gen->kernel_code, stmt); copy_from_local(gen, context); cloog_clast_free(stmt); @@ -3874,7 +3874,7 @@ static void print_grid_size(struct cuda_gen *gen, __isl_take isl_set *context) * the size of shared memory and then print the body of host code * and the associated kernel (through a call to print_kernel_body). */ -static void print_host_user(struct gpucode_info *code, +static void print_host_user(struct clast_printer_info *code, struct clast_user_stmt *u) { struct cuda_gen *gen = code->user; @@ -3958,7 +3958,7 @@ static void print_host_user(struct gpucode_info *code, /* Use CLooG to generate code for the outer gen->tile_first loops * of the global schedule in gen->sched. - * The pretty printing of this code is handled by gpu_print_host_stmt, + * The pretty printing of this code is handled by print_clast, * which calls print_host_user for each kernel invocation location. */ static void print_cloog_host_code(struct cuda_gen *gen) @@ -4002,7 +4002,7 @@ static void print_cloog_host_code(struct cuda_gen *gen) gen->code.print_for_head = NULL; gen->code.print_for_foot = NULL; gen->code.user = gen; - gpu_print_host_stmt(&gen->code, stmt); + print_clast(&gen->code, stmt); cloog_clast_free(stmt); cloog_options_free(options); diff --git a/cuda.h b/cuda.h index 8d92f15..e84e020 100644 --- a/cuda.h +++ b/cuda.h @@ -3,14 +3,14 @@ #include #include "cuda_common.h" -#include "gpucode.h" +#include "clast_printer.h" #include "ppcg_options.h" struct cuda_gen { struct cuda_info cuda; - struct gpucode_info code; - struct gpucode_info kernel_code; - struct gpucode_info stmt_code; + struct clast_printer_info code; + struct clast_printer_info kernel_code; + struct clast_printer_info stmt_code; isl_ctx *ctx; struct ppcg_options *options; diff --git a/gpucode.h b/gpucode.h deleted file mode 100644 index 4048cc7..0000000 --- a/gpucode.h +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef _GPUCODE_H -#define _GPUCODE_H - -#include - -struct gpucode_info { - int indent; - FILE *dst; - void (*print_user_stmt)(struct gpucode_info *info, - struct clast_user_stmt *s); - void (*print_user_stmt_list)(struct gpucode_info *info, - struct clast_user_stmt *s); - void (*print_for_head)(struct gpucode_info *info, struct clast_for *f); - void (*print_for_foot)(struct gpucode_info *info, struct clast_for *f); - void *user; -}; - -void print_cloog_macros(FILE *dst); -void print_indent(FILE *dst, int indent); -void gpu_print_host_stmt(struct gpucode_info *info, struct clast_stmt *s); - -__isl_give isl_set *extract_host_domain(struct clast_user_stmt *u); -__isl_give isl_set *extract_entire_host_domain(struct clast_stmt *s); - -#endif -- 2.11.4.GIT