Skip to content

Commit 90ef86a

Browse files
committed
Remove templates.hh/.cc, rename default to simsycl::default_device
1 parent ccf3a96 commit 90ef86a

6 files changed

Lines changed: 112 additions & 142 deletions

File tree

CMakeLists.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,6 @@ add_library(simsycl
126126
include/simsycl/sycl/usm.hh
127127
include/simsycl/sycl/vec.hh
128128
include/simsycl/system.hh
129-
include/simsycl/templates.hh
130129
${CONFIG_PATH}
131130
src/simsycl/check.cc
132131
src/simsycl/context.cc
@@ -136,7 +135,6 @@ add_library(simsycl
136135
src/simsycl/queue.cc
137136
src/simsycl/system.cc
138137
src/simsycl/system_config.cc
139-
src/simsycl/templates.cc
140138
)
141139
target_link_libraries(simsycl PRIVATE
142140
Boost::context

include/simsycl/system.hh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,10 @@ struct system_config {
114114
std::unordered_map<device_id, device_config> devices{};
115115
};
116116

117+
extern const platform_config default_platform;
118+
extern const device_config default_device;
119+
extern const system_config default_system;
120+
117121
void configure_system(const system_config &system);
118122

119123
} // namespace simsycl

include/simsycl/templates.hh

Lines changed: 0 additions & 15 deletions
This file was deleted.

src/simsycl/system.cc

Lines changed: 103 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
#include "simsycl/detail/check.hh"
44
#include "simsycl/sycl/device.hh"
55
#include "simsycl/sycl/platform.hh"
6-
#include "simsycl/templates.hh"
76

87
#include <assert.h>
98
#include <limits>
@@ -133,14 +132,7 @@ struct system_state {
133132
std::optional<system_state> system;
134133

135134
system_state &get_system() {
136-
if(!detail::system.has_value()) {
137-
system_config config;
138-
config.platforms.emplace("CUDA", simsycl::templates::platform::cuda_12_2);
139-
for(int i = 0; i < 4; ++i) {
140-
config.devices.emplace("GPU#" + std::to_string(i), simsycl::templates::device::nvidia::rtx_3090);
141-
}
142-
configure_system(config);
143-
}
135+
if(!system.has_value()) { system.emplace(default_system); }
144136
return system.value();
145137
}
146138

@@ -267,4 +259,106 @@ namespace simsycl {
267259

268260
void configure_system(const system_config &system) { detail::system.emplace(system); }
269261

262+
const platform_config default_platform{
263+
.version = "0.1",
264+
.name = "SimSYCL",
265+
.vendor = "SimSYCL",
266+
.extensions = {},
267+
};
268+
269+
const device_config default_device{
270+
.device_type = sycl::info::device_type::gpu,
271+
.vendor_id = 0,
272+
.max_compute_units = 16,
273+
.max_work_item_dimensions = 3,
274+
.max_work_item_sizes_1 = {1024},
275+
.max_work_item_sizes_2 = {1024, 1024},
276+
.max_work_item_sizes_3 = {64, 1024, 1024},
277+
.max_work_group_size = 1024,
278+
.max_num_sub_groups = 32,
279+
.sub_group_sizes = {32},
280+
.preferred_vector_width_char = 4,
281+
.preferred_vector_width_short = 2,
282+
.preferred_vector_width_int = 1,
283+
.preferred_vector_width_long = 1,
284+
.preferred_vector_width_float = 1,
285+
.preferred_vector_width_double = 1,
286+
.preferred_vector_width_half = 2,
287+
.native_vector_width_char = 4,
288+
.native_vector_width_short = 2,
289+
.native_vector_width_int = 1,
290+
.native_vector_width_long = 1,
291+
.native_vector_width_float = 1,
292+
.native_vector_width_double = 1,
293+
.native_vector_width_half = 2,
294+
.max_clock_frequency = 1000,
295+
.address_bits = 64,
296+
.max_mem_alloc_size = std::numeric_limits<std::size_t>::max(),
297+
.image_support = false,
298+
.max_read_image_args = 0,
299+
.max_write_image_args = 0,
300+
.image2d_max_height = 0,
301+
.image2d_max_width = 0,
302+
.image3d_max_height = 0,
303+
.image3d_max_width = 0,
304+
.image3d_max_depth = 0,
305+
.image_max_buffer_size = 0,
306+
.max_samplers = 0,
307+
.max_parameter_size = std::numeric_limits<std::size_t>::max(),
308+
.mem_base_addr_align = 8,
309+
.half_fp_config
310+
= {sycl::info::fp_config::denorm, sycl::info::fp_config::inf_nan, sycl::info::fp_config::round_to_nearest,
311+
sycl::info::fp_config::round_to_zero, sycl::info::fp_config::round_to_inf, sycl::info::fp_config::fma,
312+
sycl::info::fp_config::correctly_rounded_divide_sqrt},
313+
.single_fp_config
314+
= {sycl::info::fp_config::denorm, sycl::info::fp_config::inf_nan, sycl::info::fp_config::round_to_nearest,
315+
sycl::info::fp_config::round_to_zero, sycl::info::fp_config::round_to_inf, sycl::info::fp_config::fma,
316+
sycl::info::fp_config::correctly_rounded_divide_sqrt},
317+
.double_fp_config
318+
= {sycl::info::fp_config::denorm, sycl::info::fp_config::inf_nan, sycl::info::fp_config::round_to_nearest,
319+
sycl::info::fp_config::round_to_zero, sycl::info::fp_config::round_to_inf, sycl::info::fp_config::fma,
320+
sycl::info::fp_config::correctly_rounded_divide_sqrt},
321+
.global_mem_cache_type = sycl::info::global_mem_cache_type::read_write,
322+
.global_mem_cache_line_size = 128,
323+
.global_mem_cache_size = 16 << 20,
324+
.global_mem_size = std::numeric_limits<std::size_t>::max(),
325+
.max_constant_buffer_size = 1 << 16,
326+
.max_constant_args = std::numeric_limits<uint32_t>::max(),
327+
.local_mem_type = sycl::info::local_mem_type::local,
328+
.local_mem_size = 64 << 10,
329+
.error_correction_support = false,
330+
.host_unified_memory = false,
331+
.profiling_timer_resolution = 1,
332+
.is_endian_little = true,
333+
.is_available = true,
334+
.is_compiler_available = true,
335+
.is_linker_available = true,
336+
.execution_capabilities = {sycl::info::execution_capability::exec_kernel},
337+
.queue_profiling = true,
338+
.built_in_kernels = {},
339+
.platform_id = "SimSYCL",
340+
.name = "SimSYCL virtual GPU",
341+
.vendor = "SimSYCL",
342+
.driver_version = "0.1",
343+
.profile = "FULL_PROFILE",
344+
.version = "0.1",
345+
.aspects
346+
= { sycl::aspect::gpu, sycl::aspect::accelerator, sycl::aspect::fp64, sycl::aspect::atomic64,
347+
sycl::aspect::queue_profiling, sycl::aspect::usm_device_allocations, sycl::aspect::usm_host_allocations,
348+
sycl::aspect::usm_shared_allocations, },
349+
.extensions = {},
350+
.printf_buffer_size = std::numeric_limits<std::size_t>::max(),
351+
.preferred_interop_user_sync = true,
352+
.partition_max_sub_devices = 0,
353+
.partition_properties = {},
354+
.partition_affinity_domains = {sycl::info::partition_affinity_domain::not_applicable},
355+
.partition_type_property = sycl::info::partition_property::no_partition,
356+
.partition_type_affinity_domain = sycl::info::partition_affinity_domain::not_applicable,
357+
};
358+
359+
const system_config default_system{
360+
.platforms = {{"SimSYCL", default_platform}},
361+
.devices = {{"GPU", default_device}},
362+
};
363+
270364
} // namespace simsycl

src/simsycl/templates.cc

Lines changed: 0 additions & 110 deletions
This file was deleted.

test/launch_tests.cc

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
#include <catch2/catch_test_macros.hpp>
33

44
#include <simsycl/system.hh>
5-
#include <simsycl/templates.hh>
65
#include <sycl/sycl.hpp>
76

87

@@ -81,12 +80,12 @@ TEMPLATE_TEST_CASE_SIG(
8180
TEST_CASE(
8281
"parallel_for(nd_range) correctly will re-use fibers and local allocations when the number of groups is large",
8382
"[launch]") {
84-
simsycl::system_config system;
85-
simsycl::device_config device = simsycl::templates::device::nvidia::rtx_3090;
83+
simsycl::device_config device = simsycl::default_device;
8684
device.max_compute_units = 2; // we currently allocate #max_compute_units groups worth of fibers
87-
system.platforms.emplace("CUDA", simsycl::templates::platform::cuda_12_2);
88-
system.devices.emplace("GPU", device);
89-
simsycl::configure_system(system);
85+
simsycl::configure_system({
86+
.platforms = {{"SimSYCL", simsycl::default_platform}},
87+
.devices = {{"GPU", device}},
88+
});
9089

9190
sycl::range<1> global_range(256);
9291
sycl::range<1> local_range(16);

0 commit comments

Comments
 (0)