Mentions légales du service

Skip to content
Snippets Groups Projects
  • Alexey Bataev's avatar
    8ee6f73c
    [OPENMP 4.5] Codegen for 'taskloop' directive. · 8ee6f73c
    Alexey Bataev authored
    The taskloop construct specifies that the iterations of one or more associated loops will be executed in parallel using OpenMP tasks. The iterations are distributed across tasks created by the construct and scheduled to be executed.
    The next code will be generated for the taskloop directive:
        #pragma omp taskloop num_tasks(N) lastprivate(j)
            for( i=0; i<N*GRAIN*STRIDE-1; i+=STRIDE ) {
              int th = omp_get_thread_num();
              #pragma omp atomic
                counter++;
              #pragma omp atomic
                th_counter[th]++;
              j = i;
        }
    
    Generated code:
    task = __kmpc_omp_task_alloc(NULL,gtid,1,sizeof(struct
    task),sizeof(struct shar),&task_entry);
    psh = task->shareds;
    psh->pth_counter = &th_counter;
    psh->pcounter = &counter;
    psh->pj = &j;
    task->lb = 0;
    task->ub = N*GRAIN*STRIDE-2;
    task->st = STRIDE;
    __kmpc_taskloop(
    NULL,             // location
    gtid,             // gtid
    task,             // task structure
    1,                // if clause value
    &task->lb,        // lower bound
    &task->ub,        // upper bound
    STRIDE,           // loop increment
    0,                // 1 if nogroup specified
    2,                // schedule type: 0-none, 1-grainsize, 2-num_tasks
    N,                // schedule value (ignored for type 0)
    (void*)&__task_dup_entry // tasks duplication routine
    );
    
    git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@267395 91177308-0d34-0410-b5e6-96231b3b80d8
    8ee6f73c
    History
    [OPENMP 4.5] Codegen for 'taskloop' directive.
    Alexey Bataev authored
    The taskloop construct specifies that the iterations of one or more associated loops will be executed in parallel using OpenMP tasks. The iterations are distributed across tasks created by the construct and scheduled to be executed.
    The next code will be generated for the taskloop directive:
        #pragma omp taskloop num_tasks(N) lastprivate(j)
            for( i=0; i<N*GRAIN*STRIDE-1; i+=STRIDE ) {
              int th = omp_get_thread_num();
              #pragma omp atomic
                counter++;
              #pragma omp atomic
                th_counter[th]++;
              j = i;
        }
    
    Generated code:
    task = __kmpc_omp_task_alloc(NULL,gtid,1,sizeof(struct
    task),sizeof(struct shar),&task_entry);
    psh = task->shareds;
    psh->pth_counter = &th_counter;
    psh->pcounter = &counter;
    psh->pj = &j;
    task->lb = 0;
    task->ub = N*GRAIN*STRIDE-2;
    task->st = STRIDE;
    __kmpc_taskloop(
    NULL,             // location
    gtid,             // gtid
    task,             // task structure
    1,                // if clause value
    &task->lb,        // lower bound
    &task->ub,        // upper bound
    STRIDE,           // loop increment
    0,                // 1 if nogroup specified
    2,                // schedule type: 0-none, 1-grainsize, 2-num_tasks
    N,                // schedule value (ignored for type 0)
    (void*)&__task_dup_entry // tasks duplication routine
    );
    
    git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@267395 91177308-0d34-0410-b5e6-96231b3b80d8