<feed xmlns='http://www.w3.org/2005/Atom'>
<title>llvm-project.git/llvm/lib/Support/Parallel.cpp, branch users/nico/python-1</title>
<subtitle>Unnamed repository; edit this file 'description' to name the repository.
</subtitle>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/'/>
<entry>
<title>[Parallel] Revert sequential task changes</title>
<updated>2024-09-21T04:15:42+00:00</updated>
<author>
<name>Fangrui Song</name>
<email>i@maskray.me</email>
</author>
<published>2024-09-21T04:15:42+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=b84d773fd004ce719da69fbae5ec1dbc2b951230'/>
<id>b84d773fd004ce719da69fbae5ec1dbc2b951230</id>
<content type='text'>
https://reviews.llvm.org/D148728 introduced `bool Sequential` to unify
`execute` and the old `spawn` without argument. However, sequential
tasks might be executed by any worker thread (non-deterministic),
leading to non-determinism output for ld.lld -z nocombreloc (see
https://reviews.llvm.org/D133003).

In addition, the extra member variables have overhead.
This sequential task has only been used for lld parallel relocation
scanning.

This patch restores the behavior before https://reviews.llvm.org/D148728 .

Fix #105958

Pull Request: https://github.com/llvm/llvm-project/pull/109084
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
https://reviews.llvm.org/D148728 introduced `bool Sequential` to unify
`execute` and the old `spawn` without argument. However, sequential
tasks might be executed by any worker thread (non-deterministic),
leading to non-determinism output for ld.lld -z nocombreloc (see
https://reviews.llvm.org/D133003).

In addition, the extra member variables have overhead.
This sequential task has only been used for lld parallel relocation
scanning.

This patch restores the behavior before https://reviews.llvm.org/D148728 .

Fix #105958

Pull Request: https://github.com/llvm/llvm-project/pull/109084
</pre>
</div>
</content>
</entry>
<entry>
<title>[Support] ThreadPoolExecutor: remove unused default argument</title>
<updated>2024-08-14T00:49:57+00:00</updated>
<author>
<name>Fangrui Song</name>
<email>i@maskray.me</email>
</author>
<published>2024-08-14T00:49:57+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=a3cba6b5db1b0918923240f46dcd6279a7b4421d'/>
<id>a3cba6b5db1b0918923240f46dcd6279a7b4421d</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>[Support] Restrict ManagedStatic ThreadPoolExecutor to Windows</title>
<updated>2024-08-14T00:02:03+00:00</updated>
<author>
<name>Fangrui Song</name>
<email>i@maskray.me</email>
</author>
<published>2024-08-14T00:02:03+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=9487cf97e31bb9fac14394913b64c60ae60f5e41'/>
<id>9487cf97e31bb9fac14394913b64c60ae60f5e41</id>
<content type='text'>
https://reviews.llvm.org/D70447 switched to `ManagedStatic` to work
around race conditions in MSVC runtimes and the MinGW runtime.
However, `ManagedStatic` is not suitable for other platforms.

However, this workaround is not suitable for other platforms (#66974).
lld::fatal calls exitLld(1), which calls `llvm_shutdown` to destroy
`ManagedStatic` objects. The worker threads will finish and invoke TLS
destructors (glibc `__call_tls_dtors`). This can lead to race conditions
if other threads attempt to access TLS objects that have already been
destroyed.

While lld's early exit mechanism needs more work, I believe Parallel.cpp
should avoid this pitfall as well.

Pull Request: https://github.com/llvm/llvm-project/pull/102989
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
https://reviews.llvm.org/D70447 switched to `ManagedStatic` to work
around race conditions in MSVC runtimes and the MinGW runtime.
However, `ManagedStatic` is not suitable for other platforms.

However, this workaround is not suitable for other platforms (#66974).
lld::fatal calls exitLld(1), which calls `llvm_shutdown` to destroy
`ManagedStatic` objects. The worker threads will finish and invoke TLS
destructors (glibc `__call_tls_dtors`). This can lead to race conditions
if other threads attempt to access TLS objects that have already been
destroyed.

While lld's early exit mechanism needs more work, I believe Parallel.cpp
should avoid this pitfall as well.

Pull Request: https://github.com/llvm/llvm-project/pull/102989
</pre>
</div>
</content>
</entry>
<entry>
<title>[Support] Fix the issue where the character being saved in Unicode causes a warning to be treated as an error in Visual Studio 2022. (#88513)</title>
<updated>2024-04-12T20:43:58+00:00</updated>
<author>
<name>Harrison,Hao</name>
<email>57025411+TSWorld1314@users.noreply.github.com</email>
</author>
<published>2024-04-12T20:43:58+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=62624a4bfed4ea468dcb677b799aee3518a24bf7'/>
<id>62624a4bfed4ea468dcb677b799aee3518a24bf7</id>
<content type='text'>
Fix the issue where the character being saved in Unicode causes a
warning to be treated as an error in Visual Studio 2022.

![image](https://github.com/llvm/llvm-project/assets/57025411/07353525-6520-4b74-b4f5-5b3f5afc47e1)</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Fix the issue where the character being saved in Unicode causes a
warning to be treated as an error in Visual Studio 2022.

![image](https://github.com/llvm/llvm-project/assets/57025411/07353525-6520-4b74-b4f5-5b3f5afc47e1)</pre>
</div>
</content>
</entry>
<entry>
<title>[Support] Add PerThreadBumpPtrAllocator class.</title>
<updated>2023-05-06T12:35:26+00:00</updated>
<author>
<name>Alexey Lapshin</name>
<email>a.v.lapshin@mail.ru</email>
</author>
<published>2023-05-04T09:50:11+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=6ab43f9b87ce982fed7073d91da6c5f027321b53'/>
<id>6ab43f9b87ce982fed7073d91da6c5f027321b53</id>
<content type='text'>
PerThreadBumpPtrAllocator allows separating allocations by thread id.
That makes allocations race free. It is possible because
ThreadPoolExecutor class creates threads, keeps them until
the destructor of ThreadPoolExecutor is called, and assigns ids
to the threads. Thus PerThreadBumpPtrAllocator should be used with only
threads created by ThreadPoolExecutor. This allocator is useful when
thread safe BumpPtrAllocator is needed.

Reviewed By: MaskRay, dexonsmith, andrewng

Differential Revision: https://reviews.llvm.org/D142318
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
PerThreadBumpPtrAllocator allows separating allocations by thread id.
That makes allocations race free. It is possible because
ThreadPoolExecutor class creates threads, keeps them until
the destructor of ThreadPoolExecutor is called, and assigns ids
to the threads. Thus PerThreadBumpPtrAllocator should be used with only
threads created by ThreadPoolExecutor. This allocator is useful when
thread safe BumpPtrAllocator is needed.

Reviewed By: MaskRay, dexonsmith, andrewng

Differential Revision: https://reviews.llvm.org/D142318
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix test bot breakage from 06b617064a997574df409c7d846b6f6b492f5124</title>
<updated>2023-05-04T16:47:59+00:00</updated>
<author>
<name>Alexey Lapshin</name>
<email>a.v.lapshin@mail.ru</email>
</author>
<published>2023-05-04T16:13:29+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=629177a8197599ae9957a936f17373ea411a5fa5'/>
<id>629177a8197599ae9957a936f17373ea411a5fa5</id>
<content type='text'>
This addresses the issue found by: https://lab.llvm.org/buildbot#builders/178/builds/4571
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This addresses the issue found by: https://lab.llvm.org/buildbot#builders/178/builds/4571
</pre>
</div>
</content>
</entry>
<entry>
<title>[Support][Parallel] Change check for nested TaskGroups.</title>
<updated>2023-05-04T09:28:39+00:00</updated>
<author>
<name>Alexey Lapshin</name>
<email>a.v.lapshin@mail.ru</email>
</author>
<published>2023-04-21T14:25:41+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=06b617064a997574df409c7d846b6f6b492f5124'/>
<id>06b617064a997574df409c7d846b6f6b492f5124</id>
<content type='text'>
This patch changes check for nested TaskGroups so that it allows
parallel execution for TaskGroups. Following pattern would not work
parallelly with current check:

std::function&lt;void()&gt; Fn = [&amp;]() {
  parallel::TaskGroup tg;

  tg.spawn([&amp;]() { });
};

ThreadPool Pool;

Pool.async(Fn);
Pool.async(Fn);

Pool.wait();

One of the TaskGroup would work sequentially as current check
verifies overall number of TaskGroup. Two not nested
TaskGroups can work parallelly but current check prevents this.

Also this patch avoids parallel mode for TaskGroup
in parallel::strategy.ThreadsRequested == 1 case.

This patch is a followup of discussion from D142318

Differential Revision: https://reviews.llvm.org/D148984
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This patch changes check for nested TaskGroups so that it allows
parallel execution for TaskGroups. Following pattern would not work
parallelly with current check:

std::function&lt;void()&gt; Fn = [&amp;]() {
  parallel::TaskGroup tg;

  tg.spawn([&amp;]() { });
};

ThreadPool Pool;

Pool.async(Fn);
Pool.async(Fn);

Pool.wait();

One of the TaskGroup would work sequentially as current check
verifies overall number of TaskGroup. Two not nested
TaskGroups can work parallelly but current check prevents this.

Also this patch avoids parallel mode for TaskGroup
in parallel::strategy.ThreadsRequested == 1 case.

This patch is a followup of discussion from D142318

Differential Revision: https://reviews.llvm.org/D148984
</pre>
</div>
</content>
</entry>
<entry>
<title>[Support][Parallel] Initialize threadIndex and add assertion checking its usage.</title>
<updated>2023-05-02T16:44:15+00:00</updated>
<author>
<name>Alexey Lapshin</name>
<email>a.v.lapshin@mail.ru</email>
</author>
<published>2023-04-20T21:03:21+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=85c2768ce9023ae94d2c70951b3f7e3f33fc2105'/>
<id>85c2768ce9023ae94d2c70951b3f7e3f33fc2105</id>
<content type='text'>
That patch adds a check for threadIndex being used with only threads
created by ThreadPoolExecutor. This helps catch two types of errors:

1. If a thread is created not by ThreadPoolExecutor its index may clash
   with the index of another thread. Using threadIndex, in that case, may
   lead to a data race.

2. Index of the main thread(threadIndex == 0) currently clashes with
   the index of thread0 in ThreadPoolExecutor threads. That may lead
   to a data race if main thread and thread0 are executed concurrently.

This patch allows execution tasks on the main thread only in case
parallel::strategy.ThreadsRequested == 1. In all other cases,
assertions check that threadIndex != UINT_MAX(i.e. that task
is executed on a thread created by ThreadPoolExecutor).

Differential Revision: https://reviews.llvm.org/D148916
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
That patch adds a check for threadIndex being used with only threads
created by ThreadPoolExecutor. This helps catch two types of errors:

1. If a thread is created not by ThreadPoolExecutor its index may clash
   with the index of another thread. Using threadIndex, in that case, may
   lead to a data race.

2. Index of the main thread(threadIndex == 0) currently clashes with
   the index of thread0 in ThreadPoolExecutor threads. That may lead
   to a data race if main thread and thread0 are executed concurrently.

This patch allows execution tasks on the main thread only in case
parallel::strategy.ThreadsRequested == 1. In all other cases,
assertions check that threadIndex != UINT_MAX(i.e. that task
is executed on a thread created by ThreadPoolExecutor).

Differential Revision: https://reviews.llvm.org/D148916
</pre>
</div>
</content>
</entry>
<entry>
<title>[Support][Parallel] Add sequential mode to TaskGroup::spawn().</title>
<updated>2023-04-26T11:52:26+00:00</updated>
<author>
<name>Alexey Lapshin</name>
<email>a.v.lapshin@mail.ru</email>
</author>
<published>2023-04-18T18:22:55+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=fea8c073561f21ac0fea7f961287bf6b7dcf9f96'/>
<id>fea8c073561f21ac0fea7f961287bf6b7dcf9f96</id>
<content type='text'>
This patch allows to specify that some part of tasks should be
done in sequential order. It makes it possible to not use
condition operator for separating sequential tasks:

TaskGroup tg;
for () {
  if(condition)      ==&gt;   tg.spawn([](){fn();}, condition)
    fn();
  else
    tg.spawn([](){fn();});
}

It also prevents execution on main thread. Which allows adding
checks for getThreadIndex() function discussed in D142318.

The patch also replaces std::stack with std::deque in the
ThreadPoolExecutor to have natural execution order in case
(parallel::strategy.ThreadsRequested == 1).

Differential Revision: https://reviews.llvm.org/D148728
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This patch allows to specify that some part of tasks should be
done in sequential order. It makes it possible to not use
condition operator for separating sequential tasks:

TaskGroup tg;
for () {
  if(condition)      ==&gt;   tg.spawn([](){fn();}, condition)
    fn();
  else
    tg.spawn([](){fn();});
}

It also prevents execution on main thread. Which allows adding
checks for getThreadIndex() function discussed in D142318.

The patch also replaces std::stack with std::deque in the
ThreadPoolExecutor to have natural execution order in case
(parallel::strategy.ThreadsRequested == 1).

Differential Revision: https://reviews.llvm.org/D148728
</pre>
</div>
</content>
</entry>
<entry>
<title>[clang-format] Fix format of my last patch</title>
<updated>2023-02-22T18:12:48+00:00</updated>
<author>
<name>Vitaly Buka</name>
<email>vitalybuka@google.com</email>
</author>
<published>2023-02-22T18:11:41+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=1ddc41c3d165ae5125d6a6ed8e7d30feb74b2a30'/>
<id>1ddc41c3d165ae5125d6a6ed8e7d30feb74b2a30</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
</feed>
