Commit Graph

27 Commits

Author SHA1 Message Date
Reid Kleckner 7a2037151c Remove unnecessary x86 backend requirements from OpenMP tests
Clang can generate LLVM IR for x86 without a registered x86 backend.

llvm-svn: 284836
2016-10-21 16:09:20 +00:00
Reid Kleckner 5f8878fa5e Revert 9 changes from r284793, they still fail on some bots
llvm-svn: 284794
2016-10-20 23:30:39 +00:00
Reid Kleckner 2e1538f282 Remove 24 instances of 'REQUIRES: shell'
Tests fall into one of the following categories:

- The requirement was unnecessary

- Additional quoting was required for backslashes in paths (see "sed -e
  's/\\/\\\\/g'") in the sanitizer tests.

- OpenMP used 'REQUIRES: shell' as a proxy for the test failing on
  Windows. Those tests fail there reliably, so use XFAIL instead.

I tried not to remove shell requirements that were added to suppress
flaky test failures, but if I screwed up, we can add it back as needed.

llvm-svn: 284793
2016-10-20 23:11:45 +00:00
Alexey Bataev ad537bb8a0 [OPENMP 4.5] Fixed codegen for 'priority' and destructors in task-based
directives.

'kmp_task_t' record type added a new field for 'priority' clause and
changed the representation of pointer to destructors for privates used
within loop-based directives.
Old representation:

typedef struct kmp_task {                   /* GEH: Shouldn't this be
aligned somehow? */
  void *shareds;                            /**< pointer to block of
    pointers to shared vars   */
  kmp_routine_entry_t routine;              /**< pointer to routine
    to call for executing task */
  kmp_int32 part_id;                        /**< part id for the
    task                          */
  kmp_routine_entry_t destructors;        /* pointer to function to
  invoke deconstructors of firstprivate C++ objects */
  /*  private vars  */
} kmp_task_t;

New representation:

typedef struct kmp_task {                   /* GEH: Shouldn't this be
aligned somehow? */
  void *shareds;                            /**< pointer to block of
    pointers to shared vars   */
  kmp_routine_entry_t routine;              /**< pointer to routine
    to call for executing task */
  kmp_int32 part_id;                        /**< part id for the
    task                          */
  kmp_cmplrdata_t data1; /* Two known
optional additions: destructors and priority */
  kmp_cmplrdata_t data2; /* Process
destructors first, priority second */
/* future data */
  /*  private vars  */
} kmp_task_t;

Also excessive initialization of 'destructors' fields to 'null' was
removed from codegen if it is known that no destructors shal be used.
Currently a special bit is used in 'kmp_tasking_flags_t' bitfields
('destructors_thunk' bitfield).

llvm-svn: 271201
2016-05-30 09:06:50 +00:00
Alexey Bataev 8a83159731 [OPENMP 4.0] Fixed codegen for destructors in task-based directives.
If private variables require destructors call at the deletion of the
task, additional flag in task flags must be set. Patch fixes this
problem.

llvm-svn: 269039
2016-05-10 10:36:51 +00:00
Alexey Bataev 48591dd98c [OPENMP] Codegen for untied tasks.
If the untied clause is present on a task construct, any thread in the
team can resume the task region after a suspension. Patch adds proper
codegen for untied tasks.

llvm-svn: 266853
2016-04-20 04:01:36 +00:00
Alexey Bataev 995e861ba6 Revert "[OPENMP] Codegen for untied tasks."
This reverts commit r266754.

llvm-svn: 266755
2016-04-19 16:36:01 +00:00
Alexey Bataev 823acfacdf [OPENMP] Codegen for untied tasks.
If the untied clause is present on a task construct, any thread in the
team can resume the task region after a suspension. Patch adds proper
codegen for untied tasks.

llvm-svn: 266754
2016-04-19 16:27:55 +00:00
Alexey Bataev bec9572213 Revert "[OPENMP] Codegen for untied tasks."
This reverts commit 266722.

llvm-svn: 266724
2016-04-19 09:27:38 +00:00
Alexey Bataev 26b2577f6b [OPENMP] Codegen for untied tasks.
If the untied clause is present on a task construct, any thread in the team can resume the task region after a suspension. Patch adds proper codegen for untied tasks.

llvm-svn: 266722
2016-04-19 09:10:27 +00:00
Alexey Bataev 40e36f1f64 [OPENMP] Fix crash on codegen for 'task' directive with no shared variables.
If 'task' region does not have shared variables codegen could crash on calculation of size of list of shared variables.

llvm-svn: 253977
2015-11-24 13:01:44 +00:00
Kelvin Li 4eea8c6b82 Allow static local variables specified on data-sharing attribute clauses.
http://reviews.llvm.org/D11619

llvm-svn: 247715
2015-09-15 18:56:58 +00:00
Alexey Bataev c71a4099cf [OPENMP] Preserve alignment of the original variables for the captured references.
Patch makes codegen to preserve alignment of the shared variables captured and used in OpenMP regions.

llvm-svn: 247401
2015-09-11 10:29:41 +00:00
Alexey Bataev 2377fe95c6 [OPENMP] Outlined function for parallel and other regions with list of captured variables.
Currently all variables used in OpenMP regions are captured into a record and passed to outlined functions in this record. It may result in some poor performance because of too complex analysis later in optimization passes. Patch makes to emit outlined functions for parallel-based regions with a list of captured variables. It reduces code for 2*n GEPs, stores and loads at least.
Codegen for task-based regions remains unchanged because runtime requires that all captured variables are passed in captured record.

llvm-svn: 247251
2015-09-10 08:12:02 +00:00
Alexey Bataev b44fdfc7b2 [OPENMP] Drop type qualifiers from private variables.
If the variable is marked as private in OpenMP construct, the reference to this variable should not keep type qualifiers for the original variable. Private copy is not volatile or constant, so we can use unqualified type for private copy.

llvm-svn: 242133
2015-07-14 10:32:29 +00:00
Adrian Prantl bc068586ac Revert "Revert r241620 and follow-up commits" and move the initialization
of the llvm targets from clang/CodeGen into ClangCheck.cpp and CIndex.cpp.

llvm-svn: 241653
2015-07-08 01:00:30 +00:00
Adrian Prantl 142ec39739 Revert r241620 and follow-up commits while investigating linux buildbot failures.
llvm-svn: 241642
2015-07-07 23:19:46 +00:00
Adrian Prantl 683c4943e6 Add target requirements to testcases that emit PCH.
llvm-svn: 241630
2015-07-07 21:45:48 +00:00
Alexey Bataev aac108a324 [OPENMP] Do not emit references to original variables in 'private' clause.
Currently if the variable is captured in captured region, capture record for this region stores reference to this variable for future use. But we don't need to provide the reference to the original variable if it was explicitly marked as private in the 'private' clause of the OpenMP construct, this variable is replaced by private copy.
Differential Revision: http://reviews.llvm.org/D9550

llvm-svn: 240377
2015-06-23 04:51:00 +00:00
Alexey Bataev 3ae88e2124 [OPENMP] Prepare codegen for privates in tasks for non-capturing of privates in CapturedStmt.
Reworked codegen for privates in tasks:

call @kmpc_omp_task_alloc();
...
call @kmpc_omp_task(task_proxy);

void map_privates(.privates_rec. *privs, type1 ** priv1_ref, ..., typen **privn_ref) {
  *priv1_ref = &privs->private1;
  ...
  *privn_ref = &privs->privaten;
  ret void
}

i32 task_entry(i32 ThreadId, i32 PartId, void* privs, void (void*, ...) map_privates, shareds* captures) {
  type1 **priv1;
  ...
  typen **privn;
  call map_privates(privs, priv1, ..., privn);
  <Task body with priv1, .., privn instead of the captured variables>.
  ret i32
}

i32 task_proxy(i32 ThreadId, kmp_task_t_with_privates *tt) {
  call task_entry(ThreadId, tt->task_data.PartId, &tt->privates, map_privates, tt->task_data.shareds);
}

llvm-svn: 238010
2015-05-22 08:56:35 +00:00
Alexey Bataev 5129d3a4f5 [OPENMP] Fixed codegen for parameters privatization.
For parameters we shall take a derived type of parameters, not the original one.

llvm-svn: 237882
2015-05-21 09:47:46 +00:00
Alexey Bataev db39021cee [OPENMP] -fopenmp enables OpenMP support (fix for http://llvm.org/PR23492)
-fopenmp turns on OpenMP support and links libiomp5 as OpenMP library. Also there is -fopenmp={libiomp5|libgomp} option that allows to override effect of -fopenmp and link libgomp library (if -fopenmp=libgomp is specified).
Differential Revision: http://reviews.llvm.org/D9736

llvm-svn: 237769
2015-05-20 04:24:19 +00:00
Alexey Bataev 1d9c15cf18 [OPENMP] Fixed codegen for copying/initialization of array variables/parameters.
This modification generates proper copyin/initialization sequences for array variables/parameters. Before they were considered as pointers, not arrays.

llvm-svn: 237691
2015-05-19 12:31:28 +00:00
Alexey Bataev 8fc69dcf42 [OPENMP] Fix for '#pragma omp task' codegen.
Internal task structure must be generated like
typedef struct kmp_task {
  void *              shareds;
  kmp_routine_entry_t routine;
  kmp_int32           part_id;
  kmp_routine_entry_t destructors;
} kmp_task_t;

struct kmp_task_t_with_privates {
  kmp_task_t task_data;
  .kmp_private. privates;
};
to avoid possible additional alignment bytes in first fields (shareds, routine, part_id and destructors). Runtime library is not aware of such kind additional alignment bytes.

llvm-svn: 237561
2015-05-18 07:54:53 +00:00
NAKAMURA Takumi 88db89dfb9 Suppress clang/test/OpenMP/task_private_codegen.cpp on win32 for now. Investigating.
I'm dubious in weird behavior with CHECK-DAG.

Also, it won't "REQUIRE non-ms-sdk". All of RUNs have "-triple darwin".

llvm-svn: 236338
2015-05-01 19:44:13 +00:00
Alexey Bataev b09be505b8 [OPENMP] Mark test as not compatible with MS Windows.
llvm-svn: 236210
2015-04-30 08:35:10 +00:00
Alexey Bataev 36c1eb95e0 [OPENMP] Codegen for 'private' clause in 'task' directive.
For tasks codegen for private/firstprivate variables are different rather than for other directives.

1. Build an internal structure of privates for each private variable:
struct .kmp_privates_t. {
  Ty1 var1;
  ...
  Tyn varn;
};
2. Add a new field to kmp_task_t type with list of privates.
struct kmp_task_t {
  void *              shareds;
  kmp_routine_entry_t routine;
  kmp_int32           part_id;
  kmp_routine_entry_t destructors;
  .kmp_privates_t.    privates;
};
3. Create a function with destructors calls for all privates after end of task region.
kmp_int32 .omp_task_destructor.(kmp_int32 gtid, kmp_task_t *tt) {
  ~Destructor(&tt->privates.var1);
  ...
  ~Destructor(&tt->privates.varn);
  return 0;
}
4. Perform default initialization of all private fields (no initialization for POD data, default constructor calls for classes) + provide address of a destructor function after kmpc_omp_task_alloc() and before kmpc_omp_task() calls.
kmp_task_t *new_task = __kmpc_omp_task_alloc(ident_t *, kmp_int32 gtid, kmp_int32 flags, size_t sizeof_kmp_task_t, size_t sizeof_shareds, kmp_routine_entry_t *task_entry);

DefaultConstructor(new_task->privates.var1);
new_task->shareds.var1_ref = &new_task->privates.var1;
...
DefaultConstructor(new_task->privates.varn);
new_task->shareds.varn_ref = &new_task->privates.varn;

new_task->destructors = .omp_task_destructor.;
kmp_int32 __kmpc_omp_task(ident_t *, kmp_int32 gtid, kmp_task_t *new_task)


Differential Revision: http://reviews.llvm.org/D9322

llvm-svn: 236207
2015-04-30 06:51:57 +00:00