Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion source/common/ur_util.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
#include <vector>

#ifdef _WIN32
#define NOMINMAX

#include <windows.h>
inline int ur_getpid(void) { return static_cast<int>(GetCurrentProcessId()); }
#else
Expand Down Expand Up @@ -59,7 +61,6 @@ inline int ur_getpid(void) { return static_cast<int>(getpid()); }
#endif
///////////////////////////////////////////////////////////////////////////////
#if defined(_WIN32)
#include <Windows.h>
#define MAKE_LIBRARY_NAME(NAME, VERSION) NAME ".dll"
#else
#define HMODULE void *
Expand Down
9 changes: 6 additions & 3 deletions source/ur/ur.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@

#include <ur_api.h>

#include "ur_util.hpp"

template <class To, class From> To ur_cast(From Value) {
// TODO: see if more sanity checks are possible.
assert(sizeof(From) == sizeof(To));
Expand Down Expand Up @@ -61,9 +63,10 @@ const ur_command_t UR_EXT_COMMAND_TYPE_USER =
// overhead from mutex locking. Default value is 0 which means that single
// thread mode is disabled.
static const bool SingleThreadMode = [] {
const char *UrRet = std::getenv("UR_L0_SINGLE_THREAD_MODE");
const char *PiRet = std::getenv("SYCL_PI_LEVEL_ZERO_SINGLE_THREAD_MODE");
const bool RetVal = UrRet ? std::stoi(UrRet) : (PiRet ? std::stoi(PiRet) : 0);
auto UrRet = ur_getenv("UR_L0_SINGLE_THREAD_MODE");
auto PiRet = ur_getenv("SYCL_PI_LEVEL_ZERO_SINGLE_THREAD_MODE");
const bool RetVal =
UrRet ? std::stoi(*UrRet) : (PiRet ? std::stoi(*PiRet) : 0);
return RetVal;
}();

Expand Down