Skip to content

Commit

Permalink
Move enable JIT cache function to SYCL utils
Browse files Browse the repository at this point in the history
  • Loading branch information
lumurillo committed Nov 14, 2024
1 parent 6284e3d commit 460e3f7
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 14 deletions.
10 changes: 10 additions & 0 deletions cpp/open3d/core/SYCLUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,16 @@ std::vector<Device> GetAvailableSYCLDevices() {
#endif
}

void enablePersistentJITCache() {
#if defined(_WIN32)
_putenv_s("SYCL_CACHE_PERSISTENT", "1");
_putenv_s("SYCL_CACHE_DIR", "cache");
#else
setenv("SYCL_CACHE_PERSISTENT", "1", 1);
setenv("SYCL_CACHE_DIR", "cache", 1);
#endif
}

} // namespace sy
} // namespace core
} // namespace open3d
3 changes: 3 additions & 0 deletions cpp/open3d/core/SYCLUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ bool IsDeviceAvailable(const Device& device);
/// Return a list of available SYCL devices.
std::vector<Device> GetAvailableSYCLDevices();

/// Enables the JIT cache for SYCL.
void enablePersistentJITCache();

} // namespace sy
} // namespace core
} // namespace open3d
14 changes: 0 additions & 14 deletions cpp/open3d/t/geometry/RaycastingScene.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -170,18 +170,6 @@ typedef Eigen::AlignedVector3<float> Vec3fa;
typedef Eigen::Matrix<float, 2, 1, Eigen::DontAlign> Vec2f;
typedef Eigen::Vector3f Vec3f;

#ifdef BUILD_SYCL_MODULE
void enablePersistentJITCache() {
#if defined(_WIN32)
_putenv_s("SYCL_CACHE_PERSISTENT", "1");
_putenv_s("SYCL_CACHE_DIR", "cache");
#else
setenv("SYCL_CACHE_PERSISTENT", "1", 1);
setenv("SYCL_CACHE_DIR", "cache", 1);
#endif
}
#endif

// Error function called by embree.
void ErrorFunction(void* userPtr, enum RTCError error, const char* str) {
open3d::utility::LogError("Embree error: {} {}", rtcGetErrorString(error),
Expand Down Expand Up @@ -452,8 +440,6 @@ struct RaycastingScene::SYCLImpl : public RaycastingScene::Impl {
sycl::device sycl_device_;

void InitializeDevice() {
enablePersistentJITCache();

try {
sycl_device_ = sycl::device(rtcSYCLDeviceSelector);
} catch (std::exception& e) {
Expand Down

0 comments on commit 460e3f7

Please sign in to comment.