Skip to content

Commit

Permalink
Merge pull request #62 from db-tu-dresden/executor
Browse files Browse the repository at this point in the history
Executor
  • Loading branch information
JPietrzykTUD authored Sep 26, 2023
2 parents ac776f1 + 77dfe7e commit eb08408
Show file tree
Hide file tree
Showing 34 changed files with 1,515 additions and 86 deletions.
3 changes: 3 additions & 0 deletions generator/config/default_conf.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
configuration:
namespace: "tsl"
tsl_implementation_namespace: "functors"
header_file_extension: ".hpp"
source_file_extension: ".cpp"
root_path: "./generated_tsl"
Expand Down Expand Up @@ -52,4 +53,6 @@ configuration_files:
lib: "core"
supplementary:
root_path: "supplementary"
runtime:
root_path: "runtime"
...
9 changes: 7 additions & 2 deletions generator/config/generator/tsl_generator_schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,13 @@ extension:
type: "dict"
brief: "Dictionary for mapping architecture flags to compiler related arcitecture flags. Only non-obvious mappings must be included in this dictionary."
example: "{sse4_1: 'msse4.1', sse4_2: 'msse4.2'}"
default: "{}"
default: {}
includes: *includes
runtime_headers:
type: "list"
entry_type: "str"
default: []
brief: "List of headers that are associated with the runtime (starting from ./supplementary/runtime)"
required_supplementary_libraries:
type: "list"
brief: "List of libraries which are required for this extension."
Expand Down Expand Up @@ -289,7 +294,7 @@ primitive:
type: "str"
brief: "@TODO"
example: "test_add"
tsl_implementation_namespace:
implementation_namespace:
type: "str"
default: "functors"
brief: "Namespace for template specializations."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,22 +82,23 @@ namespace {{ tsl_implementation_namespace }} {
template<
VectorProcessingStyle {{ vector_name }},
{{ ns.additional_template_params_with_defaults}}ImplementationDegreeOfFreedom {{ idof_name }} = workaround{{ ns.parameter_pack_typenames_str }}
{% if functor_name != primitive_name %}
#ifdef {{ tsl_namespace|upper ~ '_' ~ tsl_implementation_namespace|upper ~ '_' ~ primitive_name|upper ~ '_STRUCT_DEFINED'}}
, typename std::enable_if_t<
!std::is_same_v<
typename {{ tsl_implementation_namespace }}::{{ primitive_name }}<{{ vector_name }}, {{ ns.additional_template_name }}{{ idof_name }}>::param_tuple_t,
typename {{ tsl_implementation_namespace }}::{{ functor_name }}<{{ vector_name }}, {{ ns.additional_template_name }}{{ idof_name }}>::param_tuple_t
>,
std::nullptr_t
> = nullptr
#endif
{% endif %}
>
{# If the primitive returns something, the caller has to capture the result. #}
{{ '[[nodiscard]] ' if returns['ctype'] != 'void' else '' }}{# If force_inline is set to True, we use TSL_FORCE_INLINE. #}{{ 'TSL_FORCE_INLINE ' if force_inline else '' }}{{ returns['ctype'] }} {{ primitive_name }}(
{{ '[[nodiscard]] ' if returns['ctype'] != 'void' else '' }}{# If force_inline is set to True, we use TSL_FORCE_INLINE. #}{{ 'TSL_FORCE_INLINE ' if force_inline else ' ' }}auto {{ primitive_name }}(
{{ ns.full_qualified_parameters_str }}
) {
) -> std::enable_if_t<
{% if functor_name == primitive_name %}
tsl_functor_defined<{{ tsl_implementation_namespace }}::{{ functor_name }}<{{ vector_name }}, {{ ns.additional_template_name }}{{ idof_name }}>>::value,
{{ returns['ctype'] }}
{% else %}
#ifdef {{ tsl_namespace|upper ~ '_' ~ tsl_implementation_namespace|upper ~ '_' ~ primitive_name|upper ~ '_STRUCT_DEFINED'}}
!tsl_primitive_ambiguous<{{ tsl_implementation_namespace }}::{{ primitive_name }}<{{ vector_name }}, {{ ns.additional_template_name }}{{ idof_name }}>, {{ tsl_implementation_namespace }}::{{ functor_name }}<{{ vector_name }}, {{ ns.additional_template_name }}{{ idof_name }}>>(),
#else
true,
#endif
{{ returns['ctype'] }}
{% endif %}
>{
{# If the function primitive implementation returns something we have to return it, otherwise we just call it. #}
{# Call the actual implementation with all parameters. #}
{{ 'return ' if returns['ctype'] != 'void' else '' }}{{ tsl_implementation_namespace }}::{{ functor_name }}<{{ vector_name }}, {{ ns.additional_template_name }}{{ idof_name }}>::apply(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,12 @@ add_subdirectory({{ dir }})
{% for supplementary_lib in tsl_required_supplementary_libraries %}
add_subdirectory({{ supplementary_lib["cmakelists_path"] }})
{% endfor %}
# Add includes if present
{% for supplementary_lib in tsl_required_supplementary_libraries %}
{% if "include_path" in supplementary_lib %}
#target_include_directories({{ tsl_lib_name}} INTERFACE {{ supplementary_lib["include_path"] }}/)
target_include_directories({{ tsl_lib_name }} INTERFACE $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/{{ supplementary_lib["include_path"] }}> $<INSTALL_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/{{ supplementary_lib["include_path"] }} )
{% endif %}
{% endfor %}
# Add custom targets for supplementary libraries
{% for supplementary_lib in tsl_required_supplementary_libraries %}
add_dependencies({{ tsl_lib_name}} {{ supplementary_lib["name"] }})
{% endfor %}
{% endfor %}
# Add includes if present
{% for include_path in tsl_additional_include_paths %}
#target_include_directories({{ tsl_lib_name}} INTERFACE {{ include_path }}/)
target_include_directories({{ tsl_lib_name }} INTERFACE $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/{{ include_path }}> $<INSTALL_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/{{ include_path }} )
{% endfor %}
Loading

0 comments on commit eb08408

Please sign in to comment.