Skip to content

Commit

Permalink
pocl v6.0 (#103)
Browse files Browse the repository at this point in the history
* updated v6.0

* MNT: Re-rendered with conda-build 24.5.1, conda-smithy 3.36.2, and conda-forge-pinning 2024.06.18.06.09.12

* rm patch

* rm patch 2

* Revert "rm patch 2"

This reverts commit 5fb52e8.

* re-apply POLLRDHUP part of gh1392 patch

* more pocld patches

* adjust patch

* adjust patch 2

* copy right bc files for CUDA

* disable test_large_buf

---------

Co-authored-by: Matthias Diener <[email protected]>
  • Loading branch information
regro-cf-autotick-bot and matthiasdiener authored Jun 27, 2024
1 parent f4c736e commit 74f2753
Show file tree
Hide file tree
Showing 12 changed files with 82 additions and 210 deletions.
2 changes: 1 addition & 1 deletion .ci_support/osx_64_libhwloc1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ macos_machine:
target_platform:
- osx-64
zlib:
- '1.2'
- '1'
2 changes: 1 addition & 1 deletion .ci_support/osx_64_libhwloc2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ macos_machine:
target_platform:
- osx-64
zlib:
- '1.2'
- '1'
2 changes: 1 addition & 1 deletion .ci_support/osx_arm64_.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ macos_machine:
target_platform:
- osx-arm64
zlib:
- '1.2'
- '1'
7 changes: 7 additions & 0 deletions .scripts/build_steps.sh

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions .scripts/run_osx_build.sh

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions .travis.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion recipe/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ if [[ "$CONDA_BUILD_CROSS_COMPILATION" != "1" ]]; then

if [[ $target_platform == "linux-aarch64" ]]; then
# These tests fail on aarch64
SKIP_TESTS="$SKIP_TESTS|test_printf_vectors|test_printf_vectors_ulong"
SKIP_TESTS="$SKIP_TESTS|test_printf_vectors|test_printf_vectors_ulong|test_large_buf"
fi

if [[ $target_platform == "linux-ppc64le" ]]; then
Expand Down
2 changes: 1 addition & 1 deletion recipe/install-pkg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ mkdir -p $PREFIX/lib/pocl

if [[ "$PKG_NAME" == "pocl-cuda" ]]; then
mv libpocl-devices-cuda.so $PREFIX/lib/pocl/
mv kernel-nvptx64.bc $PREFIX/share/pocl/
mv kernel-nvptx64-*.bc $PREFIX/share/pocl/
mv cuda $PREFIX/share/pocl/
elif [[ "$PKG_NAME" == "pocl-cpu-minimal" ]]; then
mv libpocl-devices-basic.so $PREFIX/lib/pocl/
Expand Down
11 changes: 4 additions & 7 deletions recipe/meta.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{% set version = "5.0" %}
{% set build_number = 6 %}
{% set sha256 = "fd0bb6e50c2286278c11627b71177991519e1f7ab2576bd8d8742974db414549" %}
{% set version = "6.0" %}
{% set build_number = 0 %}
{% set sha256 = "de9710223fc1855f833dbbf42ea2681e06aa8ec0464f0201104dc80a74dfd1f2" %}

{% set llvm_version = "15.0.7" %}

Expand All @@ -14,10 +14,7 @@ source:
patches:
- patches/gh1392.patch
- patches/alignof.diff # [ppc64le]

# https://github.com/pocl/pocl/issues/1480, https://github.com/pocl/pocl/commit/ed97458ba737be9057f322594b7ff5701ad79b1f
# unnecessary after 5.0:
- patches/cache.diff
- patches/pocld.diff

build:
number: {{ build_number }}
Expand Down
29 changes: 0 additions & 29 deletions recipe/patches/cache.diff

This file was deleted.

173 changes: 6 additions & 167 deletions recipe/patches/gh1392.patch
Original file line number Diff line number Diff line change
@@ -1,164 +1,3 @@
From a7b707c80adbff86b7e66f5919875f8f40cc6af5 Mon Sep 17 00:00:00 2001
From: Isuru Fernando <[email protected]>
Date: Wed, 17 Jan 2024 00:42:55 -0600
Subject: [PATCH 1/4] Fix ENABLE_LOADABLE_DRIVERS for remote

---
include/pocl_cache.h | 1 +
lib/CL/devices/devices.c | 12 ++++--------
lib/CL/devices/remote/remote.c | 3 ++-
lib/CL/pocl_cl.h | 2 ++
lib/CL/pocl_intfn.h | 6 +++---
5 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/include/pocl_cache.h b/include/pocl_cache.h
index c77f13e16d..41d0cdae54 100644
--- a/include/pocl_cache.h
+++ b/include/pocl_cache.h
@@ -64,6 +64,7 @@ int pocl_cache_write_spirv (char *spirv_path,
const char *spirv_content,
uint64_t file_size);

+POCL_EXPORT
int pocl_cache_write_generic_objfile (char *objfile_path,
const char *objfile_content,
uint64_t objfile_size);
diff --git a/lib/CL/devices/devices.c b/lib/CL/devices/devices.c
index 917486d3af..ce883d181c 100644
--- a/lib/CL/devices/devices.c
+++ b/lib/CL/devices/devices.c
@@ -100,9 +100,6 @@

#ifdef BUILD_REMOTE_CLIENT
#include "remote/remote.h"
-extern cl_int pocl_remote_setup_peer_mesh ();
-// from remote/remote.c
-extern const char *remote_device_name_ptr;
#endif

#define MAX_DEV_NAME_LEN 64
@@ -660,12 +657,11 @@ pocl_init_devices ()

++dev_index;
}
+ if (pocl_device_ops[i].post_init != NULL)
+ {
+ pocl_device_ops[i].post_init(&pocl_device_ops[i]);
+ }
}
-
-#ifdef BUILD_REMOTE_CLIENT
- pocl_remote_setup_peer_mesh ();
-#endif
-
first_init_done = 1;
devices_active = 1;
ERROR:
diff --git a/lib/CL/devices/remote/remote.c b/lib/CL/devices/remote/remote.c
index 42e9505cb3..c709b0d587 100644
--- a/lib/CL/devices/remote/remote.c
+++ b/lib/CL/devices/remote/remote.c
@@ -228,6 +228,7 @@ pocl_remote_init_device_ops (struct pocl_device_ops *ops)

ops->probe = pocl_remote_probe;
ops->init = pocl_remote_init;
+ ops->post_init = pocl_remote_setup_peer_mesh;
// ops->uninit = pocl_remote_uninit;
// ops->reinit = pocl_remote_reinit;

@@ -488,7 +489,7 @@ pocl_remote_init (unsigned j, cl_device_id device, const char *parameters)
}

cl_int
-pocl_remote_setup_peer_mesh ()
+pocl_remote_setup_peer_mesh (struct pocl_device_ops *ops)
{
return pocl_network_setup_peer_mesh ();
}
diff --git a/lib/CL/pocl_cl.h b/lib/CL/pocl_cl.h
index d1e045acdd..9634f20900 100644
--- a/lib/CL/pocl_cl.h
+++ b/lib/CL/pocl_cl.h
@@ -434,6 +434,8 @@ struct pocl_device_ops {
* parameters : optional environment with device-specific parameters
*/
cl_int (*init) (unsigned j, cl_device_id device, const char *parameters);
+ /* Device type initialization after all devices have been initialized */
+ cl_int (*post_init) (struct pocl_device_ops *ops);
/* uninitializes the driver for a particular device. May free hardware resources. */
cl_int (*uninit) (unsigned j, cl_device_id device);
/* reinitializes the driver for a particular device. Called after uninit;
diff --git a/lib/CL/pocl_intfn.h b/lib/CL/pocl_intfn.h
index ba4f0c7d69..030d505be2 100644
--- a/lib/CL/pocl_intfn.h
+++ b/lib/CL/pocl_intfn.h
@@ -35,9 +35,9 @@ extern "C" {
POdeclsym(clBuildProgram)
POdeclsym(clLinkProgram)
POdeclsym(clCompileProgram)
-POdeclsym(clCreateBuffer)
+POdeclsymExport(clCreateBuffer)
POdeclsym(clCreateCommandQueue)
-POdeclsym(clCreateContext)
+POdeclsymExport(clCreateContext)
POdeclsym(clCreateContextFromType)
POdeclsym(clCreateImage2D)
POdeclsym(clCreateImage3D)
@@ -93,7 +93,7 @@ POdeclsym(clGetKernelInfo)
POdeclsym(clGetKernelArgInfo)
POdeclsym(clGetKernelWorkGroupInfo)
POdeclsym(clGetKernelSubGroupInfo)
-POdeclsym(clGetMemObjectInfo)
+POdeclsymExport(clGetMemObjectInfo)
POdeclsym(clGetPlatformIDs)
POdeclsym(clGetPlatformInfo)
POdeclsym(clGetProgramBuildInfo)

From 6c32cd52953b822a580a8aab31f80062013af99c Mon Sep 17 00:00:00 2001
From: Isuru Fernando <[email protected]>
Date: Wed, 17 Jan 2024 00:43:53 -0600
Subject: [PATCH 2/4] Fix remote for Apple

---
CMakeLists.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 27a950e3cf..dd3eea02c5 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1079,7 +1079,7 @@ else()
set(TESTS_USE_ICD 0)
endif()

-if (APPLE AND NOT ENABLE_ICD AND VISIBILITY_HIDDEN)
+if (APPLE AND VISIBILITY_HIDDEN)
add_compile_definitions("-DCL_API_CALL=__attribute__ ((visibility (\"default\")))")
endif()


From c053673eeb1a9ac3d17f397169602bf5c482fca4 Mon Sep 17 00:00:00 2001
From: Isuru Fernando <[email protected]>
Date: Wed, 17 Jan 2024 00:43:09 -0600
Subject: [PATCH 3/4] Fix ENABLE_LOADABLE_DRIVERS for cuda

---
lib/llvmopencl/LLVMUtils.h | 1 +
1 file changed, 1 insertion(+)

diff --git a/lib/llvmopencl/LLVMUtils.h b/lib/llvmopencl/LLVMUtils.h
index 014105c292..341c2987ed 100644
--- a/lib/llvmopencl/LLVMUtils.h
+++ b/lib/llvmopencl/LLVMUtils.h
@@ -68,6 +68,7 @@ void eraseFunctionAndCallers(llvm::Function *Function);

bool isAutomaticLocal(llvm::Function *F, llvm::GlobalVariable &Var);

+POCL_EXPORT
bool isGVarUsedByFunction(llvm::GlobalVariable *GVar, llvm::Function *F);

// Checks if the given argument of Func is a local buffer.

From aa5595f8713bb5b5068b439b9a51d586d9fc4979 Mon Sep 17 00:00:00 2001
From: Isuru Fernando <[email protected]>
Date: Wed, 17 Jan 2024 00:51:18 -0600
Expand All @@ -168,13 +7,13 @@ Subject: [PATCH 4/4] Fix typo
pocld/pocld.cc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pocld/pocld.cc b/pocld/pocld.cc
diff --git a/pocld/daemon.cc b/pocld/daemon.cc
index bd674cd148..efb81aa099 100644
--- a/pocld/pocld.cc
+++ b/pocld/pocld.cc
@@ -70,7 +70,7 @@
#endif
--- a/pocld/daemon.cc
+++ b/pocld/daemon.cc
@@ -50,7 +50,7 @@
#include "daemon.hh"

#ifndef POLLRDHUP
-#define PULLRDHUP 0
+#define POLLRDHUP 0
Expand Down
51 changes: 51 additions & 0 deletions recipe/patches/pocld.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
diff --git a/pocld/daemon.cc b/pocld/daemon.cc
index bdf711cf8..f8aa50a1c 100644
--- a/pocld/daemon.cc
+++ b/pocld/daemon.cc
@@ -308,18 +308,25 @@ int PoclDaemon::launch(std::string ListenAddress, struct ServerPorts &Ports,
addrinfo *ai = ResolvedAddress;
NumListenFds = 0;
for (addrinfo *ai = ResolvedAddress; ai; ai = ai->ai_next) {
+#ifdef ENABLE_VSOCK
if (ai->ai_family != AF_INET && ai->ai_family != AF_INET6 &&
ai->ai_family != AF_VSOCK)
continue;
+#else
+ if (ai->ai_family != AF_INET && ai->ai_family != AF_INET6)
+ continue;
+#endif
struct sockaddr *base_addr = ai->ai_addr;
int base_addrlen = ai->ai_addrlen;
std::string addr_string = describe_sockaddr(base_addr, base_addrlen);
+#ifdef ENABLE_VSOCK
if (UseVsock && ai->ai_family != AF_VSOCK) {
POCL_MSG_ERR("Using vsock requires using the correct address "
"vsock:<cid>, instead of %s\n",
addr_string.c_str());
break;
}
+#endif
int listen_command_fd = 0;
int listen_stream_fd = 0;
struct sockaddr_storage server_addr_command, server_addr_stream;
diff --git a/pocld/shared_cl_context.cc b/pocld/shared_cl_context.cc
index 6bc358bbe..b1678af03 100644
--- a/pocld/shared_cl_context.cc
+++ b/pocld/shared_cl_context.cc
@@ -23,6 +23,7 @@
IN THE SOFTWARE.
*/

+#include <unistd.h>
#include <cassert>
#include <cstdio>
#include <filesystem>
@@ -630,7 +631,7 @@ SharedCLContext::SharedCLContext(cl::Platform *p, unsigned pid,
if (MaxMemAllocSize < MaxSVMAllocSize)
MaxSVMAllocSize = MaxMemAllocSize;

- MaxTotalAllocatableSVM = std::min(MaxTotalAllocatableSVM,
+ MaxTotalAllocatableSVM = std::min(MaxTotalAllocatableSVM, (size_t)
Dev.getInfo<CL_DEVICE_GLOBAL_MEM_SIZE>());
}

0 comments on commit 74f2753

Please sign in to comment.