History log of /llvm-project/openmp/runtime/src/z_Linux_util.cpp (Results 1 – 25 of 109)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
Revision tags: llvmorg-21-init, llvmorg-19.1.7, llvmorg-19.1.6, llvmorg-19.1.5, llvmorg-19.1.4, llvmorg-19.1.3, llvmorg-19.1.2, llvmorg-19.1.1, llvmorg-19.1.0, llvmorg-19.1.0-rc4
# 37e109c6 31-Aug-2024 Brad Smith <brad@comstyle.com>

[OpenMP] Support setting POSIX thread name on *BSD's and Solaris (#106489)


Revision tags: llvmorg-19.1.0-rc3
# 0160d817 14-Aug-2024 HighW4y2H3ll <zhenghaohuu@gmail.com>

[OpenMP] Rename worker threads for improved debuggability (#102065)

Rename the worker threads "openmp_worker"

---------

Co-authored-by: h2h <h2h@meta.com>
Co-authored-by: Matthias Braun <matz

[OpenMP] Rename worker threads for improved debuggability (#102065)

Rename the worker threads "openmp_worker"

---------

Co-authored-by: h2h <h2h@meta.com>
Co-authored-by: Matthias Braun <matze@braunis.de>

show more ...


Revision tags: llvmorg-19.1.0-rc2, llvmorg-19.1.0-rc1, llvmorg-20-init, llvmorg-18.1.8, llvmorg-18.1.7, llvmorg-18.1.6
# 561b6ab9 10-May-2024 Xing Xue <xingxue@outlook.com>

[OpenMP][AIX] Implement __kmp_get_load_balance() for AIX (#91520)

AIX has the `/proc` filesystem where `/proc/<pid>/lwp/<tid>/lwpsinfo` has
the thread state in binary, similar to Linux's
`/proc/<p

[OpenMP][AIX] Implement __kmp_get_load_balance() for AIX (#91520)

AIX has the `/proc` filesystem where `/proc/<pid>/lwp/<tid>/lwpsinfo` has
the thread state in binary, similar to Linux's
`/proc/<pid>/task/<tid>/stat` where the state is in ASCII. However, the
definition of state info `R` in `lwpsinfo` is `runnable`. In Linux,
state `R` means the thread is `running`. Therefore, `lwpsinfo` is not
ideal for our purpose of getting the current load of the system. This
patch uses `perfstat_cpu()` in AIX system library `libperfstat.a` to
obtain the number of threads current running on logical CPUs.

show more ...


Revision tags: llvmorg-18.1.5
# 928db7e7 30-Apr-2024 Xing Xue <xingxue@outlook.com>

[OpenMP][AIX] Implement __kmp_is_address_mapped() for AIX (#90516)

This patch implements `__kmp_is_address_mapped()` for AIX by calling
`loadquery()` to get the load info of the process and then ch

[OpenMP][AIX] Implement __kmp_is_address_mapped() for AIX (#90516)

This patch implements `__kmp_is_address_mapped()` for AIX by calling
`loadquery()` to get the load info of the process and then checking if
the address falls within the range of the data segment of one of the
loaded modules.

show more ...


Revision tags: llvmorg-18.1.4
# 5300a673 12-Apr-2024 Jonathan Peyton <jonathan.l.peyton@intel.com>

[OpenMP] Fix re-locking hang found in issue 86684 (#88539)

This was initially reported here (including stacktraces):
https://stackoverflow.com/questions/78183545/does-compiling-imagick-with-openmp-

[OpenMP] Fix re-locking hang found in issue 86684 (#88539)

This was initially reported here (including stacktraces):
https://stackoverflow.com/questions/78183545/does-compiling-imagick-with-openmp-enabled-in-freebsd-13-2-cause-sched-yield

If `__kmp_register_library_startup()` detects that another instance of
the library is present, `__kmp_is_address_mapped()` is eventually
called. which uses `kmpc_alloc()` to allocate memory. This function
calls `__kmp_entry_thread()` to access the thread-local memory pool,
which is a bad idea during initialization. This macro internally calls
`__kmp_get_global_thread_id_reg()` which sets the bootstrap lock at the
beginning (before calling `__kmp_register_library_startup()`).

The fix is to use `KMP_INTERNAL_MALLOC()`/`KMP_INTERNAL_FREE()` instead
of `kmpc_malloc()`/`kmpc_free()`. `KMP_INTERNAL_MALLOC` and
`KMP_INTERNAL_FREE` do not use any bootstrap locks. They just translate
to `malloc()`/`free()` and are meant to be used during library
initialization before other library-specific allocators have been
initialized.

Fixes: #86684

show more ...


Revision tags: llvmorg-18.1.3
# 31880df9 02-Apr-2024 nihui <shuizhuyuanluo@126.com>

[OpenMP] get logical core count on modern apple platform (#87231)

`hw.logicalcpu` returns the available logical core count

Fix build error for watchOS

```
runtime/src/z_Linux_util.cpp:1821:8:

[OpenMP] get logical core count on modern apple platform (#87231)

`hw.logicalcpu` returns the available logical core count

Fix build error for watchOS

```
runtime/src/z_Linux_util.cpp:1821:8: error: 'host_info' is unavailable: not available on watchOS
rc = host_info(mach_host_self(), HOST_BASIC_INFO, (host_info_t)&info, &num);
^
/Applications/Xcode_15.2.app/Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS10.2.sdk/usr/include/mach/mach_host.h:82:15: note: 'host_info' has been explicitly marked unavailable here
kern_return_t host_info
^
1 warning and 1 error generated.
make[2]: *** [runtime/src/CMakeFiles/omp.dir/z_Linux_util.cpp.o] Error 1
```

show more ...


# c5bbdb64 02-Apr-2024 nihui <shuizhuyuanluo@126.com>

[OpenMP] arm64_32 port for Apple WatchOS (#87246)

detect `aarch64_32` with compiler defined macro `__ARM64_ARCH_8_32__`
reuse ARM `__kmp_unnamed_critical_addr` and add `KMP_PREFIX_UNDERSCORE`
macr

[OpenMP] arm64_32 port for Apple WatchOS (#87246)

detect `aarch64_32` with compiler defined macro `__ARM64_ARCH_8_32__`
reuse ARM `__kmp_unnamed_critical_addr` and add `KMP_PREFIX_UNDERSCORE`
macro like AARCH64
reuse AARCH64 `__kmp_invoke_microtask`


build log for watchos armv7k + arm64_32 and watchos simulator x86_64 +
arm64

https://github.com/nihui/action-protobuf/actions/runs/8520684611/job/23337305030

show more ...


# d394f3a1 22-Mar-2024 Xing Xue <xingxue@outlook.com>

[OpenMP][AIX] Affinity implementation for AIX (#84984)

This patch implements `affinity` for AIX, which is quite different from
platforms such as Linux.
- Setting CPU affinity through masks and rel

[OpenMP][AIX] Affinity implementation for AIX (#84984)

This patch implements `affinity` for AIX, which is quite different from
platforms such as Linux.
- Setting CPU affinity through masks and related functions are not
supported. System call `bindprocessor()` is used to bind a thread to one
CPU per call.
- There are no system routines to get the affinity info of a thread. The
implementation of `get_system_affinity()` for AIX gets the mask of all
available CPUs, to be used as the full mask only.
- Topology is not available from the file system. It is obtained through
system SRAD (Scheduler Resource Allocation Domain).

This patch has run through the libomp LIT tests successfully with
`affinity` enabled.

show more ...


Revision tags: llvmorg-18.1.2
# d8366082 14-Mar-2024 Andrew Brown <andrew.brown@intel.com>

[openmp][wasm] Fix microtask type mismatch (#84355)

When OpenMP is compiled for WebAssembly (see #71297), it invokes a
microtask via a `switch` statement that dispatches to the `void *`
microtask

[openmp][wasm] Fix microtask type mismatch (#84355)

When OpenMP is compiled for WebAssembly (see #71297), it invokes a
microtask via a `switch` statement that dispatches to the `void *`
microtask pointer with spelled-out arguments (not varargs). As #83329
points out, however, this can result in a type mismatch when the
indirect call is executed by WebAssembly; WebAssembly expects the called
pointer to have the precise type of the call site. This change fixes the
issue by bringing back the approach in [D142593] of type-casting all the
`switch` arms to the precise type. This fixes #83329.

[D142593]: https://reviews.llvm.org/D142593

show more ...


# fa4cc392 10-Mar-2024 David CARLIER <devnexen@gmail.com>

[openmp] adding affinity support to DragonFlyBSD. (#84672)


# 11cd2a33 09-Mar-2024 David CARLIER <devnexen@gmail.com>

[openmp] porting affinity feature to netbsd. (#84618)

netbsd supports the portable hwloc's layer as well. for a hardware with
4 cpus, a cpu set is 4 and maxcpus is 256.


# 05280b58 08-Mar-2024 David CARLIER <devnexen@gmail.com>

[OpenMP] Implements __kmp_is_address_mapped for Solaris/Illumos. (#82930)

Also fixing OpenMP build itself for this platform.


Revision tags: llvmorg-18.1.1, llvmorg-18.1.0, llvmorg-18.1.0-rc4
# 9e7c0b13 25-Feb-2024 David CARLIER <devnexen@gmail.com>

[OpenMP] Implement __kmp_is_address_mapped on DragonFlyBSD. (#82895)

implement internal __kmp_is_address_mapped.


Revision tags: llvmorg-18.1.0-rc3, llvmorg-18.1.0-rc2, llvmorg-18.1.0-rc1, llvmorg-19-init
# dc03382d 09-Jan-2024 Brad Smith <brad@comstyle.com>

[openmp][AIX] Add AIX to __kmp_set_stack_info() (#77421)


# 2edce427 08-Jan-2024 Xing Xue <57193974+xingxue-ibm@users.noreply.github.com>

[openmp][AIX]Initial changes for porting to AIX (#76841)

This PR contains initial changes for building and testing libomp on AIX.
More changes will follow.
- `KMP_OS_AIX` is defined for the AIX pl

[openmp][AIX]Initial changes for porting to AIX (#76841)

This PR contains initial changes for building and testing libomp on AIX.
More changes will follow.
- `KMP_OS_AIX` is defined for the AIX platform
- `KMP_ARCH_PPC` is defined for 32-bit PPC
- `KMP_ARCH_PPC_XCOFF` and `KMP_ARCH_PPC64_XCOFF` are for 32- and 64-bit
XCOFF object formats respectively
- Assembly file `z_AIX_asm.S` is used for AIX specific assembly code and
will be added in a separate PR
- The target library is disabled because AIX does not have the device
support
- OMPT is temporarily disabled

show more ...


# 68ea91dd 14-Dec-2023 Andrew Brown <andrew.brown@intel.com>

[openmp][wasm] Allow compiling OpenMP to WebAssembly (#71297)

This change allows building the static OpenMP runtime, `libomp.a`, as
WebAssembly. It builds on the work done in [D142593] but goes fu

[openmp][wasm] Allow compiling OpenMP to WebAssembly (#71297)

This change allows building the static OpenMP runtime, `libomp.a`, as
WebAssembly. It builds on the work done in [D142593] but goes further in
several ways:
- it makes the OpenMP CMake files more WebAssembly-aware
- it conditions much more code (or code that had been refactored since
[D142593]) for `KMP_ARCH_WASM` and `KMP_OS_WASI`
- it fixes a Clang crash due to unimplemented common symbols in
WebAssembly

The commit messages have more details. Please understand this PR as a
start, not the completed work, for WebAssembly support in OpenMP.
Getting the tests running somehow would be a good next step, e.g.; but
what is contained here works, at least with recent versions of
[wasi-sdk] and engines that support [wasi-threads]. I suspect the same
is true for Emscripten and browsers, but I have not tested that
workflow.

[D142593]: https://reviews.llvm.org/D142593
[wasi-sdk]: https://github.com/WebAssembly/wasi-sdk
[wasi-threads]: https://github.com/WebAssembly/wasi-threads

---------

Co-authored-by: Atanas Atanasov <atanas.atanasov@intel.com>

show more ...


# 8b5af313 11-Dec-2023 Brad Smith <brad@comstyle.com>

[OpenMP] Change check for OS to check for defined for a macro (#75012)

Check for the existence of the macro instead of checking for Solaris.
illumos has this macro in sys/time.h.

/export/home/br

[OpenMP] Change check for OS to check for defined for a macro (#75012)

Check for the existence of the macro instead of checking for Solaris.
illumos has this macro in sys/time.h.

/export/home/brad/llvm-brad/openmp/runtime/src/z_Linux_util.cpp:77:9: warning: 'TIMEVAL_TO_TIMESPEC' macro redefined [-Wmacro-redefined]
77 | #define TIMEVAL_TO_TIMESPEC(tv, ts) \
| ^
/usr/include/sys/time.h:424:9: note: previous definition is here
424 | #define TIMEVAL_TO_TIMESPEC(tv, ts) { \
| ^

show more ...


Revision tags: llvmorg-17.0.6
# 3425e11a 17-Nov-2023 Brad Smith <brad@comstyle.com>

[OpenMP] Add missing pieces in __kmp_launch_worker for Solaris support (#72613)


Revision tags: llvmorg-17.0.5
# 90a9e9f6 09-Nov-2023 xingxue-ibm <57193974+xingxue-ibm@users.noreply.github.com>

[OpenMP] Fix a condition for KMP_OS_SOLARIS. (#71831)

Line 75 of `z_Linux_util.cpp` checks `#ifdef KMP_OS_SOLARIS` which is
always true regardless of the building platform because macro
`KMP_OS_SO

[OpenMP] Fix a condition for KMP_OS_SOLARIS. (#71831)

Line 75 of `z_Linux_util.cpp` checks `#ifdef KMP_OS_SOLARIS` which is
always true regardless of the building platform because macro
`KMP_OS_SOLARIS` is always defined in line 23 of `kmp_platform.h`:
`define KMP_OS_SOLARIS 0`.

show more ...


# 1111ef02 03-Nov-2023 Neale Ferguson <neale@sinenomine.net>

Add openmp support to System z (#66081)

* openmp/README.rst
- Add s390x to those platforms supported

* openmp/libomptarget/plugins-nextgen/CMakeLists.txt
- Add s390x subdirectory

* openm

Add openmp support to System z (#66081)

* openmp/README.rst
- Add s390x to those platforms supported

* openmp/libomptarget/plugins-nextgen/CMakeLists.txt
- Add s390x subdirectory

* openmp/libomptarget/plugins-nextgen/s390x/CMakeLists.txt
- Add s390x definitions

* openmp/runtime/CMakeLists.txt
- Add s390x to those platforms supported

* openmp/runtime/cmake/LibompGetArchitecture.cmake
- Define s390x ARCHITECTURE

* openmp/runtime/cmake/LibompMicroTests.cmake
- Add dependencies for System z (aka s390x)

* openmp/runtime/cmake/LibompUtils.cmake
- Add S390X to the mix

* openmp/runtime/cmake/config-ix.cmake
- Add s390x as a supported LIPOMP_ARCH

* openmp/runtime/src/kmp_affinity.h
- Define __NR_sched_[get|set]addinity for s390x

* openmp/runtime/src/kmp_config.h.cmake
- Define CACHE_LINE for s390x

* openmp/runtime/src/kmp_os.h
- Add KMP_ARCH_S390X to support checks

* openmp/runtime/src/kmp_platform.h
- Define KMP_ARCH_S390X

* openmp/runtime/src/kmp_runtime.cpp
- Generate code when KMP_ARCH_S390X is defined

* openmp/runtime/src/kmp_tasking.cpp
- Generate code when KMP_ARCH_S390X is defined

* openmp/runtime/src/thirdparty/ittnotify/ittnotify_config.h
- Define ITT_ARCH_S390X

* openmp/runtime/src/z_Linux_asm.S
- Instantiate __kmp_invoke_microtask for s390x

* openmp/runtime/src/z_Linux_util.cpp
- Generate code when KMP_ARCH_S390X is defined

* openmp/runtime/test/ompt/callback.h
- Define print_possible_return_addresses for s390x

* openmp/runtime/tools/lib/Platform.pm
- Return s390x as platform and host architecture

* openmp/runtime/tools/lib/Uname.pm
- Set hardware platform value for s390x

show more ...


# b5b251aa 03-Nov-2023 Brad Smith <brad@comstyle.com>

[OpenMP] Add support for Solaris/x86_64 (#70593)

Tested on `amd64-pc-solaris2.11`.


Revision tags: llvmorg-17.0.4
# 0a29879e 30-Oct-2023 Brad Smith <brad@comstyle.com>

[OpenMP] Add missing bit with the Hurd support (#70609)

Looking at 855d09855d8e541176758f38015e8b9b522d6110 it looks like a bit was
missing. The padding variable is used further down by the KMP_ALL

[OpenMP] Add missing bit with the Hurd support (#70609)

Looking at 855d09855d8e541176758f38015e8b9b522d6110 it looks like a bit was
missing. The padding variable is used further down by the KMP_ALLOCA()
function.

show more ...


# 0d1da7c3 29-Oct-2023 Brad Smith <brad@comstyle.com>

[OpenMP] Make use of getloadavg() on *BSD OS's (#70586)

OpenBSD does not have /proc filesystem, neither does FreeBSD (by default).


Revision tags: llvmorg-17.0.3, llvmorg-17.0.2
# 7b8130c2 20-Sep-2023 Kazushi Marukawa <marukawa@nec.com>

[OpenMP][VE] Limit the number of threads to create (#66729)

VE supports up to 64 threads per a VE process. So, we limit the number
of threads defined by KMP_MAX_NTH. We also modify the __kmp_sys_ma

[OpenMP][VE] Limit the number of threads to create (#66729)

VE supports up to 64 threads per a VE process. So, we limit the number
of threads defined by KMP_MAX_NTH. We also modify the __kmp_sys_max_nth
initialization to use KMP_MAX_NTH as a limit.

show more ...


Revision tags: llvmorg-17.0.1, llvmorg-17.0.0, llvmorg-17.0.0-rc4, llvmorg-17.0.0-rc3
# 102d8647 14-Aug-2023 Terry Wilmarth <terry.l.wilmarth@intel.com>

Fix /tmp approach, and add environment variable method as third fallback during library registration

The /tmp fallback for /dev/shm did not write to a fixed filename, so multiple instances of the ru

Fix /tmp approach, and add environment variable method as third fallback during library registration

The /tmp fallback for /dev/shm did not write to a fixed filename, so multiple instances of the runtime would not be able to detect each other. Now, we create the /tmp file in much the same way as the /dev/shm file was created, since mkstemp approach would not work to create a file that other instances of the runtime would detect. Also, add the environment variable method as a third fallback to /dev/shm and /tmp for library registration, as some systems do not have either. Also, add ability to fallback to a subsequent method should a failure occur during any part of the registration process. When unregistering, it is assumed that the method chosen during registration should work, so errors at that point are ignored. This also avoids a problem with multiple threads trying to unregister the library.

show more ...


12345