[all-commits] [llvm/llvm-project] d1b294: [libc] Add loader option to force serial execution...

Joseph Huber via All-commits all-commits at lists.llvm.org
Mon Aug 5 12:49:37 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: d1b294029004e7c3220ed46e2b06addd32490745
      https://github.com/llvm/llvm-project/commit/d1b294029004e7c3220ed46e2b06addd32490745
  Author: Joseph Huber <huberjn at outlook.com>
  Date:   2024-08-05 (Mon, 05 Aug 2024)

  Changed paths:
    M libc/utils/gpu/loader/Main.cpp

  Log Message:
  -----------
  [libc] Add loader option to force serial execution of GPU region (#101601)

Summary:
The loader is used as a test utility to run traditionally CPU based unit
tests on the GPU. This has issues when used with something like
`llvm-lit` because the GPU runtimes have a nasty habit of either running
out of resources or hanging when they are overloaded. To combat this, I
added this option to force each process to perform the GPU part
serially.

This is done right now with a simple file lock on the executing file. I
was originally thinking about using more complex IPC to allow N
processes to share execution, but that seemed overly complicated given
the incredibly large number of failure modes it introduces. File locks
are nice here because if the process crashes or is killed it will
release the lock automatically (at least on Linux). This is in contrast
to something like POSIX shared memory which will stick around until it's
unlinked, meaning that if someone did `sigkill` on the program it would
never get cleaned up and other threads might wait on a mutex that never
occurs.

Restricting this to one thread isn't overly ideal, given the fact that
the runtime can likely handle at least a *few* separate processes, but
this was easy and it works, so might as well start here. This will
hopefully unblock me on running `libcxx` tests, as those ran with so
much parallelism spurious failures were very common.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list