summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesse Natalie <jenatali@microsoft.com>2020-11-18 18:37:54 -0800
committerJesse Natalie <jenatali@microsoft.com>2020-12-02 10:13:34 -0800
commit474baa04eda3b2bba3bf10c121ae98a7137dc128 (patch)
tree7eedbb0e34bde0b37091e83307a94edd03a81042
parentf88347cd223c34324816e917e02aeaa31c6a58b5 (diff)
clover/api: Support MSVC
Three things: 1. MSVC dislikes mismatching declaration/definition of __declspec(dllexport). Since CL headers don't have the declspec, the implementations should't either. 2. An unnamed brace-initialization gets deduced as an initializer list, instead of a brace-constructed string. Just add the type name. 3. posix_memalign doesn't exist on Windows. Reviewed-by: Francisco Jerez <currojerez@riseup.net> Reviewed-by: Karol Herbst <kherbst@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7680>
-rw-r--r--src/gallium/frontends/clover/api/memory.cpp2
-rw-r--r--src/gallium/frontends/clover/api/program.cpp2
-rw-r--r--src/gallium/frontends/clover/api/util.hpp6
3 files changed, 8 insertions, 2 deletions
diff --git a/src/gallium/frontends/clover/api/memory.cpp b/src/gallium/frontends/clover/api/memory.cpp
index 89762d1b262..1ffe306289b 100644
--- a/src/gallium/frontends/clover/api/memory.cpp
+++ b/src/gallium/frontends/clover/api/memory.cpp
@@ -511,6 +511,7 @@ clSVMAlloc(cl_context d_ctx,
if (!alignment)
alignment = 0x80; // sizeof(long16)
+#if HAVE_POSIX_MEMALIGN
bool can_emulate = all_of(std::mem_fn(&device::has_system_svm), ctx.devices());
if (can_emulate) {
// we can ignore all the flags as it's not required to honor them.
@@ -520,6 +521,7 @@ clSVMAlloc(cl_context d_ctx,
posix_memalign(&ptr, alignment, size);
return ptr;
}
+#endif
CLOVER_NOT_SUPPORTED_UNTIL("2.0");
return nullptr;
diff --git a/src/gallium/frontends/clover/api/program.cpp b/src/gallium/frontends/clover/api/program.cpp
index ebe5f233c3c..d390c1c9e13 100644
--- a/src/gallium/frontends/clover/api/program.cpp
+++ b/src/gallium/frontends/clover/api/program.cpp
@@ -123,7 +123,7 @@ clCreateProgramWithBinary(cl_context d_ctx, cl_uint n,
return { CL_INVALID_VALUE, {} };
try {
- std::stringbuf bin( { (char*)p, l } );
+ std::stringbuf bin( std::string{ (char*)p, l } );
std::istream s(&bin);
return { CL_SUCCESS, module::deserialize(s) };
diff --git a/src/gallium/frontends/clover/api/util.hpp b/src/gallium/frontends/clover/api/util.hpp
index 66bd12597c6..788c99adbd2 100644
--- a/src/gallium/frontends/clover/api/util.hpp
+++ b/src/gallium/frontends/clover/api/util.hpp
@@ -29,8 +29,12 @@
#include "core/error.hpp"
#include "core/property.hpp"
#include "util/algorithm.hpp"
+#include "util/detect_os.h"
-#ifdef HAVE_CLOVER_ICD
+#if DETECT_OS_WINDOWS
+#define CLOVER_API
+#define CLOVER_ICD_API
+#elif HAVE_CLOVER_ICD
#define CLOVER_API
#define CLOVER_ICD_API PUBLIC
#else