[all-commits] [llvm/llvm-project] 964a53: [libc] Remove flexible array and replace with a te...

Joseph Huber via All-commits all-commits at lists.llvm.org
Tue Jun 20 13:22:54 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 964a535bfa77b491f5ad11222b419710795f0ffb
      https://github.com/llvm/llvm-project/commit/964a535bfa77b491f5ad11222b419710795f0ffb
  Author: Joseph Huber <jhuber6 at vols.utk.edu>
  Date:   2023-06-20 (Tue, 20 Jun 2023)

  Changed paths:
    M libc/src/__support/RPC/rpc.h
    M libc/src/__support/RPC/rpc_client.cpp
    M libc/src/gpu/rpc_reset.cpp
    M libc/startup/gpu/amdgpu/start.cpp
    M libc/startup/gpu/nvptx/start.cpp
    M libc/utils/gpu/server/Server.cpp
    M libc/utils/gpu/server/Server.h

  Log Message:
  -----------
  [libc] Remove flexible array and replace with a template

Currently the implementation of the RPC interface requires a flexible
struct. This caused problems when compilling the RPC server with GCC as
would be required if trying to export the RPC server interface. This
required that we either move to the `x[1]` workaround or make it a
template parameter. While just using `x[1]` would be much less noisy,
this is technically undefined behavior. For this reason I elected to use
templates.

The downside to using templates is that the server code must now be able
to handle multiple different types at runtime. I was unable to find a
good solution that didn't rely on type erasure so I simply branch off of
the given value.

Reviewed By: JonChesterfield

Differential Revision: https://reviews.llvm.org/D153304




More information about the All-commits mailing list