|
1 | 1 | /** |
2 | | - * Copyright (c) 2009-2024 The University of Tennessee and The University |
| 2 | + * Copyright (c) 2009-2025 The University of Tennessee and The University |
3 | 3 | * of Tennessee Research Foundation. All rights |
4 | 4 | * reserved. |
5 | 5 | * Copyright (c) 2024-2026 NVIDIA Corporation. All rights reserved. |
@@ -6828,66 +6828,56 @@ static void jdf_generate_code_hook_gpu(const jdf_t *jdf, |
6828 | 6828 | " assert(NULL != dev);\n" |
6829 | 6829 | " assert(PARSEC_DEV_IS_GPU(dev->type));\n" |
6830 | 6830 | "\n" |
6831 | | - " gpu_task = (parsec_gpu_task_t*)calloc(1, sizeof(parsec_gpu_task_t));\n" |
6832 | | - " PARSEC_OBJ_CONSTRUCT(gpu_task, parsec_list_item_t);\n" |
6833 | | - " gpu_task->release_device_task = free; /* by default free the device task */\n" |
| 6831 | + " gpu_task = (parsec_gpu_task_t*)PARSEC_OBJ_NEW(parsec_gpu_dsl_task_t);" |
6834 | 6832 | " gpu_task->ec = (parsec_task_t*)this_task;\n" |
6835 | 6833 | " gpu_task->submit = &%s_kernel_submit_%s_%s;\n" |
6836 | | - " gpu_task->task_type = 0;\n" |
6837 | | - " gpu_task->last_data_check_epoch = -1; /* force at least one validation for the task */\n", |
| 6834 | + " gpu_task->task_type = PARSEC_GPU_TASK_TYPE_KERNEL;\n", |
6838 | 6835 | dev_lower, jdf_basename, f->fname); |
6839 | 6836 |
|
6840 | 6837 | /* Set up stage in/out callbacks */ |
6841 | 6838 | jdf_find_property(body->properties, "stage_in", &stage_in_property); |
6842 | | - jdf_find_property(body->properties, "stage_out", &stage_out_property); |
6843 | | - |
6844 | | - if(stage_in_property == NULL) { |
6845 | | - coutput(" gpu_task->stage_in = parsec_default_gpu_stage_in;\n"); |
6846 | | - }else{ |
6847 | | - coutput(" gpu_task->stage_in = %s;\n", dump_expr((void**)stage_in_property->expr, &info)); |
6848 | | - } |
| 6839 | + coutput(" gpu_task->stage_in = %s;\n", (NULL == stage_in_property) ? "parsec_default_gpu_stage_in" |
| 6840 | + : dump_expr((void **)stage_in_property->expr, &info)); |
6849 | 6841 |
|
6850 | | - if(stage_out_property == NULL) { |
6851 | | - coutput(" gpu_task->stage_out = parsec_default_gpu_stage_out;\n"); |
6852 | | - }else{ |
6853 | | - coutput(" gpu_task->stage_out = %s;\n", dump_expr((void**)stage_out_property->expr, &info)); |
6854 | | - } |
| 6842 | + jdf_find_property(body->properties, "stage_out", &stage_out_property); |
| 6843 | + coutput(" gpu_task->stage_out = %s;\n", (NULL == stage_out_property) ? "parsec_default_gpu_stage_out" |
| 6844 | + : dump_expr((void **)stage_out_property->expr, &info)); |
6855 | 6845 |
|
6856 | 6846 | /* Dump the dataflow */ |
6857 | 6847 | coutput(" gpu_task->pushout = 0;\n"); |
6858 | 6848 | for(fl = f->dataflow, di = 0; fl != NULL; fl = fl->next, di++) { |
6859 | | - coutput(" gpu_task->flow[%d] = &%s;\n", |
| 6849 | + coutput(" gpu_task->flow_info[%d].flow = &%s;\n", |
6860 | 6850 | di, JDF_OBJECT_ONAME( fl )); |
6861 | 6851 |
|
6862 | 6852 | sprintf(sa->ptr, "%s.dc", fl->varname); |
6863 | 6853 | jdf_find_property(body->properties, sa->ptr, &desc_property); |
6864 | | - if(desc_property == NULL){ |
6865 | | - coutput(" gpu_task->flow_dc[%d] = NULL;\n", di); |
| 6854 | + if(desc_property == NULL) { |
| 6855 | + coutput(" gpu_task->flow_info[%d].flow_dc = NULL;\n", di); |
6866 | 6856 | }else{ |
6867 | | - coutput(" gpu_task->flow_dc[%d] = (parsec_data_collection_t *)%s;\n", di, |
| 6857 | + coutput(" gpu_task->flow_info[%d].flow_dc = (parsec_data_collection_t *)%s;\n", di, |
6868 | 6858 | dump_expr((void**)desc_property->expr, &info)); |
6869 | 6859 | } |
6870 | 6860 |
|
6871 | 6861 | sprintf(sa->ptr, "%s.size", fl->varname); |
6872 | 6862 | jdf_find_property(body->properties, sa->ptr, &size_property); |
6873 | 6863 |
|
6874 | 6864 | if(fl->flow_flags & JDF_FLOW_TYPE_CTL) { |
6875 | | - if(size_property != NULL){ |
| 6865 | + if(size_property != NULL) { |
6876 | 6866 | fprintf(stderr, "Error: specifying GPU buffer size for CTL flow %s at line %d\n", |
6877 | 6867 | fl->varname, JDF_OBJECT_LINENO(fl)); |
6878 | 6868 | exit(-1); |
6879 | 6869 | } |
6880 | | - coutput(" gpu_task->flow_nb_elts[%d] = 0;\n", di); |
6881 | | - }else{ |
| 6870 | + coutput(" gpu_task->flow_info[%d].flow_span = 0;\n", di); |
| 6871 | + } else { |
6882 | 6872 | coutput(" // A shortcut to check if the flow exists\n"); |
6883 | 6873 | coutput(" if (gpu_task->ec->data[%d].data_in != NULL) {\n", di); |
6884 | 6874 | if(size_property == NULL){ |
6885 | | - coutput(" gpu_task->flow_nb_elts[%d] = gpu_task->ec->data[%d].data_in->original->nb_elts;\n", di, di); |
6886 | | - }else{ |
6887 | | - coutput(" gpu_task->flow_nb_elts[%d] = %s;\n", |
6888 | | - di, dump_expr((void**)size_property->expr, &info)); |
| 6875 | + coutput(" gpu_task->flow_info[%d].flow_span = gpu_task->ec->data[%d].data_in->original->span;\n", di, di); |
| 6876 | + } else { |
| 6877 | + coutput(" gpu_task->flow_info[%d].flow_span = %s;\n", |
| 6878 | + di, dump_expr((void **)size_property->expr, &info)); |
6889 | 6879 | if( (stage_in_property == NULL) || ( stage_out_property == NULL )){ |
6890 | | - coutput(" assert(gpu_task->ec->data[%d].data_in->original->nb_elts <= %s);\n", |
| 6880 | + coutput(" assert(gpu_task->ec->data[%d].data_in->original->span <= %s);\n", |
6891 | 6881 | di, dump_expr((void**)size_property->expr, &info)); |
6892 | 6882 | } |
6893 | 6883 |
|
@@ -6955,6 +6945,7 @@ static void jdf_generate_code_hook_gpu(const jdf_t *jdf, |
6955 | 6945 | } |
6956 | 6946 | } |
6957 | 6947 | string_arena_free(info.sa); |
| 6948 | + coutput(" gpu_task->nb_flows = %d; /* inherit the flows from the task_class */\n", di); |
6958 | 6949 |
|
6959 | 6950 | coutput("\n" |
6960 | 6951 | " return dev->kernel_scheduler(dev, es, gpu_task);\n" |
|
0 commit comments