[all-commits] [llvm/llvm-project] cd4e88: [libc] Improve copying system vectors to the GPU

Joseph Huber via All-commits all-commits at lists.llvm.org
Mon Apr 3 08:11:06 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: cd4e8884edefd37d3c3fd42c7740ef2a82a6592b
      https://github.com/llvm/llvm-project/commit/cd4e8884edefd37d3c3fd42c7740ef2a82a6592b
  Author: Joseph Huber <jhuber6 at vols.utk.edu>
  Date:   2023-04-03 (Mon, 03 Apr 2023)

  Changed paths:
    M libc/utils/gpu/loader/Loader.h

  Log Message:
  -----------
  [libc] Improve copying system vectors to the GPU

Summary:
This implementation was buggy and inefficient. Fine-grained memory can
only be allocated on a page-level granularity. Which means that each
allocated string used about 4096 bytes. This is wasteful in general, and
also allowed for buggy behaviour. The previous copying of the
environment vector only worked because the large buffer size meant that
we would typically have a null byte after the allocated memory. However
this would break if the vector was larger than a page. This patch
allocates everything into a single buffer. It makes it easier to free,
use, and it more correct.




More information about the All-commits mailing list