docc 0.8.3 (0d44999b)
C++ API Reference
Loading...
Searching...
No Matches
sdfg::cuda::CUDAReduceDispatcher Class Reference

Atomics-based CUDA code generator for structured_control_flow::Reduce. More...

#include <sdfg/targets/cuda/cuda_reduce_dispatcher.h>

Inheritance diagram for sdfg::cuda::CUDAReduceDispatcher:
[legend]

Public Member Functions

 CUDAReduceDispatcher (codegen::LanguageExtension &language_extension, StructuredSDFG &sdfg, analysis::AnalysisManager &analysis_manager, structured_control_flow::Reduce &node, codegen::InstrumentationPlan &instrumentation_plan, codegen::ArgCapturePlan &arg_capture_plan)
Public Member Functions inherited from sdfg::gpu::GPUReduceDispatcher
 GPUReduceDispatcher (codegen::LanguageExtension &language_extension, StructuredSDFG &sdfg, analysis::AnalysisManager &analysis_manager, structured_control_flow::Reduce &node, codegen::InstrumentationPlan &instrumentation_plan, codegen::ArgCapturePlan &arg_capture_plan)
void dispatch_node (codegen::PrettyPrinter &main_stream, codegen::PrettyPrinter &globals_stream, codegen::CodeSnippetFactory &library_snippet_factory) override
codegen::InstrumentationInfo instrumentation_info () const override
 Bad design.
Public Member Functions inherited from sdfg::codegen::NodeDispatcher
 NodeDispatcher (LanguageExtension &language_extension, StructuredSDFG &sdfg, analysis::AnalysisManager &analysis_manager, structured_control_flow::ControlFlowNode &node, InstrumentationPlan &instrumentation_plan, ArgCapturePlan &arg_capture_plan)
virtual ~NodeDispatcher ()=default
InstrumentationInfo instrumentation_info_for_group () const
virtual void dispatch (PrettyPrinter &main_stream, PrettyPrinter &globals_stream, CodeSnippetFactory &library_snippet_factory)

Protected Member Functions

std::string schedule_value () const override
 Schedule value string identifying this backend's GPU schedule ("CUDA"/"ROCM").
codegen::TargetType target_type () const override
 Target type used for instrumentation info.
std::unique_ptr< codegen::LanguageExtension > create_device_language_extension () const override
 Create the backend device-code language extension (CUDA/HIP).
bool is_device_pointer_storage (const types::StorageType &storage) const override
 True if storage designates a device-resident generic pointer for this backend.
std::string kernel_file_extension () const override
 File extension for the kernel translation unit ("cu"/"rocm.cpp").
void emit_kernel_includes (codegen::CodeSnippetFactory &library_snippet_factory) const override
 Emit the backend include directives required by the generated kernel.
void emit_library_preamble (codegen::PrettyPrinter &library_stream) const override
 Emit any extra preamble at the top of the kernel translation unit.
void emit_kernel_call (codegen::PrettyPrinter &main_stream, const std::string &kernel_name, symbolic::Expression &num_blocks, symbolic::Expression &block_size, std::vector< std::string > &arguments_device) override
 Emit the host-side kernel launch.
Protected Member Functions inherited from sdfg::gpu::GPUReduceDispatcher
bool is_nested_in_gpu_kernel ()
 True if this Reduce is nested inside an enclosing GPU kernel (an ancestor Map with this backend's GPU schedule).
void dispatch_header (codegen::PrettyPrinter &stream, const std::string &kernel_name, std::vector< std::string > &arguments_declaration)
void dispatch_reduce_core (codegen::CodeSnippetFactory &library_snippet_factory, codegen::PrettyPrinter &library_stream, GPUDimension dimension, bool declare_scope_variables, std::vector< std::string > &scope_variables)
 Emit the privatize + grid-stride reduce loop + atomic merge into the given (device) stream, parallelized on dimension.
void dispatch_atomic_merge (codegen::PrettyPrinter &library_stream, codegen::CodeSnippetFactory &library_snippet_factory, const structured_control_flow::ReductionInfo &reduction)
 Emit the device-side helper(s) and the atomic merge statement that combines a thread's private partial into the global accumulator.
Protected Member Functions inherited from sdfg::codegen::NodeDispatcher
virtual bool begin_node (PrettyPrinter &stream)
virtual void end_node (PrettyPrinter &stream, bool has_declaration)

Additional Inherited Members

Protected Attributes inherited from sdfg::gpu::GPUReduceDispatcher
structured_control_flow::Reduce & node_
Protected Attributes inherited from sdfg::codegen::NodeDispatcher
LanguageExtension & language_extension_
StructuredSDFG & sdfg_
InstrumentationPlan & instrumentation_plan_
ArgCapturePlan & arg_capture_plan_
analysis::AnalysisManager & analysis_manager_

Detailed Description

Atomics-based CUDA code generator for structured_control_flow::Reduce.

Thin CUDA specialization of gpu::GPUReduceDispatcher: the whole lowering (grid-stride reduce, privatization, atomic merge) lives in the shared base; this class only supplies the CUDA-specific policy (language extension, device-pointer storage, kernel launch syntax and includes).

Constructor & Destructor Documentation

◆ CUDAReduceDispatcher()

sdfg::cuda::CUDAReduceDispatcher::CUDAReduceDispatcher ( codegen::LanguageExtension & language_extension,
StructuredSDFG & sdfg,
analysis::AnalysisManager & analysis_manager,
structured_control_flow::Reduce & node,
codegen::InstrumentationPlan & instrumentation_plan,
codegen::ArgCapturePlan & arg_capture_plan )

Member Function Documentation

◆ create_device_language_extension()

std::unique_ptr< codegen::LanguageExtension > sdfg::cuda::CUDAReduceDispatcher::create_device_language_extension ( ) const
overrideprotectedvirtual

Create the backend device-code language extension (CUDA/HIP).

Implements sdfg::gpu::GPUReduceDispatcher.

◆ emit_kernel_call()

void sdfg::cuda::CUDAReduceDispatcher::emit_kernel_call ( codegen::PrettyPrinter & main_stream,
const std::string & kernel_name,
symbolic::Expression & num_blocks,
symbolic::Expression & block_size,
std::vector< std::string > & arguments_device )
overrideprotectedvirtual

Emit the host-side kernel launch.

Implements sdfg::gpu::GPUReduceDispatcher.

◆ emit_kernel_includes()

void sdfg::cuda::CUDAReduceDispatcher::emit_kernel_includes ( codegen::CodeSnippetFactory & library_snippet_factory) const
overrideprotectedvirtual

Emit the backend include directives required by the generated kernel.

Implements sdfg::gpu::GPUReduceDispatcher.

◆ emit_library_preamble()

void sdfg::cuda::CUDAReduceDispatcher::emit_library_preamble ( codegen::PrettyPrinter & library_stream) const
overrideprotectedvirtual

Emit any extra preamble at the top of the kernel translation unit.

Implements sdfg::gpu::GPUReduceDispatcher.

◆ is_device_pointer_storage()

bool sdfg::cuda::CUDAReduceDispatcher::is_device_pointer_storage ( const types::StorageType & storage) const
overrideprotectedvirtual

True if storage designates a device-resident generic pointer for this backend.

Implements sdfg::gpu::GPUReduceDispatcher.

◆ kernel_file_extension()

std::string sdfg::cuda::CUDAReduceDispatcher::kernel_file_extension ( ) const
overrideprotectedvirtual

File extension for the kernel translation unit ("cu"/"rocm.cpp").

Implements sdfg::gpu::GPUReduceDispatcher.

◆ schedule_value()

std::string sdfg::cuda::CUDAReduceDispatcher::schedule_value ( ) const
overrideprotectedvirtual

Schedule value string identifying this backend's GPU schedule ("CUDA"/"ROCM").

Implements sdfg::gpu::GPUReduceDispatcher.

◆ target_type()

codegen::TargetType sdfg::cuda::CUDAReduceDispatcher::target_type ( ) const
overrideprotectedvirtual

Target type used for instrumentation info.

Implements sdfg::gpu::GPUReduceDispatcher.


The documentation for this class was generated from the following file: