Skip to content

Commit 70c53f6

Browse files
committed
Fix: Depend io_uring compilation on kernel version
1 parent 1358a69 commit 70c53f6

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ Some of the highlights include:
3232
- __Scatter and Gather__ for 50% faster vectorized disjoint memory operations.
3333
- __Intel's oneAPI vs Nvidia's CCCL?__ What's so special about `<thrust>` and `<cub>`?
3434
- __CUDA C++, [PTX](https://en.wikipedia.org/wiki/Parallel_Thread_Execution) Intermediate Representations, and SASS__, and how do they differ from CPU code?
35-
- __How to choose between intrinsics, inline Assembly, and separate `.S` files__ for your performance-critical code?
35+
- __How to choose between intrinsics, inline `asm`, and separate `.S` files__ for your performance-critical code?
3636
- __What are Encrypted Enclaves__ and what's the latency of Intel SGX, AMD SEV, and ARM Realm? 🔜
3737

3838
To read, jump to the [`less_slow.cpp` source file](https://github.com/ashvardanian/less_slow.cpp/blob/main/less_slow.cpp) and read the code snippets and comments.

less_slow.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6105,8 +6105,10 @@ BENCHMARK_CAPTURE(rpc_libc, public, networking_route_t::public_k, //
61056105

61066106
#pragma endregion // POSIX
61076107

6108-
#if defined(__linux__) // The next section only applies to kernel bypass on Linux
61096108
#pragma region IO Uring for Linux Kernel 5.5
6109+
#if defined(__linux__)
6110+
#include <linux/version.h>
6111+
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 5, 0)
61106112

61116113
/**
61126114
* We will start by designing a version that only uses features available
@@ -6484,6 +6486,8 @@ BENCHMARK_CAPTURE(rpc_uring55, public, networking_route_t::public_k, 256 /* mess
64846486
->UseManualTime()
64856487
->Unit(benchmark::kMicrosecond);
64866488

6489+
#endif // Is Linux 5.5 or higher
6490+
#endif // Is Linux
64876491
#pragma endregion // IO Uring for Linux Kernel 5.5
64886492

64896493
/**
@@ -6510,6 +6514,9 @@ BENCHMARK_CAPTURE(rpc_uring55, public, networking_route_t::public_k, 256 /* mess
65106514
*/
65116515

65126516
#pragma region IO Uring for Linux Kernel 6.0
6517+
#if defined(__linux__)
6518+
#include <linux/version.h>
6519+
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 0, 0)
65136520

65146521
/**
65156522
* @brief A minimal RPC @b server using @b `io_uring` functionality
@@ -6816,8 +6823,9 @@ BENCHMARK_CAPTURE(rpc_uring60, public, networking_route_t::public_k, 256 /* mess
68166823
->UseManualTime()
68176824
->Unit(benchmark::kMicrosecond);
68186825

6826+
#endif // Is Linux 6.0 or higher
6827+
#endif // Is Linux
68196828
#pragma endregion // IO Uring
6820-
#endif // defined(__linux__)
68216829

68226830
#pragma region ASIO
68236831
#include <asio.hpp>

0 commit comments

Comments
 (0)