[llvm] [libsycl] Fix _LIBSYCL_EXPORT placement (PR #192243)
Sergey Semenov via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 15 05:34:30 PDT 2026
https://github.com/sergey-semenov created https://github.com/llvm/llvm-project/pull/192243
Current placement of _LIBSYCL_EXPORT in usm_functions.hpp causes compilation errors on Windows and is not aligned with other header files.
>From 17a1f8bbd86c658eec4549800fa180aa641a2400 Mon Sep 17 00:00:00 2001
From: Semenov <sergey.semenov at intel.com>
Date: Wed, 15 Apr 2026 05:21:09 -0700
Subject: [PATCH] [libsycl] Fix _LIBSYCL_EXPORT placement
Current placement of _LIBSYCL_EXPORT causes compilation errors on
Windows and is not aligned with other header files.
---
libsycl/include/sycl/__impl/usm_functions.hpp | 20 +++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/libsycl/include/sycl/__impl/usm_functions.hpp b/libsycl/include/sycl/__impl/usm_functions.hpp
index 15ed880a47ca8..10bd4a6dddc8e 100644
--- a/libsycl/include/sycl/__impl/usm_functions.hpp
+++ b/libsycl/include/sycl/__impl/usm_functions.hpp
@@ -35,7 +35,7 @@ _LIBSYCL_BEGIN_NAMESPACE_SYCL
/// \return a pointer to the newly allocated memory, which is allocated on
/// syclDevice and which must eventually be deallocated with sycl::free in order
/// to avoid a memory leak.
-void *_LIBSYCL_EXPORT malloc_device(std::size_t numBytes,
+_LIBSYCL_EXPORT void *malloc_device(std::size_t numBytes,
const device &syclDevice,
const context &syclContext,
const property_list &propList = {});
@@ -68,7 +68,7 @@ T *malloc_device(std::size_t count, const device &syclDevice,
/// \return a pointer to the newly allocated memory, which is allocated on
/// syclDevice and which must eventually be deallocated with sycl::free in order
/// to avoid a memory leak.
-void *_LIBSYCL_EXPORT malloc_device(std::size_t numBytes,
+_LIBSYCL_EXPORT void *malloc_device(std::size_t numBytes,
const queue &syclQueue,
const property_list &propList = {});
@@ -99,7 +99,7 @@ T *malloc_device(std::size_t count, const queue &syclQueue,
/// \param propList the list of properties for the allocation.
/// \return a pointer to the newly allocated memory, which must eventually be
/// deallocated with sycl::free in order to avoid a memory leak.
-void *_LIBSYCL_EXPORT malloc_host(std::size_t numBytes,
+_LIBSYCL_EXPORT void *malloc_host(std::size_t numBytes,
const context &syclContext,
const property_list &propList = {});
@@ -127,7 +127,7 @@ T *malloc_host(std::size_t count, const context &syclContext,
/// \param propList the list of properties for the allocation.
/// \return a pointer to the newly allocated memory, which must eventually be
/// deallocated with sycl::free in order to avoid a memory leak.
-void *_LIBSYCL_EXPORT malloc_host(std::size_t numBytes, const queue &syclQueue,
+_LIBSYCL_EXPORT void *malloc_host(std::size_t numBytes, const queue &syclQueue,
const property_list &propList = {});
/// Allocates host USM.
@@ -156,7 +156,7 @@ T *malloc_host(std::size_t count, const queue &syclQueue,
/// \param propList the list of properties for the allocation.
/// \return a pointer to the newly allocated memory, which must eventually be
/// deallocated with sycl::free in order to avoid a memory leak.
-void *_LIBSYCL_EXPORT malloc_shared(std::size_t numBytes,
+_LIBSYCL_EXPORT void *malloc_shared(std::size_t numBytes,
const device &syclDevice,
const context &syclContext,
const property_list &propList = {});
@@ -187,7 +187,7 @@ T *malloc_shared(std::size_t count, const device &syclDevice,
/// \param propList the list of properties for the allocation.
/// \return a pointer to the newly allocated memory, which must eventually be
/// deallocated with sycl::free in order to avoid a memory leak.
-void *_LIBSYCL_EXPORT malloc_shared(std::size_t numBytes,
+_LIBSYCL_EXPORT void *malloc_shared(std::size_t numBytes,
const queue &syclQueue,
const property_list &propList = {});
@@ -221,7 +221,7 @@ T *malloc_shared(std::size_t count, const queue &syclQueue,
/// deallocated with sycl::free in order to avoid a memory leak. If there are
/// not enough resources to allocate the requested memory, these functions
/// return nullptr.
-void *_LIBSYCL_EXPORT malloc(std::size_t numBytes, const device &syclDevice,
+_LIBSYCL_EXPORT void *malloc(std::size_t numBytes, const device &syclDevice,
const context &syclContext, usm::alloc kind,
const property_list &propList = {});
@@ -257,7 +257,7 @@ T *malloc(std::size_t count, const device &syclDevice,
/// deallocated with sycl::free in order to avoid a memory leak. If there are
/// not enough resources to allocate the requested memory, these functions
/// return nullptr.
-void *_LIBSYCL_EXPORT malloc(std::size_t numBytes, const queue &syclQueue,
+_LIBSYCL_EXPORT void *malloc(std::size_t numBytes, const queue &syclQueue,
usm::alloc kind,
const property_list &propList = {});
@@ -288,7 +288,7 @@ T *malloc(std::size_t count, const queue &syclQueue, usm::alloc kind,
/// is a null pointer; ptr has not previously been deallocated; there are no
/// in-progress or enqueued commands using the memory pointed to by ptr.
/// \param ctxt the context that is associated with ptr.
-void _LIBSYCL_EXPORT free(void *ptr, const context &ctxt);
+_LIBSYCL_EXPORT void free(void *ptr, const context &ctxt);
/// Deallocate USM of any kind.
///
@@ -299,7 +299,7 @@ void _LIBSYCL_EXPORT free(void *ptr, const context &ctxt);
/// is a null pointer; ptr has not previously been deallocated; there are no
/// in-progress or enqueued commands using the memory pointed to by ptr.
/// \param q a queue to determine the context associated with ptr.
-void _LIBSYCL_EXPORT free(void *ptr, const queue &q);
+_LIBSYCL_EXPORT void free(void *ptr, const queue &q);
/// @}
_LIBSYCL_END_NAMESPACE_SYCL
More information about the llvm-commits
mailing list