Skip to content

Commit 11deb35

Browse files
Adding basic runtime support
1 parent d700caa commit 11deb35

File tree

4 files changed

+8
-6
lines changed

4 files changed

+8
-6
lines changed

clang/lib/CodeGen/CGOpenMPRuntime.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3691,7 +3691,7 @@ CGOpenMPRuntime::emitTaskInit(CodeGenFunction &CGF, SourceLocation Loc,
36913691
DestructorsFlag = 0x8,
36923692
PriorityFlag = 0x20,
36933693
DetachableFlag = 0x40,
3694-
PoolFlag = 0x80,
3694+
FreeAgentFlag = 0x100,
36953695
};
36963696
unsigned Flags = Data.Tied ? TiedFlag : 0;
36973697
bool NeedsCleanup = false;
@@ -3704,7 +3704,7 @@ CGOpenMPRuntime::emitTaskInit(CodeGenFunction &CGF, SourceLocation Loc,
37043704
if (const auto *Clause = D.getSingleClause<OMPThreadsetClause>()) {
37053705
OpenMPThreadsetKind Kind = Clause->getThreadsetKind();
37063706
if (Kind == OMPC_THREADSET_omp_pool)
3707-
Flags = Flags | PoolFlag;
3707+
Flags = Flags | FreeAgentFlag;
37083708
}
37093709
if (Data.Priority.getInt())
37103710
Flags = Flags | PriorityFlag;

clang/test/OpenMP/task_codegen.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10271,7 +10271,7 @@ void test_threadset()
1027110271
// CHECK6-NEXT: call i32 @__kmpc_global_thread_num(ptr @[[GLOB_PTR:[0-9]+]])
1027210272
// CHECK6-NEXT: call i32 @__kmpc_omp_task(ptr @1, i32 %omp_global_thread_num1, ptr %0)
1027310273
// CHECK6-NEXT: call i32 @__kmpc_global_thread_num(ptr @[[GLOB_PTR2:[0-9]+]])
10274-
// CHECK6-NEXT: [[TMP3:%.*]] = call ptr @__kmpc_omp_task_alloc(ptr @1, i32 %omp_global_thread_num3, i32 129, i64 40, i64 1, ptr @.omp_task_entry..[[ENTRY2:[0-9]+]])
10274+
// CHECK6-NEXT: [[TMP3:%.*]] = call ptr @__kmpc_omp_task_alloc(ptr @1, i32 %omp_global_thread_num3, i32 257, i64 40, i64 1, ptr @.omp_task_entry..[[ENTRY2:[0-9]+]])
1027510275
// CHECK6-NEXT: getelementptr inbounds nuw %struct.kmp_task_t_with_privates{{.*}}, ptr %3, i32 0, i32 0
1027610276
// CHECK6-NEXT: call i32 @__kmpc_global_thread_num(ptr @[[GLOB_PTR2:[0-9]+]])
1027710277
// CHECK6-NEXT: call i32 @__kmpc_omp_task(ptr @1, i32 %omp_global_thread_num4, ptr %3)

clang/test/OpenMP/taskloop_codegen.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ void test_threadset()
279279
// CHECK6-NEXT: call void @__kmpc_taskloop(ptr @1, i32 %[[TID0:.*]], ptr %[[TID1:.*]], i32 1, ptr %[[TID3:.*]], ptr %4, i64 %[[TID7:.*]], i32 1, i32 0, i64 0, ptr null)
280280
// CHECK6-NEXT: call void @__kmpc_end_taskgroup(ptr @1, i32 %[[TID0:.*]])
281281
// CHECK6-NEXT: call void @__kmpc_taskgroup(ptr @1, i32 %[[TID0:.*]])
282-
// CHECK6-NEXT: %[[TID8:.*]] = call ptr @__kmpc_omp_task_alloc(ptr @1, i32 %[[TID0:.*]], i32 129, i64 80, i64 1, ptr @.omp_task_entry..[[ENTRY1:[0-9]+]])
282+
// CHECK6-NEXT: %[[TID8:.*]] = call ptr @__kmpc_omp_task_alloc(ptr @1, i32 %[[TID0:.*]], i32 257, i64 80, i64 1, ptr @.omp_task_entry..[[ENTRY1:[0-9]+]])
283283
// CHECK6-NEXT: %[[TID9:.*]] = getelementptr inbounds nuw %struct.kmp_task_t_with_privates{{.*}}, ptr %[[TID8:.*]], i32 0, i32 0
284284
// CHECK6-NEXT: %[[TID10:.*]] = getelementptr inbounds nuw %struct.kmp_task_t{{.*}}, ptr %[[TID9:.*]], i32 0, i32 5
285285
// CHECK6-NEXT: store i64 0, ptr %[[TID10:.*]], align 8

openmp/runtime/src/kmp.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2740,7 +2740,8 @@ typedef struct kmp_tasking_flags { /* Total struct must be exactly 32 bits */
27402740
unsigned tasking_ser : 1;
27412741
unsigned task_serial : 1;
27422742
unsigned tasktype : 1;
2743-
unsigned reserved : 8;
2743+
unsigned reserved : 7;
2744+
unsigned free_agent_eligible : 1;
27442745
unsigned hidden_helper : 1;
27452746
unsigned detachable : 1;
27462747
unsigned priority_specified : 1;
@@ -2763,7 +2764,8 @@ typedef struct kmp_tasking_flags { /* Total struct must be exactly 32 bits */
27632764
setting for the task */
27642765
unsigned detachable : 1; /* 1 == can detach */
27652766
unsigned hidden_helper : 1; /* 1 == hidden helper task */
2766-
unsigned reserved : 8; /* reserved for compiler use */
2767+
unsigned free_agent_eligible : 1; /* set if task can be executed by a free-agent thread */
2768+
unsigned reserved : 7; /* reserved for compiler use */
27672769

27682770
/* Library flags */ /* Total library flags must be 16 bits */
27692771
unsigned tasktype : 1; /* task is either explicit(1) or implicit (0) */

0 commit comments

Comments
 (0)