29namespace sham::benchmarks {
44#define IMAD_16(x, y) \
55#define IADD_16(x, y) \
76 template<
class T, IntChainOp op>
77 inline void int_chains(
u32 i,
int nrotation, T y0, T *__restrict in, T *__restrict out) {
78 static_assert(std::is_unsigned_v<T>,
"int_chains requires an unsigned type");
82 for (
int j = 0; j < nrotation; j++) {
115 template<
class T, IntChainOp op>
117 DeviceScheduler_ptr sched,
int N,
f64 time_threshold) {
140 auto run_bench = [&q, &N, &x_ptr, &y_ptr, y0](
u32 nrotation) ->
f64 {
145 auto e = q.
submit(empty_list, [=](sycl::handler &cgh) {
146 cgh.parallel_for(sycl::range<1>{size_t(N)}, [=](sycl::item<1> item) {
159 double ref = run_bench(0);
163 sec = run_bench(nrotation);
165 if (sec >= time_threshold || nrotation >= 256 * 256 * 4) {
177 u64 op_per_thread =
u64(nrotation) * 2_u64 * 16_u64;
178 double op_count = double(N) * double(op_per_thread);
183 .iops = op_count / sec,
184 .nrotations = nrotation};
double f64
Alias for double.
std::uint32_t u32
32 bit unsigned integer
std::uint64_t u64
64 bit unsigned integer
A buffer allocated in USM (Unified Shared Memory).
void complete_event_state(sycl::event e) const
Complete the event state of the buffer.
T * get_write_access(sham::EventList &depends_list, SourceLocation src_loc=SourceLocation{})
Get a read-write pointer to the buffer's data.
void fill(T value, std::array< size_t, 2 > idx_range)
Fill a subpart of the buffer with a given value.
A SYCL queue associated with a device and a context.
sycl::event submit(Fct &&fct)
Submits a kernel to the SYCL queue.
Class to manage a list of SYCL events.
void wait()
Wait for all events in the list to be finished.
Class Timer measures the time elapsed since the timer was started.
f64 elapsed_sec() const
Converts the stored nanosecond time to a floating point representation in seconds.
void start()
Starts the timer.
void stop()
Stops the timer and stores the elapsed time in nanoseconds.
int_chains_result int_chains_bench(DeviceScheduler_ptr sched, int N, f64 time_threshold)
Run the int_chains benchmark.
void int_chains(u32 i, int nrotation, T y0, T *__restrict in, T *__restrict out)
Kernel for the int_chains benchmark.
IntChainOp
Which integer operation a chain is built from.
@ Mul
multiply-add chains, 16 multiplies + 16 adds per rotation
@ Add
add-only chains, 32 adds per rotation
provide information about the source location
Structure containing the results of an int_chains benchmark.
std::string func_name
Name of the function.
f64 iops
Integer operations per second.
f64 seconds
Computation time in seconds.
u32 nrotations
Number of rotations performed.