|
9 | 9 | #include "kernel_compiler_sycl.hpp" |
10 | 10 | #include <sycl/exception.hpp> // make_error_code |
11 | 11 |
|
12 | | -#include <iomanip> |
13 | | -#include <random> |
14 | | -#include <sstream> |
15 | | - |
16 | | -static std::string generateSemiUniqueId() { |
17 | | - auto Now = std::chrono::high_resolution_clock::now(); |
18 | | - auto Milliseconds = std::chrono::duration_cast<std::chrono::milliseconds>( |
19 | | - Now.time_since_epoch()); |
20 | | - |
21 | | - // Generate random number between 10'000 and 99'900. |
22 | | - std::random_device RD; |
23 | | - std::mt19937 Gen(RD()); |
24 | | - std::uniform_int_distribution<int> Distrib(10'000, 99'999); |
25 | | - int RandomNumber = Distrib(Gen); |
26 | | - |
27 | | - // Combine time and random number into a string. |
28 | | - std::stringstream Ss; |
29 | | - Ss << Milliseconds.count() << "_" << std::setfill('0') << std::setw(5) |
30 | | - << RandomNumber; |
31 | | - |
32 | | - return Ss.str(); |
33 | | -} |
34 | | - |
35 | 12 | #if __GNUC__ && __GNUC__ < 8 |
36 | 13 |
|
37 | 14 | // std::filesystem is not availalbe for GCC < 8 |
@@ -71,14 +48,35 @@ SYCL_to_SPIRV(const std::string &SYCLSource, include_pairs_t IncludePairs, |
71 | 48 | #include <ctime> |
72 | 49 | #include <filesystem> |
73 | 50 | #include <fstream> |
| 51 | +#include <random> |
74 | 52 | #include <regex> |
| 53 | +#include <sstream> |
75 | 54 | #include <stdio.h> |
76 | 55 |
|
77 | 56 | namespace sycl { |
78 | 57 | inline namespace _V1 { |
79 | 58 | namespace ext::oneapi::experimental { |
80 | 59 | namespace detail { |
81 | 60 |
|
| 61 | +std::string generateSemiUniqueId() { |
| 62 | + auto Now = std::chrono::high_resolution_clock::now(); |
| 63 | + auto Milliseconds = std::chrono::duration_cast<std::chrono::milliseconds>( |
| 64 | + Now.time_since_epoch()); |
| 65 | + |
| 66 | + // Generate random number between 10'000 and 99'900. |
| 67 | + std::random_device RD; |
| 68 | + std::mt19937 Gen(RD()); |
| 69 | + std::uniform_int_distribution<int> Distrib(10'000, 99'999); |
| 70 | + int RandomNumber = Distrib(Gen); |
| 71 | + |
| 72 | + // Combine time and random number into a string. |
| 73 | + std::stringstream Ss; |
| 74 | + Ss << Milliseconds.count() << "_" << std::setfill('0') << std::setw(5) |
| 75 | + << RandomNumber; |
| 76 | + |
| 77 | + return Ss.str(); |
| 78 | +} |
| 79 | + |
82 | 80 | std::filesystem::path prepareWS(const std::string &Id) { |
83 | 81 | namespace fs = std::filesystem; |
84 | 82 | const fs::path TmpDirectoryPath = fs::temp_directory_path(); |
@@ -343,8 +341,7 @@ spirv_vec_t SYCL_JIT_to_SPIRV( |
343 | 341 | [[maybe_unused]] const std::vector<std::string> &RegisteredKernelNames) { |
344 | 342 | #if SYCL_EXT_JIT_ENABLE |
345 | 343 | return sycl::detail::jit_compiler::get_instance().compileSYCL( |
346 | | - generateSemiUniqueId(), SYCLSource, IncludePairs, UserArgs, LogPtr, |
347 | | - RegisteredKernelNames); |
| 344 | + "rtc", SYCLSource, IncludePairs, UserArgs, LogPtr, RegisteredKernelNames); |
348 | 345 | #else |
349 | 346 | throw sycl::exception(sycl::errc::build, |
350 | 347 | "kernel_compiler via sycl-jit is not available"); |
|
0 commit comments